summaryrefslogtreecommitdiff
path: root/gnu/packages/commencement.scm
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2024-10-08 08:21:27 +0300
committerJanneke Nieuwenhuizen <janneke@gnu.org>2026-01-28 21:47:38 +0100
commit2ddbd6b30e699d543fc8a7ffbede13578fc071cc (patch)
tree0a40a0259835a1252164dd4f01d92e6d956785d6 /gnu/packages/commencement.scm
parent892e2a41dedf09452bc96c57e5e4f0c41260ae45 (diff)
gnu: Add gcc-muslboot0.
* gnu/packages/commencement.scm (gcc-muslboot0): New variable. * gnu/packages/patches/gcc-boot-4.6.4-riscv64-support.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. Co-authored-by: Efraim Flashner <efraim@flashner.co.il> Change-Id: I9a96fe502d739ddf1d73b0f3973f7f9e1e70dcb3
Diffstat (limited to 'gnu/packages/commencement.scm')
-rw-r--r--gnu/packages/commencement.scm111
1 files changed, 111 insertions, 0 deletions
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 8a8cff599ec..cdc3999a783 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1795,6 +1795,117 @@ ac_cv_c_float_format='IEEE (little-endian)'
1795 (search-patch "gcc-boot-4.6.4.patch")))) 1795 (search-patch "gcc-boot-4.6.4.patch"))))
1796 (invoke "patch" "--force" "-p1" "-i" patch-file))))))))) 1796 (invoke "patch" "--force" "-p1" "-i" patch-file)))))))))
1797 1797
1798(define gcc-muslboot0
1799 (package
1800 (inherit gcc-4.7)
1801 (name "gcc-muslboot0")
1802 (version "4.6.4")
1803 (source (origin
1804 (method url-fetch)
1805 (uri (string-append "mirror://gnu/gcc/gcc-"
1806 version "/gcc-core-" version ".tar.gz"))
1807 (sha256
1808 (base32
1809 "173kdb188qg79pcz073cj9967rs2vzanyjdjyxy9v0xb0p5sad75"))))
1810 (outputs '("out"))
1811 (inputs (list gmp-boot mpfr-boot mpc-boot))
1812 (native-inputs (%boot-tcc-musl-inputs))
1813 (arguments
1814 (list #:implicit-inputs? #f
1815 #:guile %bootstrap-guile
1816 #:tests? #f
1817 #:modules '((guix build gnu-build-system)
1818 (guix build utils)
1819 (srfi srfi-1))
1820 #:parallel-build? #f ; for debugging
1821 #:configure-flags
1822 #~(let ((out (assoc-ref %outputs "out"))
1823 (libc (assoc-ref %build-inputs "libc"))
1824 (bash (assoc-ref %build-inputs "bash")))
1825 (list (string-append "--prefix=" out)
1826 (string-append "--with-build-sysroot=" libc "/include")
1827 (string-append "--with-native-system-header-dir=" libc "/include")
1828 (string-append "--build="
1829 #$(string-replace-substring
1830 (commencement-build-target)
1831 "-gnu" "-musl"))
1832 (string-append "--host="
1833 #$(string-replace-substring
1834 (commencement-build-target)
1835 "-gnu" "-musl"))
1836 "--disable-bootstrap"
1837 "--disable-decimal-float"
1838 "--disable-libatomic"
1839 "--disable-libcilkrts"
1840 "--disable-libgomp"
1841 "--disable-libitm"
1842 "--disable-libmudflap"
1843 "--disable-libquadmath"
1844 "--disable-libsanitizer"
1845 "--disable-libssp"
1846 "--disable-libvtv"
1847 "--disable-lto"
1848 "--disable-lto-plugin"
1849 "--disable-multilib"
1850 "--disable-plugin"
1851 "--disable-threads"
1852 "--enable-languages=c"
1853 "--enable-static"
1854 "--disable-shared"
1855 "--enable-threads=single"
1856 "--disable-libstdcxx-pch"
1857 "--disable-build-with-cxx"))
1858 #:phases
1859 #~(modify-phases %standard-phases
1860 (add-after 'unpack 'apply-riscv64-patch
1861 (lambda* (#:key inputs #:allow-other-keys)
1862 (let ((patch-file
1863 #$(local-file
1864 (search-patch "gcc-boot-4.6.4-riscv64-support.patch"))))
1865 (invoke "patch" "--force" "-p1" "-i" patch-file))))
1866 (add-after 'unpack 'fix-alloca
1867 (lambda* (#:key inputs #:allow-other-keys)
1868 (substitute* (list "libiberty/alloca.c"
1869 "include/libiberty.h")
1870 (("C_alloca") "alloca"))))
1871 (add-before 'configure 'fix-dynamic-linker-for-musl
1872 (lambda* (#:key inputs #:allow-other-keys)
1873 (let ((libc (assoc-ref inputs "libc")))
1874 ;; Fix the dynamic linker's file name.
1875 ;; This should work on gcc-13 for all architectures except loongarch.
1876 (substitute* (find-files "gcc/config"
1877 "^(aarch64-)?(linux|gnu|sysv4)(64|-elf|-eabi)?\\.h$")
1878 (("(#define MUSL_DYNAMIC_LINKER*).*$" _ dynamic-linker)
1879 ;; TODO: Make this use architecture specific ld-musl-*.so
1880 (string-append dynamic-linker " \"" libc "/lib/libc.so\"")))
1881 ;; We also need to adjust the references made for glibc
1882 ;; to point to the musl linker location
1883 (substitute* (find-files "gcc/config"
1884 "^(linux|gnu|sysv4)(64|-elf|-eabi)?\\.h$")
1885 (("#define (GLIBC|GNU_USER)_DYNAMIC_LINKER([^ \t]*).*$"
1886 _ gnu-user suffix)
1887 (format #f "#define ~a_DYNAMIC_LINKER~a \"~a\"~%"
1888 gnu-user suffix
1889 (string-append libc "/lib/libc.so")))))))
1890 (add-after 'apply-riscv64-patch 'patch-for-modern-libc
1891 (lambda _
1892 (for-each
1893 (lambda (dir)
1894 (substitute* (string-append "gcc/config/"
1895 dir "/linux-unwind.h")
1896 (("struct ucontext") "ucontext_t")))
1897 '("alpha" "bfin" "i386" "pa" "sh" "xtensa" "riscv"))))
1898 (add-before 'configure 'setenv
1899 (lambda _
1900 (setenv "CC" "tcc")
1901 (setenv "CFLAGS" "-D HAVE_ALLOCA_H"))))))
1902 (native-search-paths
1903 (list (search-path-specification
1904 (variable "C_INCLUDE_PATH")
1905 (files '("include")))
1906 (search-path-specification
1907 (variable "LIBRARY_PATH")
1908 (files '("lib")))))))
1798 1909
1799(define gcc-mesboot1 1910(define gcc-mesboot1
1800 (package 1911 (package