diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 index e9470e76..a8fc75ef 100644 --- a/build-aux/m4/bitcoin_qt.m4 +++ b/build-aux/m4/bitcoin_qt.m4 @@ -433,7 +433,15 @@ AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[ if test "x$TARGET_OS" = xlinux; then QT_LIBS="-lQt6XcbQpa -lQt6InputSupport -lQt6FbSupport -lQt6DeviceDiscoverySupport $QT_LIBS" if test "x$PKG_CONFIG" != x; then - QT6_XCB_LIBS=`PKG_CONFIG_LIBDIR=/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig $PKG_CONFIG --libs --static x11 x11-xcb xcb xcb-cursor xcb-icccm xcb-image xcb-keysyms xcb-randr xcb-renderutil xcb-shape xcb-shm xcb-sync xcb-xfixes xcb-xkb xkbcommon xkbcommon-x11 fontconfig freetype2 harfbuzz 2>/dev/null` + qt_multiarch=`$CC -print-multiarch 2>/dev/null` + qt_system_pc_path="${QT_SYSTEM_PKG_CONFIG_LIBDIR}" + if test "x$qt_system_pc_path" = x && test "x$qt_multiarch" != x; then + qt_system_pc_path="/usr/lib/$qt_multiarch/pkgconfig:/lib/$qt_multiarch/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig" + fi + if test "x$qt_system_pc_path" = x; then + qt_system_pc_path="/usr/lib/pkgconfig:/usr/share/pkgconfig" + fi + QT6_XCB_LIBS=`PKG_CONFIG_LIBDIR="$qt_system_pc_path" $PKG_CONFIG --libs --static x11 x11-xcb xcb xcb-cursor xcb-icccm xcb-image xcb-keysyms xcb-randr xcb-render xcb-renderutil xcb-shape xcb-shm xcb-sync xcb-xfixes xcb-xkb xkbcommon xkbcommon-x11 fontconfig freetype2 harfbuzz 2>/dev/null` QT_LIBS="$QT_LIBS $QT6_XCB_LIBS" fi fi diff --git a/contrib/agrarian-build-menu.sh b/contrib/agrarian-build-menu.sh index 4ebe72bc..aea9a13c 100755 --- a/contrib/agrarian-build-menu.sh +++ b/contrib/agrarian-build-menu.sh @@ -215,12 +215,15 @@ install_packages() { linux-qt) packages+=( xvfb - libfontconfig1-dev libfreetype6-dev + libfontconfig1-dev libfreetype6-dev libharfbuzz-dev + libbrotli-dev libbz2-dev libexpat1-dev libglib2.0-dev + libgraphite2-dev libpng-dev zlib1g-dev libx11-xcb-dev libxcb1-dev libxcb-cursor-dev libxcb-image0-dev libxcb-icccm4-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-shape0-dev libxcb-shm0-dev libxcb-sync-dev libxcb-util-dev libxcb-xfixes0-dev - libxcb-xinerama0-dev libxcb-xkb-dev libxi-dev libxrender-dev + libxcb-xinerama0-dev libxcb-xkb-dev libxau-dev libxdmcp-dev + libxext-dev libxi-dev libxrender-dev libxkbcommon-dev libxkbcommon-x11-dev ) ;; diff --git a/contrib/build-linux-wallet.sh b/contrib/build-linux-wallet.sh index 4806f250..83cef8fb 100755 --- a/contrib/build-linux-wallet.sh +++ b/contrib/build-linux-wallet.sh @@ -3,10 +3,10 @@ set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" JOBS="${JOBS:-1}" -HOST="${HOST:-x86_64-pc-linux-gnu}" +BUILD_HOST="${BUILD_HOST:-$("$ROOT/depends/config.guess")}" +HOST="${HOST:-$BUILD_HOST}" PREFIX="$ROOT/depends/$HOST" BASE_CONFIG="$PREFIX/share/config.site" -BUILD_HOST="${BUILD_HOST:-$("$ROOT/depends/config.guess")}" NATIVE_BIN="$ROOT/depends/build/$BUILD_HOST/bin" PROTOC="$NATIVE_BIN/protoc" @@ -32,6 +32,68 @@ reset_qt_configure_state() { rm -rf "$qt_work" } +detect_system_pkg_config_libdir() { + local dirs=() + local multiarch pc_path dir + + if command -v dpkg-architecture >/dev/null 2>&1; then + multiarch="$(dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null || true)" + [[ -n "$multiarch" ]] && dirs+=("/usr/lib/$multiarch/pkgconfig" "/lib/$multiarch/pkgconfig") + fi + + multiarch="$(gcc -print-multiarch 2>/dev/null || true)" + [[ -n "$multiarch" ]] && dirs+=("/usr/lib/$multiarch/pkgconfig" "/lib/$multiarch/pkgconfig") + + IFS=: read -r -a pc_path <<<"$(pkg-config --variable pc_path pkg-config 2>/dev/null || true)" + dirs+=("${pc_path[@]}" /usr/lib/pkgconfig /usr/share/pkgconfig) + + local unique=() + for dir in "${dirs[@]}"; do + [[ -n "$dir" && -d "$dir" ]] || continue + case ":${unique[*]}:" in + *":$dir:"*) ;; + *) unique+=("$dir") ;; + esac + done + + (IFS=:; echo "${unique[*]}") +} + +preflight_linux_qt_deps() { + local missing=() + local modules=( + x11 x11-xcb xcb xcb-cursor xcb-icccm xcb-image xcb-keysyms + xcb-randr xcb-render xcb-renderutil xcb-shape xcb-shm xcb-sync + xcb-xfixes xcb-xkb xkbcommon xkbcommon-x11 fontconfig freetype2 + harfbuzz zlib libpng libbrotlidec libbrotlicommon expat glib-2.0 + graphite2 + ) + local module + + export QT_SYSTEM_PKG_CONFIG_LIBDIR="${QT_SYSTEM_PKG_CONFIG_LIBDIR:-$(detect_system_pkg_config_libdir)}" + + for module in "${modules[@]}"; do + if ! PKG_CONFIG_LIBDIR="$QT_SYSTEM_PKG_CONFIG_LIBDIR" pkg-config --exists "$module"; then + missing+=("$module") + fi + done + + if ((${#missing[@]})); then + cat >&2 <&2 + exit 1 +fi + reset_qt_configure_state remove_invalid_native_protobuf_cache @@ -106,7 +175,7 @@ if [[ build-aux/m4/bitcoin_qt.m4 -nt configure || build-aux/m4/bitcoin_qt.m4 -nt fi echo "Configuring Ubuntu Qt6 wallet build..." -CONFIG_SITE="$BASE_CONFIG" ./configure \ +QT_SYSTEM_PKG_CONFIG_LIBDIR="$QT_SYSTEM_PKG_CONFIG_LIBDIR" CONFIG_SITE="$BASE_CONFIG" ./configure \ --disable-maintainer-mode \ --disable-tests \ --disable-bench \ @@ -114,6 +183,9 @@ CONFIG_SITE="$BASE_CONFIG" ./configure \ --with-qtdbus=no \ --with-protoc-bindir="$NATIVE_BIN" +echo "Cleaning stale target objects before compiling..." +make clean + echo "Building Ubuntu Qt wallet with JOBS=$JOBS..." make -j"$JOBS" diff --git a/depends/hosts/aarch64-linux-gnu.mk b/depends/hosts/aarch64-linux-gnu.mk new file mode 100644 index 00000000..4e0c3bc1 --- /dev/null +++ b/depends/hosts/aarch64-linux-gnu.mk @@ -0,0 +1,2 @@ +# aarch64 Linux native build alias. +include hosts/aarch64-unknown-linux-gnu.mk diff --git a/depends/hosts/aarch64-unknown-linux-gnu.mk b/depends/hosts/aarch64-unknown-linux-gnu.mk new file mode 100644 index 00000000..dcdd119d --- /dev/null +++ b/depends/hosts/aarch64-unknown-linux-gnu.mk @@ -0,0 +1,13 @@ +# aarch64 Linux native build (Ubuntu 22.04/24.04 arm64) +host_arch := aarch64 +host_os := linux + +host_prefix := $(BASEDIR)/$(HOST) +build_prefix := $(BASEDIR)/build/$(BUILD) + +aarch64_linux_host := $(HOST) +aarch64_linux_prefix := $(host_prefix) +aarch64_linux_id_string := $(HOST) + +include hosts/default.mk +include hosts/linux.mk diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index 9a79df37..98c78bb7 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -46,6 +46,7 @@ $(package)_config_opts_linux = -fontconfig $(package)_config_opts_linux += -qpa xcb $(package)_config_opts_linux += -xcb $(package)_config_opts_linux += -xkbcommon +$(package)_config_opts_linux += -feature-xkbcommon-x11 $(package)_config_opts_linux += -system-freetype $(package)_config_opts_linux += -no-feature-sessionmanager $(package)_config_opts_mingw32 = -qpa windows @@ -84,8 +85,17 @@ define $(package)_extract_cmds endef define $(package)_config_cmds + qt_system_pc="$$$${QT_SYSTEM_PKG_CONFIG_LIBDIR:-`unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH; pkg-config --variable pc_path pkg-config 2>/dev/null || true`}" && \ + if test -z "$$$${qt_system_pc}"; then \ + qt_multiarch="`gcc -print-multiarch 2>/dev/null || true`"; \ + if test -n "$$$${qt_multiarch}"; then \ + qt_system_pc="/usr/lib/$$$${qt_multiarch}/pkgconfig:/lib/$$$${qt_multiarch}/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig"; \ + else \ + qt_system_pc="/usr/lib/pkgconfig:/usr/share/pkgconfig"; \ + fi; \ + fi && \ export PKG_CONFIG_SYSROOT_DIR=/ && \ - export PKG_CONFIG_LIBDIR=$(host_prefix)/lib/pkgconfig$(if $(filter linux,$(host_os)),:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig) && \ + export PKG_CONFIG_LIBDIR=$(host_prefix)/lib/pkgconfig$(if $(filter linux,$(host_os)),:$$$${qt_system_pc}) && \ export PKG_CONFIG_PATH=$(host_prefix)/share/pkgconfig && \ ../qtbase/configure $($(package)_config_opts) -- -G Ninja $($(package)_cmake_opts) $($(package)_cmake_opts_$(host_os)) $($(package)_cmake_opts_$(host_arch)_$(host_os)) endef