summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2019-08-26 23:28:58 -0400
committerMark H Weaver <mhw@netris.org>2019-08-26 23:28:58 -0400
commit32e18e9b9471e863e5857a89683f358bfb91c157 (patch)
tree91c4bce594098a6913c24a4959efdfd51e0d1601
parent7a9f575660d1adabff0e3c95d97522edaf9c5f31 (diff)
parent9e6256ba0f32ab12d61c914a3fed879dac881762 (diff)
downloadguix-patches-32e18e9b9471e863e5857a89683f358bfb91c157.tar
guix-patches-32e18e9b9471e863e5857a89683f358bfb91c157.tar.gz
Merge branch 'wip-binaries'
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/make-bootstrap.scm216
-rw-r--r--gnu/packages/patches/bash-4.4-linux-pgrp-pipe.patch30
-rw-r--r--guix/build/make-bootstrap.scm72
4 files changed, 294 insertions, 25 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 484cb7d45c..a756316f77 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -699,6 +699,7 @@ dist_patch_DATA = \
%D%/packages/patches/avidemux-install-to-lib.patch \
%D%/packages/patches/awesome-reproducible-png.patch \
%D%/packages/patches/azr3.patch \
+ %D%/packages/patches/bash-4.4-linux-pgrp-pipe.patch \
%D%/packages/patches/bash-completion-directories.patch \
%D%/packages/patches/bastet-change-source-of-unordered_set.patch \
%D%/packages/patches/bazaar-CVE-2017-14176.patch \
diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index c6002eb63a..37bf4e9744 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -2,7 +2,8 @@
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2018, 2019 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -37,14 +38,18 @@
#:use-module (gnu packages libunistring)
#:use-module (gnu packages linux)
#:use-module (gnu packages hurd)
+ #:use-module (gnu packages mes)
#:use-module (gnu packages multiprecision)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:export (%bootstrap-binaries-tarball
+ %linux-libre-headers-bootstrap-tarball
%binutils-bootstrap-tarball
%glibc-bootstrap-tarball
%gcc-bootstrap-tarball
%guile-bootstrap-tarball
+ %mescc-tools-bootstrap-tarball
+ %mes-bootstrap-tarball
%bootstrap-tarballs
%guile-static-stripped))
@@ -120,6 +125,15 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
(current-source-location)
#:native-inputs native-inputs))
+(define static-bash-for-bootstrap
+ (package
+ (inherit static-bash)
+ (source (origin
+ (inherit (package-source static-bash))
+ (patches
+ (cons (search-patch "bash-4.4-linux-pgrp-pipe.patch")
+ (origin-patches (package-source static-bash))))))))
+
(define %static-inputs
;; Packages that are to be used as %BOOTSTRAP-INPUTS.
(let ((coreutils (package (inherit coreutils)
@@ -187,7 +201,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
(("-Wl,-export-dynamic") ""))
#t)))))))
(inputs (if (%current-target-system)
- `(("bash" ,static-bash))
+ `(("bash" ,static-bash-for-bootstrap))
'()))))
(tar (package (inherit tar)
(arguments
@@ -228,7 +242,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
("sed" ,sed)
("grep" ,grep)
("gawk" ,gawk)))
- ("bash" ,static-bash))))
+ ("bash" ,static-bash-for-bootstrap))))
(define %static-binaries
(package
@@ -300,6 +314,26 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
(license gpl3+)
(home-page #f)))
+(define %linux-libre-headers-stripped
+ ;; The subset of Linux-Libre-Headers that we need.
+ (package (inherit linux-libre-headers)
+ (name (string-append (package-name linux-libre-headers) "-stripped"))
+ (build-system trivial-build-system)
+ (outputs '("out"))
+ (arguments
+ `(#:modules ((guix build utils)
+ (guix build make-bootstrap))
+ #:builder
+ (begin
+ (use-modules (guix build utils)
+ (guix build make-bootstrap))
+
+ (let* ((in (assoc-ref %build-inputs "linux-libre-headers"))
+ (out (assoc-ref %outputs "out")))
+ (copy-linux-headers out in)
+ #t))))
+ (inputs `(("linux-libre-headers" ,linux-libre-headers)))))
+
(define %binutils-static
;; Statically-linked Binutils.
(package (inherit binutils)
@@ -513,6 +547,154 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
#t))))
(inputs `(("gcc" ,%gcc-static)))))
+;; One package: build + remove store references
+;; (define %mescc-tools-static-stripped
+;; ;; A statically linked Mescc Tools with store references removed, for
+;; ;; bootstrap.
+;; (package
+;; (inherit mescc-tools)
+;; (name "mescc-tools-static-stripped")
+;; (arguments
+;; `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
+;; "CC=gcc -static")
+;; #:test-target "test"
+;; #:phases (modify-phases %standard-phases
+;; (delete 'configure)
+;; (add-after 'install 'strip-store-references
+;; (lambda _
+;; (let* ((out (assoc-ref %outputs "out"))
+;; (bin (string-append out "/bin")))
+;; (for-each (lambda (file)
+;; (let ((target (string-append bin "/" file)))
+;; (format #t "strippingg `~a'...~%" target)
+;; (remove-store-references target)))
+;; '( "M1" "blood-elf" "hex2"))))))))))
+
+;; Two packages: first build static, bare minimum content.
+(define %mescc-tools-static
+ ;; A statically linked MesCC Tools.
+ (package
+ (inherit mescc-tools)
+ (name "mescc-tools-static")
+ (arguments
+ `(#:system "i686-linux"
+ ,@(substitute-keyword-arguments (package-arguments mescc-tools)
+ ((#:make-flags flags)
+ `(cons "CC=gcc -static" ,flags)))))))
+
+;; ... next remove store references.
+(define %mescc-tools-static-stripped
+ ;; A statically linked Mescc Tools with store references removed, for
+ ;; bootstrap.
+ (package
+ (inherit %mescc-tools-static)
+ (name (string-append (package-name %mescc-tools-static) "-stripped"))
+ (build-system trivial-build-system)
+ (arguments
+ `(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (let* ((in (assoc-ref %build-inputs "mescc-tools"))
+ (out (assoc-ref %outputs "out"))
+ (bin (string-append out "/bin")))
+ (mkdir-p bin)
+ (for-each (lambda (file)
+ (let ((target (string-append bin "/" file)))
+ (format #t "copying `~a'...~%" file)
+ (copy-file (string-append in "/bin/" file)
+ target)
+ (remove-store-references target)))
+ '( "M1" "blood-elf" "hex2"))
+ #t))))
+ (inputs `(("mescc-tools" ,%mescc-tools-static)))))
+
+;; (define-public %mes-minimal-stripped
+;; ;; A minimal Mes without documentation dependencies, for bootstrap.
+;; (let ((triplet "i686-unknown-linux-gnu"))
+;; (package
+;; (inherit mes)
+;; (name "mes-minimal-stripped")
+;; (native-inputs
+;; `(("guile" ,guile-2.2)))
+;; (arguments
+;; `(#:system "i686-linux"
+;; #:strip-binaries? #f
+;; #:configure-flags '("--mes")
+;; #:phases
+;; (modify-phases %standard-phases
+;; (delete 'patch-shebangs)
+;; (add-after 'install 'strip-install
+;; (lambda _
+;; (let* ((out (assoc-ref %outputs "out"))
+;; (share (string-append out "/share")))
+;; (delete-file-recursively (string-append out "/lib/guile"))
+;; (delete-file-recursively (string-append share "/guile"))
+;; (delete-file-recursively (string-append share "/mes/scaffold"))
+
+;; (for-each delete-file
+;; (find-files
+;; (string-append share "/mes/lib") "\\.(h|c)"))
+
+;; (for-each (lambda (dir)
+;; (for-each remove-store-references
+;; (find-files (string-append out "/" dir)
+;; ".*")))
+;; '("bin" "share/mes")))))))))))
+
+;; Two packages: first build static, bare minimum content.
+(define-public %mes-minimal
+ ;; A minimal Mes without documentation.
+ (let ((triplet "i686-unknown-linux-gnu"))
+ (package
+ (inherit mes)
+ (name "mes-minimal")
+ (native-inputs
+ `(("guile" ,guile-2.2)))
+ (arguments
+ `(#:system "i686-linux"
+ #:strip-binaries? #f
+ #:configure-flags '("--mes")
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'patch-shebangs)
+ (add-after 'install 'strip-install
+ (lambda _
+ (let* ((out (assoc-ref %outputs "out"))
+ (share (string-append out "/share")))
+ (delete-file-recursively (string-append out "/lib/guile"))
+ (delete-file-recursively (string-append share "/guile"))
+ (delete-file-recursively (string-append share "/mes/scaffold"))
+
+ (for-each delete-file
+ (find-files
+ (string-append share "/mes/lib")
+ "\\.(h|c)")))))))))))
+
+;; next remove store references.
+(define %mes-minimal-stripped
+ ;; A minimal Mes with store references removed, for bootstrap.
+ (package
+ (inherit %mes-minimal)
+ (name (string-append (package-name %mes-minimal) "-stripped"))
+ (build-system trivial-build-system)
+ (arguments
+ `(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (let ((in (assoc-ref %build-inputs "mes"))
+ (out (assoc-ref %outputs "out")))
+
+ (copy-recursively in out)
+ (for-each (lambda (dir)
+ (for-each remove-store-references
+ (find-files (string-append out "/" dir)
+ ".*")))
+ '("bin" "share/mes"))
+ #t))))
+ (inputs `(("mes" ,%mes-minimal)))))
+
(define %guile-static
;; A statically-linked Guile that is relocatable--i.e., it can search
;; .scm and .go files relative to its installation directory, rather
@@ -571,6 +753,10 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
((#:tests? _ #f)
;; There are uses of `dynamic-link' in
;; {foreign,coverage}.test that don't fly here.
+ #f)
+ ((#:parallel-build? _ #f)
+ ;; Work around the fact that the Guile build system is
+ ;; not deterministic when parallel-build is enabled.
#f))))))
(package-with-relocatable-glibc (static-package guile))))
@@ -660,6 +846,10 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
;; A tarball with the statically-linked bootstrap binaries.
(tarball-package %static-binaries))
+(define %linux-libre-headers-bootstrap-tarball
+ ;; A tarball with the statically-linked Linux-Libre-Headers programs.
+ (tarball-package %linux-libre-headers-stripped))
+
(define %binutils-bootstrap-tarball
;; A tarball with the statically-linked Binutils programs.
(tarball-package %binutils-static-stripped))
@@ -676,6 +866,14 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
;; A tarball with the statically-linked, relocatable Guile.
(tarball-package %guile-static-stripped))
+(define %mescc-tools-bootstrap-tarball
+ ;; A tarball with statically-linked MesCC binary seed.
+ (tarball-package %mescc-tools-static-stripped))
+
+(define %mes-bootstrap-tarball
+ ;; A tarball with Mes binary seed.
+ (tarball-package %mes-minimal-stripped))
+
(define %bootstrap-tarballs
;; A single derivation containing all the bootstrap tarballs, for
;; convenience.
@@ -704,9 +902,15 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
%build-inputs)
#t)))
(inputs `(("guile-tarball" ,%guile-bootstrap-tarball)
- ("gcc-tarball" ,%gcc-bootstrap-tarball)
- ("binutils-tarball" ,%binutils-bootstrap-tarball)
- ("glibc-tarball" ,(%glibc-bootstrap-tarball))
+ ,@(match (or (%current-target-system) (%current-system))
+ ((or "i686-linux" "x86_64-linux")
+ `(("bootstrap-mescc-tools" ,%mescc-tools-bootstrap-tarball)
+ ("bootstrap-mes" ,%mes-bootstrap-tarball)
+ ("bootstrap-linux-libre-headers"
+ ,%linux-libre-headers-bootstrap-tarball)))
+ (_ `(("gcc-tarball" ,%gcc-bootstrap-tarball)
+ ("binutils-tarball" ,%binutils-bootstrap-tarball)
+ ("glibc-tarball" ,(%glibc-bootstrap-tarball)))))
("coreutils&co-tarball" ,%bootstrap-binaries-tarball)))
(synopsis "Tarballs containing all the bootstrap binaries")
(description synopsis)
diff --git a/gnu/packages/patches/bash-4.4-linux-pgrp-pipe.patch b/gnu/packages/patches/bash-4.4-linux-pgrp-pipe.patch
new file mode 100644
index 0000000000..0d03d7ce37
--- /dev/null
+++ b/gnu/packages/patches/bash-4.4-linux-pgrp-pipe.patch
@@ -0,0 +1,30 @@
+Unconditionally enable PGRP_PIPE on Linux (the kernel), regardless of
+the kernel version in use on the build machine.
+
+--- configure.ac.orig 1969-12-31 19:00:00.000000000 -0500
++++ configure.ac 2019-08-11 22:28:26.038841961 -0400
+@@ -1092,9 +1092,7 @@
+ solaris2*) LOCAL_CFLAGS=-DSOLARIS ;;
+ lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
+ linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
+- case "`uname -r`" in
+- 2.[[456789]]*|[[34]]*) AC_DEFINE(PGRP_PIPE) ;;
+- esac ;;
++ AC_DEFINE(PGRP_PIPE) ;;
+ *qnx6*) LOCAL_CFLAGS="-Dqnx -Dqnx6" LOCAL_LIBS="-lncurses" ;;
+ *qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
+ powerux*) LOCAL_LIBS="-lgen" ;;
+--- configure.orig 1969-12-31 19:00:00.000000000 -0500
++++ configure 2019-08-11 22:28:10.166763255 -0400
+@@ -16064,10 +16064,7 @@
+ solaris2*) LOCAL_CFLAGS=-DSOLARIS ;;
+ lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
+ linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
+- case "`uname -r`" in
+- 2.[456789]*|[34]*) $as_echo "#define PGRP_PIPE 1" >>confdefs.h
+- ;;
+- esac ;;
++ $as_echo "#define PGRP_PIPE 1" >>confdefs.h ;;
+ *qnx6*) LOCAL_CFLAGS="-Dqnx -Dqnx6" LOCAL_LIBS="-lncurses" ;;
+ *qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
+ powerux*) LOCAL_LIBS="-lgen" ;;
diff --git a/guix/build/make-bootstrap.scm b/guix/build/make-bootstrap.scm
index 48799f7e90..e5ef1d6d2b 100644
--- a/guix/build/make-bootstrap.scm
+++ b/guix/build/make-bootstrap.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015, 2017 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
;;; Copyright © 2015, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -23,7 +24,8 @@
#:use-module (srfi srfi-19)
#:use-module (srfi srfi-26)
#:use-module (guix build utils)
- #:export (make-stripped-libc))
+ #:export (copy-linux-headers
+ make-stripped-libc))
;; Commentary:
;;
@@ -31,6 +33,53 @@
;;
;; Code:
+(define (copy-linux-headers output kernel-headers)
+ "Copy to OUTPUT the subset of KERNEL-HEADERS that is needed when producing a
+bootstrap libc."
+
+ (let* ((incdir (string-append output "/include")))
+ (mkdir-p incdir)
+
+ ;; Copy some of the Linux-Libre headers that glibc headers
+ ;; refer to.
+ (mkdir (string-append incdir "/linux"))
+ (for-each (lambda (file)
+ (install-file (pk 'src (string-append kernel-headers "/include/linux/" file))
+ (pk 'dest (string-append incdir "/linux"))))
+ '(
+ "a.out.h" ; for 2.2.5
+ "atalk.h" ; for 2.2.5
+ "errno.h"
+ "falloc.h"
+ "if_addr.h" ; for 2.16.0
+ "if_ether.h" ; for 2.2.5
+ "if_link.h" ; for 2.16.0
+ "ioctl.h"
+ "kernel.h"
+ "limits.h"
+ "neighbour.h" ; for 2.16.0
+ "netlink.h" ; for 2.16.0
+ "param.h"
+ "prctl.h" ; for 2.16.0
+ "posix_types.h"
+ "rtnetlink.h" ; for 2.16.0
+ "socket.h"
+ "stddef.h"
+ "swab.h" ; for 2.2.5
+ "sysctl.h"
+ "sysinfo.h" ; for 2.2.5
+ "types.h"
+ "version.h" ; for 2.2.5
+ ))
+
+ (copy-recursively (string-append kernel-headers "/include/asm")
+ (string-append incdir "/asm"))
+ (copy-recursively (string-append kernel-headers "/include/asm-generic")
+ (string-append incdir "/asm-generic"))
+ (copy-recursively (string-append kernel-headers "/include/linux/byteorder")
+ (string-append incdir "/linux/byteorder"))
+ #t))
+
(define (make-stripped-libc output libc kernel-headers)
"Copy to OUTPUT the subset of LIBC and KERNEL-HEADERS that is needed
when producing a bootstrap libc."
@@ -43,25 +92,10 @@ when producing a bootstrap libc."
(string-append incdir "/mach"))
#t))
- (define (copy-linux-headers output kernel-headers)
+ (define (copy-libc+linux-headers output kernel-headers)
(let* ((incdir (string-append output "/include")))
(copy-recursively (string-append libc "/include") incdir)
-
- ;; Copy some of the Linux-Libre headers that glibc headers
- ;; refer to.
- (mkdir (string-append incdir "/linux"))
- (for-each (lambda (file)
- (install-file (string-append kernel-headers "/include/linux/" file)
- (string-append incdir "/linux")))
- '("limits.h" "errno.h" "socket.h" "kernel.h"
- "sysctl.h" "param.h" "ioctl.h" "types.h"
- "posix_types.h" "stddef.h" "falloc.h"))
-
- (copy-recursively (string-append kernel-headers "/include/asm")
- (string-append incdir "/asm"))
- (copy-recursively (string-append kernel-headers "/include/asm-generic")
- (string-append incdir "/asm-generic"))
- #t))
+ (copy-linux-headers output kernel-headers)))
(define %libc-object-files-rx "^(crt.*|ld.*|lib(c|m|dl|rt|pthread|nsl|\
util).*\\.so(\\..*)?|lib(machuser|hurduser).so.*|(libc(rt|)|libpthread)\
@@ -80,6 +114,6 @@ _nonshared\\.a)$")
(if (directory-exists? (string-append kernel-headers "/include/mach"))
(copy-mach-headers output kernel-headers)
- (copy-linux-headers output kernel-headers)))
+ (copy-libc+linux-headers output kernel-headers)))