|
| 1 | +diff --git guix-1.5.0/gnu/packages/commencement.scm guix-1.5.0/gnu/packages/commencement.scm |
| 2 | +index 852fa2d..2dfb6a3 100644 |
| 3 | +--- guix-1.5.0/gnu/packages/commencement.scm |
| 4 | ++++ guix-1.5.0/gnu/packages/commencement.scm |
| 5 | +@@ -1225,21 +1225,43 @@ ac_cv_c_float_format='IEEE (little-endian)' |
| 6 | + ("libc" ,glibc-mesboot0) |
| 7 | + ,@(alist-delete "gcc" (%boot-mesboot-core-inputs)))) |
| 8 | + |
| 9 | +-(define binutils-mesboot1 |
| 10 | ++(define (mesboot0-package name inputs pkg) |
| 11 | + (package |
| 12 | +- (inherit binutils-mesboot0) |
| 13 | +- (name "binutils-mesboot1") |
| 14 | +- (native-inputs (%boot-mesboot0-inputs)) |
| 15 | ++ (inherit pkg) |
| 16 | ++ (name name) |
| 17 | ++ (source (bootstrap-origin (package-source pkg))) |
| 18 | ++ (native-inputs (inputs)) |
| 19 | ++ (supported-systems '("i686-linux")) |
| 20 | ++ (inputs '()) |
| 21 | ++ (propagated-inputs '()) |
| 22 | + (arguments |
| 23 | +- (substitute-keyword-arguments (package-arguments binutils-mesboot0) |
| 24 | +- ((#:configure-flags configure-flags) |
| 25 | +- #~(let ((out (assoc-ref %outputs "out"))) |
| 26 | +- `("--disable-nls" "--disable-shared" |
| 27 | +- "--disable-werror" |
| 28 | +- "--build=i686-unknown-linux-gnu" |
| 29 | +- "--host=i686-unknown-linux-gnu" |
| 30 | +- "--with-sysroot=/" |
| 31 | +- ,(string-append "--prefix=" out)))))))) |
| 32 | ++ (ensure-keyword-arguments (package-arguments pkg) |
| 33 | ++ `(#:implicit-inputs? #f |
| 34 | ++ #:guile ,%bootstrap-guile |
| 35 | ++ #:tests? #f))))) |
| 36 | ++ |
| 37 | ++;; Build native versions of critical utilities earlier, for performance reasons |
| 38 | ++;; It would be great to build xz here, but it requres a newer gcc... |
| 39 | ++ |
| 40 | ++;; Bash provides built-in "test", avoiding guile startup overhead |
| 41 | ++(define bash-mesboot0 |
| 42 | ++ (let ((pkg (mesboot0-package |
| 43 | ++ "bash-mesboot0" |
| 44 | ++ %boot-mesboot0-inputs |
| 45 | ++ static-bash))) |
| 46 | ++ (package |
| 47 | ++ (inherit pkg) |
| 48 | ++ (arguments (substitute-keyword-arguments (package-arguments pkg) |
| 49 | ++ ((#:configure-flags flags) |
| 50 | ++ #~(cons* "CFLAGS=-g -O2" "LIBS=-lc -lnss_files -lnss_dns -lresolv" |
| 51 | ++ (delete |
| 52 | ++ "CFLAGS=-g -O2 -Wno-error=implicit-function-declaration" |
| 53 | ++ #$flags)))))))) |
| 54 | ++ |
| 55 | ++(define (%boot-mesboot0-native0-inputs) |
| 56 | ++ `(("bash" ,bash-mesboot0) |
| 57 | ++ ,@(fold alist-delete (%boot-mesboot0-inputs) |
| 58 | ++ '("bash")))) |
| 59 | + |
| 60 | + (define gnu-make-mesboot |
| 61 | + (package |
| 62 | +@@ -1253,7 +1275,7 @@ ac_cv_c_float_format='IEEE (little-endian)' |
| 63 | + (sha256 |
| 64 | + (base32 |
| 65 | + "1rs2f9hmvy3q6zkl15jnlmnpgffm0bhw5ax0h5c7q604wqrip69x")))) |
| 66 | +- (native-inputs (%boot-mesboot0-inputs)) |
| 67 | ++ (native-inputs (%boot-mesboot0-native0-inputs)) |
| 68 | + (supported-systems '("i686-linux" "x86_64-linux")) |
| 69 | + (inputs '()) |
| 70 | + (propagated-inputs '()) |
| 71 | +@@ -1273,11 +1295,31 @@ ac_cv_c_float_format='IEEE (little-endian)' |
| 72 | + (bin (string-append out "/bin"))) |
| 73 | + (install-file "make" bin))))))))) |
| 74 | + |
| 75 | ++(define (%boot-mesboot0-native-inputs) |
| 76 | ++ `(("make" ,gnu-make-mesboot) |
| 77 | ++ ,@(fold alist-delete (%boot-mesboot0-native0-inputs) |
| 78 | ++ '("make")))) |
| 79 | ++ |
| 80 | ++(define binutils-mesboot1 |
| 81 | ++ (package |
| 82 | ++ (inherit binutils-mesboot0) |
| 83 | ++ (name "binutils-mesboot1") |
| 84 | ++ (native-inputs (%boot-mesboot0-native-inputs)) |
| 85 | ++ (arguments |
| 86 | ++ (substitute-keyword-arguments (package-arguments binutils-mesboot0) |
| 87 | ++ ((#:configure-flags configure-flags) |
| 88 | ++ #~(let ((out (assoc-ref %outputs "out"))) |
| 89 | ++ `("--disable-nls" "--disable-shared" |
| 90 | ++ "--disable-werror" |
| 91 | ++ "--build=i686-unknown-linux-gnu" |
| 92 | ++ "--host=i686-unknown-linux-gnu" |
| 93 | ++ "--with-sysroot=/" |
| 94 | ++ ,(string-append "--prefix=" out)))))))) |
| 95 | ++ |
| 96 | + (define (%boot-mesboot1-inputs) |
| 97 | + `(("binutils" ,binutils-mesboot1) |
| 98 | +- ("make" ,gnu-make-mesboot) |
| 99 | +- ,@(fold alist-delete (%boot-mesboot0-inputs) |
| 100 | +- '("binutils" "make")))) |
| 101 | ++ ,@(fold alist-delete (%boot-mesboot0-native-inputs) |
| 102 | ++ '("binutils")))) |
| 103 | + |
| 104 | + (define gmp-boot |
| 105 | + (let ((version "4.3.2")) |
| 106 | +@@ -1467,7 +1509,7 @@ ac_cv_c_float_format='IEEE (little-endian)' |
| 107 | + ;; libstdc++ is being compiled. |
| 108 | + (setenv "CPLUS_INCLUDE_PATH" (getenv "C_INCLUDE_PATH")))))))))) |
| 109 | + |
| 110 | +-(define (%boot-mesboot2-inputs) |
| 111 | ++(define (%boot-mesboot2-bootar-inputs) |
| 112 | + `(("gcc" ,gcc-mesboot1) |
| 113 | + ,@(alist-delete "gcc" (%boot-mesboot1-inputs)))) |
| 114 | + |
| 115 | +@@ -1490,7 +1532,7 @@ ac_cv_c_float_format='IEEE (little-endian)' |
| 116 | + (supported-systems '("i686-linux" "x86_64-linux")) |
| 117 | + (inputs '()) |
| 118 | + (propagated-inputs '()) |
| 119 | +- (native-inputs (%boot-mesboot2-inputs)) |
| 120 | ++ (native-inputs (%boot-mesboot2-bootar-inputs)) |
| 121 | + (arguments |
| 122 | + `(#:implicit-inputs? #f |
| 123 | + #:guile ,%bootstrap-guile |
| 124 | +@@ -1504,6 +1546,119 @@ ac_cv_c_float_format='IEEE (little-endian)' |
| 125 | + (lambda _ |
| 126 | + (invoke "./hello")))))))) |
| 127 | + |
| 128 | ++;; Now, that we have GCC 4.6, we can finally build xz. |
| 129 | ++(define xz-mesboot0 |
| 130 | ++ (let ((pkg (mesboot0-package "xz-mesboot0" %boot-mesboot2-bootar-inputs xz))) |
| 131 | ++ (package |
| 132 | ++ (inherit pkg) |
| 133 | ++ (arguments |
| 134 | ++ (ensure-keyword-arguments (package-arguments pkg) |
| 135 | ++ ;; XXX: This fails even though the |
| 136 | ++ ;; actual runpaths seem fine. |
| 137 | ++ `(#:validate-runpath? #f |
| 138 | ++ ;; XXX: The build gets stuck |
| 139 | ++ ;; when parallel build is enabled. |
| 140 | ++ #:parallel-build? #f |
| 141 | ++ #:configure-flags (list |
| 142 | ++ ;; static build |
| 143 | ++ "--enable-static" |
| 144 | ++ "--disable-shared" |
| 145 | ++ ;; missing pthread.h |
| 146 | ++ "--enable-threads=no" |
| 147 | ++ ;; extern inlines broken |
| 148 | ++ "CFLAGS=-g -O2 -fgnu89-inline"))))))) |
| 149 | ++ |
| 150 | ++;; Tar doesn't build at this stage, so teach gash-utils tar to use xz using a wrapper |
| 151 | ++(define gash-utils-tar-wrapper |
| 152 | ++ ;; Wrapper around gash-utils tar that extracts xz files using xz-mesboot0 |
| 153 | ++ ;; before passing them on to tar. |
| 154 | ++ (package |
| 155 | ++ (inherit gash-utils-boot) |
| 156 | ++ (name "gash-utils-tar-wrapper") |
| 157 | ++ (source #f) |
| 158 | ++ (inputs '()) |
| 159 | ++ (native-inputs `(("bash" ,bash-mesboot0) |
| 160 | ++ ("coreutils" ,gash-utils-boot) |
| 161 | ++ ("gzip" ,gzip-mesboot) |
| 162 | ++ ("xz" ,xz-mesboot0))) |
| 163 | ++ (arguments |
| 164 | ++ `(#:implicit-inputs? #f |
| 165 | ++ #:guile ,%bootstrap-guile |
| 166 | ++ #:phases |
| 167 | ++ (modify-phases %standard-phases |
| 168 | ++ (delete 'unpack) |
| 169 | ++ (delete 'configure) |
| 170 | ++ (delete 'install) |
| 171 | ++ (replace 'build |
| 172 | ++ (lambda* (#:key outputs #:allow-other-keys) |
| 173 | ++ (let* ((out (assoc-ref outputs "out")) |
| 174 | ++ (bash (assoc-ref %build-inputs "bash")) |
| 175 | ++ (coreutils (assoc-ref %build-inputs "coreutils")) |
| 176 | ++ (xz (assoc-ref %build-inputs "xz")) |
| 177 | ++ (gzip (assoc-ref %build-inputs "gzip")) |
| 178 | ++ (bin (string-append out "/bin"))) |
| 179 | ++ (mkdir-p bin) |
| 180 | ++ (for-each |
| 181 | ++ (lambda (program) |
| 182 | ++ (let ((wrapper (string-append bin "/" program))) |
| 183 | ++ (with-output-to-file wrapper |
| 184 | ++ (lambda _ |
| 185 | ++ (display (string-append "#!" bash "/bin/bash |
| 186 | ++ |
| 187 | ++# Check if file is GZIP or XZ compressed |
| 188 | ++if [[ \"$#\" -eq 2 && \"$1\" = xvf && \"$2\" = *.tar.xz ]]; then |
| 189 | ++ # Decompress using xz to temporary file |
| 190 | ++ if ! " xz "/bin/xz -dc -- \"$2\" > /tmp/tar_wrapper.tar; then |
| 191 | ++ echo \"Error: failed to decompress $2\" >&2 |
| 192 | ++ rm -f /tmp/tar_wrapper.tar |
| 193 | ++ exit 1 |
| 194 | ++ fi |
| 195 | ++ |
| 196 | ++ # Extract using gash-utils tar |
| 197 | ++ " coreutils "/bin/tar \"$1\" /tmp/tar_wrapper.tar |
| 198 | ++ status=$? |
| 199 | ++ |
| 200 | ++ # Clean up |
| 201 | ++ rm -f /tmp/tar_wrapper.tar |
| 202 | ++ |
| 203 | ++ exit $status |
| 204 | ++elif [[ \"$#\" -eq 2 && \"$1\" = xvf && \"$2\" = *.tar.gz ]]; then |
| 205 | ++ # Decompress using gzip to temporary file |
| 206 | ++ if ! " gzip "/bin/gzip -dc \"$2\" > /tmp/tar_wrapper.tar; then |
| 207 | ++ echo \"Error: failed to decompress $2\" >&2 |
| 208 | ++ rm -f /tmp/tar_wrapper.tar |
| 209 | ++ exit 1 |
| 210 | ++ fi |
| 211 | ++ |
| 212 | ++ # Extract using gash-utils tar |
| 213 | ++ " coreutils "/bin/tar \"$1\" /tmp/tar_wrapper.tar |
| 214 | ++ status=$? |
| 215 | ++ |
| 216 | ++ # Clean up |
| 217 | ++ rm -f /tmp/tar_wrapper.tar |
| 218 | ++ |
| 219 | ++ exit $status |
| 220 | ++else |
| 221 | ++ # Fall back to direct gash-utils tar call |
| 222 | ++ exec " coreutils "/bin/tar \"$@\" |
| 223 | ++fi |
| 224 | ++")) |
| 225 | ++ (chmod wrapper #o555))))) |
| 226 | ++ '("tar"))))) |
| 227 | ++ (replace 'check |
| 228 | ++ (lambda* (#:key outputs #:allow-other-keys) |
| 229 | ++ (let* ((bash (assoc-ref %build-inputs "bash")) |
| 230 | ++ (bin (string-append bash "/bin")) |
| 231 | ++ (program (string-append bin "/bash"))) |
| 232 | ++ (invoke program "--help"))))))))) |
| 233 | ++ |
| 234 | ++(define (%boot-mesboot2-inputs) |
| 235 | ++ `(("xz" ,xz-mesboot0) |
| 236 | ++ ("tar" ,gash-utils-tar-wrapper) |
| 237 | ++ ;; we can drop bootar here; gzip + xz + gash-utils tar is enough to proceed |
| 238 | ++ ,@(fold alist-delete (%boot-mesboot2-bootar-inputs) |
| 239 | ++ '("bootar")))) |
| 240 | ++ |
| 241 | + (define binutils-mesboot |
| 242 | + (package |
| 243 | + (inherit binutils-mesboot1) |
| 244 | +@@ -1709,7 +1864,7 @@ SHELL := " shell " |
| 245 | + (name "gcc-mesboot1-wrapper") |
| 246 | + (source #f) |
| 247 | + (inputs '()) |
| 248 | +- (native-inputs `(("bash" ,gash-boot) |
| 249 | ++ (native-inputs `(("bash" ,bash-mesboot0) |
| 250 | + ("coreutils" ,gash-utils-boot) |
| 251 | + ("libc" ,glibc-mesboot) |
| 252 | + ("gcc" ,gcc-mesboot1))) |
| 253 | +@@ -1848,7 +2003,7 @@ exec " gcc "/bin/" program |
| 254 | + (version (package-version gcc-mesboot)) |
| 255 | + (source #f) |
| 256 | + (inputs '()) |
| 257 | +- (native-inputs `(("bash" ,gash-boot) |
| 258 | ++ (native-inputs `(("bash" ,bash-mesboot0) |
| 259 | + ("coreutils" ,gash-utils-boot) |
| 260 | + ("libc" ,glibc-mesboot) |
| 261 | + ("gcc" ,gcc-mesboot))))) |
| 262 | +@@ -1966,7 +2121,7 @@ exec " gcc "/bin/" program |
| 263 | + ("tar" ,tar-mesboot) |
| 264 | + ("xz" ,xz-mesboot) |
| 265 | + ,@(fold alist-delete (%boot-mesboot5-inputs) |
| 266 | +- '("bash" "coreutils" "bootar" "kernel-headers")))) |
| 267 | ++ '("bash" "coreutils" "tar" "kernel-headers")))) |
| 268 | + |
| 269 | + (define (%bootstrap-inputs+toolchain) |
| 270 | + ;; The traditional bootstrap-inputs. For the i686-linux, x86_64-linux |
0 commit comments