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"
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 $tool = "gdb"; then
66 .
/gdbsupport
/create-version.sh
$tool 'dummy-host' 'dummy-target' VER.tmp
67 cat VER.tmp |
grep 'version\[\]' |
sed 's/.*"\([^"]*\)".*/\1/' |
sed 's/-git$//'
69 elif test -f $tool/version.
in; then
70 head -n 1 $tool/version.
in
76 # Setup build directory for building release tarball
84 echo "==> Cleaning sources."
85 find \
( -name "*.orig" -o -name "*.rej" -o -name "*~" -o -name ".#*" -o -name "*~$bkpat" \
) -exec rm {} \
;
87 echo "==> Making $package-$ver/"
88 # Take out texinfo from a few places.
89 sed -e '/^all\.normal: /s/\all-texinfo //' \
90 -e '/^ install-texinfo /d' \
93 # configure. --enable-gold is needed to ensure .c/.h from .y are
94 # built in the gold dir. The disables speed the build a little.
97 for dir
in binutils gas gdb gold gprof gprofng libsframe ld libctf libdecnumber readline sim
; do
98 case " $tool $support_files " in
99 *" $dir "*) enables
="$enables --enable-$dir" ;;
100 *) disables
="$disables --disable-$dir" ;;
103 echo "==> configure --target=i386-pc-linux-gnu $disables $enables"
104 .
/configure
--target=i386-pc-linux-gnu
$disables $enables
105 $MAKE configure-host configure-target \
106 ALL_GCC
="" ALL_GCC_C
="" ALL_GCC_CXX
="" \
107 CC_FOR_TARGET
="$CC" CXX_FOR_TARGET
="$CXX"
108 # Make links, and run "make diststuff" or "make info" when needed.
111 dirs="$DEVO_SUPPORT $support_files $tool"
114 if [ ! -f $d/Makefile
] ; then
116 elif grep '^diststuff:' $d/Makefile
>/dev
/null
; then
117 (cd $d ; $MAKE MAKEINFOFLAGS
="$MAKEINFOFLAGS" diststuff
) \
119 elif grep '^info:' $d/Makefile
>/dev
/null
; then
120 (cd $d ; $MAKE MAKEINFOFLAGS
="$MAKEINFOFLAGS" info
) \
123 if [ -d $d/proto-
$d.dir
]; then
124 ln -s ..
/$d/proto-
$d.dir proto-toplev
/$d
126 ln -s ..
/$d proto-toplev
/$d
129 if (echo x
$d |
grep / >/dev
/null
); then
130 mkdir
-p proto-toplev
/`dirname $d`
132 ln -s ..
/`echo $x/ | sed -e 's,[^/]*/,../,g'`$d proto-toplev
/$d
134 ln -s ..
/$d proto-toplev
/$d
138 (cd etc
; $MAKE MAKEINFOFLAGS
="$MAKEINFOFLAGS" info
)
140 mkdir proto-toplev
/etc
141 (cd proto-toplev
/etc
;
142 for i
in $ETC_SUPPORT; do
146 # Take out texinfo from configurable dirs
147 rm proto-toplev
/configure.ac
148 sed -e '/^host_tools=/s/texinfo //' \
149 <configure.ac
>proto-toplev
/configure.ac
151 mkdir proto-toplev
/texinfo
152 ln -s ..
/..
/texinfo
/texinfo.tex proto-toplev
/texinfo
/
153 if test -r texinfo
/util
/tex3patch
; then
154 mkdir proto-toplev
/texinfo
/util
&& \
155 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 a sha256sum to the built tarball
173 echo "==> Adding sha256 checksum to top-level directory"
174 (cd proto-toplev
&& find * -follow \
( $CVS_NAMES \
) -prune \
176 |
xargs $SHA256PROG > ..
/sha256.new
)
177 rm -f proto-toplev
/sha256.
sum
178 mv sha256.new proto-toplev
/sha256.
sum
181 # Build the release tarball
186 echo "==> Making $package-$ver.tar"
187 rm -f $package-$ver.
tar
188 if test x
$release_date == "x" ; then
189 find $package-$ver -follow \
( $CVS_NAMES \
) -prune -o -type f
-print \
190 |
tar cTfh
- $package-$ver.
tar
192 # Attempt to create a consistent, reproducible tarball using the
194 find $package-$ver -follow \
( $CVS_NAMES \
) -prune -o -type f
-print \
196 |
tar cTfh
- $package-$ver.
tar \
197 --mtime=$release_date --group=0 --owner=0
201 # Compress the output with bzip2
206 echo "==> Bzipping $package-$ver.tar.bz2"
207 rm -f $package-$ver.
tar.bz2
208 $BZIPPROG -k -v -9 $package-$ver.
tar
211 # Compress the output with gzip
216 echo "==> Gzipping $package-$ver.tar.gz"
217 rm -f $package-$ver.
tar.gz
218 $GZIPPROG -k -v -9 $package-$ver.
tar
221 # Compress the output with lzip
226 echo "==> Lzipping $package-$ver.tar.lz"
227 rm -f $package-$ver.
tar.lz
228 $LZIPPROG -k -v -9 $package-$ver.
tar
231 # Compress the output with xz
236 echo "==> Xzipping $package-$ver.tar.xz"
237 rm -f $package-$ver.
tar.xz
238 $XZPROG -k -v -9 $package-$ver.
tar
241 # Compress the output with all selected compresion methods
247 for comp
in $compressors; do
250 do_bz2
$package $ver;;
252 do_gz
$package $ver;;
254 do_lz
$package $ver;;
256 do_xz
$package $ver;;
258 echo "Unknown compression method: $comp" && exit 1;;
263 # Add djunpack.bat the tarball
268 echo "==> Adding updated djunpack.bat to top-level directory"
269 echo - 's /gdb-[0-9\.]*/$package-'"$ver"'/'
270 sed < djunpack.bat
> djunpack.new \
271 -e 's/gdb-[0-9][0-9\.]*/$package-'"$ver"'/'
272 rm -f proto-toplev
/djunpack.bat
273 mv djunpack.new proto-toplev
/djunpack.bat
276 # Create a release package, tar it and compress it
284 ver
=$
(getver
$verdir)
285 do_proto_toplev
$package $ver $tool "$support_files"
288 do_compress
$package $ver "$compressors"
291 # Create a gdb release package, tar it and compress it
299 do_proto_toplev
$package $ver $tool "$support_files"
301 do_djunpack
$package $ver
303 do_compress
$package $ver "$compressors"
306 # The FSF "binutils" release includes gprof and ld.
307 BINUTILS_SUPPORT_DIRS
="libsframe bfd gas include libiberty libctf opcodes ld elfcpp gold gprof gprofng intl setup.com makefile.vms cpu zlib"
313 tar_compress
$package $tool "$BINUTILS_SUPPORT_DIRS" "$compressors"
316 GAS_SUPPORT_DIRS
="bfd include libiberty opcodes intl setup.com makefile.vms zlib"
322 tar_compress
$package $tool "$GAS_SUPPORT_DIRS" "$compressors"
325 GDB_SUPPORT_DIRS
="libsframe bfd include libiberty libctf opcodes readline sim intl libdecnumber cpu zlib contrib gnulib gdbsupport gdbserver libbacktrace"
331 gdb_tar_compress
$package $tool "$GDB_SUPPORT_DIRS" "$compressors"
334 # Corresponding to the CVS "sim" module.
335 SIM_SUPPORT_DIRS
="libsframe bfd opcodes libiberty libctf/swap.h include intl gdb/version.in gdb/common/create-version.sh makefile.vms zlib gnulib"
341 tar_compress
$package $tool "$SIM_SUPPORT_DIRS" "$compressors" gdb
346 echo "src-release.sh <options> <release>"
348 echo " -b: Compress with bzip2"
349 echo " -g: Compress with gzip"
350 echo " -l: Compress with lzip"
351 echo " -x: Compress with xz"
352 echo " -r <date>: Create a reproducible tarball using <date> as the mtime"
362 binutils_release
"$compressors";;
364 gas_release
"$compressors";;
366 gdb_release
"$compressors";;
368 sim_release
"$compressors";;
370 echo "Unknown release name: $release" && usage
;;
376 while getopts ":bglr:x" opt
; do
379 compressors
="$compressors bz2";;
381 compressors
="$compressors gz";;
383 compressors
="$compressors lz";;
385 release_date
=$OPTARG;;
387 compressors
="$compressors xz";;
389 echo "Invalid option: -$OPTARG" && usage
;;
395 build_release
$release "$compressors"