gnu: java-hawtjni: Simplify build phases.

* gnu/packages/java.scm (java-hawtjni)[arguments]: Use "invoke" instead of
"system*"; use "install-file" instead of "mkdir-p" and "copy-file".
This commit is contained in:
Ricardo Wurmus 2018-02-27 20:48:49 +01:00
parent 080d0b605a
commit 6338ea9a88
No known key found for this signature in database
GPG Key ID: 197A5888235FACAC
1 changed files with 11 additions and 14 deletions

View File

@ -8384,26 +8384,23 @@ including pre-existing objects that you do not have source-code of.")
(modify-phases %standard-phases (modify-phases %standard-phases
(add-before 'build 'build-native (add-before 'build 'build-native
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(with-directory-excursion "hawtjni-generator/src/main/resources/" (let ((include (string-append "-I" (assoc-ref inputs "jdk") "/include/linux")))
(and (with-directory-excursion "hawtjni-generator/src/main/resources/"
(system* "gcc" "-c" "hawtjni.c" "-o" "hawtjni.o" (invoke "gcc" "-c" "hawtjni.c" "-o" "hawtjni.o"
"-fPIC" "-O2" "-fPIC" "-O2" include)
(string-append "-I" (assoc-ref inputs "jdk") "/include/linux")) (invoke "gcc" "-c" "hawtjni-callback.c" "-o" "hawtjni-callback.o"
(system* "gcc" "-c" "hawtjni-callback.c" "-o" "hawtjni-callback.o" "-fPIC" "-O2" include)
"-fPIC" "-O2" (invoke "gcc" "-o" "libhawtjni.so" "-shared"
(string-append "-I" (assoc-ref inputs "jdk") "/include/linux")) "hawtjni.o" "hawtjni-callback.o")))
(system* "gcc" "-o" "libhawtjni.so" "-shared" #t))
"hawtjni.o" "hawtjni-callback.o")))))
(add-after 'install 'install-native (add-after 'install 'install-native
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(lib (string-append out "/lib")) (lib (string-append out "/lib"))
(inc (string-append out "/include"))) (inc (string-append out "/include")))
(mkdir-p lib)
(mkdir-p inc)
(with-directory-excursion "hawtjni-generator/src/main/resources/" (with-directory-excursion "hawtjni-generator/src/main/resources/"
(copy-file "libhawtjni.so" (string-append lib "/libhawtjni.so")) (install-file "libhawtjni.so" lib)
(copy-file "hawtjni.h" (string-append inc "/hawtjni.h")))) (install-file "hawtjni.h" inc)))
#t))))) #t)))))
(inputs (inputs
`(("java-commons-cli" ,java-commons-cli) `(("java-commons-cli" ,java-commons-cli)