| 1 | --- |
| 2 | name: "monero-win-0.18" |
| 3 | enable_cache: true |
| 4 | suites: |
| 5 | - "bionic" |
| 6 | architectures: |
| 7 | - "amd64" |
| 8 | packages: |
| 9 | - "curl" |
| 10 | - "g++" |
| 11 | - "git" |
| 12 | - "pkg-config" |
| 13 | - "autoconf" |
| 14 | - "libtool" |
| 15 | - "automake" |
| 16 | - "faketime" |
| 17 | - "bsdmainutils" |
| 18 | - "mingw-w64" |
| 19 | - "g++-mingw-w64" |
| 20 | - "zip" |
| 21 | - "ca-certificates" |
| 22 | - "python" |
| 23 | - "cmake" |
| 24 | alternatives: |
| 25 | - |
| 26 | package: "i686-w64-mingw32-g++" |
| 27 | path: "/usr/bin/i686-w64-mingw32-g++-posix" |
| 28 | - |
| 29 | package: "i686-w64-mingw32-gcc" |
| 30 | path: "/usr/bin/i686-w64-mingw32-gcc-posix" |
| 31 | - |
| 32 | package: "x86_64-w64-mingw32-g++" |
| 33 | path: "/usr/bin/x86_64-w64-mingw32-g++-posix" |
| 34 | - |
| 35 | package: "x86_64-w64-mingw32-gcc" |
| 36 | path: "/usr/bin/x86_64-w64-mingw32-gcc-posix" |
| 37 | remotes: |
| 38 | - "url": "https://github.com/monero-project/monero.git" |
| 39 | "dir": "monero" |
| 40 | files: [] |
| 41 | script: | |
| 42 | WRAP_DIR=$HOME/wrapped |
| 43 | HOSTS="i686-w64-mingw32 x86_64-w64-mingw32" |
| 44 | FAKETIME_HOST_PROGS="windres objcopy" |
| 45 | FAKETIME_PROGS="date zip" |
| 46 | HOST_CFLAGS="-O2 -g" |
| 47 | HOST_CXXFLAGS="-O2 -g" |
| 48 | |
| 49 | export GZIP="-9n" |
| 50 | export TZ="UTC" |
| 51 | export BUILD_DIR=`pwd` |
| 52 | mkdir -p ${WRAP_DIR} |
| 53 | if test -n "$GBUILD_CACHE_ENABLED"; then |
| 54 | export SOURCES_PATH=${GBUILD_COMMON_CACHE} |
| 55 | export BASE_CACHE=${GBUILD_PACKAGE_CACHE} |
| 56 | export GITIAN=1 |
| 57 | mkdir -p ${BASE_CACHE} ${SOURCES_PATH} |
| 58 | fi |
| 59 | |
| 60 | function create_global_faketime_wrappers { |
| 61 | for prog in ${FAKETIME_PROGS}; do |
| 62 | echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog} |
| 63 | echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog} |
| 64 | echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog} |
| 65 | echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog} |
| 66 | echo "\$REAL \$@" >> $WRAP_DIR/${prog} |
| 67 | chmod +x ${WRAP_DIR}/${prog} |
| 68 | done |
| 69 | } |
| 70 | |
| 71 | function create_per-host_faketime_wrappers { |
| 72 | for i in $HOSTS; do |
| 73 | for prog in ${FAKETIME_HOST_PROGS}; do |
| 74 | echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog} |
| 75 | echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog} |
| 76 | echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog} |
| 77 | echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog} |
| 78 | echo "\$REAL \$@" >> $WRAP_DIR/${i}-${prog} |
| 79 | chmod +x ${WRAP_DIR}/${i}-${prog} |
| 80 | done |
| 81 | done |
| 82 | } |
| 83 | |
| 84 | # Faketime for depends so intermediate results are comparable |
| 85 | export PATH_orig=${PATH} |
| 86 | create_global_faketime_wrappers "2000-01-01 12:00:00" |
| 87 | create_per-host_faketime_wrappers "2000-01-01 12:00:00" |
| 88 | export PATH=${WRAP_DIR}:${PATH} |
| 89 | |
| 90 | # gcc 7+ honors SOURCE_DATE_EPOCH, no faketime needed |
| 91 | export SOURCE_DATE_EPOCH=`date -d 2000-01-01T12:00:00 +%s` |
| 92 | |
| 93 | git config --global core.abbrev 9 |
| 94 | cd monero |
| 95 | # Set the version string that gets added to the tar archive name |
| 96 | version="`git describe`" |
| 97 | if [[ $version == *"-"*"-"* ]]; then |
| 98 | version="`git rev-parse --short=9 HEAD`" |
| 99 | version="`echo $version | head -c 9`" |
| 100 | fi |
| 101 | |
| 102 | BASEPREFIX=`pwd`/contrib/depends |
| 103 | # Build dependencies for each host |
| 104 | export TAR_OPTIONS=--mtime=2000-01-01T12:00:00 |
| 105 | for i in $HOSTS; do |
| 106 | EXTRA_INCLUDES="$EXTRA_INCLUDES_BASE/$i" |
| 107 | if [ -d "$EXTRA_INCLUDES" ]; then |
| 108 | export HOST_ID_SALT="$EXTRA_INCLUDES" |
| 109 | fi |
| 110 | make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}" V=1 |
| 111 | unset HOST_ID_SALT |
| 112 | done |
| 113 | |
| 114 | # Faketime for binaries |
| 115 | export PATH=${PATH_orig} |
| 116 | create_global_faketime_wrappers "${REFERENCE_DATETIME}" |
| 117 | create_per-host_faketime_wrappers "${REFERENCE_DATETIME}" |
| 118 | export PATH=${WRAP_DIR}:${PATH} |
| 119 | |
| 120 | ORIGPATH="$PATH" |
| 121 | # Run cmake and make, for each create a new build/ directory, |
| 122 | # compile from there, archive, export and delete the archive again |
| 123 | export SOURCE_DATE_EPOCH=`date -d ${REFERENCE_DATE}T${REFERENCE_TIME} +%s` |
| 124 | export TAR_OPTIONS=--mtime=${REFERENCE_DATE}T${REFERENCE_TIME} |
| 125 | for i in ${HOSTS}; do |
| 126 | export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH} |
| 127 | mkdir build && cd build |
| 128 | cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake |
| 129 | make ${MAKEOPTS} |
| 130 | cp ../LICENSE ../README.md ../docs/ANONYMITY_NETWORKS.md bin |
| 131 | DISTNAME=monero-${i}-${version} |
| 132 | mv bin ${DISTNAME} |
| 133 | find ${DISTNAME}/ | sort | zip -X@ ${OUTDIR}/${DISTNAME}.zip |
| 134 | cd .. && rm -rf build |
| 135 | done |
| 136 |