2 name: "bitcoin-linux-0.16"
10 - "g++-aarch64-linux-gnu"
11 - "g++-4.8-aarch64-linux-gnu"
12 - "gcc-4.8-aarch64-linux-gnu"
13 - "binutils-aarch64-linux-gnu"
14 - "g++-arm-linux-gnueabihf"
15 - "g++-4.8-arm-linux-gnueabihf"
16 - "gcc-4.8-arm-linux-gnueabihf"
17 - "binutils-arm-linux-gnueabihf"
31 - "url": "https://github.com/bitcoin/bitcoin.git"
36 WRAP_DIR=$HOME/wrapped
37 HOSTS="i686-pc-linux-gnu x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu"
38 CONFIGFLAGS="--enable-glibc-back-compat --enable-reduce-exports --disable-bench --disable-gui-tests"
39 FAKETIME_HOST_PROGS=""
40 FAKETIME_PROGS="date ar ranlib nm"
42 HOST_CXXFLAGS="-O2 -g"
43 HOST_LDFLAGS=-static-libstdc++
47 export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME""
49 export BUILD_DIR=`pwd`
51 if test -n "$GBUILD_CACHE_ENABLED"; then
52 export SOURCES_PATH=${GBUILD_COMMON_CACHE}
53 export BASE_CACHE=${GBUILD_PACKAGE_CACHE}
54 mkdir -p ${BASE_CACHE} ${SOURCES_PATH}
57 function create_global_faketime_wrappers {
58 for prog in ${FAKETIME_PROGS}; do
59 echo '#!/bin/bash' > ${WRAP_DIR}/${prog}
60 echo "REAL=\`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1\`" >> ${WRAP_DIR}/${prog}
61 echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${prog}
62 echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${prog}
63 echo "\$REAL \$@" >> $WRAP_DIR/${prog}
64 chmod +x ${WRAP_DIR}/${prog}
68 function create_per-host_faketime_wrappers {
70 for prog in ${FAKETIME_HOST_PROGS}; do
71 echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog}
72 echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog}
73 echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog}
74 echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog}
75 echo "\$REAL \$@" >> $WRAP_DIR/${i}-${prog}
76 chmod +x ${WRAP_DIR}/${i}-${prog}
81 # Faketime for depends so intermediate results are comparable
82 export PATH_orig=${PATH}
83 create_global_faketime_wrappers "2000-01-01 12:00:00"
84 create_per-host_faketime_wrappers "2000-01-01 12:00:00"
85 export PATH=${WRAP_DIR}:${PATH}
87 EXTRA_INCLUDES_BASE=$WRAP_DIR/extra_includes
88 mkdir -p $EXTRA_INCLUDES_BASE
90 # x86 needs /usr/include/i386-linux-gnu/asm pointed to /usr/include/x86_64-linux-gnu/asm,
91 # but we can't write there. Instead, create a link here and force it to be included in the
92 # search paths by wrapping gcc/g++.
94 mkdir -p $EXTRA_INCLUDES_BASE/i686-pc-linux-gnu
95 rm -f $WRAP_DIR/extra_includes/i686-pc-linux-gnu/asm
96 ln -s /usr/include/x86_64-linux-gnu/asm $EXTRA_INCLUDES_BASE/i686-pc-linux-gnu/asm
98 for prog in gcc g++; do
99 rm -f ${WRAP_DIR}/${prog}
100 cat << EOF > ${WRAP_DIR}/${prog}
102 REAL="`which -a ${prog} | grep -v ${WRAP_DIR}/${prog} | head -1`"
105 if [ "\$var" = "-m32" ]; then
106 export C_INCLUDE_PATH="$EXTRA_INCLUDES_BASE/i686-pc-linux-gnu"
107 export CPLUS_INCLUDE_PATH="$EXTRA_INCLUDES_BASE/i686-pc-linux-gnu"
113 chmod +x ${WRAP_DIR}/${prog}
117 BASEPREFIX=`pwd`/depends
118 # Build dependencies for each host
120 EXTRA_INCLUDES="$EXTRA_INCLUDES_BASE/$i"
121 if [ -d "$EXTRA_INCLUDES" ]; then
122 export HOST_ID_SALT="$EXTRA_INCLUDES"
124 make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}"
128 # Faketime for binaries
129 export PATH=${PATH_orig}
130 create_global_faketime_wrappers "${REFERENCE_DATETIME}"
131 create_per-host_faketime_wrappers "${REFERENCE_DATETIME}"
132 export PATH=${WRAP_DIR}:${PATH}
134 # Create the release tarball using (arbitrarily) the first host
136 CONFIG_SITE=${BASEPREFIX}/`echo "${HOSTS}" | awk '{print $1;}'`/share/config.site ./configure --prefix=/
138 SOURCEDIST=`echo bitcoin-*.tar.gz`
139 DISTNAME=`echo ${SOURCEDIST} | sed 's/.tar.*//'`
140 # Correct tar file order
143 tar xf ../$SOURCEDIST
144 find bitcoin-* | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ../$SOURCEDIST
147 # Workaround for tarball not building with the bare tag version (prep)
148 make -C src obj/build.h
151 # Extract the release tarball into a dir for each host and build
152 for i in ${HOSTS}; do
153 export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
154 mkdir -p distsrc-${i}
156 INSTALLPATH=`pwd`/installed/${DISTNAME}
157 mkdir -p ${INSTALLPATH}
158 tar --strip-components=1 -xf ../$SOURCEDIST
160 # Workaround for tarball not building with the bare tag version
161 echo '#!/bin/true' >share/genbuild.sh
163 cp ../src/obj/build.h src/obj/
165 CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS} CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" LDFLAGS="${HOST_LDFLAGS}"
167 make ${MAKEOPTS} -C src check-security
169 #TODO: This is a quick hack that disables symbol checking for arm.
170 # Instead, we should investigate why these are popping up.
171 # For aarch64, we'll need to bump up the min GLIBC version, as the abi
172 # support wasn't introduced until 2.17.
176 *) make ${MAKEOPTS} -C src check-symbols ;;
179 make install DESTDIR=${INSTALLPATH}
181 find . -name "lib*.la" -delete
182 find . -name "lib*.a" -delete
183 rm -rf ${DISTNAME}/lib/pkgconfig
184 find ${DISTNAME}/bin -type f -executable -exec ../contrib/devtools/split-debug.sh {} {} {}.dbg \;
185 find ${DISTNAME}/lib -type f -exec ../contrib/devtools/split-debug.sh {} {} {}.dbg \;
186 find ${DISTNAME} -not -name "*.dbg" | 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
187 find ${DISTNAME} -name "*.dbg" | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}-debug.tar.gz
192 mv $SOURCEDIST $OUTDIR/src