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="README Makefile.in configure configure.ac \
42 config.guess config.sub config move-if-change \
43 COPYING COPYING.LIB install-sh config-ml.in symlink-tree \
44 mkinstalldirs ltmain.sh missing ylwrap \
45 libtool.m4 ltsugar.m4 ltversion.m4 ltoptions.m4 \
46 Makefile.def Makefile.tpl src-release.sh config.rpath \
47 ChangeLog MAINTAINERS README-maintainer-mode \
48 lt~obsolete.m4 ltgcc.m4 depcomp mkdep compile \
49 COPYING3 COPYING3.LIB"
51 # Files in devo/etc used in any net release.
52 ETC_SUPPORT="Makefile.in configure configure.in standards.texi \
53 make-stds.texi standards.info* configure.texi configure.info* \
54 ChangeLog configbuild.* configdev.* fdl.texi texi2pod.pl gnu-oids.texi"
56 # Get the version number of a given tool
60 if grep 'AC_INIT.*BFD_VERSION' $tool/configure.ac >/dev/null 2>&1; then
61 bfd/configure --version | sed -n -e '1s,.* ,,p'
62 elif test -f $tool/common/create-version.sh; then
63 $tool/common/create-version.sh $tool 'dummy-host' 'dummy-target' VER.tmp
64 cat VER.tmp | grep 'version\[\]' | sed 's/.*"\([^"]*\)".*/\1/' | sed 's/-git$//'
66 elif test -f $tool/version.in; then
67 head -1 $tool/version.in
73 # Setup build directory for building release tarball
81 echo "==> Cleaning sources."
82 find -name "*.orig" -exec rm {} \;
83 find -name "*.rej" -exec rm {} \;
85 echo "==> Making $package-$ver/"
86 # Take out texinfo from a few places.
87 sed -e '/^all\.normal: /s/\all-texinfo //' \
88 -e '/^ install-texinfo /d' \
91 # configure. --enable-gold is needed to ensure .c/.h from .y are
92 # built in the gold dir. The disables speed the build a little.
95 for dir in binutils gas gdb gold gprof ld libdecnumber readline sim; do
96 case " $tool $support_files " in
97 *" $dir "*) enables="$enables --enable-$dir" ;;
98 *) disables="$disables --disable-$dir" ;;
101 echo "==> configure --target=i386-pc-linux-gnu $disables $enables"
102 ./configure --target=i386-pc-linux-gnu $disables $enables
103 $MAKE configure-host configure-target \
104 ALL_GCC="" ALL_GCC_C="" ALL_GCC_CXX="" \
105 CC_FOR_TARGET="$CC" CXX_FOR_TARGET="$CXX"
106 # Make links, and run "make diststuff" or "make info" when needed.
109 dirs="$DEVO_SUPPORT $support_files $tool"
112 if [ ! -f $d/Makefile ] ; then
114 elif grep '^diststuff:' $d/Makefile >/dev/null ; then
115 (cd $d ; $MAKE MAKEINFOFLAGS="$MAKEINFOFLAGS" diststuff) \
117 elif grep '^info:' $d/Makefile >/dev/null ; then
118 (cd $d ; $MAKE MAKEINFOFLAGS="$MAKEINFOFLAGS" info) \
121 if [ -d $d/proto-$d.dir ]; then
122 ln -s ../$d/proto-$d.dir proto-toplev/$d
124 ln -s ../$d proto-toplev/$d
127 if (echo x$d | grep / >/dev/null); then
128 mkdir -p proto-toplev/`dirname $d`
130 ln -s ../`echo $x/ | sed -e 's,[^/]*/,../,g'`$d proto-toplev/$d
132 ln -s ../$d proto-toplev/$d
136 (cd etc; $MAKE MAKEINFOFLAGS="$MAKEINFOFLAGS" info)
138 mkdir proto-toplev/etc
139 (cd proto-toplev/etc;
140 for i in $ETC_SUPPORT; do
144 # Take out texinfo from configurable dirs
145 rm proto-toplev/configure.ac
146 sed -e '/^host_tools=/s/texinfo //' \
147 <configure.ac >proto-toplev/configure.ac
149 mkdir proto-toplev/texinfo
150 ln -s ../../texinfo/texinfo.tex proto-toplev/texinfo/
151 if test -r texinfo/util/tex3patch ; then
152 mkdir proto-toplev/texinfo/util && \
153 ln -s ../../../texinfo/util/tex3patch proto-toplev/texinfo/util
157 chmod -R og=u . || chmod og=u `find . -print`
159 # Create .gmo files from .po files.
160 for f in `find . -name '*.po' -type f -print`; do
161 msgfmt -o `echo $f | sed -e 's/\.po$/.gmo/'` $f
165 ln -s proto-toplev $package-$ver
168 CVS_NAMES='-name CVS -o -name .cvsignore'
170 # Add an md5sum to the built tarball
173 echo "==> Adding md5 checksum to top-level directory"
174 (cd proto-toplev && find * -follow \( $CVS_NAMES \) -prune \
176 | xargs $MD5PROG > ../md5.new)
177 rm -f proto-toplev/md5.sum
178 mv md5.new proto-toplev/md5.sum
181 # Build the release tarball
186 echo "==> Making $package-$ver.tar"
187 rm -f $package-$ver.tar
188 find $package-$ver -follow \( $CVS_NAMES \) -prune \
190 | tar cTfh - $package-$ver.tar
193 # Compress the output with bzip2
198 echo "==> Bzipping $package-$ver.tar.bz2"
199 rm -f $package-$ver.tar.bz2
200 $BZIPPROG -k -v -9 $package-$ver.tar
203 # Compress the output with gzip
208 echo "==> Gzipping $package-$ver.tar.gz"
209 rm -f $package-$ver.tar.gz
210 $GZIPPROG -k -v -9 $package-$ver.tar
213 # Compress the output with lzip
218 echo "==> Lzipping $package-$ver.tar.lz"
219 rm -f $package-$ver.tar.lz
220 $LZIPPROG -k -v -9 $package-$ver.tar
223 # Compress the output with xz
228 echo "==> Xzipping $package-$ver.tar.xz"
229 rm -f $package-$ver.tar.xz
230 $XZPROG -k -v -9 $package-$ver.tar
233 # Compress the output with all selected compresion methods
239 for comp in $compressors; do
242 do_bz2 $package $ver;;
244 do_gz $package $ver;;
246 do_lz $package $ver;;
248 do_xz $package $ver;;
250 echo "Unknown compression method: $comp" && exit 1;;
255 # Add djunpack.bat the tarball
260 echo "==> Adding updated djunpack.bat to top-level directory"
261 echo - 's /gdb-[0-9\.]*/$package-'"$ver"'/'
262 sed < djunpack.bat > djunpack.new \
263 -e 's/gdb-[0-9][0-9\.]*/$package-'"$ver"'/'
264 rm -f proto-toplev/djunpack.bat
265 mv djunpack.new proto-toplev/djunpack.bat
268 # Create a release package, tar it and compress it
276 ver=$(getver $verdir)
277 do_proto_toplev $package $ver $tool "$support_files"
280 do_compress $package $ver "$compressors"
283 # Create a gdb release package, tar it and compress it
291 do_proto_toplev $package $ver $tool "$support_files"
293 do_djunpack $package $ver
295 do_compress $package $ver "$compressors"
298 # The FSF "binutils" release includes gprof and ld.
299 BINUTILS_SUPPORT_DIRS="bfd gas include libiberty opcodes ld elfcpp gold gprof intl setup.com makefile.vms cpu zlib"
305 tar_compress $package $tool "$BINUTILS_SUPPORT_DIRS" "$compressors"
308 GAS_SUPPORT_DIRS="bfd include libiberty opcodes intl setup.com makefile.vms zlib"
314 tar_compress $package $tool "$GAS_SUPPORT_DIRS" "$compressors"
317 GDB_SUPPORT_DIRS="bfd include libiberty opcodes readline sim intl libdecnumber cpu zlib"
323 gdb_tar_compress $package $tool "$GDB_SUPPORT_DIRS" "$compressors"
326 # Corresponding to the CVS "sim" module.
327 SIM_SUPPORT_DIRS="bfd opcodes libiberty include intl gdb/version.in gdb/common/create-version.sh makefile.vms zlib"
333 tar_compress $package $tool "$SIM_SUPPORT_DIRS" "$compressors" gdb
338 echo "src-release.sh <options> <release>"
340 echo " -b: Compress with bzip2"
341 echo " -g: Compress with gzip"
342 echo " -l: Compress with lzip"
343 echo " -x: Compress with xz"
353 binutils_release "$compressors";;
355 gas_release "$compressors";;
357 gdb_release "$compressors";;
359 sim_release "$compressors";;
361 echo "Unknown release name: $release" && usage;;
367 while getopts ":bglx" opt; do
370 compressors="$compressors bz2";;
372 compressors="$compressors gz";;
374 compressors="$compressors lz";;
376 compressors="$compressors xz";;
378 echo "Invalid option: -$OPTARG" && usage;;
384 build_release $release "$compressors"