@@ -21,6 +21,7 @@ script: |
21
21
# Defines
22
22
export TZ=UTC
23
23
INDIR=$HOME/build
24
+ TEMPDIR=$HOME/tmp
24
25
# Qt: workaround for determinism in resource ordering
25
26
# Qt5's rcc uses a QHash to store the files for the resource.
26
27
# A security fix in QHash makes the ordering of keys to be different on every run
@@ -55,31 +56,37 @@ script: |
55
56
cd qt-everywhere-opensource-src-5.2.0
56
57
SPECNAME="win32-g++"
57
58
SPECFILE="qtbase/mkspecs/${SPECNAME}/qmake.conf"
58
- sed 's/$TODAY/ 2011-01-30/' -i configure
59
+ sed 's/qt_instdate=`date +%Y-%m-%d`/qt_instdate= 2011-01-30/' -i qtbase/ configure
59
60
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}
60
61
sed --posix "s|QMAKE_LFLAGS =|QMAKE_LFLAGS\t\t= -L$DEPSDIR/lib|" -i ${SPECFILE}
61
- # ar adds timestamps to every object file included in the static library
62
- # 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...
63
- # which somehow cannot be combined with other flags.
64
- # use faketime only for ar, as it confuses make/qmake into hanging sometimes
65
- sed --posix "s|QMAKE_LIB = \\\$\\\${CROSS_COMPILE}ar -ru|QMAKE_LIB\t\t= $HOME/ar -Dr|" -i ${SPECFILE}
66
- echo '#!/bin/bash' > $HOME/ar
67
- echo 'export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1' >> $HOME/ar
68
- echo "$HOST-ar \"\$@\"" >> $HOME/ar
69
- chmod +x $HOME/ar
62
+ # Before we tried to pass arguments to ar (static linking) in using QMAKE_LIB, however
63
+ # qt removes the arguments for ar and provides a script which makes it impossible to pass the determinism flag -
64
+ # so rather than try to replace ar, post-process all libraries and plugins at the end.
65
+ #
70
66
# Don't load faketime while compiling Qt, qmake will get stuck in nearly infinite loops
71
67
#export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
72
- export FAKETIME=$REFERENCE_DATETIME
68
+ # export FAKETIME=$REFERENCE_DATETIME
73
69
#
74
70
# Compile static libraries, and use statically linked openssl (-openssl-linked):
75
71
OPENSSL_LIBS="-L$DEPSDIR/lib -lssl -lcrypto -lgdi32" ./configure -prefix $INSTALLPREFIX -bindir $INSTALLPREFIX/host/bin -confirm-license -release -opensource -static -xplatform $SPECNAME -device-option CROSS_COMPILE="$HOST-" -no-audio-backend -no-javascript-jit -no-sql-sqlite -no-sql-odbc -no-nis -no-cups -no-iconv -no-dbus -no-gif -no-opengl -no-compile-examples -no-feature-style-windowsce -no-feature-style-windowsmobile -no-qml-debug -openssl-linked -skip qtsvg -skip qtwebkit -skip qtwebkit-examples -skip qtserialport -skip qtdeclarative -skip qtmultimedia -skip qtimageformats -skip qtlocation -skip qtsensors -skip qtquick1 -skip qtquickcontrols -skip qtactiveqt -skip qtconnectivity -skip qtwinextras -skip qtxmlpatterns -skip qtscript -skip qtdoc -system-libpng -system-zlib
76
72
make $MAKEOPTS install
73
+ # post-process all generated libraries and plugins to be deterministic
74
+ # extract them to a temporary directory then re-build them deterministically
75
+ for LIB in $(find $INSTALLPREFIX -name *.a); do
76
+ rm -rf $TEMPDIR && mkdir $TEMPDIR && cd $TEMPDIR
77
+ $HOST-ar xv $LIB | cut -b5- > /tmp/list.txt
78
+ rm $LIB
79
+ $HOST-ar crsD $LIB $(cat /tmp/list.txt)
80
+ done
77
81
#
78
82
cd $INSTALLPREFIX
79
-
83
+ # Remove unused non-deterministic stuff
84
+ rm host/bin/qtpaths.exe lib/libQt5Bootstrap.a lib/libQt5Bootstrap.la
80
85
# as zip stores file timestamps, use faketime to intercept stat calls to set dates for all files to reference date
81
86
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
82
- zip -r $OUTDIR/qt-win${BITS}-5.2.0-gitian-r2.zip *
87
+ export FAKETIME=$REFERENCE_DATETIME
88
+ find -print0 | xargs -r0 touch # fix up timestamps before packaging
89
+ find | sort | zip -X@ $OUTDIR/qt-win${BITS}-5.2.0-gitian-r2.zip
83
90
unset LD_PRELOAD
84
91
unset FAKETIME
85
92
done # for BITS in
0 commit comments