2 name: "bitcoin-linux-0.15"
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
148 # Extract the release tarball into a dir for each host and build
149 for i in ${HOSTS}; do
150 export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH}
151 mkdir -p distsrc-${i}
153 INSTALLPATH=`pwd`/installed/${DISTNAME}
154 mkdir -p ${INSTALLPATH}
155 tar --strip-components=1 -xf ../$SOURCEDIST
157 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}"
159 make ${MAKEOPTS} -C src check-security
161 #TODO: This is a quick hack that disables symbol checking for arm.
162 # Instead, we should investigate why these are popping up.
163 # For aarch64, we'll need to bump up the min GLIBC version, as the abi
164 # support wasn't introduced until 2.17.
168 *) make ${MAKEOPTS} -C src check-symbols ;;
171 make install DESTDIR=${INSTALLPATH}
173 find . -name "lib*.la" -delete
174 find . -name "lib*.a" -delete
175 rm -rf ${DISTNAME}/lib/pkgconfig
176 find ${DISTNAME}/bin -type f -executable -exec ../contrib/devtools/split-debug.sh {} {} {}.dbg \;
177 find ${DISTNAME}/lib -type f -exec ../contrib/devtools/split-debug.sh {} {} {}.dbg \;
178 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
179 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
184 mv $SOURCEDIST $OUTDIR/src