2022-06-02 12:50:33 +00:00
|
|
|
(use-modules (gnu)
|
|
|
|
(gnu packages)
|
|
|
|
(gnu packages autotools)
|
2022-12-21 15:15:22 +00:00
|
|
|
(gnu packages assembly)
|
2022-06-02 12:50:33 +00:00
|
|
|
(gnu packages base)
|
|
|
|
(gnu packages bash)
|
|
|
|
(gnu packages bison)
|
2023-05-27 19:26:43 +00:00
|
|
|
(gnu packages build-tools)
|
2022-06-02 12:50:33 +00:00
|
|
|
(gnu packages certs)
|
|
|
|
(gnu packages check)
|
|
|
|
(gnu packages cmake)
|
|
|
|
(gnu packages commencement)
|
|
|
|
(gnu packages compression)
|
|
|
|
(gnu packages cross-base)
|
|
|
|
(gnu packages curl)
|
2022-12-21 15:15:22 +00:00
|
|
|
(gnu packages elf)
|
2022-06-02 12:50:33 +00:00
|
|
|
(gnu packages file)
|
|
|
|
(gnu packages gawk)
|
|
|
|
(gnu packages gcc)
|
|
|
|
(gnu packages gettext)
|
|
|
|
(gnu packages gnome)
|
|
|
|
(gnu packages gperf)
|
|
|
|
(gnu packages installers)
|
2023-03-24 03:12:12 +00:00
|
|
|
(gnu packages libusb)
|
2022-06-02 12:50:33 +00:00
|
|
|
(gnu packages linux)
|
|
|
|
(gnu packages llvm)
|
|
|
|
(gnu packages mingw)
|
|
|
|
(gnu packages moreutils)
|
2023-05-27 19:26:43 +00:00
|
|
|
(gnu packages ninja)
|
2022-06-02 12:50:33 +00:00
|
|
|
(gnu packages perl)
|
|
|
|
(gnu packages pkg-config)
|
|
|
|
(gnu packages python)
|
|
|
|
(gnu packages python-crypto)
|
|
|
|
(gnu packages python-web)
|
|
|
|
(gnu packages shells)
|
|
|
|
(gnu packages tls)
|
|
|
|
(gnu packages version-control)
|
2023-03-29 13:17:12 +00:00
|
|
|
(gnu packages xorg)
|
2023-06-29 18:36:16 +00:00
|
|
|
(gnu packages zig)
|
2022-06-02 12:50:33 +00:00
|
|
|
(guix build-system gnu)
|
2022-12-22 12:22:26 +00:00
|
|
|
(guix build-system perl)
|
2022-06-02 12:50:33 +00:00
|
|
|
(guix build-system python)
|
|
|
|
(guix build-system trivial)
|
|
|
|
(guix download)
|
|
|
|
(guix gexp)
|
|
|
|
(guix git-download)
|
|
|
|
((guix licenses) #:prefix license:)
|
|
|
|
(guix packages)
|
|
|
|
(guix profiles)
|
|
|
|
(guix utils))
|
|
|
|
|
|
|
|
(define-syntax-rule (search-our-patches file-name ...)
|
|
|
|
"Return the list of absolute file names corresponding to each
|
|
|
|
FILE-NAME found in ./patches relative to the current file."
|
|
|
|
(parameterize
|
|
|
|
((%patch-path (list (string-append (dirname (current-filename)) "/patches"))))
|
|
|
|
(list (search-patch file-name) ...)))
|
|
|
|
|
2023-09-07 08:23:04 +00:00
|
|
|
(define building-on (string-append "--build=" (list-ref (string-split (%current-system) #\-) 0) "-guix-linux-gnu"))
|
2023-09-07 07:31:50 +00:00
|
|
|
|
2022-06-02 12:50:33 +00:00
|
|
|
(define (make-cross-toolchain target
|
|
|
|
base-gcc-for-libc
|
|
|
|
base-kernel-headers
|
|
|
|
base-libc
|
|
|
|
base-gcc)
|
|
|
|
"Create a cross-compilation toolchain package for TARGET"
|
|
|
|
(let* ((xbinutils (cross-binutils target))
|
|
|
|
;; 1. Build a cross-compiling gcc without targeting any libc, derived
|
|
|
|
;; from BASE-GCC-FOR-LIBC
|
2023-09-07 08:29:48 +00:00
|
|
|
(xgcc-sans-libc (cross-gcc target
|
2022-06-02 12:50:33 +00:00
|
|
|
#:xgcc base-gcc-for-libc
|
2023-09-07 08:29:48 +00:00
|
|
|
#:xbinutils xbinutils))
|
2022-06-02 12:50:33 +00:00
|
|
|
;; 2. Build cross-compiled kernel headers with XGCC-SANS-LIBC, derived
|
|
|
|
;; from BASE-KERNEL-HEADERS
|
|
|
|
(xkernel (cross-kernel-headers target
|
2023-09-07 08:52:18 +00:00
|
|
|
#:linux-headers base-kernel-headers
|
|
|
|
#:xgcc xgcc-sans-libc
|
|
|
|
#:xbinutils xbinutils))
|
2022-06-02 12:50:33 +00:00
|
|
|
;; 3. Build a cross-compiled libc with XGCC-SANS-LIBC and XKERNEL,
|
|
|
|
;; derived from BASE-LIBC
|
2023-09-07 08:29:48 +00:00
|
|
|
(xlibc (cross-libc target
|
2023-09-07 08:52:18 +00:00
|
|
|
#:libc base-libc
|
|
|
|
#:xgcc xgcc-sans-libc
|
|
|
|
#:xbinutils xbinutils
|
|
|
|
#:xheaders xkernel))
|
2022-06-02 12:50:33 +00:00
|
|
|
;; 4. Build a cross-compiling gcc targeting XLIBC, derived from
|
|
|
|
;; BASE-GCC
|
2023-09-07 08:29:48 +00:00
|
|
|
(xgcc (cross-gcc target
|
2022-06-02 12:50:33 +00:00
|
|
|
#:xgcc base-gcc
|
|
|
|
#:xbinutils xbinutils
|
2023-09-07 08:29:48 +00:00
|
|
|
#:libc xlibc)))
|
2022-06-02 12:50:33 +00:00
|
|
|
;; Define a meta-package that propagates the resulting XBINUTILS, XLIBC, and
|
|
|
|
;; XGCC
|
|
|
|
(package
|
|
|
|
(name (string-append target "-toolchain"))
|
|
|
|
(version (package-version xgcc))
|
|
|
|
(source #f)
|
|
|
|
(build-system trivial-build-system)
|
|
|
|
(arguments '(#:builder (begin (mkdir %output) #t)))
|
|
|
|
(propagated-inputs
|
|
|
|
`(("binutils" ,xbinutils)
|
|
|
|
("libc" ,xlibc)
|
|
|
|
("libc:static" ,xlibc "static")
|
|
|
|
("gcc" ,xgcc)
|
|
|
|
("gcc-lib" ,xgcc "lib")))
|
|
|
|
(synopsis (string-append "Complete GCC tool chain for " target))
|
|
|
|
(description (string-append "This package provides a complete GCC tool
|
|
|
|
chain for " target " development."))
|
|
|
|
(home-page (package-home-page xgcc))
|
|
|
|
(license (package-license xgcc)))))
|
|
|
|
|
|
|
|
(define base-gcc gcc-10)
|
2023-11-16 13:22:49 +00:00
|
|
|
(define base-linux-kernel-headers linux-libre-headers-6.1)
|
2022-06-02 12:50:33 +00:00
|
|
|
|
|
|
|
(define* (make-bitcoin-cross-toolchain target
|
|
|
|
#:key
|
2023-09-07 08:29:48 +00:00
|
|
|
(base-gcc-for-libc linux-base-gcc)
|
2022-06-02 12:50:33 +00:00
|
|
|
(base-kernel-headers base-linux-kernel-headers)
|
2023-09-07 08:29:48 +00:00
|
|
|
(base-libc glibc-2.27)
|
|
|
|
(base-gcc linux-base-gcc))
|
2022-06-02 12:50:33 +00:00
|
|
|
"Convenience wrapper around MAKE-CROSS-TOOLCHAIN with default values
|
|
|
|
desirable for building Feather Wallet release binaries."
|
|
|
|
(make-cross-toolchain target
|
|
|
|
base-gcc-for-libc
|
|
|
|
base-kernel-headers
|
|
|
|
base-libc
|
|
|
|
base-gcc))
|
|
|
|
|
2023-09-07 08:23:04 +00:00
|
|
|
(define (gcc-mingw-patches gcc)
|
|
|
|
(package-with-extra-patches gcc
|
|
|
|
(search-our-patches "gcc-remap-guix-store.patch"
|
2023-09-07 08:56:16 +00:00
|
|
|
"vmov-alignment.patch")))
|
2022-06-02 12:50:33 +00:00
|
|
|
|
|
|
|
(define (make-mingw-pthreads-cross-toolchain target)
|
|
|
|
"Create a cross-compilation toolchain package for TARGET"
|
|
|
|
(let* ((xbinutils (cross-binutils target))
|
2023-10-06 19:05:59 +00:00
|
|
|
(pthreads-xlibc mingw-w64-x86_64-winpthreads)
|
2023-09-07 08:23:04 +00:00
|
|
|
(pthreads-xgcc (cross-gcc target
|
|
|
|
#:xgcc (gcc-mingw-patches mingw-w64-base-gcc)
|
2022-06-02 12:50:33 +00:00
|
|
|
#:xbinutils xbinutils
|
2023-09-07 08:23:04 +00:00
|
|
|
#:libc pthreads-xlibc)))
|
2022-06-02 12:50:33 +00:00
|
|
|
;; Define a meta-package that propagates the resulting XBINUTILS, XLIBC, and
|
|
|
|
;; XGCC
|
|
|
|
(package
|
|
|
|
(name (string-append target "-posix-toolchain"))
|
|
|
|
(version (package-version pthreads-xgcc))
|
|
|
|
(source #f)
|
|
|
|
(build-system trivial-build-system)
|
|
|
|
(arguments '(#:builder (begin (mkdir %output) #t)))
|
|
|
|
(propagated-inputs
|
|
|
|
`(("binutils" ,xbinutils)
|
|
|
|
("libc" ,pthreads-xlibc)
|
|
|
|
("gcc" ,pthreads-xgcc)
|
|
|
|
("gcc-lib" ,pthreads-xgcc "lib")))
|
|
|
|
(synopsis (string-append "Complete GCC tool chain for " target))
|
|
|
|
(description (string-append "This package provides a complete GCC tool
|
|
|
|
chain for " target " development."))
|
|
|
|
(home-page (package-home-page pthreads-xgcc))
|
|
|
|
(license (package-license pthreads-xgcc)))))
|
|
|
|
|
2023-09-07 08:23:04 +00:00
|
|
|
(define-public mingw-w64-base-gcc
|
|
|
|
(package
|
|
|
|
(inherit base-gcc)
|
|
|
|
(arguments
|
|
|
|
(substitute-keyword-arguments (package-arguments base-gcc)
|
|
|
|
((#:configure-flags flags)
|
|
|
|
`(append ,flags
|
|
|
|
;; https://gcc.gnu.org/install/configure.html
|
|
|
|
(list "--enable-threads=posix",
|
|
|
|
building-on)))))))
|
|
|
|
|
2023-09-07 08:29:48 +00:00
|
|
|
(define-public linux-base-gcc
|
|
|
|
(package
|
|
|
|
(inherit base-gcc)
|
|
|
|
(arguments
|
|
|
|
(substitute-keyword-arguments (package-arguments base-gcc)
|
|
|
|
((#:configure-flags flags)
|
|
|
|
`(append ,flags
|
|
|
|
;; https://gcc.gnu.org/install/configure.html
|
|
|
|
(list "--enable-initfini-array=yes",
|
|
|
|
"--enable-default-ssp=yes",
|
|
|
|
"--enable-default-pie=yes",
|
|
|
|
building-on)))
|
|
|
|
((#:phases phases)
|
|
|
|
`(modify-phases ,phases
|
|
|
|
;; Given a XGCC package, return a modified package that replace each instance of
|
|
|
|
;; -rpath in the default system spec that's inserted by Guix with -rpath-link
|
|
|
|
(add-after 'pre-configure 'replace-rpath-with-rpath-link
|
|
|
|
(lambda _
|
|
|
|
(substitute* (cons "gcc/config/rs6000/sysv4.h"
|
|
|
|
(find-files "gcc/config"
|
|
|
|
"^gnu-user.*\\.h$"))
|
|
|
|
(("-rpath=") "-rpath-link="))
|
|
|
|
#t))))))))
|
|
|
|
|
2023-02-27 13:39:31 +00:00
|
|
|
(define-public glibc-2.27
|
2022-06-02 12:50:33 +00:00
|
|
|
(package
|
|
|
|
(inherit glibc-2.31)
|
|
|
|
(version "2.27")
|
|
|
|
(source (origin
|
|
|
|
(method git-fetch)
|
|
|
|
(uri (git-reference
|
|
|
|
(url "https://sourceware.org/git/glibc.git")
|
2023-02-27 13:39:31 +00:00
|
|
|
(commit "73886db6218e613bd6d4edf529f11e008a6c2fa6")))
|
|
|
|
(file-name (git-file-name "glibc" "73886db6218e613bd6d4edf529f11e008a6c2fa6"))
|
2022-06-02 12:50:33 +00:00
|
|
|
(sha256
|
|
|
|
(base32
|
2023-02-27 13:39:31 +00:00
|
|
|
"0azpb9cvnbv25zg8019rqz48h8i2257ngyjg566dlnp74ivrs9vq"))
|
2023-09-07 08:15:52 +00:00
|
|
|
(patches (search-our-patches "glibc-2.27-riscv64-Use-__has_include-to-include-asm-syscalls.h.patch"
|
2023-02-27 13:39:31 +00:00
|
|
|
"glibc-2.27-fcommon.patch"
|
2023-09-07 08:29:48 +00:00
|
|
|
"glibc-2.27-no-librt.patch"))))
|
|
|
|
(arguments
|
|
|
|
(substitute-keyword-arguments (package-arguments glibc)
|
|
|
|
((#:configure-flags flags)
|
|
|
|
`(append ,flags
|
|
|
|
;; https://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html
|
|
|
|
(list "--enable-stack-protector=all",
|
|
|
|
"--enable-bind-now",
|
|
|
|
"--disable-werror",
|
|
|
|
building-on)))
|
|
|
|
((#:phases phases)
|
|
|
|
`(modify-phases ,phases
|
|
|
|
(add-before 'configure 'set-etc-rpc-installation-directory
|
|
|
|
(lambda* (#:key outputs #:allow-other-keys)
|
|
|
|
;; Install the rpc data base file under `$out/etc/rpc'.
|
|
|
|
;; Otherwise build will fail with "Permission denied."
|
|
|
|
(let ((out (assoc-ref outputs "out")))
|
|
|
|
(substitute* "sunrpc/Makefile"
|
|
|
|
(("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
|
|
|
|
(string-append out "/etc/rpc" suffix "\n"))
|
|
|
|
(("^install-others =.*$")
|
|
|
|
(string-append "install-others = " out "/etc/rpc\n"))))))))))))
|
2022-12-21 15:15:22 +00:00
|
|
|
|
2023-03-24 03:12:12 +00:00
|
|
|
(define-public ldid
|
|
|
|
(package
|
|
|
|
(name "ldid")
|
|
|
|
(version "v2.1.5-procursus7")
|
|
|
|
(source (origin
|
|
|
|
(method url-fetch)
|
|
|
|
(uri (string-append "https://github.com/ProcursusTeam/"
|
|
|
|
name "/archive/refs/tags/" version ".tar.gz"))
|
|
|
|
(sha256
|
|
|
|
(base32
|
|
|
|
"0ppzy4d9sl4m0sn8nk8wpi39qfimvka6h2ycr67y8r97y3363r04"))))
|
|
|
|
(build-system gnu-build-system)
|
|
|
|
(arguments
|
|
|
|
`(#:phases
|
|
|
|
(modify-phases %standard-phases
|
|
|
|
(delete 'configure)
|
|
|
|
(replace 'build (lambda _ (invoke "make")))
|
|
|
|
(delete 'check)
|
|
|
|
(replace 'install
|
|
|
|
(lambda* (#:key outputs #:allow-other-keys)
|
|
|
|
(let* ((out (assoc-ref outputs "out"))
|
|
|
|
(bin (string-append out "/bin")))
|
|
|
|
(install-file "ldid" bin)
|
|
|
|
#t)))
|
|
|
|
)))
|
|
|
|
(native-inputs (list pkg-config))
|
|
|
|
(inputs (list openssl libplist))
|
|
|
|
(home-page "https://github.com/ProcursusTeam/ldid")
|
|
|
|
(synopsis "Link Identity Editor.")
|
|
|
|
(description "Put real or fake signatures in a Mach-O.")
|
|
|
|
(license license:gpl3+)))
|
|
|
|
|
2022-06-02 12:50:33 +00:00
|
|
|
(packages->manifest
|
|
|
|
(append
|
|
|
|
(list ;; The Basics
|
|
|
|
bash
|
|
|
|
which
|
2023-03-30 08:40:28 +00:00
|
|
|
coreutils-minimal
|
2022-06-02 12:50:33 +00:00
|
|
|
util-linux
|
|
|
|
;; File(system) inspection
|
|
|
|
file
|
|
|
|
grep
|
|
|
|
diffutils
|
|
|
|
findutils
|
|
|
|
;; File transformation
|
|
|
|
patch
|
|
|
|
gawk
|
|
|
|
sed
|
|
|
|
moreutils
|
2022-12-21 15:15:22 +00:00
|
|
|
patchelf
|
2022-06-02 12:50:33 +00:00
|
|
|
;; Compression and archiving
|
|
|
|
tar
|
|
|
|
bzip2
|
|
|
|
gzip
|
|
|
|
xz
|
|
|
|
p7zip
|
2022-12-21 15:15:22 +00:00
|
|
|
zip
|
|
|
|
unzip
|
2022-06-02 12:50:33 +00:00
|
|
|
;; Build tools
|
|
|
|
gnu-make
|
|
|
|
libtool
|
|
|
|
autoconf-2.71
|
|
|
|
automake
|
|
|
|
pkg-config
|
|
|
|
bison
|
|
|
|
gperf
|
|
|
|
gettext-minimal
|
2022-12-21 15:15:22 +00:00
|
|
|
squashfs-tools
|
2023-03-30 08:40:28 +00:00
|
|
|
cmake-minimal
|
2023-05-27 19:26:43 +00:00
|
|
|
meson
|
|
|
|
ninja
|
2023-06-29 18:36:16 +00:00
|
|
|
zig
|
2022-06-02 12:50:33 +00:00
|
|
|
;; Native GCC 10 toolchain
|
|
|
|
gcc-toolchain-10
|
|
|
|
(list gcc-toolchain-10 "static")
|
|
|
|
;; Scripting
|
|
|
|
perl
|
2023-03-30 08:40:28 +00:00
|
|
|
python-minimal
|
2022-06-02 12:50:33 +00:00
|
|
|
;; Git
|
2023-03-30 08:40:28 +00:00
|
|
|
git-minimal
|
2023-03-29 13:17:12 +00:00
|
|
|
;; Xcb
|
|
|
|
xcb-util
|
|
|
|
xcb-util-cursor
|
|
|
|
xcb-util-image
|
|
|
|
xcb-util-keysyms
|
|
|
|
xcb-util-renderutil
|
|
|
|
xcb-util-wm
|
2022-12-21 15:15:22 +00:00
|
|
|
)
|
2022-06-02 12:50:33 +00:00
|
|
|
(let ((target (getenv "HOST")))
|
|
|
|
(cond ((string-suffix? "-mingw32" target)
|
|
|
|
;; Windows
|
2022-12-21 15:15:22 +00:00
|
|
|
(list (make-mingw-pthreads-cross-toolchain "x86_64-w64-mingw32")
|
2023-09-07 09:03:28 +00:00
|
|
|
nsis-x86_64))
|
2022-06-02 12:50:33 +00:00
|
|
|
((string-contains target "-linux-")
|
2023-03-24 15:40:37 +00:00
|
|
|
(list (make-bitcoin-cross-toolchain target)))
|
2022-06-02 12:50:33 +00:00
|
|
|
((string-contains target "darwin")
|
2023-10-03 18:16:09 +00:00
|
|
|
(list clang-toolchain-10 binutils ldid))
|
2022-06-02 12:50:33 +00:00
|
|
|
(else '())))))
|