lbrycrd/contrib/gitian-descriptors/protobuf-win.yml
Wladimir J. van der Laan 31b3d94ef5 gitian: Make protobuf win32 intermediate output deterministic
While building protobuf in different environments we noticed that
the host tool protoc was slightly different between builds (a symbol table
sorting issue).
Add a deterministic seed as well as disable zlib support.

Exected output is now:

    e2e403e1a08869c7eed4d4293bce13d51ec6a63592918b90ae215a0eceb44cb4 protobuf-win32-2.5.0-gitian-r4.zip
    a0999037e8b0ef9ade13efd88fee261ba401f5ca910068b7e0cd3262ba667db0 protobuf-win64-2.5.0-gitian-r4.zip

No effect on final executables so no version bump.
2014-02-25 07:58:11 +01:00

65 lines
2 KiB
YAML

---
name: "protobuf-win32"
suites:
- "precise"
architectures:
- "amd64"
packages:
- "mingw-w64"
- "g++-mingw-w64"
- "zip"
- "faketime"
reference_datetime: "2013-04-15 00:00:00"
remotes: []
files:
- "protobuf-2.5.0.tar.bz2"
script: |
#
export TZ=UTC
INDIR=$HOME/build
TEMPDIR=$HOME/tmp
OPTFLAGS="-O2"
# Integrity Check
echo "13bfc5ae543cf3aa180ac2485c0bc89495e3ae711fc6fab4f8ffe90dfb4bb677 protobuf-2.5.0.tar.bz2" | sha256sum -c
for BITS in 32 64; do # for architectures
#
INSTALLPREFIX=$HOME/staging${BITS}
BUILDDIR=$HOME/build${BITS}
if [ "$BITS" == "32" ]; then
HOST=i686-w64-mingw32
else
HOST=x86_64-w64-mingw32
fi
#
mkdir -p $INSTALLPREFIX $BUILDDIR
cd $BUILDDIR
#
tar xjf $INDIR/protobuf-2.5.0.tar.bz2
cd protobuf-2.5.0
# First: build a native (linux) protoc
./configure --enable-shared=no --disable-dependency-tracking --without-zlib CXXFLAGS="-frandom-seed=11 ${OPTFLAGS}"
make
mkdir -p $INSTALLPREFIX/host/bin
cp src/protoc $INSTALLPREFIX/host/bin
# Now recompile with the mingw cross-compiler:
make distclean
./configure --prefix=$INSTALLPREFIX --enable-shared=no --disable-dependency-tracking --without-zlib --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
# post-process all generated libraries to be deterministic
# extract them to a temporary directory then re-build them deterministically
for LIB in $(find $INSTALLPREFIX -name \*.a); do
rm -rf $TEMPDIR && mkdir $TEMPDIR && cd $TEMPDIR
$HOST-ar xv $LIB | cut -b5- > /tmp/list.txt
rm $LIB
$HOST-ar crsD $LIB $(cat /tmp/list.txt)
done
#
cd $INSTALLPREFIX
find include lib host | sort | zip -X@ $OUTDIR/protobuf-win$BITS-2.5.0-gitian-r4.zip
unset LD_PRELOAD
unset FAKETIME
done # for BITS in