diff options
| author | Efraim Flashner <efraim@flashner.co.il> | 2025-07-28 09:55:50 +0300 |
|---|---|---|
| committer | Janneke Nieuwenhuizen <janneke@gnu.org> | 2026-01-28 21:47:41 +0100 |
| commit | 108b89f8eb7ab2da47a9090a69bcc289b3faa374 (patch) | |
| tree | 071d581772a2ec77ad2a531099f6e44b122d2c8f | |
| parent | eace31d89a67b7d0b852cd8b169203eed7ac386e (diff) | |
WIP: maybe add gcc-mesboot-10.
Change-Id: I60f650c1d212fd831fae7d8a9fb20f2c1144fb05
| -rw-r--r-- | gnu/packages/commencement.scm | 179 |
1 files changed, 179 insertions, 0 deletions
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index ff2ddde8430..638816eb882 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm | |||
| @@ -2733,6 +2733,185 @@ exec " gcc "/bin/" program | |||
| 2733 | (format (current-error-port) "LIBRARY_PATH=~a\n" | 2733 | (format (current-error-port) "LIBRARY_PATH=~a\n" |
| 2734 | (getenv "LIBRARY_PATH")))))))))))) | 2734 | (getenv "LIBRARY_PATH")))))))))))) |
| 2735 | 2735 | ||
| 2736 | (define gcc-mesboot-10 | ||
| 2737 | (package | ||
| 2738 | (inherit gcc-mesboot1) | ||
| 2739 | (name "gcc-mesboot") | ||
| 2740 | (version "10.4.0") | ||
| 2741 | (source (origin | ||
| 2742 | (method url-fetch) | ||
| 2743 | (uri (string-append "mirror://gnu/gcc/gcc-" | ||
| 2744 | version "/gcc-" version ".tar.xz")) | ||
| 2745 | (sha256 | ||
| 2746 | (base32 | ||
| 2747 | "1wg4xdizkksmwi66mvv2v4pk3ja8x64m7v9gzhykzd3wrmdpsaf9")))) | ||
| 2748 | (native-inputs `( | ||
| 2749 | ("xz" ,xz-mesboot) ; TODO: Insert properly. | ||
| 2750 | ,@(modify-inputs (%boot-muslboot3-inputs) | ||
| 2751 | (prepend %bootstrap-gcc) | ||
| 2752 | (replace "libc" musl-boot-static)))) | ||
| 2753 | ;,@(%boot-muslboot3-inputs))) | ||
| 2754 | (inputs `(;("gmp-source" ,(bootstrap-origin (package-source gmp-6.0))) | ||
| 2755 | ;("mpfr-source" ,(bootstrap-origin (package-source mpfr))) | ||
| 2756 | ;("mpc-source" ,(bootstrap-origin (package-source mpc))) | ||
| 2757 | ("gmp-boot" ,gmp-boot1) | ||
| 2758 | ("mpfr-boot" ,mpfr-boot1) | ||
| 2759 | ("mpc-boot" ,mpc-boot1) | ||
| 2760 | )) | ||
| 2761 | (supported-systems '("riscv64-linux")) | ||
| 2762 | (arguments | ||
| 2763 | `(#:validate-runpath? #f | ||
| 2764 | ,@(substitute-keyword-arguments (package-arguments gcc-mesboot1) | ||
| 2765 | ((#:parallel-build? _ #t) #f) ; Times out | ||
| 2766 | ((#:make-flags _ #~'()) | ||
| 2767 | ;#~(let* ((libc (assoc-ref %build-inputs "libc")) | ||
| 2768 | ; (ldflags (string-append | ||
| 2769 | ; "-B" libc "/lib " | ||
| 2770 | ; "-Wl,-dynamic-linker " | ||
| 2771 | ; "-Wl," libc "/lib/libc.a"))) | ||
| 2772 | ; (list (string-append "LDFLAGS=" ldflags) | ||
| 2773 | ; (string-append "LDFLAGS_FOR_TARGET=" ldflags) | ||
| 2774 | ; ;"CFLAGS=-g0 -O2 -lsupc++" | ||
| 2775 | ; ))) | ||
| 2776 | #~'()) | ||
| 2777 | #; | ||
| 2778 | ((#:make-flags flags #~'()) | ||
| 2779 | ;; Remove the LDFLAGS for libc from the make-flags | ||
| 2780 | #~(cons* "CFLAGS=-g0 -O2" | ||
| 2781 | "CXXFLAGS=-g -O2" | ||
| 2782 | "BOOT_CFLAGS=-O2 -g0" | ||
| 2783 | ;"LDFLAGS=-static" | ||
| 2784 | "BOOT_LDFLAGS=-static" | ||
| 2785 | #$flags | ||
| 2786 | )) | ||
| 2787 | ((#:configure-flags configure-flags) | ||
| 2788 | #~(let ((out (assoc-ref %outputs "out")) | ||
| 2789 | (libc (assoc-ref %build-inputs "libc"))) | ||
| 2790 | (list (string-append "--prefix=" out) | ||
| 2791 | ;(string-append "--build=" #$(commencement-build-target)) | ||
| 2792 | ;(string-append "--host=" #$(commencement-build-target)) | ||
| 2793 | (string-append "--build=" | ||
| 2794 | #$(string-replace-substring | ||
| 2795 | (commencement-build-target) | ||
| 2796 | "-gnu" "-musl")) | ||
| 2797 | (string-append "--host=" | ||
| 2798 | #$(string-replace-substring | ||
| 2799 | (commencement-build-target) | ||
| 2800 | "-gnu" "-musl")) | ||
| 2801 | |||
| 2802 | "--with-host-libstdcxx=-lsupc++" | ||
| 2803 | ;"--with-host-libstdcxx=-lstdc++" | ||
| 2804 | |||
| 2805 | ;; Maybe not needed with musl-gcc | ||
| 2806 | (string-append "--with-native-system-header-dir=" libc "/include") | ||
| 2807 | ;(string-append "--with-build-sysroot=" libc );"/include") | ||
| 2808 | (string-append "--with-gxx-include-dir=" out "/include/c++") | ||
| 2809 | |||
| 2810 | ;; These 3 seem necessary after switching CC to musl-gcc. | ||
| 2811 | (string-append "--with-gmp=" (assoc-ref %build-inputs "gmp-boot")) | ||
| 2812 | (string-append "--with-mpfr=" (assoc-ref %build-inputs "mpfr-boot")) | ||
| 2813 | (string-append "--with-mpc=" (assoc-ref %build-inputs "mpc-boot")) | ||
| 2814 | |||
| 2815 | ;"--with-stage1-ldflags=-static" | ||
| 2816 | |||
| 2817 | "--disable-bootstrap" | ||
| 2818 | "--disable-decimal-float" | ||
| 2819 | "--disable-libatomic" | ||
| 2820 | "--disable-libcilkrts" | ||
| 2821 | "--disable-libgomp" | ||
| 2822 | "--disable-libitm" | ||
| 2823 | "--disable-libmudflap" | ||
| 2824 | "--disable-libquadmath" | ||
| 2825 | "--disable-libsanitizer" | ||
| 2826 | "--disable-libssp" | ||
| 2827 | "--disable-libvtv" | ||
| 2828 | "--disable-lto" | ||
| 2829 | "--disable-lto-plugin" | ||
| 2830 | "--disable-multilib" | ||
| 2831 | "--disable-plugin" | ||
| 2832 | ;"--disable-threads" | ||
| 2833 | "--enable-languages=c,c++" | ||
| 2834 | |||
| 2835 | ;"--enable-static" | ||
| 2836 | ;"--enable-shared" | ||
| 2837 | ;"--enable-threads=single" | ||
| 2838 | "--enable-threads=posix" | ||
| 2839 | |||
| 2840 | ;; No pre-compiled libstdc++ headers, to save space. | ||
| 2841 | "--disable-libstdcxx-pch" | ||
| 2842 | |||
| 2843 | ;; Maybe? | ||
| 2844 | ;"--enable-__cxa_atexit" | ||
| 2845 | ;"--enable-default-pie" | ||
| 2846 | ;"--enable-host-shared" | ||
| 2847 | |||
| 2848 | ;"--disable-libstdc++-v3" | ||
| 2849 | ;; for libcpp ... | ||
| 2850 | ;"--disable-build-with-cxx" | ||
| 2851 | ;"--without-headers" | ||
| 2852 | ))) | ||
| 2853 | ((#:phases phases) | ||
| 2854 | #~(modify-phases #$phases | ||
| 2855 | (delete 'apply-boot-patch) | ||
| 2856 | (delete 'unpack-g++) ; sadly, gcc-4.9.4 does not provide | ||
| 2857 | ; modular core/language downloads | ||
| 2858 | (add-after 'unpack 'setenv | ||
| 2859 | (lambda _ | ||
| 2860 | (setenv "CC" "musl-gcc"))) | ||
| 2861 | #; | ||
| 2862 | (add-before 'configure 'configure-libiberty | ||
| 2863 | (lambda _ | ||
| 2864 | (with-directory-excursion "libiberty" | ||
| 2865 | (assoc-ref %standard-phases 'configure)))) | ||
| 2866 | #; | ||
| 2867 | (add-after 'unpack 'unpack-gmp&co | ||
| 2868 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 2869 | (let ((gmp (assoc-ref %build-inputs "gmp-source")) | ||
| 2870 | (mpfr (assoc-ref %build-inputs "mpfr-source")) | ||
| 2871 | (mpc (assoc-ref %build-inputs "mpc-source"))) | ||
| 2872 | |||
| 2873 | ;; To reduce the set of pre-built bootstrap inputs, build | ||
| 2874 | ;; GMP & co. from GCC. | ||
| 2875 | (for-each (lambda (source) | ||
| 2876 | (invoke "tar" "xvf" source)) | ||
| 2877 | (list gmp mpfr mpc)) | ||
| 2878 | |||
| 2879 | ;; Create symlinks like `gmp' -> `gmp-x.y.z'. | ||
| 2880 | #$@(map (lambda (lib) | ||
| 2881 | ;; Drop trailing letters, as gmp-6.0.0a unpacks | ||
| 2882 | ;; into gmp-6.0.0. | ||
| 2883 | #~(symlink #$(string-trim-right | ||
| 2884 | (package-full-name lib "-") | ||
| 2885 | char-set:letter) | ||
| 2886 | #$(package-name lib))) | ||
| 2887 | (list gmp-6.0 mpfr mpc))))) | ||
| 2888 | #; | ||
| 2889 | (replace 'set-cplus-include-path | ||
| 2890 | (lambda* (#:key outputs #:allow-other-keys) | ||
| 2891 | (let* ((bash (assoc-ref %build-inputs "bash")) | ||
| 2892 | (gcc (assoc-ref %build-inputs "gcc"))) | ||
| 2893 | (setenv "CONFIG_SHELL" (string-append bash "/bin/sh")) | ||
| 2894 | (setenv "C_INCLUDE_PATH" (string-append | ||
| 2895 | (getenv "C_INCLUDE_PATH") ":" | ||
| 2896 | gcc "/lib/gcc-lib/" | ||
| 2897 | #$(commencement-build-target) | ||
| 2898 | "/4.6.4/include" | ||
| 2899 | ":" (getcwd) | ||
| 2900 | ;":" (getcwd) "/mpfr/src" | ||
| 2901 | )) | ||
| 2902 | (setenv "CPLUS_INCLUDE_PATH" (string-append | ||
| 2903 | (getenv "CPLUS_INCLUDE_PATH") ":" | ||
| 2904 | gcc "/lib/gcc-lib/" | ||
| 2905 | #$(commencement-build-target) | ||
| 2906 | "/4.6.4/include" | ||
| 2907 | ":" (getcwd) | ||
| 2908 | ;":" (getcwd) "/mpfr/src" | ||
| 2909 | )) | ||
| 2910 | (format (current-error-port) "C_INCLUDE_PATH=~a\n" (getenv "C_INCLUDE_PATH")) | ||
| 2911 | (format (current-error-port) "CPLUS_INCLUDE_PATH=~a\n" (getenv "CPLUS_INCLUDE_PATH")) | ||
| 2912 | (format (current-error-port) "LIBRARY_PATH=~a\n" | ||
| 2913 | (getenv "LIBRARY_PATH")))))))))))) | ||
| 2914 | |||
| 2736 | (define gcc-mesboot-wrapper | 2915 | (define gcc-mesboot-wrapper |
| 2737 | ;; We need this so gcc-mesboot can be used to create shared binaries that | 2916 | ;; We need this so gcc-mesboot can be used to create shared binaries that |
| 2738 | ;; have the correct interpreter and runpath to libc. | 2917 | ;; have the correct interpreter and runpath to libc. |
