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
|
||||||
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
|
# CFLAGS
|
||||||
HOST_CFLAGS="-O2 -g"
|
HOST_CFLAGS="-O2 -g"
|
||||||
HOST_CFLAGS+=$(find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;)
|
HOST_CFLAGS+=$(find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;)
|
||||||
case "$HOST" in
|
case "$HOST" in
|
||||||
*linux*) HOST_CFLAGS+=" -ffile-prefix-map=${PWD}=." ;;
|
*linux*) HOST_CFLAGS+=" -ffile-prefix-map=${DISTSRC}/src=." ;;
|
||||||
*mingw*) HOST_CFLAGS+=" -fno-ident" ;;
|
*mingw*) HOST_CFLAGS+=" -fno-ident" ;;
|
||||||
*darwin*) unset HOST_CFLAGS ;;
|
*darwin*) unset HOST_CFLAGS ;;
|
||||||
esac
|
esac
|
||||||
|
@ -239,38 +239,31 @@ mkdir -p "$DISTSRC"
|
||||||
# Extract the source tarball
|
# Extract the source tarball
|
||||||
tar --strip-components=1 -xf "${GIT_ARCHIVE}"
|
tar --strip-components=1 -xf "${GIT_ARCHIVE}"
|
||||||
|
|
||||||
./autogen.sh
|
|
||||||
|
|
||||||
# Configure this DISTSRC for $HOST
|
# Configure this DISTSRC for $HOST
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
env CONFIG_SITE="${BASEPREFIX}/${HOST}/share/config.site" \
|
env CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" LDFLAGS="${HOST_LDFLAGS}" \
|
||||||
./configure --prefix=/ \
|
cmake -S . -B build \
|
||||||
--disable-ccache \
|
--toolchain "${BASEPREFIX}/${HOST}/toolchain.cmake" \
|
||||||
--disable-maintainer-mode \
|
-DWITH_CCACHE=OFF \
|
||||||
--disable-dependency-tracking \
|
${CONFIGFLAGS}
|
||||||
${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
|
|
||||||
|
|
||||||
# Build Bitcoin Core
|
# Build Bitcoin Core
|
||||||
make --jobs="$JOBS" ${V:+V=1}
|
cmake --build build -j "$JOBS" ${V:+--verbose}
|
||||||
|
|
||||||
# Check that symbol/security checks tools are sane.
|
# 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.
|
# 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.
|
# 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"
|
mkdir -p "$OUTDIR"
|
||||||
|
|
||||||
# Make the os-specific installers
|
# Make the os-specific installers
|
||||||
case "$HOST" in
|
case "$HOST" in
|
||||||
*mingw*)
|
*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
|
esac
|
||||||
|
|
||||||
|
@ -282,20 +275,25 @@ mkdir -p "$DISTSRC"
|
||||||
# Install built Bitcoin Core to $INSTALLPATH
|
# Install built Bitcoin Core to $INSTALLPATH
|
||||||
case "$HOST" in
|
case "$HOST" in
|
||||||
*darwin*)
|
*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
|
esac
|
||||||
|
|
||||||
case "$HOST" in
|
case "$HOST" in
|
||||||
*darwin*)
|
*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}"
|
mkdir -p "unsigned-app-${HOST}"
|
||||||
cp --target-directory="unsigned-app-${HOST}" \
|
cp --target-directory="unsigned-app-${HOST}" \
|
||||||
contrib/macdeploy/detached-sig-create.sh
|
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}"
|
cd "unsigned-app-${HOST}"
|
||||||
find . -print0 \
|
find . -print0 \
|
||||||
|
@ -304,23 +302,18 @@ mkdir -p "$DISTSRC"
|
||||||
| gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" \
|
| gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" \
|
||||||
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" && exit 1 )
|
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" && exit 1 )
|
||||||
)
|
)
|
||||||
make deploy ${V:+V=1} OSX_ZIP="${OUTDIR}/${DISTNAME}-${HOST}-unsigned.zip"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
(
|
(
|
||||||
cd installed
|
cd installed
|
||||||
|
|
||||||
# Prune libtool and object archives
|
|
||||||
find . -name "lib*.la" -delete
|
|
||||||
find . -name "lib*.a" -delete
|
|
||||||
|
|
||||||
case "$HOST" in
|
case "$HOST" in
|
||||||
*darwin*) ;;
|
*darwin*) ;;
|
||||||
*)
|
*)
|
||||||
# Split binaries from their debug symbols
|
# Split binaries from their debug symbols
|
||||||
{
|
{
|
||||||
find "${DISTNAME}/bin" -type f -executable -print0
|
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
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue