| 1 | --- |
| 2 | name: "monero-osx-0.18" |
| 3 | enable_cache: true |
| 4 | suites: |
| 5 | - "bionic" |
| 6 | architectures: |
| 7 | - "amd64" |
| 8 | packages: |
| 9 | - "ca-certificates" |
| 10 | - "curl" |
| 11 | - "g++" |
| 12 | - "git" |
| 13 | - "pkg-config" |
| 14 | - "autoconf" |
| 15 | - "libtool" |
| 16 | - "automake" |
| 17 | - "faketime" |
| 18 | - "bsdmainutils" |
| 19 | - "cmake" |
| 20 | - "libcap-dev" |
| 21 | - "libz-dev" |
| 22 | - "libbz2-dev" |
| 23 | - "python" |
| 24 | - "python-dev" |
| 25 | - "python-setuptools" |
| 26 | remotes: |
| 27 | - "url": "https://github.com/monero-project/monero.git" |
| 28 | "dir": "monero" |
| 29 | files: [] |
| 30 | script: | |
| 31 | WRAP_DIR=$HOME/wrapped |
| 32 | HOSTS="x86_64-apple-darwin11 aarch64-apple-darwin11" |
| 33 | FAKETIME_HOST_PROGS="" |
| 34 | FAKETIME_PROGS="ar ranlib date dmg genisoimage python" |
| 35 | |
| 36 | export GZIP="-9n" |
| 37 | export TZ="UTC" |
| 38 | export BUILD_DIR=`pwd` |
| 39 | mkdir -p ${WRAP_DIR} |
| 40 | if test -n "$GBUILD_CACHE_ENABLED"; then |
| 41 | export SOURCES_PATH=${GBUILD_COMMON_CACHE} |
| 42 | export BASE_CACHE=${GBUILD_PACKAGE_CACHE} |
| 43 | export GITIAN=1 |
| 44 | mkdir -p ${BASE_CACHE} ${SOURCES_PATH} |
| 45 | fi |
| 46 | |
| 47 | export ZERO_AR_DATE=1 |
| 48 | |
| 49 | function create_global_faketime_wrappers { |
| 50 | for prog in ${FAKETIME_PROGS}; do |
| 51 | echo '#!/usr/bin/env 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 | } |
| 59 | |
| 60 | function create_per-host_faketime_wrappers { |
| 61 | for i in $HOSTS; do |
| 62 | for prog in ${FAKETIME_HOST_PROGS}; do |
| 63 | echo '#!/usr/bin/env 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 | } |
| 72 | |
| 73 | # Faketime for depends so intermediate results are comparable |
| 74 | export PATH_orig=${PATH} |
| 75 | create_global_faketime_wrappers "2000-01-01 12:00:00" |
| 76 | create_per-host_faketime_wrappers "2000-01-01 12:00:00" |
| 77 | export PATH=${WRAP_DIR}:${PATH} |
| 78 | |
| 79 | git config --global core.abbrev 9 |
| 80 | cd monero |
| 81 | # Set the version string that gets added to the tar archive name |
| 82 | version="`git describe`" |
| 83 | if [[ $version == *"-"*"-"* ]]; then |
| 84 | version="`git rev-parse --short=9 HEAD`" |
| 85 | version="`echo $version | head -c 9`" |
| 86 | fi |
| 87 | |
| 88 | BASEPREFIX=`pwd`/contrib/depends |
| 89 | |
| 90 | # Build dependencies for each host |
| 91 | export TAR_OPTIONS=--mtime=2000-01-01T12:00:00 |
| 92 | for i in $HOSTS; do |
| 93 | make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}" |
| 94 | done |
| 95 | |
| 96 | # Faketime for binaries |
| 97 | export PATH=${PATH_orig} |
| 98 | create_global_faketime_wrappers "${REFERENCE_DATETIME}" |
| 99 | create_per-host_faketime_wrappers "${REFERENCE_DATETIME}" |
| 100 | export PATH=${WRAP_DIR}:${PATH} |
| 101 | |
| 102 | ORIGPATH="$PATH" |
| 103 | # Build in a new dir for each host |
| 104 | export TAR_OPTIONS=--mtime=${REFERENCE_DATE}T${REFERENCE_TIME} |
| 105 | for i in ${HOSTS}; do |
| 106 | export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH} |
| 107 | mkdir build && cd build |
| 108 | cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake |
| 109 | make ${MAKEOPTS} |
| 110 | chmod 755 bin/* |
| 111 | cp ../LICENSE ../README.md ../docs/ANONYMITY_NETWORKS.md bin |
| 112 | chmod 644 bin/LICENSE bin/*.md |
| 113 | DISTNAME=monero-${i}-${version} |
| 114 | mv bin ${DISTNAME} |
| 115 | find ${DISTNAME}/ | sort | tar --no-recursion --owner=0 --group=0 -c -T - | bzip2 -9 > ${OUTDIR}/${DISTNAME}.tar.bz2 |
| 116 | cd .. |
| 117 | rm -rf build |
| 118 | done |
| 119 |