2 name: "bitcoin-osx-0.16"
31 - "url": "https://github.com/bitcoin/bitcoin.git"
34 - "MacOSX10.11.sdk.tar.gz"
36 WRAP_DIR=$HOME/wrapped
37 HOSTS="x86_64-apple-darwin11"
38 CONFIGFLAGS="--enable-reduce-exports --disable-bench --disable-gui-tests GENISOIMAGE=$WRAP_DIR/genisoimage"
39 FAKETIME_HOST_PROGS=""
40 FAKETIME_PROGS="ar ranlib date dmg genisoimage"
44 export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME""
46 export BUILD_DIR=`pwd`
48 if test -n "$GBUILD_CACHE_ENABLED"; then
49 export SOURCES_PATH=${GBUILD_COMMON_CACHE}
50 export BASE_CACHE=${GBUILD_PACKAGE_CACHE}
51 mkdir -p ${BASE_CACHE} ${SOURCES_PATH}
56 function create_global_faketime_wrappers {
57 for prog in ${FAKETIME_PROGS}; do
58 echo '#!/bin/bash' > ${WRAP_DIR}/${prog}
59 echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog}
60 echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog}
61 echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog}
62 echo "\$REAL \$@" >> $WRAP_DIR/${prog}
63 chmod +x ${WRAP_DIR}/${prog}
67 function create_per-host_faketime_wrappers {
69 for prog in ${FAKETIME_HOST_PROGS}; do
70 echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog}
71 echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
72 echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
73 echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}
74 echo "\$REAL \$@" >> $WRAP_DIR/${i}-${prog}
75 chmod +x ${WRAP_DIR}/${i}-${prog}
80 # Faketime for depends so intermediate results are comparable
81 export PATH_orig=${PATH}
82 create_global_faketime_wrappers "2000-01-01 12:00:00"
83 create_per-host_faketime_wrappers "2000-01-01 12:00:00"
84 export PATH=${WRAP_DIR}:${PATH}
87 BASEPREFIX=`pwd`/depends
89 mkdir -p ${BASEPREFIX}/SDKs
90 tar -C ${BASEPREFIX}/SDKs -xf ${BUILD_DIR}/MacOSX10.11.sdk.tar.gz
92 # Build dependencies for each host
94 make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}"
97 # Faketime for binaries
98 export PATH=${PATH_orig}
99 create_global_faketime_wrappers "${REFERENCE_DATETIME}"
100 create_per-host_faketime_wrappers "${REFERENCE_DATETIME}"
101 export PATH=${WRAP_DIR}:${PATH}
103 # Create the release tarball using (arbitrarily) the first host
105 CONFIG_SITE=${BASEPREFIX}/`echo "${HOSTS}" | awk '{print $1;}'`/share/config.site ./configure --prefix=/
107 SOURCEDIST=`echo bitcoin-*.tar.gz`
108 DISTNAME=`echo ${SOURCEDIST} | sed 's/.tar.*//'`
110 # Correct tar file order
113 tar xf ../$SOURCEDIST
114 find bitcoin-* | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ../$SOURCEDIST
117 # Workaround for tarball not building with the bare tag version (prep)
118 make -C src obj/build.h
121 # Extract the release tarball into a dir for each host and build
122 for i in ${HOSTS}; do
123 export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
124 mkdir -p distsrc-${i}
126 INSTALLPATH=`pwd`/installed/${DISTNAME}
127 mkdir -p ${INSTALLPATH}
128 tar --strip-components=1 -xf ../$SOURCEDIST
130 # Workaround for tarball not building with the bare tag version
131 echo '#!/bin/true' >share/genbuild.sh
133 cp ../src/obj/build.h src/obj/
135 CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS}
137 make install-strip DESTDIR=${INSTALLPATH}
141 OSX_VOLNAME="$(cat osx_volname)"
142 mkdir -p unsigned-app-${i}
143 cp osx_volname unsigned-app-${i}/
144 cp contrib/macdeploy/detached-sig-apply.sh unsigned-app-${i}
145 cp contrib/macdeploy/detached-sig-create.sh unsigned-app-${i}
146 cp ${BASEPREFIX}/${i}/native/bin/dmg ${BASEPREFIX}/${i}/native/bin/genisoimage unsigned-app-${i}
147 cp ${BASEPREFIX}/${i}/native/bin/${i}-codesign_allocate unsigned-app-${i}/codesign_allocate
148 cp ${BASEPREFIX}/${i}/native/bin/${i}-pagestuff unsigned-app-${i}/pagestuff
149 mv dist unsigned-app-${i}
150 pushd unsigned-app-${i}
151 find . | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-osx-unsigned.tar.gz
155 ${WRAP_DIR}/dmg dmg "${OSX_VOLNAME}.dmg" ${OUTDIR}/${DISTNAME}-osx-unsigned.dmg
158 find . -name "lib*.la" -delete
159 find . -name "lib*.a" -delete
160 rm -rf ${DISTNAME}/lib/pkgconfig
161 find ${DISTNAME} | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}.tar.gz
165 mv $SOURCEDIST $OUTDIR/src
166 mv ${OUTDIR}/${DISTNAME}-x86_64-*.tar.gz ${OUTDIR}/${DISTNAME}-osx64.tar.gz