summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/packages/commencement.scm106
-rw-r--r--gnu/packages/patches/gcc-boot-2.95.3-arm.patch31
2 files changed, 87 insertions, 50 deletions
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 8b5df32654..bb14cf612f 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -697,56 +697,62 @@ MesCC-Tools), and finally M2-Planet.")
 
 (define gnu-make-mesboot0
   ;; The initial make
-  (package
-    (inherit gnu-make)
-    (name "make-mesboot0")
-    (version "3.80")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "mirror://gnu/make/make-" version ".tar.gz"))
-              (sha256
-               (base32
-                "1pb7fb7fqf9wz9najm85qdma1xhxzf1rhj5gwrlzdsz2zm0hpcv4"))))
-    (supported-systems '("i686-linux" "x86_64-linux"))
-    (inputs '())
-    (propagated-inputs '())
-    (native-inputs `(("tcc" ,tcc-boot0)
-                     ,@(%boot-gash-inputs)))
-    (arguments
-     `(#:implicit-inputs? #f
-       #:guile ,%bootstrap-guile
-       #:configure-flags '("CC=tcc"
-                           "CPP=tcc -E"
-                           "LD=tcc"
-                           "--build=i686-unknown-linux-gnu"
-                           "--host=i686-unknown-linux-gnu"
-                           "--disable-nls")
-       #:modules ((guix build gnu-build-system)
-                  (guix build utils)
-                  (srfi srfi-1))
-       #:strip-binaries? #f             ; no strip yet
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'scripted-patch
-           (lambda _
-             (substitute* "build.sh.in"
-               (("@LIBOBJS@") "getloadavg.o")
-               (("@REMOTE@") "stub"))))
-         (add-after 'configure 'configure-fixup
-           (lambda _
-             (substitute* "make.h"
-               (("^extern long int lseek.*" all) (string-append "// " all)))))
-         (replace 'build
-           (lambda _
-             (invoke "sh" "./build.sh")))
-         (replace 'check                ; proper check needs awk
-           (lambda _
-             (invoke "./make" "--version")))
-         (replace 'install
-           (lambda _
-             (let* ((out (assoc-ref %outputs "out"))
-                    (bin (string-append out "/bin")))
-               (install-file "make" bin)))))))))
+  (let ((triplet (match (%current-system)
+                   ((or "armhf-linux" "aarch64-linux")
+                    "arm-linux")
+                   ((or "i686-linux" "x86_64-linux")
+                    "i686-linux-gnu"))))
+    (package
+      (inherit gnu-make)
+      (name "make-mesboot0")
+      (version "3.80")
+      (source (origin
+                (method url-fetch)
+                (uri (string-append "mirror://gnu/make/make-" version ".tar.gz"))
+                (sha256
+                 (base32
+                  "1pb7fb7fqf9wz9najm85qdma1xhxzf1rhj5gwrlzdsz2zm0hpcv4"))))
+      (supported-systems '("armhf-linux" "aarch64-linux"
+                           "i686-linux" "x86_64-linux"))
+      (inputs '())
+      (propagated-inputs '())
+      (native-inputs `(("tcc" ,tcc-boot0)
+                       ,@(%boot-gash-inputs)))
+      (arguments
+       `(#:implicit-inputs? #f
+         #:guile ,%bootstrap-guile
+         #:configure-flags (list "CC=tcc"
+                                 "CPP=tcc -E"
+                                 "LD=tcc"
+                                 (string-append "--build=" ,triplet)
+                                 (string-append "--host=" ,triplet)
+                                 "--disable-nls")
+         #:modules ((guix build gnu-build-system)
+                    (guix build utils)
+                    (srfi srfi-1))
+         #:strip-binaries? #f           ; no strip yet
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'scripted-patch
+             (lambda _
+               (substitute* "build.sh.in"
+                 (("@LIBOBJS@") "getloadavg.o")
+                 (("@REMOTE@") "stub"))))
+           (add-after 'configure 'configure-fixup
+             (lambda _
+               (substitute* "make.h"
+                 (("^extern long int lseek.*" all) (string-append "// " all)))))
+           (replace 'build
+             (lambda _
+               (invoke "sh" "./build.sh")))
+           (replace 'check          ; proper check needs awk
+             (lambda _
+               (invoke "./make" "--version")))
+           (replace 'install
+             (lambda _
+               (let* ((out (assoc-ref %outputs "out"))
+                      (bin (string-append out "/bin")))
+                 (install-file "make" bin))))))))))
 
 (define (%boot-tcc0-inputs)
   `(("make" ,gnu-make-mesboot0)
diff --git a/gnu/packages/patches/gcc-boot-2.95.3-arm.patch b/gnu/packages/patches/gcc-boot-2.95.3-arm.patch
new file mode 100644
index 0000000000..73a059ef7f
--- /dev/null
+++ b/gnu/packages/patches/gcc-boot-2.95.3-arm.patch
@@ -0,0 +1,31 @@
+This patch enables building gcc-2.95.3 on armhf-linux using TCC and
+Mes C Library.
+
+  * Add include/asm/unist.h linux header.
+  * Disable libgcc2.c float and long long functions.
+
+Upstream status: Not presented upstream.
+
+--- gcc-2.95.3/include/asm/unistd.h.orig	1970-01-01 01:00:00.000000000 +0100
++++ gcc-2.95.3/include/asm/unistd.h	2020-12-23 07:49:44.156673879 +0100
+@@ -0,0 +1,9 @@
++#ifndef __ASM_UNISTD_H
++#define  __ASM_UNISTD_H
++
++#if __arm__
++#define __NR_getpid 0x14
++#define __NR_kill 0x25
++#endif
++
++#endif // __ASM_UNISTD_H
+--- gcc-2.95.3/gcc/Makefile.in.orig	2020-12-23 08:31:57.733501802 +0100
++++ gcc-2.95.3/gcc/Makefile.in	2020-12-23 08:31:49.985371208 +0100
+@@ -1260,7 +1260,7 @@
+ 	-(cd tmpcopy; chmod +w * > /dev/null 2>&1)
+ 	(cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC2))
+ 	(cd tmpcopy; $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) ../tmplibgcc.a *$(objext))
+-	rm -rf libgcc2.a tmpcopy
++	rm -rf tmpcopy
+ 	if $(RANLIB_TEST_FOR_TARGET) ; then \
+ 	  $(RANLIB_FOR_TARGET) tmplibgcc.a; \
+ 	else true; fi