2 VERSION
='2017-09-19 07:31' # UTC
4 # Building coreutils from a git-cloned directory may require versions of
5 # tools like autoconf, automake, gettext, etc. that are newer than the ones
6 # provided by the distribution on which you want to build. In that case,
7 # you can use this script to bootstrap the "autotools" tool chain, starting
8 # with m4 (prereq of autoconf), then autoconf (prereq of automake), etc.
9 # It also builds a few others, including gettext and pkg-config.
10 # The results are installed in a directory whose --prefix you specify, and
11 # it tells you how to update envvars like PATH and (if you use pkg-config)
14 # On principle, I find it best to ensure that packages I care about work
15 # with the latest versions of all of these tools. While these tools are
16 # paragons of portability, you should ensure that recent distribution
19 # Written by Jim Meyering
21 # For systems with limited/botched make (the case of most vendor makes!),
22 # allow the user to override it.
25 prog_name
=`basename $0`
26 die
() { echo "$prog_name: $*" >&2; exit 1; }
29 https://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz
30 https://ftp.gnu.org/gnu/m4/m4-1.4.17.tar.gz
31 https://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
32 https://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz
33 https://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.gz
34 https://ftp.gnu.org/gnu/gettext/gettext-0.19.6.tar.gz
40 Download, build, and install some tools.
43 --prefix=PREFIX install tools under specified directory
44 --skip-check do not run \"make check\" (this can save 50+ min)
45 --help display this help and exit
47 For example, to install programs into \$HOME/autotools/bin, run this command:
49 $prog_name --prefix=\$HOME/autotools
51 If you've already verified that your system/environment can build working
52 versions of these tools, you can make this script complete in just a
53 minute or two (rather than about an hour if you let all \"make check\"
54 tests run) by invoking it like this:
56 $prog_name --prefix=\$HOME/autotools --skip-check
61 # Get the public keys associated with each .sig file.
62 # for i in *.sig; do k=$(gpgv $i 2>&1 | sed -n 's/.*key ID //p'); \
63 # gpg --keyserver pgp.mit.edu --recv-key $k; done
65 # Get the listed tarballs into the current directory.
70 WGET_COMMAND
='wget -nv --no-cache';;
72 WGET_COMMAND
='wget -nv --cache=off';;
74 WGET_COMMAND
='wget -nv';;
76 die
'no wget program found; please install it and try again';;
79 # Download the each tar-ball along with its signature, if there is one.
81 for t
in $tarballs; do
84 test -f $base ||
$WGET_COMMAND $t
86 # No signatures for some :-(
87 case $base in pkg-config
*) continue;; esac
89 test -f $base.sig ||
$WGET_COMMAND $t.sig
90 # Verify each signature.
91 gpg
--quiet --verify --trust-model=always \
92 --trusted-key=32419B785D0CDCFC \
93 --trusted-key=3859C03B2E236E47 \
94 --trusted-key=B93F60C6B5C4CE13 \
95 --trusted-key=F382AE19F4850180 \
96 --trusted-key=FC818E17429F96EA \
97 --trusted-key=60F906016E407573 \
98 --trusted-key=D605848ED7E69871 \
99 $base.sig
> /dev
/null
2>&1 \
100 ||
echo "info: not verifying GPG signature for $base" 1>&2
106 #################################################################
117 --help) usage
; exit;;
118 --skip-check) make_check
=no
;;
119 --prefix=*) prefix
=`expr "$option" : '--prefix=\(.*\)'`;;
120 *) die
"$option: unknown option";;
125 || die
"you must specify a --prefix"
129 *) die
'invalid prefix: '"$prefix"': it must be an absolute name';;
133 # Make sure id -u succeeds.
134 my_uid
=`id -u` && test -n "$my_uid" || die
"'id -u' failed"
135 test $my_uid -ne 0 || die
"please don't run this program as root"
137 # Ensure that prefix is not /usr/bin or /bin, /sbin, etc.
139 /bin|
/sbin|
/usr
/bin|
/usr
/sbin
)
140 die
"don't set PREFIX to a system directory";;
144 # Create a build directory, then cd into it for the rest....
145 tmpdir
=.build-auto-tools
151 export PATH
=$prefix/bin
:$PATH
153 echo building
/installing
$pkg...
154 dir
=`basename $pkg .tar.gz`
156 gzip -dc $pkg |
tar xf
-
158 .
/configure CFLAGS
=-O2 LDFLAGS
=-s --prefix=$prefix >makerr-config
2>&1
159 $MAKE >makerr-build
2>&1
160 if test $make_check = yes; then
162 # FIXME: these are out of date and very system-sensitive
163 automake
*) expected_duration_minutes
=40;;
164 autoconf
*) expected_duration_minutes
=15;;
165 libtool
*) expected_duration_minutes
=3;;
168 if test -n "$expected_duration_minutes"; then
169 echo "running 'make check' for $pkg; NB: this can take over" \
170 "$expected_duration_minutes minutes"
172 $MAKE check
>makerr-check
2>&1
174 $MAKE install >makerr-install
2>&1
175 echo "done at `date +%Y-%m-%d.%T`"
179 # Without checks (and with existing tarballs), it takes just one minute.
180 # Including all checks, it takes nearly an hour on an AMD64/3400+
182 case $PKG_CONFIG_PATH in
183 $prefix/lib
/pkgconfig
:/usr
/lib
/pkgconfig
)
184 echo 'Good! your PKG_CONFIG_PATH envvar is already set';;
186 **************************************************************************
187 Be sure that PKG_CONFIG_PATH is set in your environment, e.g.,
188 PKG_CONFIG_PATH=$prefix/lib/pkgconfig:/usr/lib/pkgconfig
189 **************************************************************************
194 "$prefix/bin:"*) echo 'Good! your PATH is fine';;
196 **************************************************************************
197 Be sure that "$prefix/bin" is earlier in your PATH than /bin, /usr/bin, etc.
198 **************************************************************************
203 **************************************************************************
204 You may want to remove the tool build directory:
206 **************************************************************************
210 ## eval: (add-hook 'write-file-hooks 'time-stamp)
211 ## time-stamp-start: "VERSION='"
212 ## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
213 ## time-stamp-time-zone: "UTC"
214 ## time-stamp-end: "' # UTC"