(begin (use-modules (ice-9 ftw) (srfi srfi-1) (srfi srfi-26) (guix build utils) (guix build gnu-build-system)) (begin (define %build-inputs (quote (("source" . "/gnu/store/nj71bzkb965zm8153acalp0xwczpld3z-glibc-2.41.tar.xz") ("bison" . "/gnu/store/h3y190sl2xkn818p2q7kj1f8m6i85gmp-bison-boot0-3.8.2") ("texinfo" . "/gnu/store/jkm969l65w38160zjyibj65wq7p3n5ja-texinfo-6.8") ("perl" . "/gnu/store/n7pgwxvqs1a1hx6sp23f7g2rk651lbln-perl-boot0-5.36.0") ("python" . "/gnu/store/0sypilfjwggl4qi0v5pr99iq3npry38x-python-boot0-3.5.9") ("gcc" . "/gnu/store/ps962gjvxm2jjp45hiiblgn97ni0fw34-gcc-cross-boot0-14.3.0") ("ld-wrapper-cross" . "/gnu/store/ay6q6m0bjfdx5jrp8nw5si3ydyl0yqad-ld-wrapper-boot0-0") ("binutils-cross" . "/gnu/store/hh4dbnxr2bczpkhjpb6wvhpj1dzqv6zs-binutils-cross-boot0-2.44") ("bzip2" . "/gnu/store/bwhk7mi9i4ys5w2wsbnfyigwwp8pqfkq-bzip2-boot0-1.0.8") ("coreutils" . "/gnu/store/gn9ngz6psd2frzslwifsvli61dmijgbq-coreutils-boot0-9.1") ("gawk" . "/gnu/store/way59xg0d2n2kgpb9yidbz7973fjjp0i-gawk-boot0-5.3.0") ("patch" . "/gnu/store/141gc4fwp7rbvmq6ynbwqibm9c4dv3f6-patch-boot0-2.7.6") ("sed" . "/gnu/store/div48p18zfc15mnj9xfd6nc0d126ckji-sed-boot0-4.9") ("tar" . "/gnu/store/3miwwqidab1k6dynbhvx9smw8r35xc2m-tar-boot0-1.35") ("make" . "/gnu/store/amvqxzwkwdy7qx2b6g4pdv9723w8wyb4-make-boot0-4.4.1") ("diffutils" . "/gnu/store/dvqkmj2ix0sfgfcijvx03wxay7b50y2k-diffutils-boot0-3.12") ("findutils" . "/gnu/store/bgzkm5jsik7zl1mnlgcmdjs3r7wky3g1-findutils-boot0-4.10.0") ("file" . "/gnu/store/a3j8vzdjnhmyp6g4h168ffgddib6zmk6-file-boot0-5.46") ("bash" . "/gnu/store/ac973jmmvv70y6xjn2d5rnih6gd19s2f-bash-mesboot-5.2.37") ("coreutils" . "/gnu/store/48zzvabsg1rsrq99wd2i92d60lzmd71k-coreutils-mesboot-9.1") ("grep" . "/gnu/store/igkvc8k782fi29yanvp04hv3s2ymsg1s-grep-mesboot-3.11") ("sed" . "/gnu/store/600v63djvfg1c30cplszglb2729qxvk0-sed-mesboot-4.8") ("tar" . "/gnu/store/wq0kn0nvnx3zk424mq3q62hhydxscwhq-tar-mesboot-1.35") ("xz" . "/gnu/store/1n6fngk89jk1y0grxxi3q0k8l4bnmf9p-xz-mesboot-5.4.5") ("gcc-wrapper" . "/gnu/store/hws34smywkwzb6dhq4dm7dwc5n3asdfx-gcc-mesboot-wrapper-4.9.4") ("gcc" . "/gnu/store/smbi96nsyf5p8njbz8fldifrq95kh1kp-gcc-mesboot-4.9.4") ("libc" . "/gnu/store/3fgyrin1yhfkj4bs79wk0jv6pkbykvsw-glibc-mesboot-2.16.0") ("gawk" . "/gnu/store/zfkrb361iy4l1avx02qz39pl5czxyacv-gawk-mesboot-3.1.8") ("make" . "/gnu/store/b0pb60c7r0b3xgpp2bvlflah3gv00w2q-make-mesboot-3.82") ("gzip" . "/gnu/store/fgx3c56cfylbfjdi731s3zggp03js9d3-gzip-mesboot-1.2.4") ("patch" . "/gnu/store/i29sqgr7lhaq1crnqwa5rxi43d8skfw1-patch-mesboot-2.5.9") ("guile" . "/gnu/store/lgi9x15a0w35mcpd7g1kb9274r6wy4pv-guile-bootstrap-2.0") ("static-bash" . "/gnu/store/ac973jmmvv70y6xjn2d5rnih6gd19s2f-bash-mesboot-5.2.37") ("kernel-headers" . "/gnu/store/d41d6s3pmn5ys0ihi82056qq7z9fjsyk-linux-libre-headers-6.12.17") ("m4" . "/gnu/store/fq5alw8bfy0c5rcvj1kwyps6kh3y84jk-m4-boot0-1.4.19")))) (define %outputs (list (cons "out" ((@ (guile) getenv) "out")) (cons "static" ((@ (guile) getenv) "static")))) (define %output (assoc-ref %outputs "out")) (gnu-build #:source "/gnu/store/nj71bzkb965zm8153acalp0xwczpld3z-glibc-2.41.tar.xz" #:system "x86_64-linux" #:build "x86_64-unknown-linux-gnu" #:outputs %outputs #:inputs %build-inputs #:search-paths (quote (("INFOPATH" ("share/info") ":" directory #f) ("PERL5LIB" ("lib/perl5/site_perl") ":" directory #f) ("PYTHONPATH" ("lib/python3.5/site-packages") ":" directory #f) ("C_INCLUDE_PATH" ("include") ":" directory #f) ("CPLUS_INCLUDE_PATH" ("include/c++" "include") ":" directory #f) ("OBJC_INCLUDE_PATH" ("include") ":" directory #f) ("OBJCPLUS_INCLUDE_PATH" ("include/c++" "include") ":" directory #f) ("LIBRARY_PATH" ("lib" "lib64") ":" directory #f) ("BASH_LOADABLES_PATH" ("lib/bash") ":" directory #f) ("C_INCLUDE_PATH" ("include" "lib/gcc-lib/i686-unknown-linux-gnu/2.95.3/include") ":" directory #f) ("LIBRARY_PATH" ("lib") ":" directory #f) ("GUIX_LOCPATH" ("lib/locale") ":" directory #f) ("TZDIR" ("share/zoneinfo") #f directory #f))) #:phases (modify-phases (modify-phases %standard-phases (add-before (quote configure) (quote pre-configure) (lambda* (#:key inputs native-inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (bin (string-append out "/bin")) (bash (or (assoc-ref inputs "static-bash") (assoc-ref native-inputs "static-bash")))) (substitute* "inet/Makefile" (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix) (string-append out "/etc/rpc" suffix "\n")) (("^install-others =.*$") (string-append "install-others = " out "/etc/rpc\n"))) (substitute* "Makeconfig" ((" -lgcc_s") "")) (substitute* "elf/dl-cache.c" (("@STORE_DIRECTORY@") (string-append "\"" (%store-directory) "\""))) (substitute* "sysdeps/posix/system.c" (("#define[[:blank:]]+SHELL_PATH.*$") (format #f "#define SHELL_PATH \"~a/bin/bash\"\n" bash))) (substitute* "libio/iopopen.c" (("/bin/sh") (string-append bash "/bin/sh"))) (substitute* (find-files "." "^paths\\.h$") (("#define[[:blank:]]+_PATH_BSHELL[[:blank:]].*$") (string-append "#define _PATH_BSHELL \"" bash "/bin/sh\"\n"))) (substitute* "malloc/mtrace.pl" (("^#!.*") "") (("exec @PERL@") "exec perl"))))) (add-after (quote install) (quote move-static-libs) (lambda* (#:key outputs #:allow-other-keys) (define (empty-static-library? file) (let ((file (string-append (assoc-ref outputs "out") "/lib/" file))) (and (ar-file? file) (= (stat:size (stat file)) 8)))) (define (static-library? file) (and (string-suffix? ".a" file) (not (string-contains file "_nonshared")) (not (empty-static-library? file)))) (define (linker-script? file) (and (not (ar-file? file)) (not (elf-file? file)))) (let* ((out (assoc-ref outputs "out")) (lib (string-append out "/lib")) (files (scandir lib static-library?)) (empty (scandir lib empty-static-library?)) (static (assoc-ref outputs "static")) (slib (string-append static "/lib"))) (mkdir-p slib) (for-each (lambda (base) (rename-file (string-append lib "/" base) (string-append slib "/" base))) files) (for-each (lambda (base) (copy-file (string-append lib "/" base) (string-append slib "/" base))) empty) (for-each (lambda (ld-script) (substitute* ld-script ((out) static))) (filter linker-script? (map (cut string-append slib "/" <>) files)))))) (add-after (quote install) (quote install-utf8-c-locale) (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (bin (string-append out "/bin")) (locale (string-append out "/lib/locale/" "2.41"))) (mkdir-p locale) (invoke (string-append bin "/localedef") "--no-archive" "--prefix" locale "-i" "C" "-f" "UTF-8" (string-append locale "/C.UTF-8")))))) (add-before (quote configure) (quote pre-configure) (lambda* (#:key inputs #:allow-other-keys) (unsetenv "C_INCLUDE_PATH") (unsetenv "CPLUS_INCLUDE_PATH")))) #:locale "C.UTF-8" #:separate-from-pid1? #t #:bootstrap-scripts %bootstrap-scripts #:configure-flags (append (list "--host=x86_64-guix-linux-gnu" "--build=x86_64-unknown-linux-gnu" "") (list "--sysconfdir=/etc" (string-append "libc_cv_complocaledir=/run/current-system/locale/" "2.41") (string-append "--with-headers=" (assoc-ref %build-inputs "kernel-headers") "/include") "--enable-kernel=3.2.0" (string-append "BASH_SHELL=" (assoc-ref %build-inputs "bash") "/bin/bash"))) #:make-flags (quote ()) #:out-of-source? #t #:tests? #f #:test-target "check" #:parallel-build? #t #:parallel-tests? #t #:patch-shebangs? #t #:license-file-regexp "^(COPYING.*|LICEN[CS]E.*|[Ll]icen[cs]e.*|Copy[Rr]ight(\\.(txt|md))?)$" #:strip-binaries? #t #:validate-runpath? #f #:make-dynamic-linker-cache? #t #:license-file-regexp "^(COPYING.*|LICEN[CS]E.*|[Ll]icen[cs]e.*|Copy[Rr]ight(\\.(txt|md))?)$" #:strip-flags (quote ("--strip-debug")) #:strip-directories (quote ("lib" "lib64" "libexec" "bin" "sbin")))))