You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

gitian-win.yml 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. ---
  2. name: "starwels-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/starwels/starwels.git"
  26. "dir": "starwels"
  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"
  36. export QT_RCC_TEST=1
  37. export GZIP="-9n"
  38. export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME""
  39. export TZ="UTC"
  40. export BUILD_DIR=`pwd`
  41. mkdir -p ${WRAP_DIR}
  42. if test -n "$GBUILD_CACHE_ENABLED"; then
  43. export SOURCES_PATH=${GBUILD_COMMON_CACHE}
  44. export BASE_CACHE=${GBUILD_PACKAGE_CACHE}
  45. mkdir -p ${BASE_CACHE} ${SOURCES_PATH}
  46. fi
  47. function create_global_faketime_wrappers {
  48. for prog in ${FAKETIME_PROGS}; do
  49. echo '#!/bin/bash' > ${WRAP_DIR}/${prog}
  50. echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog}
  51. echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog}
  52. echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog}
  53. echo "\$REAL \$@" >> $WRAP_DIR/${prog}
  54. chmod +x ${WRAP_DIR}/${prog}
  55. done
  56. }
  57. function create_per-host_faketime_wrappers {
  58. for i in $HOSTS; do
  59. for prog in ${FAKETIME_HOST_PROGS}; do
  60. echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog}
  61. echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
  62. echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
  63. echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}
  64. echo "\$REAL \$@" >> $WRAP_DIR/${i}-${prog}
  65. chmod +x ${WRAP_DIR}/${i}-${prog}
  66. done
  67. done
  68. }
  69. function create_per-host_linker_wrapper {
  70. # This is only needed for trusty, as the mingw linker leaks a few bytes of
  71. # heap, causing non-determinism. See discussion in https://github.com/bitcoin/bitcoin/pull/6900
  72. for i in $HOSTS; do
  73. mkdir -p ${WRAP_DIR}/${i}
  74. for prog in collect2; do
  75. echo '#!/bin/bash' > ${WRAP_DIR}/${i}/${prog}
  76. REAL=$(${i}-gcc -print-prog-name=${prog})
  77. echo "export MALLOC_PERTURB_=255" >> ${WRAP_DIR}/${i}/${prog}
  78. echo "${REAL} \$@" >> $WRAP_DIR/${i}/${prog}
  79. chmod +x ${WRAP_DIR}/${i}/${prog}
  80. done
  81. for prog in gcc g++; do
  82. echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog}
  83. echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
  84. echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
  85. echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}
  86. echo "export COMPILER_PATH=${WRAP_DIR}/${i}" >> ${WRAP_DIR}/${i}-${prog}
  87. echo "\$REAL \$@" >> $WRAP_DIR/${i}-${prog}
  88. chmod +x ${WRAP_DIR}/${i}-${prog}
  89. done
  90. done
  91. }
  92. # Faketime for depends so intermediate results are comparable
  93. export PATH_orig=${PATH}
  94. create_global_faketime_wrappers "2000-01-01 12:00:00"
  95. create_per-host_faketime_wrappers "2000-01-01 12:00:00"
  96. create_per-host_linker_wrapper "2000-01-01 12:00:00"
  97. export PATH=${WRAP_DIR}:${PATH}
  98. cd starwels
  99. BASEPREFIX=`pwd`/depends
  100. # Build dependencies for each host
  101. for i in $HOSTS; do
  102. make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}"
  103. done
  104. # Faketime for binaries
  105. export PATH=${PATH_orig}
  106. create_global_faketime_wrappers "${REFERENCE_DATETIME}"
  107. create_per-host_faketime_wrappers "${REFERENCE_DATETIME}"
  108. create_per-host_linker_wrapper "${REFERENCE_DATETIME}"
  109. export PATH=${WRAP_DIR}:${PATH}
  110. # Create the release tarball using (arbitrarily) the first host
  111. ./autogen.sh
  112. CONFIG_SITE=${BASEPREFIX}/`echo "${HOSTS}" | awk '{print $1;}'`/share/config.site ./configure --prefix=/
  113. make dist
  114. SOURCEDIST=`echo starwels-*.tar.gz`
  115. DISTNAME=`echo ${SOURCEDIST} | sed 's/.tar.*//'`
  116. DISTDR=`echo starwels-*`
  117. # Correct tar file order
  118. mkdir -p temp
  119. pushd temp
  120. tar xf ../$SOURCEDIST
  121. find starwels-* | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ../$SOURCEDIST
  122. mkdir -p $OUTDIR/src
  123. cp ../$SOURCEDIST $OUTDIR/src
  124. popd
  125. # Workaround for tarball not building with the bare tag version (prep)
  126. make -C src obj/build.h
  127. ORIGPATH="$PATH"
  128. # Extract the release tarball into a dir for each host and build
  129. for i in ${HOSTS}; do
  130. export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
  131. mkdir -p distsrc-${i}
  132. cd distsrc-${i}
  133. INSTALLPATH=`pwd`/installed/${DISTDR}
  134. mkdir -p ${INSTALLPATH}
  135. tar --strip-components=1 -xf ../$SOURCEDIST
  136. # Workaround for tarball not building with the bare tag version
  137. echo '#!/bin/true' >share/genbuild.sh
  138. mkdir src/obj
  139. cp ../src/obj/build.h src/obj/
  140. CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS} CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}"
  141. make ${MAKEOPTS}
  142. make ${MAKEOPTS} -C src check-security
  143. make deploy
  144. make install DESTDIR=${INSTALLPATH}
  145. rename 's/-setup\.exe$/-setup-unsigned.exe/' *-setup.exe
  146. cp -f starwels-*setup*.exe $OUTDIR/
  147. cd installed
  148. mv ${DISTDR}/bin/*.dll ${DISTDR}/lib/
  149. find . -name "lib*.la" -delete
  150. find . -name "lib*.a" -delete
  151. rm -rf ${DISTDR}/lib/pkgconfig
  152. find ${DISTDR}/bin -type f -executable -exec ${i}-objcopy --only-keep-debug {} {}.dbg \; -exec ${i}-strip -s {} \; -exec ${i}-objcopy --add-gnu-debuglink={}.dbg {} \;
  153. find ${DISTDR}/lib -type f -exec ${i}-objcopy --only-keep-debug {} {}.dbg \; -exec ${i}-strip -s {} \; -exec ${i}-objcopy --add-gnu-debuglink={}.dbg {} \;
  154. find ${DISTDR} -not -name "*.dbg" -type f | sort | zip -X@ ${OUTDIR}/${DISTDR}-${i}.zip
  155. find ${DISTDR} -name "*.dbg" -type f | sort | zip -X@ ${OUTDIR}/${DISTDR}-${i}-debug.zip
  156. cd ../../
  157. rm -rf distsrc-${i}
  158. done
  159. cp -rf contrib/windeploy $BUILD_DIR
  160. cd $BUILD_DIR/windeploy
  161. mkdir unsigned
  162. cp $OUTDIR/starwels-*setup-unsigned.exe unsigned/
  163. find . | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTDR}-win-unsigned.tar.gz
  164. mv ${OUTDIR}/${DISTDR}-x86_64-*-debug.zip ${OUTDIR}/${DISTDR}-win64-debug.zip
  165. mv ${OUTDIR}/${DISTDR}-i686-*-debug.zip ${OUTDIR}/${DISTDR}-win32-debug.zip
  166. mv ${OUTDIR}/${DISTDR}-x86_64-*.zip ${OUTDIR}/${DISTDR}-win64.zip
  167. mv ${OUTDIR}/${DISTDR}-i686-*.zip ${OUTDIR}/${DISTDR}-win32.zip