aboutsummaryrefslogtreecommitdiff
path: root/contrib/guix/libexec/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/guix/libexec/build.sh')
-rwxr-xr-xcontrib/guix/libexec/build.sh67
1 files changed, 32 insertions, 35 deletions
diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh
index 9bc8c0e75d..3184cd4afe 100755
--- a/contrib/guix/libexec/build.sh
+++ b/contrib/guix/libexec/build.sh
@@ -71,11 +71,9 @@ unset OBJCPLUS_INCLUDE_PATH
export C_INCLUDE_PATH="${NATIVE_GCC}/include"
export CPLUS_INCLUDE_PATH="${NATIVE_GCC}/include/c++:${NATIVE_GCC}/include"
-export OBJC_INCLUDE_PATH="${NATIVE_GCC}/include"
-export OBJCPLUS_INCLUDE_PATH="${NATIVE_GCC}/include/c++:${NATIVE_GCC}/include"
case "$HOST" in
- *darwin*) export LIBRARY_PATH="${NATIVE_GCC}/lib" ;;
+ *darwin*) export LIBRARY_PATH="${NATIVE_GCC}/lib" ;; # Required for qt/qmake
*mingw*) export LIBRARY_PATH="${NATIVE_GCC}/lib" ;;
*)
NATIVE_GCC_STATIC="$(store_path gcc-toolchain static)"
@@ -180,6 +178,14 @@ make -C depends --jobs="$JOBS" HOST="$HOST" \
x86_64_linux_NM=x86_64-linux-gnu-gcc-nm \
x86_64_linux_STRIP=x86_64-linux-gnu-strip
+case "$HOST" in
+ *darwin*)
+ # Unset now that Qt is built
+ unset C_INCLUDE_PATH
+ unset CPLUS_INCLUDE_PATH
+ unset LIBRARY_PATH
+ ;;
+esac
###########################
# Source Tarball Building #
@@ -200,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
@@ -224,8 +230,6 @@ case "$HOST" in
*mingw*) HOST_LDFLAGS="-Wl,--no-insert-timestamp" ;;
esac
-# Make $HOST-specific native binaries from depends available in $PATH
-export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}"
mkdir -p "$DISTSRC"
(
cd "$DISTSRC"
@@ -233,38 +237,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
@@ -276,20 +273,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 \
@@ -298,23 +300,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