2002-05-06 08:27:15 +08:00
|
|
|
#!/bin/bash -xe
|
|
|
|
#
|
|
|
|
# Generate a NASM release
|
|
|
|
#
|
2007-09-14 03:22:00 +08:00
|
|
|
# Usage: release version [destination]
|
2002-05-06 08:27:15 +08:00
|
|
|
#
|
|
|
|
|
2007-09-14 03:22:00 +08:00
|
|
|
version="$1"
|
2002-05-06 08:27:15 +08:00
|
|
|
if [ -z "$1" ]; then
|
2007-09-14 03:22:00 +08:00
|
|
|
echo "Usage: $0 version [destination]" 1>&2
|
|
|
|
exit 1
|
2002-05-06 08:27:15 +08:00
|
|
|
fi
|
|
|
|
|
2007-09-14 03:22:00 +08:00
|
|
|
WHERE="$2"
|
|
|
|
if [ -z "$WHERE" ]; then
|
|
|
|
WHERE=/var/tmp
|
2002-05-06 08:27:15 +08:00
|
|
|
fi
|
|
|
|
|
2007-09-14 03:22:00 +08:00
|
|
|
if [ -n "$GIT_DIR" ]; then
|
|
|
|
HERE="$GIT_DIR"
|
2002-05-06 08:27:15 +08:00
|
|
|
else
|
2007-09-14 03:22:00 +08:00
|
|
|
HERE=`pwd`
|
2002-05-06 08:27:15 +08:00
|
|
|
fi
|
|
|
|
|
2007-09-14 03:22:00 +08:00
|
|
|
if [ x`cat version` != x"${version}" ]; then
|
|
|
|
echo "${version}" > version
|
|
|
|
git update-index version
|
|
|
|
git commit -m "Version ${version}" -- version
|
2002-05-06 08:27:15 +08:00
|
|
|
fi
|
2007-09-23 07:38:25 +08:00
|
|
|
git tag -m "NASM version ${version}" -f "nasm-${version}"
|
2002-05-06 08:27:15 +08:00
|
|
|
|
2007-09-14 03:22:00 +08:00
|
|
|
cd "$WHERE"
|
|
|
|
rm -rf nasm-release.*
|
|
|
|
work=nasm-release.$$
|
|
|
|
mkdir $work
|
|
|
|
cd $work
|
|
|
|
unset GIT_DIR
|
|
|
|
git clone -s -l "$HERE" nasm
|
2007-10-14 14:19:21 +08:00
|
|
|
rm -rf nasm/.git nasm/.gitignore
|
2002-05-06 08:27:15 +08:00
|
|
|
|
2017-04-19 01:52:05 +08:00
|
|
|
# How to invoke make if makej is not set
|
|
|
|
makej="${makej:-make}"
|
2017-04-19 01:35:15 +08:00
|
|
|
|
2002-05-06 08:27:15 +08:00
|
|
|
# Create files which are in the release but automatically generated
|
|
|
|
cd nasm
|
2007-09-14 03:22:00 +08:00
|
|
|
./autogen.sh
|
2002-05-06 08:27:15 +08:00
|
|
|
./configure --prefix=/usr/local
|
2017-04-19 01:52:05 +08:00
|
|
|
$makej perlreq spec manpages
|
|
|
|
$makej alldeps
|
|
|
|
$makej distclean
|
2002-05-06 08:27:15 +08:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
# Clean up any previous attempt
|
2007-09-14 03:22:00 +08:00
|
|
|
rm -f ../nasm-"$version".tar.gz ../nasm-"$version"-xdoc.tar.gz
|
|
|
|
rm -f ../nasm-"$version".tar.bz2 ../nasm-"$version"-xdoc.tar.bz2
|
2012-02-26 13:28:15 +08:00
|
|
|
rm -f ../nasm-"$version".tar.xz ../nasm-"$version"-xdoc.tar.xz
|
2007-09-14 03:22:00 +08:00
|
|
|
rm -f ../nasm-"$version".zip ../nasm-"$version"-xdoc.zip
|
2002-05-06 08:27:15 +08:00
|
|
|
|
|
|
|
# Create tarfile (Unix convention: file includes prefix)
|
2007-09-14 03:22:00 +08:00
|
|
|
mv nasm nasm-"$version"
|
|
|
|
tar cvvf nasm-"$version".tar nasm-"$version"
|
2012-02-26 14:49:25 +08:00
|
|
|
xz -9ek nasm-"$version".tar
|
|
|
|
bzip2 -9k nasm-"$version".tar
|
|
|
|
gzip -9 nasm-"$version".tar
|
2012-02-26 13:28:15 +08:00
|
|
|
mv nasm-"$version".tar.gz nasm-"$version".tar.bz2 nasm-"$version".tar.xz ..
|
2002-05-06 08:27:15 +08:00
|
|
|
|
|
|
|
# Create zipfile (DOS convention: no prefix, convert file endings)
|
2007-09-14 03:22:00 +08:00
|
|
|
cd nasm-"$version"
|
2018-12-26 21:11:26 +08:00
|
|
|
binext='jpg zip ico png pdf bin o obj exe com'
|
|
|
|
for e in $binext; do
|
|
|
|
xbin="$xbin -x *.$e -x *.$e.t"
|
|
|
|
ibin="$ibin -i *.$e -i *.$e.t"
|
|
|
|
done
|
2017-04-14 14:16:08 +08:00
|
|
|
# Text files
|
2018-12-26 21:11:26 +08:00
|
|
|
zip -9Dlr ../../nasm-"$version".zip * $xbin
|
2017-04-14 14:16:08 +08:00
|
|
|
# Binary files
|
2018-12-26 21:11:26 +08:00
|
|
|
zip -9Dgr ../../nasm-"$version".zip * $ibin
|
2002-05-06 08:27:15 +08:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
# Record what we have already generated
|
2007-09-14 03:22:00 +08:00
|
|
|
find nasm-"$version" -not -type d -print > main
|
2002-05-06 08:27:15 +08:00
|
|
|
|
2002-05-27 09:18:45 +08:00
|
|
|
# Create documentation
|
2007-09-14 03:22:00 +08:00
|
|
|
cd nasm-"$version"
|
2003-08-30 04:00:26 +08:00
|
|
|
./configure --prefix=/usr/local
|
2017-04-19 01:52:05 +08:00
|
|
|
$makej doc
|
2002-05-27 08:52:46 +08:00
|
|
|
# Remove intermediate files.
|
2017-04-19 01:52:05 +08:00
|
|
|
$makej cleaner
|
2002-05-06 08:27:15 +08:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
# Remove non-documentation
|
|
|
|
cat main | xargs rm -f
|
2012-02-26 13:28:15 +08:00
|
|
|
# Delete empty subdirectories
|
|
|
|
find nasm-"$version"/doc -type d -exec rmdir '{}' \; 2>/dev/null || true
|
2002-05-06 08:27:15 +08:00
|
|
|
|
|
|
|
# Create doc tarfile
|
2007-09-14 03:22:00 +08:00
|
|
|
tar cvvf nasm-"$version"-xdoc.tar nasm-"$version"/doc
|
2012-02-26 14:49:25 +08:00
|
|
|
xz -9ek nasm-"$version"-xdoc.tar
|
|
|
|
bzip2 -9k nasm-"$version"-xdoc.tar
|
|
|
|
gzip -9 nasm-"$version"-xdoc.tar
|
2012-02-26 13:28:15 +08:00
|
|
|
mv nasm-"$version"-xdoc.tar.gz nasm-"$version"-xdoc.tar.bz2 nasm-"$version"-xdoc.tar.xz ..
|
2002-05-06 08:27:15 +08:00
|
|
|
|
|
|
|
# Create doc zipfile (DOS convention: no prefix, convert file endings)
|
2007-09-14 03:22:00 +08:00
|
|
|
cd nasm-"$version"
|
2018-12-26 21:11:26 +08:00
|
|
|
zip -9Dlr ../../nasm-"$version"-xdoc.zip doc $xbin
|
|
|
|
zip -9Dgr ../../nasm-"$version"-xdoc.zip doc $ibin
|
2002-05-06 08:27:15 +08:00
|
|
|
|
|
|
|
# Clean up
|
2007-09-14 03:25:32 +08:00
|
|
|
cd ../..
|
2002-05-06 08:27:15 +08:00
|
|
|
rm -rf "$work"
|