2 # Copyright (C) 1990-2020 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.
35 # Default to avoid splitting info files by setting the threshold high.
36 MAKEINFOFLAGS
=--split-size=5000000
39 # Support for building net releases
41 # Files in root used in any net release.
42 DEVO_SUPPORT
="ar-lib ChangeLog compile config config-ml.in config.guess \
43 config.rpath config.sub configure configure.ac COPYING COPYING.LIB \
44 COPYING3 COPYING3.LIB depcomp install-sh libtool.m4 ltgcc.m4 \
45 ltmain.sh ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4 \
46 MAINTAINERS Makefile.def Makefile.in Makefile.tpl missing mkdep \
47 mkinstalldirs move-if-change README README-maintainer-mode \
48 SECURITY.txt src-release.sh symlink-tree test-driver ylwrap \
51 # Files in devo/etc used in any net release.
52 ETC_SUPPORT
="ChangeLog Makefile.am Makefile.in aclocal.m4 add-log.el \
53 add-log.vi configbuild.* configdev.* configure configure.ac \
54 configure.in configure.info* configure.texi fdl.texi gnu-oids.texi \
55 make-stds.texi standards.info* standards.texi texi2pod.pl \
58 # Get the version number of a given tool
62 if grep 'AC_INIT.*BFD_VERSION' $tool/configure.ac
>/dev
/null
2>&1; then
63 bfd
/configure
--version |
sed -n -e '1s,.* ,,p'
64 elif test -f $tool/common
/create-version.sh
; then
65 $tool/common
/create-version.sh
$tool 'dummy-host' 'dummy-target' VER.tmp
66 cat VER.tmp |
grep 'version\[\]' |
sed 's/.*"\([^"]*\)".*/\1/' |
sed 's/-git$//'
68 elif test $tool = "gdb"; then
69 .
/gdbsupport
/create-version.sh
$tool 'dummy-host' 'dummy-target' VER.tmp
70 cat VER.tmp |
grep 'version\[\]' |
sed 's/.*"\([^"]*\)".*/\1/' |
sed 's/-git$//'
72 elif test -f $tool/version.
in; then
73 head -n 1 $tool/version.
in
79 # Setup build directory for building release tarball
87 echo "==> Cleaning sources."
88 find \
( -name "*.orig" -o -name "*.rej" -o -name "*~" -o -name ".#*" -o -name "*~$bkpat" \
) -exec rm {} \
;
90 echo "==> Making $package-$ver/"
91 # Take out texinfo from a few places.
92 sed -e '/^all\.normal: /s/\all-texinfo //' \
93 -e '/^ install-texinfo /d' \
96 # configure. --enable-gold is needed to ensure .c/.h from .y are
97 # built in the gold dir. The disables speed the build a little.
100 for dir
in binutils gas gdb gold gprof gprofng libsframe ld libctf libdecnumber readline sim
; do
101 case " $tool $support_files " in
102 *" $dir "*) enables
="$enables --enable-$dir" ;;
103 *) disables
="$disables --disable-$dir" ;;
106 echo "==> configure --target=i386-pc-linux-gnu $disables $enables"
107 .
/configure
--target=i386-pc-linux-gnu
$disables $enables
108 $MAKE configure-host configure-target \
109 ALL_GCC
="" ALL_GCC_C
="" ALL_GCC_CXX
="" \
110 CC_FOR_TARGET
="$CC" CXX_FOR_TARGET
="$CXX"
111 # Make links, and run "make diststuff" or "make info" when needed.
114 dirs="$DEVO_SUPPORT $support_files $tool"
117 if [ ! -f $d/Makefile
] ; then
119 elif grep '^diststuff:' $d/Makefile
>/dev
/null
; then
120 (cd $d ; $MAKE MAKEINFOFLAGS
="$MAKEINFOFLAGS" diststuff
) \
122 elif grep '^info:' $d/Makefile
>/dev
/null
; then
123 (cd $d ; $MAKE MAKEINFOFLAGS
="$MAKEINFOFLAGS" info
) \
126 if [ -d $d/proto-
$d.dir
]; then
127 ln -s ..
/$d/proto-
$d.dir proto-toplev
/$d
129 ln -s ..
/$d proto-toplev
/$d
132 if (echo x
$d |
grep / >/dev
/null
); then
133 mkdir
-p proto-toplev
/`dirname $d`
135 ln -s ..
/`echo $x/ | sed -e 's,[^/]*/,../,g'`$d proto-toplev
/$d
137 ln -s ..
/$d proto-toplev
/$d
141 (cd etc
; $MAKE MAKEINFOFLAGS
="$MAKEINFOFLAGS" info
)
143 mkdir proto-toplev
/etc
144 (cd proto-toplev
/etc
;
145 for i
in $ETC_SUPPORT; do
149 # Take out texinfo from configurable dirs
150 rm proto-toplev
/configure.ac
151 sed -e '/^host_tools=/s/texinfo //' \
152 <configure.ac
>proto-toplev
/configure.ac
154 mkdir proto-toplev
/texinfo
155 ln -s ..
/..
/texinfo
/texinfo.tex proto-toplev
/texinfo
/
156 if test -r texinfo
/util
/tex3patch
; then
157 mkdir proto-toplev
/texinfo
/util
&& \
158 ln -s ..
/..
/..
/texinfo
/util
/tex3patch proto-toplev
/texinfo
/util
160 chmod -R og
=u . ||
chmod og
=u
`find . -print`
162 # Create .gmo files from .po files.
163 for f
in `find . -name '*.po' -type f -print`; do
164 msgfmt
-o `echo $f | sed -e 's/\.po$/.gmo/'` $f
168 ln -s proto-toplev
$package-$ver
171 CVS_NAMES
='-name CVS -o -name .cvsignore'
173 # Add a sha256sum to the built tarball
176 echo "==> Adding sha256 checksum to top-level directory"
177 (cd proto-toplev
&& find * -follow \
( $CVS_NAMES \
) -prune \
179 |
xargs $SHA256PROG > ..
/sha256.new
)
180 rm -f proto-toplev
/sha256.
sum
181 mv sha256.new proto-toplev
/sha256.
sum
184 # Build the release tarball
189 echo "==> Making $package-$ver.tar"
190 rm -f $package-$ver.
tar
191 if test x
$release_date == "x" ; then
192 find $package-$ver -follow \
( $CVS_NAMES \
) -prune -o -type f
-print \
193 |
tar cTfh
- $package-$ver.
tar
195 # Attempt to create a consistent, reproducible tarball using the
197 find $package-$ver -follow \
( $CVS_NAMES \
) -prune -o -type f
-print \
199 |
tar cTfh
- $package-$ver.
tar \
200 --mtime=$release_date --group=0 --owner=0
204 # Compress the output with bzip2
209 echo "==> Bzipping $package-$ver.tar.bz2"
210 rm -f $package-$ver.
tar.bz2
211 $BZIPPROG -k -v -9 $package-$ver.
tar
214 # Compress the output with gzip
219 echo "==> Gzipping $package-$ver.tar.gz"
220 rm -f $package-$ver.
tar.gz
221 $GZIPPROG -k -v -9 $package-$ver.
tar
224 # Compress the output with lzip
229 echo "==> Lzipping $package-$ver.tar.lz"
230 rm -f $package-$ver.
tar.lz
231 $LZIPPROG -k -v -9 $package-$ver.
tar
234 # Compress the output with xz
239 echo "==> Xzipping $package-$ver.tar.xz"
240 rm -f $package-$ver.
tar.xz
241 $XZPROG -k -v -9 $package-$ver.
tar
244 # Compress the output with all selected compresion methods
250 for comp
in $compressors; do
253 do_bz2
$package $ver;;
255 do_gz
$package $ver;;
257 do_lz
$package $ver;;
259 do_xz
$package $ver;;
261 echo "Unknown compression method: $comp" && exit 1;;
266 # Add djunpack.bat the tarball
271 echo "==> Adding updated djunpack.bat to top-level directory"
272 echo - 's /gdb-[0-9\.]*/$package-'"$ver"'/'
273 sed < djunpack.bat
> djunpack.new \
274 -e 's/gdb-[0-9][0-9\.]*/$package-'"$ver"'/'
275 rm -f proto-toplev
/djunpack.bat
276 mv djunpack.new proto-toplev
/djunpack.bat
279 # Create a release package, tar it and compress it
287 ver
=$
(getver
$verdir)
288 do_proto_toplev
$package $ver $tool "$support_files"
291 do_compress
$package $ver "$compressors"
294 # Create a gdb release package, tar it and compress it
302 do_proto_toplev
$package $ver $tool "$support_files"
304 do_djunpack
$package $ver
306 do_compress
$package $ver "$compressors"
309 # The FSF "binutils" release includes gprof and ld.
310 BINUTILS_SUPPORT_DIRS
="libsframe bfd gas include libiberty libctf opcodes ld elfcpp gold gprof gprofng setup.com makefile.vms cpu zlib"
316 tar_compress
$package $tool "$BINUTILS_SUPPORT_DIRS" "$compressors"
319 GAS_SUPPORT_DIRS
="bfd include libiberty opcodes setup.com makefile.vms zlib"
325 tar_compress
$package $tool "$GAS_SUPPORT_DIRS" "$compressors"
328 GDB_SUPPORT_DIRS
="libsframe bfd include libiberty libctf opcodes readline sim libdecnumber cpu zlib contrib gnulib gdbsupport gdbserver libbacktrace"
334 gdb_tar_compress
$package $tool "$GDB_SUPPORT_DIRS" "$compressors"
337 # Corresponding to the CVS "sim" module.
338 SIM_SUPPORT_DIRS
="libsframe bfd opcodes libiberty libctf/swap.h include gdb/version.in gdb/common/create-version.sh makefile.vms zlib gnulib"
344 tar_compress
$package $tool "$SIM_SUPPORT_DIRS" "$compressors" gdb
349 echo "src-release.sh <options> <release>"
351 echo " -b: Compress with bzip2"
352 echo " -g: Compress with gzip"
353 echo " -l: Compress with lzip"
354 echo " -x: Compress with xz"
355 echo " -r <date>: Create a reproducible tarball using <date> as the mtime"
365 binutils_release
"$compressors";;
367 gas_release
"$compressors";;
369 gdb_release
"$compressors";;
371 sim_release
"$compressors";;
373 echo "Unknown release name: $release" && usage
;;
379 while getopts ":bglr:x" opt
; do
382 compressors
="$compressors bz2";;
384 compressors
="$compressors gz";;
386 compressors
="$compressors lz";;
388 release_date
=$OPTARG;;
390 compressors
="$compressors xz";;
392 echo "Invalid option: -$OPTARG" && usage
;;
398 build_release
$release "$compressors"