2014-07-23 07:31:30 +02:00
PACKAGE = qt
2021-06-02 06:12:07 +02:00
$(package)_version = 5.12.11
2022-12-04 13:57:03 +01:00
$(package)_download_path = https://download.qt.io/archive/qt/5.12/$( $( package) _version) /submodules
2021-11-25 05:02:50 +01:00
$(package)_suffix = everywhere-src-$( $( package) _version) .tar.xz
2015-07-24 01:07:03 +02:00
$(package)_file_name = qtbase-$( $( package) _suffix)
2021-06-02 06:12:07 +02:00
$(package)_sha256_hash = 1c1b4e33137ca77881074c140d54c3c9747e845a31338cfe8680f171f0bc3a39
2021-11-25 05:02:50 +01:00
$(package)_linux_dependencies = freetype fontconfig libxcb libxkbcommon
2014-07-23 07:31:30 +02:00
$(package)_qt_libs = corelib network widgets gui plugins testlib
2021-06-10 05:02:27 +02:00
$(package)_linguist_tools = lrelease lupdate lconvert
$(package)_patches = qt.pro qttools_src.pro
$(package)_patches += fix_qt_pkgconfig.patch mac-qmake.conf fix_no_printer.patch no-xlib.patch
2021-11-24 05:32:59 +01:00
$(package)_patches += fix_android_qmake_conf.patch fix_android_jni_static.patch dont_hardcode_pwd.patch
2021-11-28 19:56:54 +01:00
$(package)_patches += dont_hardcode_x86_64.patch
2021-05-03 08:01:07 +02:00
$(package)_patches += fix_lib_paths.patch fix_android_pch.patch
2021-09-01 19:47:04 +02:00
$(package)_patches += fix_limits_header.patch
2022-04-26 17:06:53 +02:00
$(package)_patches += fix_montery_include.patch
2022-02-20 23:59:29 +01:00
$(package)_patches += glibc_compatibility.patch
2021-04-06 00:59:11 +02:00
$(package)_patches += qtbase-moc-ignore-gcc-macro.patch
2023-06-27 20:51:37 +02:00
$(package)_patches += fast_fixed_dtoa_no_optimize.patch
2015-07-24 01:07:03 +02:00
$(package)_qttranslations_file_name = qttranslations-$( $( package) _suffix)
2021-06-02 06:12:07 +02:00
$(package)_qttranslations_sha256_hash = 577b0668a777eb2b451c61e8d026d79285371597ce9df06b6dee6c814164b7c3
2015-07-24 01:07:03 +02:00
$(package)_qttools_file_name = qttools-$( $( package) _suffix)
2021-06-02 06:12:07 +02:00
$(package)_qttools_sha256_hash = 98b2aaca230458f65996f3534fd471d2ffd038dd58ac997c0589c06dc2385b4f
2015-07-24 01:07:03 +02:00
$(package)_extra_sources = $( $( package) _qttranslations_file_name)
$(package)_extra_sources += $( $( package) _qttools_file_name)
2014-07-23 07:31:30 +02:00
d e f i n e $( package ) _ s e t _ v a r s
2014-09-23 23:41:42 +02:00
$(package)_config_opts_release = -release
2020-11-23 14:04:09 +01:00
$(package)_config_opts_release += -silent
2017-01-15 06:41:39 +01:00
$(package)_config_opts_debug = -debug
2021-11-25 05:02:50 +01:00
$(package)_config_opts_debug += -optimized-tools
2016-06-20 13:31:17 +02:00
$(package)_config_opts += -bindir $( build_prefix) /bin
2020-11-23 14:04:09 +01:00
$(package)_config_opts += -c++std c++1z
2016-06-20 13:31:17 +02:00
$(package)_config_opts += -confirm-license
$(package)_config_opts += -hostprefix $( build_prefix)
2018-12-13 14:32:41 +01:00
$(package)_config_opts += -no-compile-examples
2016-06-20 13:31:17 +02:00
$(package)_config_opts += -no-cups
$(package)_config_opts += -no-egl
$(package)_config_opts += -no-eglfs
$(package)_config_opts += -no-freetype
$(package)_config_opts += -no-gif
2015-06-12 19:49:47 +02:00
$(package)_config_opts += -no-glib
$(package)_config_opts += -no-icu
2019-07-25 22:01:43 +02:00
$(package)_config_opts += -no-ico
2015-06-12 19:49:47 +02:00
$(package)_config_opts += -no-iconv
2016-06-20 13:31:17 +02:00
$(package)_config_opts += -no-kms
$(package)_config_opts += -no-linuxfb
2022-06-13 21:03:26 +02:00
$(package)_config_opts += -no-libjpeg
2019-12-16 13:25:07 +01:00
$(package)_config_opts += -no-libproxy
2016-06-20 13:31:17 +02:00
$(package)_config_opts += -no-libudev
$(package)_config_opts += -no-mtdev
2022-04-25 11:01:47 +02:00
$(package)_config_opts += -no-openssl
2016-06-20 13:31:17 +02:00
$(package)_config_opts += -no-openvg
$(package)_config_opts += -no-reduce-relocations
2019-12-16 13:25:07 +01:00
$(package)_config_opts += -no-sctp
2022-06-13 21:03:26 +02:00
$(package)_config_opts += -no-securetransport
2015-06-12 19:49:47 +02:00
$(package)_config_opts += -no-sql-db2
$(package)_config_opts += -no-sql-ibase
$(package)_config_opts += -no-sql-oci
$(package)_config_opts += -no-sql-tds
$(package)_config_opts += -no-sql-mysql
$(package)_config_opts += -no-sql-odbc
$(package)_config_opts += -no-sql-psql
$(package)_config_opts += -no-sql-sqlite
$(package)_config_opts += -no-sql-sqlite2
2019-12-16 13:25:07 +01:00
$(package)_config_opts += -no-system-proxies
2016-06-20 13:31:17 +02:00
$(package)_config_opts += -no-use-gold-linker
$(package)_config_opts += -nomake examples
$(package)_config_opts += -nomake tests
2021-06-10 05:02:27 +02:00
$(package)_config_opts += -nomake tools
2016-06-20 13:31:17 +02:00
$(package)_config_opts += -opensource
2015-06-12 19:49:47 +02:00
$(package)_config_opts += -pkg-config
2016-06-20 13:31:17 +02:00
$(package)_config_opts += -prefix $( host_prefix)
2015-06-12 19:49:47 +02:00
$(package)_config_opts += -qt-libpng
$(package)_config_opts += -qt-pcre
2019-03-01 16:29:48 +01:00
$(package)_config_opts += -qt-harfbuzz
2021-11-25 05:02:50 +01:00
$(package)_config_opts += -qt-zlib
2016-06-20 13:31:17 +02:00
$(package)_config_opts += -static
$(package)_config_opts += -v
2019-07-25 22:01:43 +02:00
$(package)_config_opts += -no-feature-bearermanagement
$(package)_config_opts += -no-feature-colordialog
$(package)_config_opts += -no-feature-commandlineparser
$(package)_config_opts += -no-feature-concurrent
2018-12-13 14:32:41 +01:00
$(package)_config_opts += -no-feature-dial
2019-07-25 22:01:43 +02:00
$(package)_config_opts += -no-feature-fontcombobox
2018-12-13 14:32:41 +01:00
$(package)_config_opts += -no-feature-ftp
2019-12-16 13:25:07 +01:00
$(package)_config_opts += -no-feature-http
2019-07-25 22:01:43 +02:00
$(package)_config_opts += -no-feature-image_heuristic_mask
$(package)_config_opts += -no-feature-keysequenceedit
2018-12-13 14:32:41 +01:00
$(package)_config_opts += -no-feature-lcdnumber
2019-12-16 13:25:07 +01:00
$(package)_config_opts += -no-feature-networkdiskcache
$(package)_config_opts += -no-feature-networkproxy
2018-12-13 14:32:41 +01:00
$(package)_config_opts += -no-feature-pdf
2017-01-26 10:30:36 +01:00
$(package)_config_opts += -no-feature-printdialog
2019-07-25 22:01:43 +02:00
$(package)_config_opts += -no-feature-printer
$(package)_config_opts += -no-feature-printpreviewdialog
$(package)_config_opts += -no-feature-printpreviewwidget
$(package)_config_opts += -no-feature-sessionmanager
2019-12-16 13:25:07 +01:00
$(package)_config_opts += -no-feature-socks5
2018-12-13 14:32:41 +01:00
$(package)_config_opts += -no-feature-sql
2021-11-25 05:02:50 +01:00
$(package)_config_opts += -no-feature-sqlmodel
2018-12-13 14:32:41 +01:00
$(package)_config_opts += -no-feature-statemachine
$(package)_config_opts += -no-feature-syntaxhighlighter
$(package)_config_opts += -no-feature-textbrowser
$(package)_config_opts += -no-feature-textodfwriter
2019-07-25 22:01:43 +02:00
$(package)_config_opts += -no-feature-topleveldomain
$(package)_config_opts += -no-feature-undocommand
$(package)_config_opts += -no-feature-undogroup
$(package)_config_opts += -no-feature-undostack
$(package)_config_opts += -no-feature-undoview
$(package)_config_opts += -no-feature-vnc
2018-12-13 14:32:41 +01:00
$(package)_config_opts += -no-feature-wizard
2018-05-19 16:22:47 +02:00
$(package)_config_opts += -no-feature-xml
2014-07-23 07:31:30 +02:00
2019-12-01 04:46:05 +01:00
$(package)_config_opts_darwin = -no-dbus
2019-12-09 10:05:20 +01:00
$(package)_config_opts_darwin += -no-opengl
2020-11-27 18:56:24 +01:00
$(package)_config_opts_darwin += -pch
2021-03-21 22:45:26 +01:00
$(package)_config_opts_darwin += -no-feature-corewlan
2021-06-10 05:02:27 +02:00
$(package)_config_opts_darwin += QMAKE_MACOSX_DEPLOYMENT_TARGET = $( OSX_MIN_VERSION)
2019-12-01 04:46:05 +01:00
2014-07-23 07:31:30 +02:00
i f n e q ( $( build_os ) , d a r w i n )
2019-12-01 04:46:05 +01:00
$(package)_config_opts_darwin += -xplatform macx-clang-linux
2015-06-12 19:49:47 +02:00
$(package)_config_opts_darwin += -device-option MAC_SDK_PATH = $( OSX_SDK)
2015-07-24 01:07:03 +02:00
$(package)_config_opts_darwin += -device-option MAC_SDK_VERSION = $( OSX_SDK_VERSION)
2015-06-12 19:49:47 +02:00
$(package)_config_opts_darwin += -device-option CROSS_COMPILE = " $( host) - "
$(package)_config_opts_darwin += -device-option MAC_TARGET = $( host)
2020-09-04 02:23:19 +02:00
$(package)_config_opts_darwin += -device-option XCODE_VERSION = $( XCODE_VERSION)
2014-07-23 07:31:30 +02:00
e n d i f
2021-11-24 16:00:43 +01:00
i f n e q ( $( build_arch ) , $( host_arch ) )
2021-06-03 15:04:16 +02:00
$(package)_config_opts_aarch64_darwin += -device-option QMAKE_APPLE_DEVICE_ARCHS = arm64
2021-11-24 16:00:43 +01:00
$(package)_config_opts_x86_64_darwin += -device-option QMAKE_APPLE_DEVICE_ARCHS = x86_64
e n d i f
2020-12-07 10:07:43 +01:00
2021-11-25 05:02:50 +01:00
$(package)_config_opts_linux = -qt-xcb
2019-07-23 08:22:06 +02:00
$(package)_config_opts_linux += -no-xcb-xlib
$(package)_config_opts_linux += -no-feature-xlib
2015-06-12 19:49:47 +02:00
$(package)_config_opts_linux += -system-freetype
$(package)_config_opts_linux += -fontconfig
$(package)_config_opts_linux += -no-opengl
2021-11-25 05:02:50 +01:00
$(package)_config_opts_linux += -no-feature-vulkan
2022-02-20 23:59:29 +01:00
$(package)_config_opts_linux += -no-feature-getentropy
$(package)_config_opts_linux += -no-feature-renameat2
2019-12-01 04:46:05 +01:00
$(package)_config_opts_linux += -dbus-runtime
2018-07-17 13:06:41 +02:00
$(package)_config_opts_arm_linux += -platform linux-g++ -xplatform bitcoin-linux-g++
2014-07-23 07:31:30 +02:00
$(package)_config_opts_i686_linux = -xplatform linux-g++-32
2021-12-30 04:32:24 +01:00
i f n e q ( , $( findstring -stdlib =libc ++,$ ( $ ( 1) _cxx ) ) )
$(package)_config_opts_x86_64_linux = -xplatform linux-clang-libc++
e l s e
2018-05-19 16:22:47 +02:00
$(package)_config_opts_x86_64_linux = -xplatform linux-g++-64
2021-12-30 04:32:24 +01:00
e n d i f
2018-08-05 19:22:11 +02:00
$(package)_config_opts_aarch64_linux = -xplatform linux-aarch64-gnu-g++
2019-12-09 18:48:45 +01:00
$(package)_config_opts_powerpc64_linux = -platform linux-g++ -xplatform bitcoin-linux-g++
$(package)_config_opts_powerpc64le_linux = -platform linux-g++ -xplatform bitcoin-linux-g++
2018-07-19 07:04:00 +02:00
$(package)_config_opts_riscv64_linux = -platform linux-g++ -xplatform bitcoin-linux-g++
2019-12-09 18:48:45 +01:00
$(package)_config_opts_s390x_linux = -platform linux-g++ -xplatform bitcoin-linux-g++
2019-12-01 04:46:05 +01:00
$(package)_config_opts_mingw32 = -no-opengl
$(package)_config_opts_mingw32 += -no-dbus
$(package)_config_opts_mingw32 += -xplatform win32-g++
2021-05-12 06:24:23 +02:00
$(package)_config_opts_mingw32 += " QMAKE_CFLAGS = ' $( $( package) _cflags) $( $( package) _cppflags) ' "
$(package)_config_opts_mingw32 += " QMAKE_CXXFLAGS = ' $( $( package) _cflags) $( $( package) _cppflags) ' "
$(package)_config_opts_mingw32 += " QMAKE_LFLAGS = ' $( $( package) _ldflags) ' "
2019-12-01 04:46:05 +01:00
$(package)_config_opts_mingw32 += -device-option CROSS_COMPILE = " $( host) - "
2020-11-27 18:56:24 +01:00
$(package)_config_opts_mingw32 += -pch
2021-11-24 05:32:59 +01:00
$(package)_config_opts_android = -xplatform android-clang
$(package)_config_opts_android += -android-sdk $( ANDROID_SDK)
$(package)_config_opts_android += -android-ndk $( ANDROID_NDK)
$(package)_config_opts_android += -android-ndk-platform android-$( ANDROID_API_LEVEL)
$(package)_config_opts_android += -device-option CROSS_COMPILE = " $( host) - "
$(package)_config_opts_android += -egl
$(package)_config_opts_android += -qpa xcb
$(package)_config_opts_android += -no-eglfs
2019-12-01 04:46:05 +01:00
$(package)_config_opts_android += -no-dbus
2021-11-24 05:32:59 +01:00
$(package)_config_opts_android += -opengl es2
$(package)_config_opts_android += -qt-freetype
$(package)_config_opts_android += -no-fontconfig
$(package)_config_opts_android += -L $( host_prefix) /lib
$(package)_config_opts_android += -I $( host_prefix) /include
2020-11-27 18:56:24 +01:00
$(package)_config_opts_android += -pch
2021-03-21 16:50:25 +01:00
$(package)_config_opts_android += -no-feature-vulkan
2021-11-24 05:32:59 +01:00
$(package)_config_opts_aarch64_android += -android-arch arm64-v8a
$(package)_config_opts_armv7a_android += -android-arch armeabi-v7a
$(package)_config_opts_x86_64_android += -android-arch x86_64
2014-07-23 07:31:30 +02:00
e n d e f
2015-07-24 01:07:03 +02:00
d e f i n e $( package ) _ f e t c h _ c m d s
$( call fetch_file ,$ ( package ) ,$ ( $ ( package ) _download_path ) ,$ ( $ ( package ) _download_file ) ,$ ( $ ( package ) _file_name ) ,$ ( $ ( package ) _sha 256_hash ) ) & & \
$( call fetch_file ,$ ( package ) ,$ ( $ ( package ) _download_path ) ,$ ( $ ( package ) _qttranslations_file_name ) ,$ ( $ ( package ) _qttranslations_file_name ) ,$ ( $ ( package ) _qttranslations_sha 256_hash ) ) & & \
$( call fetch_file ,$ ( package ) ,$ ( $ ( package ) _download_path ) ,$ ( $ ( package ) _qttools_file_name ) ,$ ( $ ( package ) _qttools_file_name ) ,$ ( $ ( package ) _qttools_sha 256_hash ) )
e n d e f
d e f i n e $( package ) _ e x t r a c t _ c m d s
mkdir -p $( $( package) _extract_dir) && \
echo " $( $( package) _sha256_hash) $( $( package) _source) " > $( $( package) _extract_dir) /.$( $( package) _file_name) .hash && \
2016-04-15 08:55:38 +02:00
echo " $( $( package) _qttranslations_sha256_hash) $( $( package) _source_dir) / $( $( package) _qttranslations_file_name) " >> $( $( package) _extract_dir) /.$( $( package) _file_name) .hash && \
echo " $( $( package) _qttools_sha256_hash) $( $( package) _source_dir) / $( $( package) _qttools_file_name) " >> $( $( package) _extract_dir) /.$( $( package) _file_name) .hash && \
2015-07-24 01:07:03 +02:00
$( build_SHA256SUM) -c $( $( package) _extract_dir) /.$( $( package) _file_name) .hash && \
mkdir qtbase && \
2019-03-18 16:31:05 +01:00
tar --no-same-owner --strip-components= 1 -xf $( $( package) _source) -C qtbase && \
2015-07-24 01:07:03 +02:00
mkdir qttranslations && \
2019-03-18 16:31:05 +01:00
tar --no-same-owner --strip-components= 1 -xf $( $( package) _source_dir) /$( $( package) _qttranslations_file_name) -C qttranslations && \
2015-07-24 01:07:03 +02:00
mkdir qttools && \
2019-03-18 16:31:05 +01:00
tar --no-same-owner --strip-components= 1 -xf $( $( package) _source_dir) /$( $( package) _qttools_file_name) -C qttools
2015-07-24 01:07:03 +02:00
e n d e f
2020-09-04 02:23:19 +02:00
# Preprocessing steps work as follows:
#
# 1. Apply our patches to the extracted source. See each patch for more info.
#
2021-06-10 05:02:27 +02:00
# 2. Create a macOS-Clang-Linux mkspec using our mac-qmake.conf.
2020-09-04 02:23:19 +02:00
#
2021-06-10 05:02:27 +02:00
# 3. After making a copy of the mkspec for the linux-arm-gnueabi host, named
2020-09-04 02:23:19 +02:00
# bitcoin-linux-g++, replace instances of linux-arm-gnueabi with $(host). This
# way we can generically support hosts like riscv64-linux-gnu, which Qt doesn't
# ship a mkspec for. See it's usage in config_opts_* above.
#
2021-06-10 05:02:27 +02:00
# 4. Put our C, CXX and LD FLAGS into gcc-base.conf. Only used for non-host builds.
2020-09-04 02:23:19 +02:00
#
2021-06-10 05:02:27 +02:00
# 5. Do similar for the win32-g++ mkspec.
2020-09-04 02:23:19 +02:00
#
2021-06-10 05:02:27 +02:00
# 6. In clang.conf, swap out clang & clang++, for our compiler + flags. See #17466.
2020-09-04 02:23:19 +02:00
#
2021-06-10 05:02:27 +02:00
# 7. Adjust a regex in toolchain.prf, to accommodate Guix's usage of
2020-09-04 02:23:19 +02:00
# CROSS_LIBRARY_PATH. See #15277.
2014-07-23 07:31:30 +02:00
d e f i n e $( package ) _ p r e p r o c e s s _ c m d s
2021-06-10 05:02:27 +02:00
cp $( $( package) _patch_dir) /qt.pro qt.pro && \
cp $( $( package) _patch_dir) /qttools_src.pro qttools/src/src.pro && \
2020-09-04 02:23:19 +02:00
patch -p1 -i $( $( package) _patch_dir) /dont_hardcode_pwd.patch && \
patch -p1 -i $( $( package) _patch_dir) /fix_qt_pkgconfig.patch && \
patch -p1 -i $( $( package) _patch_dir) /fix_no_printer.patch && \
patch -p1 -i $( $( package) _patch_dir) /fix_android_qmake_conf.patch && \
patch -p1 -i $( $( package) _patch_dir) /fix_android_jni_static.patch && \
2021-03-21 16:50:25 +01:00
patch -p1 -i $( $( package) _patch_dir) /fix_android_pch.patch && \
2020-09-04 02:23:19 +02:00
patch -p1 -i $( $( package) _patch_dir) /no-xlib.patch && \
2021-11-24 16:00:43 +01:00
patch -p1 -i $( $( package) _patch_dir) /dont_hardcode_x86_64.patch && \
2021-11-25 05:02:50 +01:00
patch -p1 -i $( $( package) _patch_dir) /fix_lib_paths.patch && \
2020-09-04 02:23:19 +02:00
patch -p1 -i $( $( package) _patch_dir) /fix_limits_header.patch && \
2022-04-26 17:06:53 +02:00
patch -p1 -i $( $( package) _patch_dir) /fix_montery_include.patch && \
2022-02-20 23:59:29 +01:00
patch -p1 -i $( $( package) _patch_dir) /glibc_compatibility.patch && \
2021-04-06 00:59:11 +02:00
patch -p1 -i $( $( package) _patch_dir) /qtbase-moc-ignore-gcc-macro.patch && \
2023-06-27 20:51:37 +02:00
patch -p1 -i $( $( package) _patch_dir) /fast_fixed_dtoa_no_optimize.patch && \
2014-07-23 07:31:30 +02:00
mkdir -p qtbase/mkspecs/macx-clang-linux && \
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ && \
cp -f $( $( package) _patch_dir) /mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
2018-07-17 13:06:41 +02:00
cp -r qtbase/mkspecs/linux-arm-gnueabi-g++ qtbase/mkspecs/bitcoin-linux-g++ && \
2018-07-25 12:59:08 +02:00
sed -i.old " s/arm-linux-gnueabi-/ $( host) -/g " qtbase/mkspecs/bitcoin-linux-g++/qmake.conf && \
2017-01-30 09:00:51 +01:00
echo " !host_build: QMAKE_CFLAGS += $( $( package) _cflags) $( $( package) _cppflags) " >> qtbase/mkspecs/common/gcc-base.conf && \
echo " !host_build: QMAKE_CXXFLAGS += $( $( package) _cxxflags) $( $( package) _cppflags) " >> qtbase/mkspecs/common/gcc-base.conf && \
echo " !host_build: QMAKE_LFLAGS += $( $( package) _ldflags) " >> qtbase/mkspecs/common/gcc-base.conf && \
2021-11-25 05:02:50 +01:00
sed -i.old " s|QMAKE_CC = \$ $$ $\$ $$ ${ CROSS_COMPILE } clang|QMAKE_CC = $( $( package) _cc) | " qtbase/mkspecs/common/clang.conf && \
sed -i.old " s|QMAKE_CXX = \$ $$ $\$ $$ ${ CROSS_COMPILE } clang++|QMAKE_CXX = $( $( package) _cxx) | " qtbase/mkspecs/common/clang.conf && \
Merge #15277: contrib: Enable building in Guix containers
751549b52a9a4cd27389d807ae67f02bbb39cd7f contrib: guix: Additional clarifications re: substitutes (Carl Dong)
cd3e947f50db7cfe05c05b368c25742193729a62 contrib: guix: Various improvements. (Carl Dong)
8dff3e48a9e03299468ed3b342642f01f70da9db contrib: guix: Clarify SOURCE_DATE_EPOCH. (Carl Dong)
3e80ec3ea9691c7c89173de922a113e643fe976b contrib: Add deterministic Guix builds. (Carl Dong)
Pull request description:
~~**This post is kept updated as this project progresses. Use this [latest update link](https://github.com/bitcoin/bitcoin/pull/15277#issuecomment-497303718) to see what's new.**~~
Please read the `README.md`.
-----
### Guix Introduction
This PR enables building bitcoin in Guix containers. [Guix](https://www.gnu.org/software/guix/manual/en/html_node/Features.html) is a transactional package manager much like Nix, but unlike Nix, it has more of a focus on [bootstrappability](https://www.gnu.org/software/guix/manual/en/html_node/Bootstrapping.html) and [reproducibility](https://www.gnu.org/software/guix/blog/tags/reproducible-builds/) which are attractive for security-sensitive projects like bitcoin.
### Guix Build Walkthrough
Please read the `README.md`.
[Old instructions no. 4](https://github.com/bitcoin/bitcoin/pull/15277#issuecomment-497303718)
[Old instructions no. 3](https://github.com/bitcoin/bitcoin/pull/15277#issuecomment-493827011)
[Old instructions no. 2](https://github.com/bitcoin/bitcoin/pull/15277#issuecomment-471658439)
<details>
<summary>Old instructions no. 1</summary>
In this PR, we define a Guix [manifest](https://www.gnu.org/software/guix/manual/en/html_node/Invoking-guix-package.html#profile_002dmanifest) in `contrib/guix/manifest.scm`, which declares what packages we want in our environment.
We can then invoke
```
guix environment --manifest=contrib/guix/manifest.scm --container --pure --no-grafts --no-substitutes
```
To have Guix:
1. Build an environment containing the packages we defined in our `contrib/guix/manifest.scm` manifest from the Guix bootstrap binaries (see [bootstrappability](https://www.gnu.org/software/guix/manual/en/html_node/Bootstrapping.html) for more details).
2. Start a container with that environment that has no network access, and no access to the host's filesystem except to the `pwd` that it was started in.
3. Drop you into a shell in that container.
> Note: if you don't want to wait hours for Guix to build the entire world from scratch, you can eliminate the `--no-substitutes` option to have Guix download from available binary sources. Note that this convenience doesn't necessarily compromise your security, as you can check that a package was built correctly after the fact using `guix build --check <packagename>`
Therefore, we can perform a build of bitcoin much like in Gitian by invoking the following:
```
make -C depends -j"$(nproc)" download && \
cat contrib/guix/build.sh | guix environment --manifest=contrib/guix/manifest.scm --container --pure --no-grafts --no-substitutes
```
We don't include `make -C depends -j"$(nproc)" download` inside `contrib/guix/build.sh` because `contrib/guix/build.sh` is run inside the container, which has no network access (which is a good thing).
</details>
### Rationale
I believe that this represents a substantial improvement for the "supply chain security" of bitcoin because:
1. We no longer have to rely on Ubuntu for our build environment for our releases ([oh the horror](https://github.com/bitcoin/bitcoin/blob/72bd4ab867e3be0d8410403d9641c08288d343e3/contrib/gitian-descriptors/gitian-linux.yml#L10)), because Guix builds everything about the container, we can perform this on almost any Linux distro/system.
2. It is now much easier to determine what trusted binaries are in our supply chain, and even make a nice visualization! (see [bootstrappability](https://www.gnu.org/software/guix/manual/en/html_node/Bootstrapping.html)).
3. There is active effort among Guix folks to minimize the number of trusted binaries even further. OriansJ's [stage0](https://github.com/oriansj/stage0), and janneke's [Mes](https://www.gnu.org/software/mes/) all aim to achieve [reduced binary boostrap](http://joyofsource.com/reduced-binary-seed-bootstrap.html) for Guix. In fact, I believe if OriansJ gets his way, we will end up some day with only a single trusted binary: hex0 (a ~500 byte self-hosting hex assembler).
### Steps to Completion
- [x] Successfully build bitcoin inside the Guix environment
- [x] Make `check-symbols` pass
- [x] Do the above but without nasty hacks
- [x] Solve some of the more innocuous hacks
- [ ] Make it cross-compile (HELP WANTED HERE)
- [x] Linux
- [x] x86_64-linux-gnu
- [x] i686-linux-gnu
- [x] aarch64-linux-gnu
- [x] arm-linux-gnueabihf
- [x] riscv64-linux-gnu
- [ ] OS X
- [ ] x86_64-apple-darwin14
- [ ] Windows
- [ ] x86_64-w64-mingw32
- [ ] Maybe make importer for depends syntax
- [ ] Document build process for future releases
- [ ] Extra: Pin the revision of Guix that we build with with Guix [inferiors](https://www.gnu.org/software/guix/manual/en/html_node/Inferiors.html)
### Help Wanted
[Old content no. 3](https://github.com/bitcoin/bitcoin/pull/15277#issuecomment-483318210)
[Old content no. 2](https://github.com/bitcoin/bitcoin/pull/15277#issuecomment-471658439)
<details>
<summary>Old content no. 1</summary>
As of now, the command described above to perform a build of bitcoin a lot like Gitian works, but fails at the `check-symbols` stage. This is because a few dynamic libraries are linked in that shouldn't be.
Here's what `ldd src/bitcoind` looks like when built in a Guix container:
```
linux-vdso.so.1 (0x00007ffcc2d90000)
libdl.so.2 => /gnu/store/h90vnqw0nwd0hhm1l5dgxsdrigddfmq4-glibc-2.28/lib/libdl.so.2 (0x00007fb7eda09000)
librt.so.1 => /gnu/store/h90vnqw0nwd0hhm1l5dgxsdrigddfmq4-glibc-2.28/lib/librt.so.1 (0x00007fb7ed9ff000)
libstdc++.so.6 => /gnu/store/4sqps8dczv3g7rwbdibfz6rf5jlk7w90-gcc-5.5.0-lib/lib/libstdc++.so.6 (0x00007fb7ed87c000)
libpthread.so.0 => /gnu/store/h90vnqw0nwd0hhm1l5dgxsdrigddfmq4-glibc-2.28/lib/libpthread.so.0 (0x00007fb7ed85b000)
libm.so.6 => /gnu/store/h90vnqw0nwd0hhm1l5dgxsdrigddfmq4-glibc-2.28/lib/libm.so.6 (0x00007fb7ed6da000)
libgcc_s.so.1 => /gnu/store/4sqps8dczv3g7rwbdibfz6rf5jlk7w90-gcc-5.5.0-lib/lib/libgcc_s.so.1 (0x00007fb7ed6bf000)
libc.so.6 => /gnu/store/h90vnqw0nwd0hhm1l5dgxsdrigddfmq4-glibc-2.28/lib/libc.so.6 (0x00007fb7ed506000)
/gnu/store/h90vnqw0nwd0hhm1l5dgxsdrigddfmq4-glibc-2.28/lib/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fb7ee3a0000)
```
And here's what it looks in one of our releases:
```
linux-vdso.so.1 (0x00007ffff52cd000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f87726b4000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007f87726aa000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007f8772525000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f877250b000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f8772347000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f8773392000)
```
~~I suspect it is because my script does not apply the gitian-input patches [described in the release process](https://github.com/bitcoin/bitcoin/blob/master/doc/release-process.md#fetch-and-create-inputs-first-time-or-when-dependency-versions-change) but there is no description as to how these patches are applied.~~ It might also be something else entirely.
Edit: It is something else. It appears that the gitian inputs are only used by [`gitian-win-signer.yml`](https://github.com/bitcoin/bitcoin/blob/d6e700e40f861ddd6743f4d13f0d6f6bc19093c2/contrib/gitian-descriptors/gitian-win-signer.yml#L14)
</details>
### How to Help
1. Install Guix on your distro either [from source](https://www.gnu.org/software/guix/manual/en/html_node/Requirements.html) or perform a [binary installation](https://www.gnu.org/software/guix/manual/en/html_node/Binary-Installation.html#Binary-Installation)
2. Try out my branch and the command described above!
ACKs for top commit:
MarcoFalke:
Thanks for the replies. ACK 751549b52a9a4cd27389d807ae67f02bbb39cd7f
laanwj:
ACK 751549b52a9a4cd27389d807ae67f02bbb39cd7f
Tree-SHA512: 50e6ab58c6bda9a67125b6271daf7eff0ca57d0efa8941ed3cd951e5bf78b31552fc5e537b1e1bcf2d3cc918c63adf19d685aa117a0f851024dc67e697890a8d
2019-07-12 19:23:30 +02:00
sed -i.old "s/error(\"failed to parse default search paths from compiler output\")/\!darwin: error(\"failed to parse default search paths from compiler output\")/g" qtbase/mkspecs/features/toolchain.prf && \
sed -i.old "s/LIBRARY_PATH/(CROSS_)?\0/g" qtbase/mkspecs/features/toolchain.prf
2014-07-23 07:31:30 +02:00
e n d e f
d e f i n e $( package ) _ c o n f i g _ c m d s
2020-12-18 03:23:04 +01:00
export PKG_CONFIG_SYSROOT_DIR = / && \
2014-07-23 07:31:30 +02:00
export PKG_CONFIG_LIBDIR = $( host_prefix) /lib/pkgconfig && \
2021-11-28 19:56:54 +01:00
export QT_MAC_SDK_NO_VERSION_CHECK = 1 && \
2020-12-25 03:54:23 +01:00
cd qtbase && \
2021-06-10 05:02:27 +02:00
./configure -top-level $( $( package) _config_opts)
2014-07-23 07:31:30 +02:00
e n d e f
d e f i n e $( package ) _ b u i l d _ c m d s
2021-06-10 05:02:27 +02:00
$( MAKE)
2014-07-23 07:31:30 +02:00
e n d e f
d e f i n e $( package ) _ s t a g e _ c m d s
2020-12-25 03:54:23 +01:00
$( MAKE) -C qtbase/src INSTALL_ROOT = $( $( package) _staging_dir) $( addsuffix -install_subtargets,$( addprefix sub-,$( $( package) _qt_libs) ) ) && \
2021-06-10 05:02:27 +02:00
$( MAKE) -C qttools/src/linguist INSTALL_ROOT = $( $( package) _staging_dir) $( addsuffix -install_subtargets,$( addprefix sub-,$( $( package) _linguist_tools) ) ) && \
2020-12-16 13:58:59 +01:00
$( MAKE) -C qttranslations INSTALL_ROOT = $( $( package) _staging_dir) install_subtargets
2014-07-23 07:31:30 +02:00
e n d e f
d e f i n e $( package ) _ p o s t p r o c e s s _ c m d s
2015-07-24 01:07:03 +02:00
rm -rf native/mkspecs/ native/lib/ lib/cmake/ && \
2021-06-10 05:02:27 +02:00
rm -f lib/lib*.la
2014-07-23 07:31:30 +02:00
e n d e f