Skip to content

Commit

Permalink
gitian: Make windows dependencies outputs fully deterministic
Browse files Browse the repository at this point in the history
Sort .zip order, and other determinism changes to make sure builds
are repeatable for windows deps.
  • Loading branch information
laanwj committed Feb 8, 2014
1 parent 23617fd commit c43d1e5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 23 deletions.
10 changes: 4 additions & 6 deletions contrib/gitian-descriptors/boost-win.yml
Expand Up @@ -16,6 +16,8 @@ files:
- "boost-mingw-gas-cross-compile-2013-03-03.patch"
script: |
# Defines
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
export FAKETIME=$REFERENCE_DATETIME
export TZ=UTC
INDIR=$HOME/build
# Input Integrity Check
Expand All @@ -35,7 +37,7 @@ script: |
mkdir -p $INSTALLPREFIX $BUILDDIR
cd $BUILDDIR
#
tar xjf $INDIR/boost_1_55_0.tar.bz2
tar --warning=no-timestamp -xjf $INDIR/boost_1_55_0.tar.bz2
cd boost_1_55_0
GCCVERSION=$($HOST-g++ -E -dM $(mktemp --suffix=.h) | grep __VERSION__ | cut -d ' ' -f 3 | cut -d '"' -f 2)
echo "using gcc : $GCCVERSION : $HOST-g++
Expand Down Expand Up @@ -70,10 +72,6 @@ script: |
./bjam toolset=gcc binary-format=pe target-os=windows threadapi=win32 address-model=$BITS threading=multi variant=release link=static runtime-link=static --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged --build-type=complete --prefix="$INSTALLPREFIX" $MAKEOPTS install
#
cd "$INSTALLPREFIX"
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
export FAKETIME=$REFERENCE_DATETIME
zip -r $OUTDIR/boost-win$BITS-1.55.0-gitian-r6.zip *
unset LD_PRELOAD
unset FAKETIME
find | sort | zip -@ $OUTDIR/boost-win$BITS-1.55.0-gitian-r6.zip
done # for BITS in
6 changes: 4 additions & 2 deletions contrib/gitian-descriptors/deps-win.yml
Expand Up @@ -107,11 +107,13 @@ script: |
#
tar xjf $INDIR/qrencode-3.4.3.tar.bz2
cd qrencode-3.4.3
png_CFLAGS="-I$INSTALLPREFIX/include" png_LIBS="-L$INSTALLPREFIX/lib -lpng" ./configure --prefix=$INSTALLPREFIX --host=$HOST --enable-static --disable-shared --without-tools --disable-maintainer-mode --disable-dependency-tracking
png_CFLAGS="-I$INSTALLPREFIX/include" png_LIBS="-L$INSTALLPREFIX/lib -lpng" ./configure --prefix=$INSTALLPREFIX --host=$HOST --enable-static --disable-shared --without-tools --disable-dependency-tracking
# Workaround to prevent re-configuring by make (resulting in missing m4 error); make all files have a date in the past
find . -print0 | xargs -r0 touch -t 200001010000
make
make install
cd ..
#
cd $INSTALLPREFIX
zip -r $OUTDIR/bitcoin-deps-win$BITS-gitian-r10.zip include lib
find include lib | sort | zip -@ $OUTDIR/bitcoin-deps-win$BITS-gitian-r10.zip
done # for BITS in
6 changes: 3 additions & 3 deletions contrib/gitian-descriptors/protobuf-win.yml
Expand Up @@ -44,13 +44,13 @@ script: |
# Now recompile with the mingw cross-compiler:
make distclean
./configure --prefix=$INSTALLPREFIX --enable-shared=no --disable-dependency-tracking --with-protoc=$INSTALLPREFIX/host/bin/protoc --host=$HOST CXXFLAGS="-frandom-seed=11 ${OPTFLAGS}"
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
export FAKETIME=$REFERENCE_DATETIME
make
make install
#
cd $INSTALLPREFIX
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
export FAKETIME=$REFERENCE_DATETIME
zip -r $OUTDIR/protobuf-win$BITS-2.5.0-gitian-r4.zip include lib host
find include lib host | sort | zip -@ $OUTDIR/protobuf-win$BITS-2.5.0-gitian-r4.zip
unset LD_PRELOAD
unset FAKETIME
done # for BITS in
17 changes: 5 additions & 12 deletions contrib/gitian-descriptors/qt-win.yml
Expand Up @@ -55,18 +55,9 @@ script: |
cd qt-everywhere-opensource-src-5.2.0
SPECNAME="win32-g++"
SPECFILE="qtbase/mkspecs/${SPECNAME}/qmake.conf"
sed 's/$TODAY/2011-01-30/' -i configure
sed 's/qt_instdate=`date +%Y-%m-%d`/qt_instdate=2011-01-30/' -i qtbase/configure
sed --posix "s|QMAKE_CFLAGS = -pipe -fno-keep-inline-dllexport|QMAKE_CFLAGS\t\t= -pipe -fno-keep-inline-dllexport -isystem /usr/$HOST/include/ -frandom-seed=qtbuild -I$DEPSDIR/include|" -i ${SPECFILE}
sed --posix "s|QMAKE_LFLAGS =|QMAKE_LFLAGS\t\t= -L$DEPSDIR/lib|" -i ${SPECFILE}
# ar adds timestamps to every object file included in the static library
# providing -D as ar argument is supposed to solve it, but doesn't work as qmake strips off the arguments and adds -M to pass a script...
# which somehow cannot be combined with other flags.
# use faketime only for ar, as it confuses make/qmake into hanging sometimes
sed --posix "s|QMAKE_LIB = \\\$\\\${CROSS_COMPILE}ar -ru|QMAKE_LIB\t\t= $HOME/ar -Dr|" -i ${SPECFILE}
echo '#!/bin/bash' > $HOME/ar
echo 'export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1' >> $HOME/ar
echo "$HOST-ar \"\$@\"" >> $HOME/ar
chmod +x $HOME/ar
# Don't load faketime while compiling Qt, qmake will get stuck in nearly infinite loops
#export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
export FAKETIME=$REFERENCE_DATETIME
Expand All @@ -76,10 +67,12 @@ script: |
make $MAKEOPTS install
#
cd $INSTALLPREFIX
# Remove unused non-deterministic stuff
rm host/bin/qtpaths.exe lib/libQt5Bootstrap.a lib/libQt5Bootstrap.la
# as zip stores file timestamps, use faketime to intercept stat calls to set dates for all files to reference date
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
zip -r $OUTDIR/qt-win${BITS}-5.2.0-gitian-r2.zip *
find -print0 | xargs -r0 touch # fix up timestamps before packaging
find | sort | zip -@ $OUTDIR/qt-win${BITS}-5.2.0-gitian-r2.zip
unset LD_PRELOAD
unset FAKETIME
done # for BITS in

0 comments on commit c43d1e5

Please sign in to comment.