(begin (use-modules (ice-9 ftw) (ice-9 match) (ice-9 regex) (srfi srfi-1) (srfi srfi-26) (srfi srfi-34) (srfi srfi-35) (guix build utils)) (define tar-supports-sort? (guard (c ((message-condition? c) #f)) (invoke/quiet (string-append "/gnu/store/snyn870y9z8a00r49sxyjpk8sk0b9361-bootstrap-binaries-0" "/bin/tar") "cf" "/dev/null" "--files-from=/dev/null" "--sort=name") #t)) (define (apply-patch patch) (format (current-error-port) "applying '~a'...~%" patch) (invoke (string-append "/gnu/store/snyn870y9z8a00r49sxyjpk8sk0b9361-bootstrap-binaries-0" "/bin/patch") "--force" "--no-backup-if-mismatch" "-p1" "--input" patch)) (define (first-file directory) (car (scandir directory (lambda (name) (not (member name (quote ("." "..")))))))) (define (repack directory output) (unless tar-supports-sort? (call-with-output-file ".file_list" (lambda (port) (for-each (lambda (name) (format port "~a~%" name)) (find-files directory #:directories? #t #:fail-on-error? #t))))) (apply invoke "/gnu/store/snyn870y9z8a00r49sxyjpk8sk0b9361-bootstrap-binaries-0/bin/tar" "cvfa" output "--mtime=@1" "--owner=root:0" "--group=root:0" (if tar-supports-sort? (quasiquote ("--sort=name" (unquote directory))) (quote ("--no-recursion" "--files-from=.file_list"))))) (let ((line (cond-expand (guile-2.0 _IOLBF) (else (quote line))))) (setvbuf (current-output-port) line) (setvbuf (current-error-port) line)) (fluid-set! %default-port-conversion-strategy (quote error)) (let ((locale "C.UTF-8")) (catch (quote system-error) (lambda () (setlocale LC_ALL locale)) (lambda args (format (current-error-port) "failed to install '~a' locale: ~a~%" locale (system-error-errno args))))) (setenv "PATH" (string-join (map (cut string-append <> "/bin") (delete-duplicates (filter-map identity (list #f "/gnu/store/snyn870y9z8a00r49sxyjpk8sk0b9361-bootstrap-binaries-0" "/gnu/store/snyn870y9z8a00r49sxyjpk8sk0b9361-bootstrap-binaries-0")))) ":")) (setenv "ZSTD_NBTHREADS" (number->string (parallel-job-count))) (let ((name (strip-store-file-name "/gnu/store/hjllq841s8d34fm5q2nw63cbzlbb1ls8-glibc-2.41.tar.xz")) (command (and=> "/gnu/store/snyn870y9z8a00r49sxyjpk8sk0b9361-bootstrap-binaries-0" (cut string-append <> "/bin/" (compressor "/gnu/store/hjllq841s8d34fm5q2nw63cbzlbb1ls8-glibc-2.41.tar.xz"))))) (if (file-is-directory? "/gnu/store/hjllq841s8d34fm5q2nw63cbzlbb1ls8-glibc-2.41.tar.xz") (copy-recursively "/gnu/store/hjllq841s8d34fm5q2nw63cbzlbb1ls8-glibc-2.41.tar.xz" name) (cond ((tarball? "/gnu/store/hjllq841s8d34fm5q2nw63cbzlbb1ls8-glibc-2.41.tar.xz") (invoke (string-append "/gnu/store/snyn870y9z8a00r49sxyjpk8sk0b9361-bootstrap-binaries-0" "/bin/tar") "xvf" "/gnu/store/hjllq841s8d34fm5q2nw63cbzlbb1ls8-glibc-2.41.tar.xz")) ((and=> (compressor "/gnu/store/hjllq841s8d34fm5q2nw63cbzlbb1ls8-glibc-2.41.tar.xz") (cut string= "unzip" <>)) (invoke "unzip" "/gnu/store/hjllq841s8d34fm5q2nw63cbzlbb1ls8-glibc-2.41.tar.xz")) (else (copy-file "/gnu/store/hjllq841s8d34fm5q2nw63cbzlbb1ls8-glibc-2.41.tar.xz" name) (when command (invoke command "--decompress" name)))))) (let* ((file (first-file ".")) (directory (if (file-is-directory? file) file "."))) (format (current-error-port) "source is at '~a'~%" file) (with-directory-excursion directory (for-each apply-patch (quote ("/gnu/store/5icxvnlbac76mm49g6sq7vzznjxmn2s6-glibc-ldd-powerpc.patch" "/gnu/store/5jhvzlrxayih69n3rvx4ams4l3qzr46d-glibc-2.41-ldd-x86_64.patch" "/gnu/store/szmwgavrvxawnal8y9ny4yfbfr71ga9v-glibc-2.40-dl-cache.patch" "/gnu/store/ks7idaap9smsl8yap23jj8z30xnv22kn-glibc-2.37-versioned-locpath.patch" "/gnu/store/65ls8n9kf530qv5anfsc7l1vymq4pb8m-glibc-guix-locpath.patch" "/gnu/store/vh29xqy3daavjpi0ikpmqzfczzpbscix-glibc-reinstate-prlimit64-fallback.patch" "/gnu/store/rnqkir22908x6z3i1mk4phyvskz15qc4-glibc-supported-locales.patch" "/gnu/store/3ihlnw52qsingnazqpjr6455i94c5wir-glibc-2.37-hurd-clock_t_centiseconds.patch" "/gnu/store/sv533k03gwzjs29119hdvk95pc044a9p-glibc-2.41-hurd-local-clock_gettime_MONOTONIC.patch" "/gnu/store/p7a2ji0rg9ff23xyw24npcxkaf09hi53-glibc-hurd-mach-print.patch" "/gnu/store/31lrg24mgmy9fk3arbfv2ra7spxh7d0w-glibc-hurd-gettyent.patch" "/gnu/store/jv1byn1ik8ykwkasjaca591385ww0w6n-glibc-hurd-getauxval.patch" "/gnu/store/02hsn1zyawfifldjiz2g7vgy1rqk5r3g-glibc-hurd-pthread_setcancelstate.patch" "/gnu/store/z6ilp2cgp0hwl3nhcn2akprqcnj28w21-glibc-hurd-signal-fpe-exception.patch" "/gnu/store/3dbasdf57d92qyrpwslhc3j79nn9sqbh-glibc-hurd-xstate.patch" "/gnu/store/h5ws6jd8ji5557jahydsgq1a4icziyd7-glibc-hurd-2.41-pthread-once.patch" "/gnu/store/0yikcnhdj4r1drzk3hm719gviv3yhyzc-glibc-hurd-2.41-pthread-sigmask.patch" "/gnu/store/p0w3acwmf0z7apf3sjgch966mbm0rmcn-glibc-hurd-2.41-symlink.patch" "/gnu/store/8q2950xvyhsski09r5y8a4ifnz8jqhf6-glibc-hurd64-gcc-14.2-tls-bug.patch"))) #t) (cond ((file-is-directory? "/gnu/store/hjllq841s8d34fm5q2nw63cbzlbb1ls8-glibc-2.41.tar.xz") (copy-recursively directory ((@ (guile) getenv) "out") #:log (%make-void-port "w"))) ((or "/gnu/store/snyn870y9z8a00r49sxyjpk8sk0b9361-bootstrap-binaries-0" (tarball? "/gnu/store/hjllq841s8d34fm5q2nw63cbzlbb1ls8-glibc-2.41.tar.xz")) (repack directory ((@ (guile) getenv) "out"))) (else (copy-file file ((@ (guile) getenv) "out"))))))