mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
cmake: Migrate Guix build scripts to CMake
This commit is contained in:
parent
747adb6ffe
commit
e821f0a37a
1 changed files with 23 additions and 30 deletions
|
@ -206,13 +206,13 @@ mkdir -p "$OUTDIR"
|
|||
###########################
|
||||
|
||||
# CONFIGFLAGS
|
||||
CONFIGFLAGS="--enable-reduce-exports --disable-bench --disable-gui-tests --disable-fuzz-binary"
|
||||
CONFIGFLAGS="-DREDUCE_EXPORTS=ON -DBUILD_BENCH=OFF -DBUILD_GUI_TESTS=OFF -DBUILD_FUZZ_BINARY=OFF"
|
||||
|
||||
# CFLAGS
|
||||
HOST_CFLAGS="-O2 -g"
|
||||
HOST_CFLAGS+=$(find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;)
|
||||
case "$HOST" in
|
||||
*linux*) HOST_CFLAGS+=" -ffile-prefix-map=${PWD}=." ;;
|
||||
*linux*) HOST_CFLAGS+=" -ffile-prefix-map=${DISTSRC}/src=." ;;
|
||||
*mingw*) HOST_CFLAGS+=" -fno-ident" ;;
|
||||
*darwin*) unset HOST_CFLAGS ;;
|
||||
esac
|
||||
|
@ -239,38 +239,31 @@ mkdir -p "$DISTSRC"
|
|||
# Extract the source tarball
|
||||
tar --strip-components=1 -xf "${GIT_ARCHIVE}"
|
||||
|
||||
./autogen.sh
|
||||
|
||||
# Configure this DISTSRC for $HOST
|
||||
# shellcheck disable=SC2086
|
||||
env CONFIG_SITE="${BASEPREFIX}/${HOST}/share/config.site" \
|
||||
./configure --prefix=/ \
|
||||
--disable-ccache \
|
||||
--disable-maintainer-mode \
|
||||
--disable-dependency-tracking \
|
||||
${CONFIGFLAGS} \
|
||||
${HOST_CFLAGS:+CFLAGS="${HOST_CFLAGS}"} \
|
||||
${HOST_CXXFLAGS:+CXXFLAGS="${HOST_CXXFLAGS}"} \
|
||||
${HOST_LDFLAGS:+LDFLAGS="${HOST_LDFLAGS}"}
|
||||
|
||||
sed -i.old 's/-lstdc++ //g' config.status libtool
|
||||
env CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" LDFLAGS="${HOST_LDFLAGS}" \
|
||||
cmake -S . -B build \
|
||||
--toolchain "${BASEPREFIX}/${HOST}/toolchain.cmake" \
|
||||
-DWITH_CCACHE=OFF \
|
||||
${CONFIGFLAGS}
|
||||
|
||||
# Build Bitcoin Core
|
||||
make --jobs="$JOBS" ${V:+V=1}
|
||||
cmake --build build -j "$JOBS" ${V:+--verbose}
|
||||
|
||||
# Check that symbol/security checks tools are sane.
|
||||
make test-security-check ${V:+V=1}
|
||||
cmake --build build --target test-security-check ${V:+--verbose}
|
||||
# Perform basic security checks on a series of executables.
|
||||
make -C src --jobs=1 check-security ${V:+V=1}
|
||||
cmake --build build -j 1 --target check-security ${V:+--verbose}
|
||||
# Check that executables only contain allowed version symbols.
|
||||
make -C src --jobs=1 check-symbols ${V:+V=1}
|
||||
cmake --build build -j 1 --target check-symbols ${V:+--verbose}
|
||||
|
||||
mkdir -p "$OUTDIR"
|
||||
|
||||
# Make the os-specific installers
|
||||
case "$HOST" in
|
||||
*mingw*)
|
||||
make deploy ${V:+V=1} BITCOIN_WIN_INSTALLER="${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe"
|
||||
cmake --build build -j "$JOBS" -t deploy ${V:+--verbose}
|
||||
mv build/bitcoin-win64-setup.exe "${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -282,20 +275,25 @@ mkdir -p "$DISTSRC"
|
|||
# Install built Bitcoin Core to $INSTALLPATH
|
||||
case "$HOST" in
|
||||
*darwin*)
|
||||
make install-strip DESTDIR="${INSTALLPATH}" ${V:+V=1}
|
||||
# This workaround can be dropped for CMake >= 3.27.
|
||||
# See the upstream commit 689616785f76acd844fd448c51c5b2a0711aafa2.
|
||||
find build -name 'cmake_install.cmake' -exec sed -i 's| -u -r | |g' {} +
|
||||
|
||||
cmake --install build --strip --prefix "${INSTALLPATH}" ${V:+--verbose}
|
||||
;;
|
||||
*)
|
||||
make install DESTDIR="${INSTALLPATH}" ${V:+V=1}
|
||||
cmake --install build --prefix "${INSTALLPATH}" ${V:+--verbose}
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$HOST" in
|
||||
*darwin*)
|
||||
make deploydir ${V:+V=1}
|
||||
cmake --build build --target deploy ${V:+--verbose}
|
||||
mv build/dist/Bitcoin-Core.zip "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.zip"
|
||||
mkdir -p "unsigned-app-${HOST}"
|
||||
cp --target-directory="unsigned-app-${HOST}" \
|
||||
contrib/macdeploy/detached-sig-create.sh
|
||||
mv --target-directory="unsigned-app-${HOST}" dist
|
||||
mv --target-directory="unsigned-app-${HOST}" build/dist
|
||||
(
|
||||
cd "unsigned-app-${HOST}"
|
||||
find . -print0 \
|
||||
|
@ -304,23 +302,18 @@ mkdir -p "$DISTSRC"
|
|||
| gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" \
|
||||
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" && exit 1 )
|
||||
)
|
||||
make deploy ${V:+V=1} OSX_ZIP="${OUTDIR}/${DISTNAME}-${HOST}-unsigned.zip"
|
||||
;;
|
||||
esac
|
||||
(
|
||||
cd installed
|
||||
|
||||
# Prune libtool and object archives
|
||||
find . -name "lib*.la" -delete
|
||||
find . -name "lib*.a" -delete
|
||||
|
||||
case "$HOST" in
|
||||
*darwin*) ;;
|
||||
*)
|
||||
# Split binaries from their debug symbols
|
||||
{
|
||||
find "${DISTNAME}/bin" -type f -executable -print0
|
||||
} | xargs -0 -P"$JOBS" -I{} "${DISTSRC}/contrib/devtools/split-debug.sh" {} {} {}.dbg
|
||||
} | xargs -0 -P"$JOBS" -I{} "${DISTSRC}/build/split-debug.sh" {} {} {}.dbg
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue