#!/bin/sh # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # # Written by Jim Meyering VERSION='2007-07-10 09:09' # UTC prog_name=`basename $0` die () { echo "$prog_name: $*" >&2; exit 1; } tarballs=' http://pkgconfig.freedesktop.org/releases/pkg-config-0.21.tar.gz ftp://ftp.gnu.org/gnu/m4/m4-1.4.10.tar.gz ftp://ftp.gnu.org/gnu/automake/automake-1.10.tar.gz ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.gz ftp://ftp.gnu.org/gnu/libtool/libtool-1.5.24.tar.gz ' usage() { echo >&2 "\ Usage: $0 [OPTION]... Download, build, and install some tools. Options: --prefix=PREFIX install tools under specified directory --skip-check do not run "make check" (this can save 50+ min) --help display this help and exit For example, to install programs into \$HOME/qpid-tools/bin, run this command: $prog_name --prefix=\$HOME/qpid-tools If you've already verified that your system/environment can build working versions of these tools, you can make this script complete in just a minute or two (rather than about an hour if you let all "make check" tests run) by invoking it like this: $prog_name --prefix=\$HOME/qpid-tools --skip-check " } # Get the listed tarballs into the current directory. get_sources() { case `wget --help` in *'--no-cache'*) WGET_COMMAND='wget -nv --no-cache';; *'--cache=on/off'*) WGET_COMMAND='wget -nv --cache=off';; *'--non-verbose'*) WGET_COMMAND='wget -nv';; *) die 'no wget program found; please install it and try again';; esac # Download the each tar-ball along with its signature, if there is one. pkgs= for t in $(echo $tarballs); do base=$(basename $t) pkgs="$pkgs $base" test -f $base || $WGET_COMMAND $t # pkg-config has no .sig file. case $base in pkg-config*) continue;; esac test -f $base.sig || $WGET_COMMAND $t.sig # Verify each signature. gpg --quiet --verify --trust-model=always \ --trusted-key=32419B785D0CDCFC \ --trusted-key=3859C03B2E236E47 \ --trusted-key=B93F60C6B5C4CE13 \ --trusted-key=F382AE19F4850180 \ $base.sig > /dev/null 2>&1 \ || echo "info: not verifying GPG signature for $base" 1>&2 done printf 'verifying package SHA1 checksums...' 1>&2 sha1sum -c --warn --status <&2 echo $pkgs } ################################################################# set -e # Parse options. make_check=yes prefix= for option do case $option in --help) usage; exit;; --skip-check) make_check=no;; --prefix=*) prefix=`expr "$option" : '--prefix=\(.*\)'`;; *) die "$option: unknown option";; esac done test -n "$prefix" \ || die "you must specify a --prefix" case $prefix in /*) ;; *) die 'invalid prefix: '"$prefix"': it must be an absolute name';; esac # Don't run as root. # Make sure id -u succeeds. my_uid=`id -u` test $? = 0 || { echo "$0: cannot run \`id -u'" 1>&2 (exit 1); exit 1 } test $my_uid = 0 && die "please don't run this program as root" # Ensure that prefix is not /usr/bin or /bin, /sbin, etc. case $prefix in /bin|/sbin|/usr/bin|/usr/sbin) die "don't set PREFIX to a system directory";; *) ;; esac # Create a build directory, then cd into it for the rest.... tmpdir=.build-auto-tools mkdir -p $tmpdir cd $tmpdir pkgs=$(get_sources) for pkg in $pkgs; do echo building/installing $pkg... dir=$(basename $pkg .tar.gz) rm -rf dir gzip -dc $pkg|tar xf - cd $dir ./configure CFLAGS=-O2 LDFLAGS=-s --prefix=$prefix > makerr-config 2>&1 make -j1 > makerr-build 2>&1 if test "$make_check" = yes; then case $pkg in automake*) expected_duration_minutes=40;; autoconf*) expected_duration_minutes=15;; # libtool*) expected_duration_minutes=3;; *);; esac test -n "$expected_duration_minutes" \ && echo "running 'make check' for $pkg; NB: this can take over" \ "$expected_duration_minutes minutes" case $pkg in # In this package, the check-requires-private test fails. # Change the Makefile so it skips that test. pkg-config-0.21.tar.gz) perl -pi.bak -e 's/check-requires-private //' check/Makefile;; esac make -j1 check > makerr-check 2>&1 fi make -j1 install > makerr-install 2>&1 echo done at $(date +%Y-%m-%d.%T) cd .. done # Without checks (and with existing tarballs), it takes just one minute. # Including all checks, it takes nearly an hour on an AMD64/3400+ case $PKG_CONFIG_PATH in $prefix/lib/pkgconfig:/usr/lib/pkgconfig) echo 'Good! your PKG_CONFIG_PATH envvar is already set';; *) cat <