Skip to content

Commit dac4e2a

Browse files
committed
Merge pull request #3914
ddcd1af gitian: add statically built variant of bitcoind/bitcoin-cli (Wladimir J. van der Laan)
2 parents a7101b1 + ddcd1af commit dac4e2a

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

contrib/gitian-descriptors/gitian-linux.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,39 @@ script: |
3939
unzip ../build/bitcoin-deps-linux${GBUILD_BITS}-gitian-r3.zip
4040
unzip ../build/boost-linux${GBUILD_BITS}-1.55.0-gitian-r1.zip
4141
cd ../build
42+
43+
function do_configure {
44+
./configure "$@" --enable-upnp-default --prefix=$STAGING --with-protoc-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --disable-dependency-tracking PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib ${OPTFLAGS}" CXXFLAGS="-frandom-seed=bitcoin ${OPTFLAGS}" BOOST_CHRONO_EXTRALIBS="-lrt"
45+
}
4246
#
4347
cd bitcoin
4448
./autogen.sh
45-
./configure --prefix=$STAGING --bindir=$BINDIR --with-protoc-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --disable-dependency-tracking PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib ${OPTFLAGS}" CXXFLAGS="-frandom-seed=bitcoin ${OPTFLAGS}" BOOST_CHRONO_EXTRALIBS="-lrt"
49+
do_configure
4650
make dist
4751
DISTNAME=`echo bitcoin-*.tar.gz`
52+
53+
# Build dynamic versions of everything
54+
# (with static linking to boost and openssl as well a some non-OS deps)
4855
mkdir -p distsrc
4956
cd distsrc
5057
tar --strip-components=1 -xf ../$DISTNAME
51-
./configure --enable-upnp-default --prefix=$STAGING --bindir=$BINDIR --with-protoc-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --disable-dependency-tracking PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" CPPFLAGS="-I$STAGING/include ${OPTFLAGS}" LDFLAGS="-L$STAGING/lib ${OPTFLAGS}" CXXFLAGS="-frandom-seed=bitcoin ${OPTFLAGS}" BOOST_CHRONO_EXTRALIBS="-lrt"
58+
do_configure --bindir=$BINDIR
5259
make $MAKEOPTS
5360
make $MAKEOPTS install-strip
61+
make $MAKEOPTS clean
62+
63+
# Build fully static versions of bitcoind and bitcoin-cli for older Linux distros
64+
STATIC_BINDIR="$HOME/bindir.static"
65+
mkdir -p $STATIC_BINDIR
66+
# For 32-bit, -pie cannot be used with -static, as invalid executables are generated
67+
# For 64-bit, -pie with -static causes a link error
68+
# Disable hardening in configure and manually pass 'static-safe' hardening flags
69+
OPTFLAGS='-O2 -static -Wstack-protector -fstack-protector-all -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wl,-z,relro -Wl,-z,now'
70+
do_configure --bindir=$STATIC_BINDIR --disable-tests --enable-upnp-default --without-gui --disable-hardening
71+
make $MAKEOPTS
72+
make $MAKEOPTS install-strip
73+
cp $STATIC_BINDIR/bitcoind $BINDIR/bitcoind.static
74+
cp $STATIC_BINDIR/bitcoin-cli $BINDIR/bitcoin-cli.static
5475
5576
# sort distribution tar file and normalize user/group/mtime information for deterministic output
5677
mkdir -p $OUTDIR/src

0 commit comments

Comments
 (0)