2 # Copyright (C) 1990-2018 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.
34 # Default to avoid splitting info files by setting the threshold high.
35 MAKEINFOFLAGS=--split-size=5000000
38 # Support for building net releases
40 # Files in root used in any net release.
41 DEVO_SUPPORT="ar-lib ChangeLog compile config config-ml.in config.guess \
42 config.rpath config.sub configure configure.ac COPYING COPYING.LIB \
43 COPYING3 COPYING3.LIB depcomp install-sh libtool.m4 ltgcc.m4 \
44 ltmain.sh ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4 \
45 MAINTAINERS Makefile.def Makefile.in Makefile.tpl missing mkdep \
46 mkinstalldirs move-if-change README README-maintainer-mode \
47 src-release.sh symlink-tree test-driver ylwrap"
49 # Files in devo/etc used in any net release.
50 ETC_SUPPORT="Makefile.in configure configure.in standards.texi \
51 make-stds.texi standards.info* configure.texi configure.info* \
52 ChangeLog configbuild.* configdev.* fdl.texi texi2pod.pl gnu-oids.texi"
54 # Get the version number of a given tool
58 if grep 'AC_INIT.*BFD_VERSION' $tool/configure.ac >/dev/null 2>&1; then
59 bfd/configure --version | sed -n -e '1s,.* ,,p'
60 elif test -f $tool/common/create-version.sh; then
61 $tool/common/create-version.sh $tool 'dummy-host' 'dummy-target' VER.tmp
62 cat VER.tmp | grep 'version\[\]' | sed 's/.*"\([^"]*\)".*/\1/' | sed 's/-git$//'
64 elif test -f $tool/version.in; then
65 head -1 $tool/version.in
71 # Setup build directory for building release tarball
79 echo "==> Cleaning sources."
80 find \( -name "*.orig" -o -name "*.rej" -o -name "*~" -o -name ".#*" -o -name "*~$bkpat" \) -exec rm {} \;
82 echo "==> Making $package-$ver/"
83 # Take out texinfo from a few places.
84 sed -e '/^all\.normal: /s/\all-texinfo //' \
85 -e '/^ install-texinfo /d' \
88 # configure. --enable-gold is needed to ensure .c/.h from .y are
89 # built in the gold dir. The disables speed the build a little.
92 for dir in binutils gas gdb gold gprof ld libdecnumber readline sim; do
93 case " $tool $support_files " in
94 *" $dir "*) enables="$enables --enable-$dir" ;;
95 *) disables="$disables --disable-$dir" ;;
98 echo "==> configure --target=i386-pc-linux-gnu $disables $enables"
99 ./configure --target=i386-pc-linux-gnu $disables $enables
100 $MAKE configure-host configure-target \
101 ALL_GCC="" ALL_GCC_C="" ALL_GCC_CXX="" \
102 CC_FOR_TARGET="$CC" CXX_FOR_TARGET="$CXX"
103 # Make links, and run "make diststuff" or "make info" when needed.
106 dirs="$DEVO_SUPPORT $support_files $tool"
109 if [ ! -f $d/Makefile ] ; then
111 elif grep '^diststuff:' $d/Makefile >/dev/null ; then
112 (cd $d ; $MAKE MAKEINFOFLAGS="$MAKEINFOFLAGS" diststuff) \
114 elif grep '^info:' $d/Makefile >/dev/null ; then
115 (cd $d ; $MAKE MAKEINFOFLAGS="$MAKEINFOFLAGS" info) \
118 if [ -d $d/proto-$d.dir ]; then
119 ln -s ../$d/proto-$d.dir proto-toplev/$d
121 ln -s ../$d proto-toplev/$d
124 if (echo x$d | grep / >/dev/null); then
125 mkdir -p proto-toplev/`dirname $d`
127 ln -s ../`echo $x/ | sed -e 's,[^/]*/,../,g'`$d proto-toplev/$d
129 ln -s ../$d proto-toplev/$d
133 (cd etc; $MAKE MAKEINFOFLAGS="$MAKEINFOFLAGS" info)
135 mkdir proto-toplev/etc
136 (cd proto-toplev/etc;
137 for i in $ETC_SUPPORT; do
141 # Take out texinfo from configurable dirs
142 rm proto-toplev/configure.ac
143 sed -e '/^host_tools=/s/texinfo //' \
144 <configure.ac >proto-toplev/configure.ac
146 mkdir proto-toplev/texinfo
147 ln -s ../../texinfo/texinfo.tex proto-toplev/texinfo/
148 if test -r texinfo/util/tex3patch ; then
149 mkdir proto-toplev/texinfo/util && \
150 ln -s ../../../texinfo/util/tex3patch proto-toplev/texinfo/util
154 chmod -R og=u . || chmod og=u `find . -print`
156 # Create .gmo files from .po files.
157 for f in `find . -name '*.po' -type f -print`; do
158 msgfmt -o `echo $f | sed -e 's/\.po$/.gmo/'` $f
162 ln -s proto-toplev $package-$ver
165 CVS_NAMES='-name CVS -o -name .cvsignore'
167 # Add an md5sum to the built tarball
170 echo "==> Adding md5 checksum to top-level directory"
171 (cd proto-toplev && find * -follow \( $CVS_NAMES \) -prune \
173 | xargs $MD5PROG > ../md5.new)
174 rm -f proto-toplev/md5.sum
175 mv md5.new proto-toplev/md5.sum
178 # Build the release tarball
183 echo "==> Making $package-$ver.tar"
184 rm -f $package-$ver.tar
185 find $package-$ver -follow \( $CVS_NAMES \) -prune \
187 | tar cTfh - $package-$ver.tar
190 # Compress the output with bzip2
195 echo "==> Bzipping $package-$ver.tar.bz2"
196 rm -f $package-$ver.tar.bz2
197 $BZIPPROG -k -v -9 $package-$ver.tar
200 # Compress the output with gzip
205 echo "==> Gzipping $package-$ver.tar.gz"
206 rm -f $package-$ver.tar.gz
207 $GZIPPROG -k -v -9 $package-$ver.tar
210 # Compress the output with lzip
215 echo "==> Lzipping $package-$ver.tar.lz"
216 rm -f $package-$ver.tar.lz
217 $LZIPPROG -k -v -9 $package-$ver.tar
220 # Compress the output with xz
225 echo "==> Xzipping $package-$ver.tar.xz"
226 rm -f $package-$ver.tar.xz
227 $XZPROG -k -v -9 $package-$ver.tar
230 # Compress the output with all selected compresion methods
236 for comp in $compressors; do
239 do_bz2 $package $ver;;
241 do_gz $package $ver;;
243 do_lz $package $ver;;
245 do_xz $package $ver;;
247 echo "Unknown compression method: $comp" && exit 1;;
252 # Add djunpack.bat the tarball
257 echo "==> Adding updated djunpack.bat to top-level directory"
258 echo - 's /gdb-[0-9\.]*/$package-'"$ver"'/'
259 sed < djunpack.bat > djunpack.new \
260 -e 's/gdb-[0-9][0-9\.]*/$package-'"$ver"'/'
261 rm -f proto-toplev/djunpack.bat
262 mv djunpack.new proto-toplev/djunpack.bat
265 # Create a release package, tar it and compress it
273 ver=$(getver $verdir)
274 do_proto_toplev $package $ver $tool "$support_files"
277 do_compress $package $ver "$compressors"
280 # Create a gdb release package, tar it and compress it
288 do_proto_toplev $package $ver $tool "$support_files"
290 do_djunpack $package $ver
292 do_compress $package $ver "$compressors"
295 # The FSF "binutils" release includes gprof and ld.
296 BINUTILS_SUPPORT_DIRS="bfd gas include libiberty opcodes ld elfcpp gold gprof intl setup.com makefile.vms cpu zlib"
302 tar_compress $package $tool "$BINUTILS_SUPPORT_DIRS" "$compressors"
305 GAS_SUPPORT_DIRS="bfd include libiberty opcodes intl setup.com makefile.vms zlib"
311 tar_compress $package $tool "$GAS_SUPPORT_DIRS" "$compressors"
314 GDB_SUPPORT_DIRS="bfd include libiberty opcodes readline sim intl libdecnumber cpu zlib contrib"
320 gdb_tar_compress $package $tool "$GDB_SUPPORT_DIRS" "$compressors"
323 # Corresponding to the CVS "sim" module.
324 SIM_SUPPORT_DIRS="bfd opcodes libiberty include intl gdb/version.in gdb/common/create-version.sh makefile.vms zlib"
330 tar_compress $package $tool "$SIM_SUPPORT_DIRS" "$compressors" gdb
335 echo "src-release.sh <options> <release>"
337 echo " -b: Compress with bzip2"
338 echo " -g: Compress with gzip"
339 echo " -l: Compress with lzip"
340 echo " -x: Compress with xz"
350 binutils_release "$compressors";;
352 gas_release "$compressors";;
354 gdb_release "$compressors";;
356 sim_release "$compressors";;
358 echo "Unknown release name: $release" && usage;;
364 while getopts ":bglx" opt; do
367 compressors="$compressors bz2";;
369 compressors="$compressors gz";;
371 compressors="$compressors lz";;
373 compressors="$compressors xz";;
375 echo "Invalid option: -$OPTARG" && usage;;
381 build_release $release "$compressors"