2 name: "bitcoin-osx-0.15"
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
118 # Extract the release tarball into a dir for each host and build
119 for i in ${HOSTS}; do
120 export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
121 mkdir -p distsrc-${i}
123 INSTALLPATH=`pwd`/installed/${DISTNAME}
124 mkdir -p ${INSTALLPATH}
125 tar --strip-components=1 -xf ../$SOURCEDIST
127 CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS}
129 make install-strip DESTDIR=${INSTALLPATH}
133 OSX_VOLNAME="$(cat osx_volname)"
134 mkdir -p unsigned-app-${i}
135 cp osx_volname unsigned-app-${i}/
136 cp contrib/macdeploy/detached-sig-apply.sh unsigned-app-${i}
137 cp contrib/macdeploy/detached-sig-create.sh unsigned-app-${i}
138 cp ${BASEPREFIX}/${i}/native/bin/dmg ${BASEPREFIX}/${i}/native/bin/genisoimage unsigned-app-${i}
139 cp ${BASEPREFIX}/${i}/native/bin/${i}-codesign_allocate unsigned-app-${i}/codesign_allocate
140 cp ${BASEPREFIX}/${i}/native/bin/${i}-pagestuff unsigned-app-${i}/pagestuff
141 mv dist unsigned-app-${i}
142 pushd unsigned-app-${i}
143 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
147 ${WRAP_DIR}/dmg dmg "${OSX_VOLNAME}.dmg" ${OUTDIR}/${DISTNAME}-osx-unsigned.dmg
150 find . -name "lib*.la" -delete
151 find . -name "lib*.a" -delete
152 rm -rf ${DISTNAME}/lib/pkgconfig
153 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
157 mv $SOURCEDIST $OUTDIR/src
158 mv ${OUTDIR}/${DISTNAME}-x86_64-*.tar.gz ${OUTDIR}/${DISTNAME}-osx64.tar.gz