gnu: axoloti-runtime: Simplify with G-expression.
* gnu/packages/axoloti.scm (axoloti-runtime)[arguments]: Use G-expression to simplify; remove trailing #T from build phases. Change-Id: Ic9628b58c0e2b7816af6b7b42ab1aff927b4b0damaster
parent
e391a271bb
commit
b162136d87
|
@ -90,103 +90,101 @@
|
||||||
'(delete-file-recursively "lib/"))))
|
'(delete-file-recursively "lib/"))))
|
||||||
(build-system gnu-build-system)
|
(build-system gnu-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
`(#:tests? #f ; no check target
|
(list
|
||||||
#:modules ((guix build gnu-build-system)
|
#:tests? #f ; no check target
|
||||||
|
#:modules '((guix build gnu-build-system)
|
||||||
(guix build utils)
|
(guix build utils)
|
||||||
(srfi srfi-1)
|
(srfi srfi-1)
|
||||||
(srfi srfi-26)
|
(srfi srfi-26)
|
||||||
(ice-9 match)
|
(ice-9 match)
|
||||||
(ice-9 regex))
|
(ice-9 regex))
|
||||||
#:phases
|
#:phases
|
||||||
(modify-phases %standard-phases
|
#~(modify-phases %standard-phases
|
||||||
(add-after 'unpack 'patch-paths
|
(add-after 'unpack 'patch-paths
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
;; prepare ChibiOS
|
;; prepare ChibiOS
|
||||||
(invoke "unzip" "-o" (assoc-ref inputs "chibios"))
|
(invoke "unzip" "-o" (assoc-ref inputs "chibios"))
|
||||||
(invoke "mv" "ChibiOS_2.6.9" "chibios")
|
(invoke "mv" "ChibiOS_2.6.9" "chibios")
|
||||||
(with-directory-excursion "chibios/ext"
|
(with-directory-excursion "chibios/ext"
|
||||||
(invoke "unzip" "-o" "fatfs-0.9-patched.zip"))
|
(invoke "unzip" "-o" "fatfs-0.9-patched.zip"))
|
||||||
|
|
||||||
;; Remove source of non-determinism in ChibiOS
|
;; Remove source of non-determinism in ChibiOS
|
||||||
(substitute* "chibios/os/various/shell.c"
|
(substitute* "chibios/os/various/shell.c"
|
||||||
(("#ifdef __DATE__") "#if 0"))
|
(("#ifdef __DATE__") "#if 0"))
|
||||||
|
|
||||||
;; Patch shell paths
|
;; Patch shell paths
|
||||||
(substitute* '("src/main/java/qcmds/QCmdCompileFirmware.java"
|
(substitute* '("src/main/java/qcmds/QCmdCompileFirmware.java"
|
||||||
"src/main/java/qcmds/QCmdCompilePatch.java"
|
"src/main/java/qcmds/QCmdCompilePatch.java"
|
||||||
"src/main/java/qcmds/QCmdFlashDFU.java")
|
"src/main/java/qcmds/QCmdFlashDFU.java")
|
||||||
(("/bin/sh") (which "sh")))
|
(("/bin/sh") (which "sh")))
|
||||||
|
|
||||||
;; Override cross compiler base name
|
;; Override cross compiler base name
|
||||||
(substitute* "firmware/Makefile.patch"
|
(substitute* "firmware/Makefile.patch"
|
||||||
(("arm-none-eabi-(gcc|g\\+\\+|objcopy|objdump)" tool)
|
(("arm-none-eabi-(gcc|g\\+\\+|objcopy|objdump)" tool)
|
||||||
(which tool)))
|
(which tool)))
|
||||||
|
|
||||||
;; XXX: for some reason the whitespace substitution does not
|
;; XXX: for some reason the whitespace substitution does not
|
||||||
;; work, so we disable it.
|
;; work, so we disable it.
|
||||||
(substitute* "firmware/Makefile.patch"
|
(substitute* "firmware/Makefile.patch"
|
||||||
(("^BDIR=.*") "BDIR=${axoloti_home}/build\n"))
|
(("^BDIR=.*") "BDIR=${axoloti_home}/build\n"))
|
||||||
|
|
||||||
;; Hardcode full path to compiler tools
|
;; Hardcode full path to compiler tools
|
||||||
(substitute* '("firmware/Makefile"
|
(substitute* '("firmware/Makefile"
|
||||||
"firmware/flasher/Makefile"
|
"firmware/flasher/Makefile"
|
||||||
"firmware/mounter/Makefile")
|
"firmware/mounter/Makefile")
|
||||||
(("TRGT =.*")
|
(("TRGT =.*")
|
||||||
(string-append "TRGT = "
|
(string-append "TRGT = "
|
||||||
(assoc-ref inputs "cross-toolchain")
|
(assoc-ref inputs "cross-toolchain")
|
||||||
"/bin/arm-none-eabi-\n")))
|
"/bin/arm-none-eabi-\n")))
|
||||||
|
|
||||||
;; Hardcode path to "make"
|
;; Hardcode path to "make"
|
||||||
(substitute* '("firmware/compile_firmware_linux.sh"
|
(substitute* '("firmware/compile_firmware_linux.sh"
|
||||||
"firmware/compile_patch_linux.sh")
|
"firmware/compile_patch_linux.sh")
|
||||||
(("make") (which "make")))
|
(("make") (which "make")))
|
||||||
|
|
||||||
;; Hardcode path to "dfu-util"
|
;; Hardcode path to "dfu-util"
|
||||||
(substitute* "platform_linux/upload_fw_dfu.sh"
|
(substitute* "platform_linux/upload_fw_dfu.sh"
|
||||||
(("-f \"\\$\\{platformdir\\}/bin/dfu-util\"") "-z \"\"")
|
(("-f \"\\$\\{platformdir\\}/bin/dfu-util\"") "-z \"\"")
|
||||||
(("\\./dfu-util") (which "dfu-util")))
|
(("\\./dfu-util") (which "dfu-util")))))
|
||||||
#t))
|
(delete 'configure)
|
||||||
(delete 'configure)
|
(replace 'build
|
||||||
(replace 'build
|
;; Build Axoloti firmware with cross-compiler
|
||||||
;; Build Axoloti firmware with cross-compiler
|
(lambda _
|
||||||
(lambda _
|
(with-directory-excursion "platform_linux"
|
||||||
(with-directory-excursion "platform_linux"
|
(invoke "sh" "compile_firmware.sh"))))
|
||||||
(invoke "sh" "compile_firmware.sh"))))
|
(replace 'install
|
||||||
(replace 'install
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
(let* ((share (string-append #$output "/share/axoloti/"))
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(doc (string-append share "doc"))
|
||||||
(share (string-append out "/share/axoloti/"))
|
(dir (getcwd))
|
||||||
(doc (string-append share "doc"))
|
(pats '("/doc/[^/]+$"
|
||||||
(dir (getcwd))
|
"/patches/[^/]+/[^/]+$"
|
||||||
(pats '("/doc/[^/]+$"
|
"/objects/[^/]+/[^/]+$"
|
||||||
"/patches/[^/]+/[^/]+$"
|
"/firmware/.+"
|
||||||
"/objects/[^/]+/[^/]+$"
|
"/chibios/[^/]+$"
|
||||||
"/firmware/.+"
|
"/chibios/boards/ST_STM32F4_DISCOVERY/[^/]+$"
|
||||||
"/chibios/[^/]+$"
|
"/chibios/(ext|os|docs)/.+"
|
||||||
"/chibios/boards/ST_STM32F4_DISCOVERY/[^/]+$"
|
"/CMSIS/[^/]+/[^/]+$"
|
||||||
"/chibios/(ext|os|docs)/.+"
|
"/patch/[^/]+/[^/]+$"
|
||||||
"/CMSIS/[^/]+/[^/]+$"
|
"/[^/]+\\.txt$"))
|
||||||
"/patch/[^/]+/[^/]+$"
|
(pattern (string-append
|
||||||
"/[^/]+\\.txt$"))
|
"(" (string-join
|
||||||
(pattern (string-append
|
(map (cut string-append dir <>)
|
||||||
"(" (string-join
|
pats)
|
||||||
(map (cut string-append dir <>)
|
"|") ")"))
|
||||||
pats)
|
(files (find-files dir
|
||||||
"|") ")"))
|
(lambda (file stat)
|
||||||
(files (find-files dir
|
(and (eq? 'regular (stat:type stat))
|
||||||
(lambda (file stat)
|
(string-match pattern file))))))
|
||||||
(and (eq? 'regular (stat:type stat))
|
(for-each (lambda (file)
|
||||||
(string-match pattern file))))))
|
(install-file file
|
||||||
(for-each (lambda (file)
|
(string-append
|
||||||
(install-file file
|
share
|
||||||
(string-append
|
(regexp-substitute
|
||||||
share
|
#f
|
||||||
(regexp-substitute
|
(string-match dir (dirname file))
|
||||||
#f
|
'pre 'post))))
|
||||||
(string-match dir (dirname file))
|
files)))))))
|
||||||
'pre 'post))))
|
|
||||||
files)
|
|
||||||
#t))))))
|
|
||||||
(inputs
|
(inputs
|
||||||
`(("chibios"
|
`(("chibios"
|
||||||
,(origin
|
,(origin
|
||||||
|
|
Reference in New Issue