Merge branch 'wip-binaries'

This commit is contained in:
Mark H Weaver 2019-08-26 23:28:58 -04:00
commit 32e18e9b94
No known key found for this signature in database
GPG key ID: 7CEF29847562C516
4 changed files with 294 additions and 25 deletions

View file

@ -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 \

View file

@ -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 @@ (define-module (gnu packages make-bootstrap)
#: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 @@ (define (native-inputs)
(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 @@ (define %static-inputs
(("-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 @@ (define %static-inputs
("sed" ,sed)
("grep" ,grep)
("gawk" ,gawk)))
("bash" ,static-bash))))
("bash" ,static-bash-for-bootstrap))))
(define %static-binaries
(package
@ -300,6 +314,26 @@ (define (copy-directory source destination)
(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 @@ (define %gcc-stripped
#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 @@ (define %guile-static
((#: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 @@ (define %bootstrap-binaries-tarball
;; 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 @@ (define %guile-bootstrap-tarball
;; 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 @@ (define %bootstrap-tarballs
%build-inputs)
#t)))
(inputs `(("guile-tarball" ,%guile-bootstrap-tarball)
("gcc-tarball" ,%gcc-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))
("glibc-tarball" ,(%glibc-bootstrap-tarball)))))
("coreutils&co-tarball" ,%bootstrap-binaries-tarball)))
(synopsis "Tarballs containing all the bootstrap binaries")
(description synopsis)

View file

@ -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" ;;

View file

@ -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 @@ (define-module (guix build make-bootstrap)
#: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 @@ (define-module (guix build make-bootstrap)
;;
;; 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 @@ (define (copy-mach-headers output kernel-headers)
(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 @@ (define %libc-object-files-rx "^(crt.*|ld.*|lib(c|m|dl|rt|pthread|nsl|\
(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)))