Skip to content

Commit

Permalink
Revert "Merge dashpay#6383: backport: merge bitcoin#28370, bitcoin#28759
Browse files Browse the repository at this point in the history
  • Loading branch information
knst committed Dec 26, 2024
1 parent f2ba16f commit 09af7b7
Show file tree
Hide file tree
Showing 7 changed files with 341 additions and 78 deletions.
3 changes: 1 addition & 2 deletions contrib/guix/guix-build
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ mkdir -p "$VERSION_BASE"
################

# Default to building for all supported HOSTs (overridable by environment)
# powerpc64le-linux-gnu currently disabled due non-determinism issues across build arches.
export HOSTS="${HOSTS:-x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu riscv64-linux-gnu powerpc64-linux-gnu
export HOSTS="${HOSTS:-x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu riscv64-linux-gnu powerpc64-linux-gnu powerpc64le-linux-gnu
x86_64-w64-mingw32
x86_64-apple-darwin arm64-apple-darwin}"

Expand Down
11 changes: 2 additions & 9 deletions contrib/guix/libexec/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ store_path() {
# Set environment variables to point the NATIVE toolchain to the right
# includes/libs
NATIVE_GCC="$(store_path gcc-toolchain)"
NATIVE_GCC_STATIC="$(store_path gcc-toolchain static)"

unset LIBRARY_PATH
unset CPATH
Expand All @@ -71,20 +72,12 @@ unset CPLUS_INCLUDE_PATH
unset OBJC_INCLUDE_PATH
unset OBJCPLUS_INCLUDE_PATH

export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC_STATIC}/lib"
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" ;;
*mingw*) export LIBRARY_PATH="${NATIVE_GCC}/lib" ;;
*)
NATIVE_GCC_STATIC="$(store_path gcc-toolchain static)"
export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC_STATIC}/lib"
;;
esac

# Set environment variables to point the CROSS toolchain to the right
# includes/libs for $HOST
case "$HOST" in
Expand Down
2 changes: 1 addition & 1 deletion contrib/guix/libexec/prelude.bash
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fi
time-machine() {
# shellcheck disable=SC2086
guix time-machine --url=https://git.savannah.gnu.org/git/guix.git \
--commit=f0bb724211872cd6158fce6162e0b8c73efed126 \
--commit=160f78a4d92205df986ed9efcce7d3aac188cb24 \
--cores="$JOBS" \
--keep-failed \
--fallback \
Expand Down
90 changes: 46 additions & 44 deletions contrib/guix/manifest.scm
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,21 @@
(gnu packages gawk)
(gnu packages gcc)
((gnu packages installers) #:select (nsis-x86_64))
((gnu packages linux) #:select (linux-libre-headers-6.1 util-linux))
((gnu packages linux) #:select (linux-libre-headers-5.15 util-linux))
(gnu packages llvm)
(gnu packages mingw)
(gnu packages moreutils)
(gnu packages pkg-config)
((gnu packages python) #:select (python-minimal))
((gnu packages python-build) #:select (python-tomli))
((gnu packages python-crypto) #:select (python-asn1crypto))
((gnu packages python-xyz) #:select (python-altgraph))
((gnu packages python-web) #:select (python-requests))
((gnu packages tls) #:select (openssl))
((gnu packages version-control) #:select (git-minimal))
(guix build-system cmake)
(guix build-system gnu)
(guix build-system python)
(guix build-system trivial)
(guix download)
(guix gexp)
(guix git-download)
((guix licenses) #:prefix license:)
Expand Down Expand Up @@ -95,19 +94,8 @@ chain for " target " development."))
(home-page (package-home-page xgcc))
(license (package-license xgcc)))))

(define base-gcc
(package
(inherit gcc-12) ;; 12.3.0
(version "12.4.0")
(source (origin
(method url-fetch)
(uri (string-append "mirror://gnu/gcc/gcc-"
version "/gcc-" version ".tar.xz"))
(sha256
(base32
"0xcida8l2wykvvzvpcrcn649gj0ijn64gwxbplacpg6c0hk6akvh"))))))

(define base-linux-kernel-headers linux-libre-headers-6.1)
(define base-gcc gcc-10)
(define base-linux-kernel-headers linux-libre-headers-5.15)

(define* (make-bitcoin-cross-toolchain target
#:key
Expand All @@ -125,19 +113,13 @@ desirable for building Dash Core release binaries."

(define (gcc-mingw-patches gcc)
(package-with-extra-patches gcc
(search-our-patches "gcc-remap-guix-store.patch")))

(define (binutils-mingw-patches binutils)
(package-with-extra-patches binutils
(search-our-patches "binutils-unaligned-default.patch")))
(search-our-patches "gcc-remap-guix-store.patch"
"vmov-alignment.patch")))

(define (make-mingw-pthreads-cross-toolchain target)
"Create a cross-compilation toolchain package for TARGET"
(let* ((xbinutils (binutils-mingw-patches (cross-binutils target)))
(machine (substring target 0 (string-index target #\-)))
(pthreads-xlibc (make-mingw-w64 machine
#:xgcc (cross-gcc target #:xgcc (gcc-mingw-patches base-gcc))
#:with-winpthreads? #t))
(let* ((xbinutils (cross-binutils target))
(pthreads-xlibc mingw-w64-x86_64-winpthreads)
(pthreads-xgcc (cross-gcc target
#:xgcc (gcc-mingw-patches mingw-w64-base-gcc)
#:xbinutils xbinutils
Expand All @@ -161,6 +143,10 @@ chain for " target " development."))
(home-page (package-home-page pthreads-xgcc))
(license (package-license pthreads-xgcc)))))

(define (make-nsis-for-gcc-10 base-nsis)
(package-with-extra-patches base-nsis
(search-our-patches "nsis-gcc-10-memmove.patch")))

;; While LIEF is packaged in Guix, we maintain our own package,
;; to simplify building, and more easily apply updates.
;; Moreover, the Guix's package uses cmake, which caused build
Expand Down Expand Up @@ -396,6 +382,29 @@ certificates or paths. Supports various options, including: validation at a
specific moment in time, whitelisting and revocation checks.")
(license license:expat))))

(define-public python-altgraph
(package
(name "python-altgraph")
(version "0.17")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ronaldoussoren/altgraph")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"09sm4srvvkw458pn48ga9q7ykr4xlz7q8gh1h9w7nxpf001qgpwb"))))
(build-system python-build-system)
(home-page "https://github.com/ronaldoussoren/altgraph")
(synopsis "Python graph (network) package")
(description "altgraph is a fork of graphlib: a graph (network) package for
constructing graphs, BFS and DFS traversals, topological sort, shortest paths,
etc. with graphviz output.")
(license license:expat)))


(define-public python-macholib
(package
(name "python-macholib")
Expand Down Expand Up @@ -445,7 +454,7 @@ and endian independent.")
(license license:expat)))

(define-public python-signapple
(let ((commit "7a96b4171a360abf0f0f56e499f8f9ed2116280d"))
(let ((commit "8a945a2e7583be2665cf3a6a89d665b70ecd1ab6"))
(package
(name "python-signapple")
(version (git-version "0.1" "1" commit))
Expand All @@ -458,13 +467,14 @@ and endian independent.")
(file-name (git-file-name name commit))
(sha256
(base32
"0aa4k180jnpal15yhncnm3g3z9gzmi7qb25q5l0kaj444a1p2pm4"))))
"0fr1hangvfyiwflca6jg5g8zvg3jc9qr7vd2c12ff89pznf38dlg"))))
(build-system python-build-system)
(propagated-inputs
`(("python-asn1crypto" ,python-asn1crypto)
("python-oscrypto" ,python-oscrypto)
("python-certvalidator" ,python-certvalidator)
("python-elfesteem" ,python-elfesteem)
("python-requests" ,python-requests)
("python-macholib" ,python-macholib)))
;; There are no tests, but attempting to run python setup.py test leads to
;; problems, just disable the test
Expand Down Expand Up @@ -502,8 +512,6 @@ inspecting signatures in Mach-O binaries.")
(list "--enable-initfini-array=yes",
"--enable-default-ssp=yes",
"--enable-default-pie=yes",
"--enable-standard-branch-protection=yes",
"--enable-cet=yes",
building-on)))
((#:phases phases)
`(modify-phases ,phases
Expand Down Expand Up @@ -585,6 +593,9 @@ inspecting signatures in Mach-O binaries.")
automake
pkg-config
bison
;; Native GCC 10 toolchain
gcc-toolchain-10
(list gcc-toolchain-10 "static")
;; Scripting
python-minimal ;; (3.10)
;; Git
Expand All @@ -593,23 +604,14 @@ inspecting signatures in Mach-O binaries.")
python-lief)
(let ((target (getenv "HOST")))
(cond ((string-suffix? "-mingw32" target)
(list ;; Native GCC 12 toolchain
gcc-toolchain-12
zip
;; Windows
(list zip
(make-mingw-pthreads-cross-toolchain "x86_64-w64-mingw32")
nsis-x86_64
(make-nsis-for-gcc-10 nsis-x86_64)
nss-certs
osslsigncode))
((string-contains target "-linux-")
(list ;; Native GCC 12 toolchain
gcc-toolchain-12
(list gcc-toolchain-12 "static")
(make-bitcoin-cross-toolchain target)))
(list (make-bitcoin-cross-toolchain target)))
((string-contains target "darwin")
(list ;; Native GCC 11 toolchain
gcc-toolchain-11
binutils
clang-toolchain-10
python-signapple
xorriso))
(list clang-toolchain-10 binutils xorriso python-signapple))
(else '())))))
22 changes: 0 additions & 22 deletions contrib/guix/patches/binutils-unaligned-default.patch

This file was deleted.

23 changes: 23 additions & 0 deletions contrib/guix/patches/nsis-gcc-10-memmove.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
commit f6df41524e703dc471e283e566a48e05a735b7f2
Author: Anders <[email protected]>
Date: Sat Jun 27 23:18:45 2020 +0000

Don't let GCC 10 generate memmove calls (bug #1248)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7189 212acab6-be3b-0410-9dea-997c60f758d6

diff --git a/SCons/Config/gnu b/SCons/Config/gnu
index bfcb362d..21fa446b 100644
--- a/SCons/Config/gnu
+++ b/SCons/Config/gnu
@@ -103,6 +103,10 @@ stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no standard libraries
stub_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align
stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file

+conf = FlagsConfigure(stub_env)
+conf.CheckCompileFlag('-fno-tree-loop-distribute-patterns') # GCC 10: Don't generate msvcrt!memmove calls (bug #1248)
+conf.Finish()
+
stub_uenv = stub_env.Clone()
stub_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])

Loading

0 comments on commit 09af7b7

Please sign in to comment.