summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2017-04-18 14:30:25 -0700
committerH. Peter Anvin <hpa@zytor.com>2017-04-18 14:30:25 -0700
commit77c8356423c1272d5f950528cfcb20850726a986 (patch)
tree9b1bbc8e1a9ec43da283677371918d3fbee931ff
parent2efb04c8f97d587775f24bb1ae1ffe27c70bce36 (diff)
downloadnasmbuild-77c8356423c1272d5f950528cfcb20850726a986.tar.gz
nasmbuild-77c8356423c1272d5f950528cfcb20850726a986.tar.xz
nasmbuild-77c8356423c1272d5f950528cfcb20850726a986.zip
buildall.sh: parallelize build
Do the build in parallel across platforms
-rwxr-xr-xbuildall.sh191
1 files changed, 113 insertions, 78 deletions
diff --git a/buildall.sh b/buildall.sh
index c67974e..ed2f72e 100755
--- a/buildall.sh
+++ b/buildall.sh
@@ -32,11 +32,13 @@ build () {
jobs=$((cpus+2))
export makej="make -j$jobs"
- rm -rf nasm-* win32 win64 dos macosx os2 rpmbuild doc html
- mkdir -p rpmbuild/{BUILD,RPMS,SRPMS,SPECS,SOURCES}
+ local -A jobn
+
+ rm -rf nasm-* win32 win64 dos macosx os2 rpmbuild doc html log
+ mkdir -p log
# --- Generate tarballs ---
- (
+ (
cd "$gitdir"
if [ -d "$patchdir"/"$version" ]; then
for p in "$patchdir"/"$version"/*; do
@@ -51,9 +53,17 @@ build () {
)
# --- Generate Linux RPMs ---
- do32 rpmbuild --target i386 -ta nasm-$version.tar.xz
- rpmbuild --target x86_64 -ta nasm-$version.tar.xz
-
+ (
+ mkdir -p rpmbuild/i386/{BUILD,RPMS,SRPMS,SPECS,SOURCES}
+ do32 rpmbuild -D "%_topdir ${here}/rpmbuild/i386" --target i386 -ta nasm-$version.tar.xz
+ ) > log/rpm32 2>&1 &
+ jobn[rpm32]=$!
+ (
+ mkdir -p rpmbuild/x86_64/{BUILD,RPMS,SRPMS,SPECS,SOURCES}
+ rpmbuild -D "%_topdir ${here}/rpmbuild/x86_64" --target x86_64 -ta nasm-$version.tar.xz
+ ) > log/rpm64 2>&1 &
+ jobn[rpm64]=$!
+
# --- Expand tarballs (generate combined src+doc working tree) ---
xz -cd nasm-$version-xdoc.tar.xz | tar xf -
cp -a nasm-$version/doc .
@@ -61,75 +71,83 @@ build () {
xz -cd nasm-$version.tar.xz | tar xf -
# --- Generate Win32 binaries ---
- mkdir -p win32
- cp -a nasm-$version win32
- cd win32/nasm-$version
- LDFLAGS='-s' ./configure --host=i686-w64-mingw32
- $makej LN_S='ln'
- cd ..
- zip -9Dl ../nasm-$version-win32.zip nasm-$version/LICENSE
- zip -9Drg ../nasm-$version-win32.zip nasm-$version -i \*.exe
- cd nasm-$version
- if [ -f nsis/nasm.nsi ]; then
- make nsis
- mv nasm-$version-installer*.exe ../../
- elif [ -f nasm.nsi ]; then
- makensis nasm.nsi
- mv nasm-$version-installer.exe ../../nasm-$version-installer-x86.exe
- fi
- cd ../..
+ (
+ mkdir -p win32
+ cp -a nasm-$version win32
+ cd win32/nasm-$version
+ LDFLAGS='-s' ./configure --host=i686-w64-mingw32
+ $makej LN_S='ln'
+ cd ..
+ zip -9Dl ../nasm-$version-win32.zip nasm-$version/LICENSE
+ zip -9Drg ../nasm-$version-win32.zip nasm-$version -i \*.exe
+ cd nasm-$version
+ if [ -f nsis/nasm.nsi ]; then
+ make nsis
+ mv nasm-$version-installer*.exe ../../
+ elif [ -f nasm.nsi ]; then
+ makensis nasm.nsi
+ mv nasm-$version-installer.exe ../../nasm-$version-installer-x86.exe
+ fi
+ ) > log/win32 2>&1 &
+ jobn[win32]=$!
# --- Generate Win64 binaries ---
- mkdir -p win64
- cp -a nasm-$version win64
- cd win64/nasm-$version
- LDFLAGS='-s' ./configure --host=x86_64-w64-mingw32
- $makej LN_S='ln'
- cd ..
- zip -9Dl ../nasm-$version-win64.zip nasm-$version/LICENSE
- zip -9Drg ../nasm-$version-win64.zip nasm-$version -i \*.exe
- cd nasm-$version
- if [ -f nsis/nasm.nsi ]; then
- make nsis
- mv nasm-$version-installer*.exe ../../
- elif [ -f nasm.nsi ]; then
- makensis nasm.nsi
- mv nasm-$version-installer.exe ../../nasm-$version-installer-x64.exe
- fi
- cd ../..
-
+ (
+ mkdir -p win64
+ cp -a nasm-$version win64
+ cd win64/nasm-$version
+ LDFLAGS='-s' ./configure --host=x86_64-w64-mingw32
+ $makej LN_S='ln'
+ cd ..
+ zip -9Dl ../nasm-$version-win64.zip nasm-$version/LICENSE
+ zip -9Drg ../nasm-$version-win64.zip nasm-$version -i \*.exe
+ cd nasm-$version
+ if [ -f nsis/nasm.nsi ]; then
+ make nsis
+ mv nasm-$version-installer*.exe ../../
+ elif [ -f nasm.nsi ]; then
+ makensis nasm.nsi
+ mv nasm-$version-installer.exe ../../nasm-$version-installer-x64.exe
+ fi
+ ) > log/win64 2>&1 &
+ jobn[win64]=$!
+
# --- Generate DOS binaries ---
- mkdir -p dos
- cp -a nasm-$version dos
- cd dos/nasm-$version
- LDFLAGS='-s' ./configure --host=i586-pc-msdosdjgpp
- $makej LN_S='ln'
- mv doc/nasmdoc.txt .
- cp $READMES/dos README
- cp $CWSDPMI/bin/cwsdpmi.{exe,doc} .
- cd ..
- zip -9Dl ../nasm-$version-dos.zip nasm-$version/{LICENSE,README,nasmdoc.txt,cwsdpmi.doc}
- zip -9Drg ../nasm-$version-dos.zip nasm-$version -i \*.exe
- find nasm-$version -name \*.exe -a -not -name cwsdpmi.exe -type f -print0 | \
- xargs -0r time upx -q --lzma --best --all-filters
- /usr/sbin/hardlink nasm-$version
- zip -9Dl ../nasm-$version-dos-upx.zip nasm-$version/{LICENSE,README,nasmdoc.txt,cwsdpmi.doc}
- zip -9Drg ../nasm-$version-dos-upx.zip nasm-$version -i \*.exe
- cd ..
-
+ (
+ mkdir -p dos
+ cp -a nasm-$version dos
+ cd dos/nasm-$version
+ LDFLAGS='-s' ./configure --host=i586-pc-msdosdjgpp
+ $makej LN_S='ln'
+ mv doc/nasmdoc.txt .
+ cp $READMES/dos README
+ cp $CWSDPMI/bin/cwsdpmi.{exe,doc} .
+ cd ..
+ zip -9Dl ../nasm-$version-dos.zip nasm-$version/{LICENSE,README,nasmdoc.txt,cwsdpmi.doc}
+ zip -9Drg ../nasm-$version-dos.zip nasm-$version -i \*.exe
+ find nasm-$version -name \*.exe -a -not -name cwsdpmi.exe -type f -print0 | \
+ xargs -0r time upx -q --lzma --best --all-filters
+ /usr/sbin/hardlink nasm-$version
+ zip -9Dl ../nasm-$version-dos-upx.zip nasm-$version/{LICENSE,README,nasmdoc.txt,cwsdpmi.doc}
+ zip -9Drg ../nasm-$version-dos-upx.zip nasm-$version -i \*.exe
+ ) > log/dos 2>&1 &
+ jobn[dos]=$!
+
# --- Generate MacOS X binaries ---
- mkdir -p macosx/nasm-$version
- cp -a nasm-$version macosx/nasm-$version.work
- cd macosx/nasm-$version.work
- CC='darwinx-gcc -arch i386 -arch x86_64 -arch ppc' \
- ./configure --host=i686-apple-darwin10
- $makej
- mv LICENSE README doc/nasmdoc.pdf ../nasm-$version/
- make install INSTALLROOT=`pwd`/../nasm-$version bindir= mandir=
- make install_rdf INSTALLROOT=`pwd`/../nasm-$version bindir= mandir=
- cd ..
- zip -9Dr ../nasm-$version-macosx.zip nasm-$version
- cd ..
+ (
+ mkdir -p macosx/nasm-$version
+ cp -a nasm-$version macosx/nasm-$version.work
+ cd macosx/nasm-$version.work
+ CC='darwinx-gcc -arch i386 -arch x86_64 -arch ppc' \
+ ./configure --host=i686-apple-darwin10
+ $makej
+ mv LICENSE README doc/nasmdoc.pdf ../nasm-$version/
+ make install INSTALLROOT=`pwd`/../nasm-$version bindir= mandir=
+ make install_rdf INSTALLROOT=`pwd`/../nasm-$version bindir= mandir=
+ cd ..
+ zip -9Dr ../nasm-$version-macosx.zip nasm-$version
+ ) > log/macosx 2>&1 &
+ jobn[macosx]=$!
# --- Generate OS/2 binaries ---
#mkdir -p os2
@@ -141,9 +159,29 @@ build () {
#zip -9Drg ../nasm-$version-os2.zip nasm-$version -i \*.exe
#cd ..
+ # --- Wait for job completion and dump logs ---
+ ok=true
+ set +xe
+ for j in rpm32 rpm64 win32 win64 dos macosx; do
+ wait ${jobn[$j]}; ws=$?
+ err=''
+ if [ $ws -ne 0 ]; then
+ ok=false; err=" *** ERROR: $w ***"
+ fi
+
+ echo ''
+ echo " === ${j}${err} ==="
+ echo ''
+ cat log/$j
+ done
+ set -xe
+
+ # Fail if we stumbled
+ $ok that we finished everything ok
+
# --- Clean up ---
- rm -rf "$gitdir" nasm-$version
-
+ rm -rf "$gitdir" nasm-$version log
+
# --- Publish resulting output files ---
mkdir -p "$outdir"
echo "$rev" > "$outdir"/git.id
@@ -178,7 +216,7 @@ build () {
process_release () {
version="$1"
outdir="$2"
-
+
rm -rf $web/docs/"$version" $web/xdoc/"$version"
cp -al "$outdir"/doc/html $web/docs/"$version"
cp -al "$outdir"/doc $web/xdoc/"$version"
@@ -209,10 +247,7 @@ HEAD=$(cd git && git rev-parse HEAD)
#
if [ x"$1" = xtest ]; then
rm -rf /var/tmp/nasmtest
- (
- flock -x 8
- build $(cat git/version)-test /var/tmp/nasmtest git "$HEAD"
- ) 8< /home/nasmbuild/robot.sh
+ build $(cat git/version)-test /var/tmp/nasmtest git "$HEAD"
exit 0
fi