Guix package and manifest for RISC-V and i386 for testing
This commit is contained in:
parent
928c097cab
commit
74fa23f5a4
72
guix.scm
72
guix.scm
|
@ -28,11 +28,12 @@
|
|||
(not (false-if-exception (equal? ".git" (substring path start end))))))
|
||||
|
||||
(define libccross (cross-libc "riscv64-linux-gnu"))
|
||||
(define libccross-i386 (cross-libc "i686-linux-gnu"))
|
||||
|
||||
(define-public tcc-mine-native
|
||||
(define-public tcc-mine-i386
|
||||
(package
|
||||
(name "tcc") ;aka. "tinycc"
|
||||
(version "riscv-mes-HEAD")
|
||||
(version "i386-mes-HEAD")
|
||||
(source (local-file %source-dir
|
||||
#:recursive? #t
|
||||
#:select? discard-git))
|
||||
|
@ -41,25 +42,52 @@
|
|||
(arguments
|
||||
(list
|
||||
#:configure-flags
|
||||
#~(list
|
||||
"--extra-cflags=-DHAVE_FLOAT=1 -DHAVE_BITFIELD=1 -DHAVE_LONG_LONG=1 -DHAVE_SETJMP=1"
|
||||
"--disable-rpath")
|
||||
#:test-target "test"
|
||||
#~(list "--enable-cross"
|
||||
"--disable-rpath"
|
||||
"--extra-cflags=-DHAVE_FLOAT=1 -DHAVE_BITFIELD=1 -DHAVE_LONG_LONG=1 -DHAVE_SETJMP=1 -DASM_DEBUG=1")
|
||||
#:tests? #f
|
||||
#:validate-runpath? #f
|
||||
#:phases
|
||||
#~(modify-phases
|
||||
%standard-phases
|
||||
(replace 'build
|
||||
(lambda _
|
||||
(invoke "./build-gcc.sh")))
|
||||
(replace 'install
|
||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||
(install-file "libtcc1.a"
|
||||
(string-append (assoc-ref outputs "out") "/lib/tcc"))
|
||||
(install-file "tcc"
|
||||
(string-append (assoc-ref outputs "out") "/bin"))
|
||||
(copy-recursively "include"
|
||||
(string-append (assoc-ref outputs "out") "/include")))) )))
|
||||
#:phases #~(modify-phases %standard-phases
|
||||
(replace 'build
|
||||
(lambda _
|
||||
(invoke "make" "cross-i386")))
|
||||
|
||||
;; Cross compilers don't get the default config so we need to add custom
|
||||
;; configuration like explained in `make help`
|
||||
(add-before 'configure 'configure-cross
|
||||
(lambda _
|
||||
(call-with-output-file "config-cross.mak"
|
||||
(lambda (port)
|
||||
(display
|
||||
(string-append "CRT-i386 = " #$libccross-i386 "/lib") port)
|
||||
(newline port)
|
||||
(display
|
||||
(string-append "LIB-i386 = " #$libccross-i386 "/lib") port)
|
||||
(newline port)
|
||||
(display
|
||||
(string-append "INC-i386 = " #$libccross-i386 "/include" ":" #$output "/include") port)))))
|
||||
|
||||
;(add-before 'install 'fail (lambda _ (error "Fail for debug")))
|
||||
|
||||
;; Default `make install` phase does not install the cross compilers
|
||||
;; We have to do it by hand
|
||||
(replace 'install
|
||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||
;; Make an empty libtcc1. Needed because:
|
||||
;; - Later it'll try to dynamically link it (needed)
|
||||
;; - It only has i386 related definitions, and fails if it's compiled in other arch (make it empty)
|
||||
(call-with-output-file "lib/libtcc1.c"
|
||||
(lambda (p) (display "" p)))
|
||||
(invoke "./i386-tcc" "-c" "lib/libtcc1.c" "-o" "libtcc1.o")
|
||||
(invoke "./i386-tcc" "-ar" "cr" "libtcc1-i386.a" "libtcc1.o")
|
||||
|
||||
;; Now install
|
||||
(install-file "libtcc1-i386.a"
|
||||
(string-append (assoc-ref outputs "out") "/lib/tcc"))
|
||||
(install-file "i386-tcc"
|
||||
(string-append (assoc-ref outputs "out") "/bin"))
|
||||
(copy-recursively "include"
|
||||
(string-append (assoc-ref outputs "out") "/include")))))))
|
||||
(native-search-paths
|
||||
(list (search-path-specification
|
||||
(variable "CPATH")
|
||||
|
@ -68,6 +96,7 @@
|
|||
(variable "LIBRARY_PATH")
|
||||
(files '("lib" "lib64")))))
|
||||
|
||||
(outputs (list "out" "debug"))
|
||||
(synopsis "Tiny and fast C compiler")
|
||||
(description
|
||||
"TCC, also referred to as \"TinyCC\", is a small and fast C compiler
|
||||
|
@ -79,7 +108,6 @@ standard.")
|
|||
(license license:lgpl2.1+)))
|
||||
|
||||
|
||||
|
||||
(define-public tcc-mine
|
||||
(package
|
||||
(name "tcc") ;aka. "tinycc"
|
||||
|
@ -94,7 +122,7 @@ standard.")
|
|||
#:configure-flags
|
||||
#~(list "--enable-cross"
|
||||
"--disable-rpath"
|
||||
"--extra-cflags=-DHAVE_FLOAT=1 -DHAVE_BITFIELD=1 -DHAVE_LONG_LONG=1 -DHAVE_SETJMP=1")
|
||||
"--extra-cflags=-DHAVE_FLOAT=1 -DHAVE_BITFIELD=1 -DHAVE_LONG_LONG=1 -DHAVE_SETJMP=1 -DASM_DEBUG=1")
|
||||
#:tests? #f
|
||||
#:validate-runpath? #f
|
||||
#:phases #~(modify-phases %standard-phases
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
(load "guix.scm")
|
||||
(use-modules (gnu packages gdb))
|
||||
(define triplet "i686-linux-gnu")
|
||||
|
||||
(packages->manifest
|
||||
(let* ((binutils (cross-binutils triplet))
|
||||
(libc (cross-libc triplet)))
|
||||
(list tcc-mine-i386
|
||||
(list gcc "lib")
|
||||
binutils
|
||||
libc
|
||||
gdb
|
||||
(list libc "static"))))
|
|
@ -1,5 +1,5 @@
|
|||
(load "guix.scm")
|
||||
|
||||
(use-modules (gnu packages gdb))
|
||||
(define triplet "riscv64-linux-gnu")
|
||||
|
||||
(packages->manifest
|
||||
|
@ -9,4 +9,5 @@
|
|||
(list gcc "lib")
|
||||
binutils
|
||||
libc
|
||||
gdb
|
||||
(list libc "static"))))
|
||||
|
|
Loading…
Reference in New Issue