Fix typos.
[bitcoinplatinum.git] / contrib / gitian-descriptors / gitian-win.yml
blob1d4d70494b0cc403649235133c72cbbbc8b2fba0
1 ---
2 name: "bitcoin-win-0.15"
3 enable_cache: true
4 suites:
5 - "trusty"
6 architectures:
7 - "amd64"
8 packages:
9 - "curl"
10 - "g++"
11 - "git-core"
12 - "pkg-config"
13 - "autoconf"
14 - "libtool"
15 - "automake"
16 - "faketime"
17 - "bsdmainutils"
18 - "mingw-w64"
19 - "g++-mingw-w64"
20 - "nsis"
21 - "zip"
22 - "ca-certificates"
23 - "python"
24 remotes:
25 - "url": "https://github.com/bitcoin/bitcoin.git"
26   "dir": "bitcoin"
27 files: []
28 script: |
29   WRAP_DIR=$HOME/wrapped
30   HOSTS="i686-w64-mingw32 x86_64-w64-mingw32"
31   CONFIGFLAGS="--enable-reduce-exports --disable-bench --disable-gui-tests"
32   FAKETIME_HOST_PROGS="g++ ar ranlib nm windres strip objcopy"
33   FAKETIME_PROGS="date makensis zip"
34   HOST_CFLAGS="-O2 -g"
35   HOST_CXXFLAGS="-O2 -g"
37   export QT_RCC_TEST=1
38   export GZIP="-9n"
39   export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME""
40   export TZ="UTC"
41   export BUILD_DIR=`pwd`
42   mkdir -p ${WRAP_DIR}
43   if test -n "$GBUILD_CACHE_ENABLED"; then
44     export SOURCES_PATH=${GBUILD_COMMON_CACHE}
45     export BASE_CACHE=${GBUILD_PACKAGE_CACHE}
46     mkdir -p ${BASE_CACHE} ${SOURCES_PATH}
47   fi
49   function create_global_faketime_wrappers {
50   for prog in ${FAKETIME_PROGS}; do
51     echo '#!/bin/bash' > ${WRAP_DIR}/${prog}
52     echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog}
53     echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog}
54     echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog}
55     echo "\$REAL \$@" >> $WRAP_DIR/${prog}
56     chmod +x ${WRAP_DIR}/${prog}
57   done
58   }
60   function create_per-host_faketime_wrappers {
61   for i in $HOSTS; do
62     for prog in ${FAKETIME_HOST_PROGS}; do
63         echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog}
64         echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
65         echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
66         echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}
67         echo "\$REAL \$@" >> $WRAP_DIR/${i}-${prog}
68         chmod +x ${WRAP_DIR}/${i}-${prog}
69     done
70   done
71   }
73   function create_per-host_linker_wrapper {
74   # This is only needed for trusty, as the mingw linker leaks a few bytes of
75   # heap, causing non-determinism. See discussion in https://github.com/bitcoin/bitcoin/pull/6900
76   for i in $HOSTS; do
77     mkdir -p ${WRAP_DIR}/${i}
78     for prog in collect2; do
79         echo '#!/bin/bash' > ${WRAP_DIR}/${i}/${prog}
80         REAL=$(${i}-gcc -print-prog-name=${prog})
81         echo "export MALLOC_PERTURB_=255" >> ${WRAP_DIR}/${i}/${prog}
82         echo "${REAL} \$@" >> $WRAP_DIR/${i}/${prog}
83         chmod +x ${WRAP_DIR}/${i}/${prog}
84     done
85     for prog in gcc g++; do
86         echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog}
87         echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
88         echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
89         echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}
90         echo "export COMPILER_PATH=${WRAP_DIR}/${i}" >> ${WRAP_DIR}/${i}-${prog}
91         echo "\$REAL \$@" >> $WRAP_DIR/${i}-${prog}
92         chmod +x ${WRAP_DIR}/${i}-${prog}
93     done
94   done
95   }
97   # Faketime for depends so intermediate results are comparable
98   export PATH_orig=${PATH}
99   create_global_faketime_wrappers "2000-01-01 12:00:00"
100   create_per-host_faketime_wrappers "2000-01-01 12:00:00"
101   create_per-host_linker_wrapper "2000-01-01 12:00:00"
102   export PATH=${WRAP_DIR}:${PATH}
104   cd bitcoin
105   BASEPREFIX=`pwd`/depends
106   # Build dependencies for each host
107   for i in $HOSTS; do
108     make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}"
109   done
111   # Faketime for binaries
112   export PATH=${PATH_orig}
113   create_global_faketime_wrappers "${REFERENCE_DATETIME}"
114   create_per-host_faketime_wrappers "${REFERENCE_DATETIME}"
115   create_per-host_linker_wrapper "${REFERENCE_DATETIME}"
116   export PATH=${WRAP_DIR}:${PATH}
118   # Create the release tarball using (arbitrarily) the first host
119   export GIT_DIR="$PWD/.git"
120   ./autogen.sh
121   CONFIG_SITE=${BASEPREFIX}/`echo "${HOSTS}" | awk '{print $1;}'`/share/config.site ./configure --prefix=/
122   make dist
123   SOURCEDIST=`echo bitcoin-*.tar.gz`
124   DISTNAME=`echo ${SOURCEDIST} | sed 's/.tar.*//'`
126   # Correct tar file order
127   mkdir -p temp
128   pushd temp
129   tar xf ../$SOURCEDIST
130   find bitcoin-* | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ../$SOURCEDIST
131   mkdir -p $OUTDIR/src
132   cp ../$SOURCEDIST $OUTDIR/src
133   popd
135   ORIGPATH="$PATH"
136   # Extract the release tarball into a dir for each host and build
137   for i in ${HOSTS}; do
138     export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
139     mkdir -p distsrc-${i}
140     cd distsrc-${i}
141     INSTALLPATH=`pwd`/installed/${DISTNAME}
142     mkdir -p ${INSTALLPATH}
143     tar --strip-components=1 -xf ../$SOURCEDIST
145     CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS} CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}"
146     make ${MAKEOPTS}
147     make ${MAKEOPTS} -C src check-security
148     make deploy
149     make install DESTDIR=${INSTALLPATH}
150     rename 's/-setup\.exe$/-setup-unsigned.exe/' *-setup.exe
151     cp -f bitcoin-*setup*.exe $OUTDIR/
152     cd installed
153     mv ${DISTNAME}/bin/*.dll ${DISTNAME}/lib/
154     find . -name "lib*.la" -delete
155     find . -name "lib*.a" -delete
156     rm -rf ${DISTNAME}/lib/pkgconfig
157     find ${DISTNAME}/bin -type f -executable -exec ${i}-objcopy --only-keep-debug {} {}.dbg \; -exec ${i}-strip -s {} \; -exec ${i}-objcopy --add-gnu-debuglink={}.dbg {} \;
158     find ${DISTNAME}/lib -type f -exec ${i}-objcopy --only-keep-debug {} {}.dbg \; -exec ${i}-strip -s {} \; -exec ${i}-objcopy --add-gnu-debuglink={}.dbg {} \;
159     find ${DISTNAME} -not -name "*.dbg"  -type f | sort | zip -X@ ${OUTDIR}/${DISTNAME}-${i}.zip
160     find ${DISTNAME} -name "*.dbg"  -type f | sort | zip -X@ ${OUTDIR}/${DISTNAME}-${i}-debug.zip
161     cd ../../
162     rm -rf distsrc-${i}
163   done
164   cp -rf contrib/windeploy $BUILD_DIR
165   cd $BUILD_DIR/windeploy
166   mkdir unsigned
167   cp $OUTDIR/bitcoin-*setup-unsigned.exe unsigned/
168   find . | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-win-unsigned.tar.gz
169   mv ${OUTDIR}/${DISTNAME}-x86_64-*-debug.zip ${OUTDIR}/${DISTNAME}-win64-debug.zip
170   mv ${OUTDIR}/${DISTNAME}-i686-*-debug.zip ${OUTDIR}/${DISTNAME}-win32-debug.zip
171   mv ${OUTDIR}/${DISTNAME}-x86_64-*.zip ${OUTDIR}/${DISTNAME}-win64.zip
172   mv ${OUTDIR}/${DISTNAME}-i686-*.zip ${OUTDIR}/${DISTNAME}-win32.zip