2 # Copyright (C) 1990-2014 Free Software Foundation
4 # This file is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # This script creates release packages for gdb, binutils, and other
19 # packages which live in src. It used to be implemented as the src-release
20 # Makefile and prior to that was part of the top level Makefile, but that
21 # turned out to be very messy and hard to maintain.
33 # Default to avoid splitting info files by setting the threshold high.
34 MAKEINFOFLAGS=--split-size=5000000
37 # Support for building net releases
39 # Files in devo used in any net release.
40 DEVO_SUPPORT="README Makefile.in configure configure.ac \
41 config.guess config.sub config move-if-change \
42 COPYING COPYING.LIB install-sh config-ml.in symlink-tree \
43 mkinstalldirs ltmain.sh missing ylwrap \
44 libtool.m4 ltsugar.m4 ltversion.m4 ltoptions.m4 \
45 Makefile.def Makefile.tpl src-release.sh config.rpath \
46 ChangeLog MAINTAINERS README-maintainer-mode \
47 lt~obsolete.m4 ltgcc.m4 depcomp mkdep compile \
48 COPYING3 COPYING3.LIB"
50 # Files in devo/etc used in any net release.
51 ETC_SUPPORT="Makefile.in configure configure.in standards.texi \
52 make-stds.texi standards.info* configure.texi configure.info* \
53 ChangeLog configbuild.* configdev.* fdl.texi texi2pod.pl gnu-oids.texi"
55 # Get the version number of a given tool
59 if grep 'AC_INIT.*BFD_VERSION' $tool/configure.ac >/dev/null 2>&1; then
60 bfd/configure --version | sed -n -e '1s,.* ,,p'
61 elif test -f $tool/common/create-version.sh; then
62 $tool/common/create-version.sh $tool 'dummy-host' 'dummy-target' VER.tmp
63 cat VER.tmp | grep 'version\[\]' | sed 's/.*"\([^"]*\)".*/\1/' | sed 's/-git$//'
65 elif test -f $tool/version.in; then
66 head -1 $tool/version.in
72 # Setup build directory for building release tarball
79 echo "==> Making $package-$ver/"
80 # Take out texinfo from a few places.
81 sed -e '/^all\.normal: /s/\all-texinfo //' \
82 -e '/^ install-texinfo /d' \
85 # configure. --enable-gold is needed to ensure .c/.h from .y are
86 # built in the gold dir. The disables speed the build a little.
89 for dir in binutils gas gdb gold gprof ld libdecnumber readline sim; do
90 case " $tool $support_files " in
91 *" $dir "*) enables="$enables --enable-$dir" ;;
92 *) disables="$disables --disable-$dir" ;;
95 echo "==> configure --target=i386-pc-linux-gnu $disables $enables"
96 ./configure --target=i386-pc-linux-gnu $disables $enables
97 $MAKE configure-host configure-target \
98 ALL_GCC="" ALL_GCC_C="" ALL_GCC_CXX="" \
99 CC_FOR_TARGET="$CC" CXX_FOR_TARGET="$CXX"
100 # Make links, and run "make diststuff" or "make info" when needed.
103 dirs="$DEVO_SUPPORT $support_files $tool"
106 if [ ! -f $d/Makefile ] ; then
108 elif grep '^diststuff:' $d/Makefile >/dev/null ; then
109 (cd $d ; $MAKE MAKEINFOFLAGS="$MAKEINFOFLAGS" diststuff) \
111 elif grep '^info:' $d/Makefile >/dev/null ; then
112 (cd $d ; $MAKE MAKEINFOFLAGS="$MAKEINFOFLAGS" info) \
115 if [ -d $d/proto-$d.dir ]; then
116 ln -s ../$d/proto-$d.dir proto-toplev/$d
118 ln -s ../$d proto-toplev/$d
121 if (echo x$d | grep / >/dev/null); then
122 mkdir -p proto-toplev/`dirname $d`
124 ln -s ../`echo $x/ | sed -e 's,[^/]*/,../,g'`$d proto-toplev/$d
126 ln -s ../$d proto-toplev/$d
130 (cd etc; $MAKE MAKEINFOFLAGS="$MAKEINFOFLAGS" info)
132 mkdir proto-toplev/etc
133 (cd proto-toplev/etc;
134 for i in $ETC_SUPPORT; do
138 # Take out texinfo from configurable dirs
139 rm proto-toplev/configure.ac
140 sed -e '/^host_tools=/s/texinfo //' \
141 <configure.ac >proto-toplev/configure.ac
143 mkdir proto-toplev/texinfo
144 ln -s ../../texinfo/texinfo.tex proto-toplev/texinfo/
145 if test -r texinfo/util/tex3patch ; then
146 mkdir proto-toplev/texinfo/util && \
147 ln -s ../../../texinfo/util/tex3patch proto-toplev/texinfo/util
151 chmod -R og=u . || chmod og=u `find . -print`
153 # Create .gmo files from .po files.
154 for f in `find . -name '*.po' -type f -print`; do
155 msgfmt -o `echo $f | sed -e 's/\.po$/.gmo/'` $f
159 ln -s proto-toplev $package-$ver
162 CVS_NAMES='-name CVS -o -name .cvsignore'
164 # Add an md5sum to the built tarball
167 echo "==> Adding md5 checksum to top-level directory"
168 (cd proto-toplev && find * -follow \( $CVS_NAMES \) -prune \
170 | xargs $MD5PROG > ../md5.new)
171 rm -f proto-toplev/md5.sum
172 mv md5.new proto-toplev/md5.sum
175 # Build the release tarball
180 echo "==> Making $package-$ver.tar"
181 rm -f $package-$ver.tar
182 find $package-$ver -follow \( $CVS_NAMES \) -prune \
184 | tar cTfh - $package-$ver.tar
187 # Compress the output with bzip2
192 echo "==> Bzipping $package-$ver.tar.bz2"
193 rm -f $package-$ver.tar.bz2
194 $BZIPPROG -k -v -9 $package-$ver.tar
197 # Compress the output with gzip
202 echo "==> Gzipping $package-$ver.tar.gz"
203 rm -f $package-$ver.tar.gz
204 $GZIPPROG -k -v -9 $package-$ver.tar
207 # Compress the output with xz
212 echo "==> Xzipping $package-$ver.tar.xz"
213 rm -f $package-$ver.tar.xz
214 $XZPROG -k -v -9 $package-$ver.tar
217 # Compress the output with all selected compresion methods
223 for comp in $compressors; do
226 do_bz2 $package $ver;;
228 do_gz $package $ver;;
230 do_xz $package $ver;;
232 echo "Unknown compression method: $comp" && exit 1;;
237 # Add djunpack.bat the tarball
242 echo "==> Adding updated djunpack.bat to top-level directory"
243 echo - 's /gdb-[0-9\.]*/$package-'"$ver"'/'
244 sed < djunpack.bat > djunpack.new \
245 -e 's/gdb-[0-9][0-9\.]*/$package-'"$ver"'/'
246 rm -f proto-toplev/djunpack.bat
247 mv djunpack.new proto-toplev/djunpack.bat
250 # Create a release package, tar it and compress it
258 ver=$(getver $verdir)
259 do_proto_toplev $package $ver $tool "$support_files"
262 do_compress $package $ver "$compressors"
265 # Create a gdb release package, tar it and compress it
273 do_proto_toplev $package $ver $tool "$support_files"
275 do_djunpack $package $ver
277 do_compress $package $ver "$compressors"
280 # The FSF "binutils" release includes gprof and ld.
281 BINUTILS_SUPPORT_DIRS="bfd gas include libiberty opcodes ld elfcpp gold gprof intl setup.com makefile.vms cpu zlib"
287 tar_compress $package $tool "$BINUTILS_SUPPORT_DIRS" "$compressors"
290 GAS_SUPPORT_DIRS="bfd include libiberty opcodes intl setup.com makefile.vms zlib"
296 tar_compress $package $tool "$GAS_SUPPORT_DIRS" "$compressors"
299 GDB_SUPPORT_DIRS="bfd include libiberty opcodes readline sim intl libdecnumber cpu zlib"
305 gdb_tar_compress $package $tool "$GDB_SUPPORT_DIRS" "$compressors"
308 # Corresponding to the CVS "sim" module.
309 SIM_SUPPORT_DIRS="bfd opcodes libiberty include intl gdb/version.in gdb/common/create-version.sh makefile.vms zlib"
315 tar_compress $package $tool "$SIM_SUPPORT_DIRS" "$compressors" gdb
320 echo "src-release.sh <options> <release>"
322 echo " -b: Compress with bzip2"
323 echo " -g: Compress with gzip"
324 echo " -x: Compress with xz"
334 binutils_release "$compressors";;
336 gas_release "$compressors";;
338 gdb_release "$compressors";;
340 sim_release "$compressors";;
342 echo "Unknown release name: $release" && usage;;
348 while getopts ":gbx" opt; do
351 compressors="$compressors bz2";;
353 compressors="$compressors gz";;
355 compressors="$compressors xz";;
357 echo "Invalid option: -$OPTARG" && usage;;
363 build_release $release "$compressors"