From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:34417) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5bFx-0005s8-Ee for guix-patches@gnu.org; Sat, 22 Feb 2020 15:20:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j5bFu-0003Zi-Ff for guix-patches@gnu.org; Sat, 22 Feb 2020 15:20:09 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:44091) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j5bFu-0003Z1-B8 for guix-patches@gnu.org; Sat, 22 Feb 2020 15:20:06 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j5bFu-0001q8-7u for guix-patches@gnu.org; Sat, 22 Feb 2020 15:20:06 -0500 Subject: [bug#39747] [PATCH 3/7] gnu: java-openjfx-graphics: Implement a complete compilation. Resent-Message-ID: Received: from eggs.gnu.org ([2001:470:142:3::10]:34254) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5bEy-0005ho-8c for guix-patches@gnu.org; Sat, 22 Feb 2020 15:19:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j5bEv-0000Rk-B1 for guix-patches@gnu.org; Sat, 22 Feb 2020 15:19:08 -0500 Received: from mx4.mail.mmer.org ([178.22.66.29]:27545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j5bEq-0007zS-Oo for guix-patches@gnu.org; Sat, 22 Feb 2020 15:19:05 -0500 Received: from delta (unknown [10.147.19.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx4.mail.mmer.org (Postfix) with ESMTPSA id 8BF129CCFC for ; Sat, 22 Feb 2020 19:48:11 +0000 (UTC) From: Alexey Abramov Date: Sat, 22 Feb 2020 21:17:51 +0100 Message-Id: <20200222201755.50425-3-levenson@mmer.org> In-Reply-To: <20200222201755.50425-1-levenson@mmer.org> References: <20200222201755.50425-1-levenson@mmer.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 39747@debbugs.gnu.org --- gnu/packages/java.scm | 639 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 625 insertions(+), 14 deletions(-) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 6f75194256..4e975a0490 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -53,6 +53,7 @@ #:use-module (gnu packages gettext) #:use-module (gnu packages gcc) #:use-module (gnu packages gl) + #:use-module (gnu packages glib) #:use-module (gnu packages ghostscript) ;lcms #:use-module (gnu packages gnome) #:use-module (gnu packages groovy) @@ -2419,20 +2420,630 @@ distribution."))) =20 (define-public java-openjfx-graphics (package (inherit java-openjfx-build) - (name "java-openjfx-graphics") - (arguments - `(#:jar-name "java-openjfx-graphics.jar" - #:source-dir "modules/graphics/src/main/java" - #:tests? #f; require X - #:test-dir "modules/graphics/src/test")) - (propagated-inputs - `(("java-openjfx-base" ,java-openjfx-base) - ("java-swt" ,java-swt))) - (description "OpenJFX is a client application platform for desktop, -mobile and embedded systems built on Java. Its goal is to produce a -modern, efficient, and fully featured toolkit for developing rich client -applications. This package contains graphics-related classes for the -OpenJFX distribution."))) + (name "java-openjfx-graphics") + (arguments + `(#:jar-name "java-openjfx-graphics.jar" + #:source-dir "modules/graphics/src/main/java" + #:tests? #f ; requires X + #:test-dir "modules/graphics/src/test" + #:test-include (list "**/*Test.*") + #:modules ((guix build ant-build-system) + (guix build utils) + (srfi srfi-1) + (srfi srfi-26) + (ice-9 regex) + (ice-9 match)) + #:phases + (let* ((jdk (assoc-ref %build-inputs "jdk")) + (javac/h-flags + `( ;; When javac is compiling code it doesn't link + ;; against rt.jar by default. Instead it uses sp= ecial + ;; symbol file lib/ct.sym with class stubs. + ;; Surprisingly this file contains many but not = *all* + ;; of internal classes. + "-XDignore.symbol.file" + ;; It=E2=80=99s an internal option for JDK 1.7+ = that prevents + ;; the compiler from sharing a table that will n= ever + ;; be reused. When shared, it can=E2=80=99t be g= arbage + ;; collected, continues to accumulate data, and + ;; therefore wastes memory. + "-XDuseUnsharedTable=3Dtrue")) + (common-flags + `("-fno-strict-aliasing" "-fPIC" "-fno-omit-frame-= pointer" ;; optimization flags + "-fstack-protector" + "-W" "-Wall" "-Wno-unused" "-Wno-parentheses" "-= Werror=3Dimplicit-function-declaration")) + (cc-flags + `(,@common-flags "-c" "-ffunction-sections" "-fdat= a-sections" + "-I" ,(string-append jdk "/includ= e") + "-I" ,(string-append jdk "/includ= e/linux"))) + (link-flags + `("-static-libgcc" "-static-libstdc++" "-shared" ,= @common-flags + "-z" "relro" + "-Wl,--gc-sections")) + (java-aux-class? + (lambda (class) + (string-match "\\$[0-9]+.class" class))) + (java-list-classes + (lambda (path) + ;; For each .java file we need to figure out wha= t + ;; class the .java file belongs in and convert i= t to a + ;; class name. + (filter-map + (lambda (class) + (let* ((rx (make-regexp (string-append path f= ile-name-separator-string "?"))) + (class (string-drop-right class (strin= g-length ".class"))) + (class (match:suffix (regexp-exec rx c= lass)))) + (if (java-aux-class? class) + #f + (string-join (string-split class #\/) "= .")))) + (find-files path "\\.class$"))))) + (modify-phases %standard-phases + + (replace 'build + (lambda _ + ;; Do not mix different classes. There will be mor= e stuff in build/classes + (invoke "ant" "compile" "-Dclasses.dir=3Dmodules/g= raphics/build/classes/java/main") + #t)) + + (add-after 'build 'chdir-to-a-module-directory + (lambda _ + (chdir (string-append (getcwd) "/modules/graphics"= )) + #t)) + + (add-after 'chdir-to-a-module-directory 'compile-prism= -compilers + (lambda _ + (let ((prism-compilers-classes "build/classes/jsl-= compilers/prism") + (prism-src "src/main/jsl-prism/")) + (mkdir-p prism-compilers-classes) + (apply invoke `("javac" + "-d" ,prism-compilers-classes + ,@javac/h-flags + ,@(find-files prism-src "\\.java= ")))) + #t)) + + (add-after 'compile-prism-compilers 'generate-prism-sh= aders + (lambda _ + (let ((prism-compilers-classes "build/classes/jsl-= compilers/prism") + (prism-src "src/main/jsl-prism/") + (prism-generated-src "build/generated-src/js= l-prism")) + (mkdir-p prism-generated-src) + (for-each (lambda (file) + (apply invoke `("java" + "-cp" ,(string-join = (list + = ;; For CompileJSL + = prism-compilers-classes + = ;; jsl files are there + = prism-src + = (getenv "CLASSPATH")) + = ":") + "CompileJSL" + "-i" ,prism-src + "-o" ,prism-generate= d-src + "-t" + "-pkg" "com/sun/pris= m" + "-d3d" + "-es2" + "-name" ,file))) + (find-files prism-src "\\.jsl$"))) + #t)) + + (add-after 'generate-prism-shaders 'compile-prism-shad= ers + (lambda _ + (let* ((classes "build/classes/java/main") + (prism-classes "build/classes/jsl-prism") + (prism-generated-src "build/generated-src/j= sl-prism") + (prism-generated-shaders-src (string-append= prism-generated-src "/com/sun/prism/shader"))) + (mkdir-p prism-classes) + (apply invoke `("javac" + "-d" ,prism-classes + "-cp" ,(string-append classes ":= " (getenv "CLASSPATH")) + ,@javac/h-flags + ,@(find-files prism-generated-sh= aders-src)))) + #t)) + (add-after 'compile-prism-shaders 'compile-decora-comp= ilers + (lambda _ + (let ((classes "build/classes/java/main") + (decora-compilers-classes "build/classes/jsl= -compilers/decora") + (decora-src "src/main/jsl-decora/")) + (mkdir-p decora-compilers-classes) + (apply invoke `("javac" + "-d" ,decora-compilers-classes + "-cp" ,(string-append classes ":= " (getenv "CLASSPATH")) + ,@javac/h-flags + ,@(find-files decora-src "\\.jav= a")))) + #t)) + + (add-after 'compile-decora-compilers 'generate-decora-= shaders + (lambda _ + (let ((classes "build/classes/java/main") + (decora-classes "build/classes/jsl-decora/") + (decora-compilers-classes "build/classes/jsl= -compilers/decora") + (decora-generated-src "build/generated-src/j= sl-decora") + (decora-src "src/main/jsl-decora/") + (decora-components '([(file-name . "ColorAdj= ust") + (generator . "CompileJ= SL") + (outputs . "-all")] + [(file-name . "Brightpa= ss") + (generator . "CompileJ= SL") + (outputs . "-all")] + [(file-name . "SepiaTon= e") + (generator . "CompileJ= SL") + (outputs . "-all")] + [(file-name . "Perspect= iveTransform") + (generator . "CompileJ= SL") + (outputs . "-all")] + [(file-name . "Displace= mentMap") + (generator . "CompileJ= SL") + (outputs . "-all")] + [(file-name . "InvertMa= sk") + (generator . "CompileJ= SL") + (outputs . "-all")] + [(file-name . "Blend") + (generator . "CompileB= lend") + (outputs . "-all")] + [(file-name . "PhongLig= hting") + (generator . "CompileP= hong") + (outputs . "-all")] + [(file-name . "LinearCo= nvolve") + (generator . "CompileL= inearConvolve") + (outputs . "-hw")] + [(file-name . "LinearCo= nvolveShadow") + (generator . "CompileL= inearConvolve") + (outputs . "-hw")]))) + (mkdir-p decora-generated-src) + (for-each (match-lambda + ((('file-name . file-name) + ('generator . generator) + ('outputs . outputs)) + (apply invoke `("java" + "-cp" ,(string-join= (cons* classes + = decora-src + = ;; CompileJSL + = decora-compilers-classes + = decora-classes + = ;; We need resources from the build + = "../../buildSrc/src/main/resources" + = (list (getenv "CLASSPATH"))) + = ":") + ,generator + "-i" ,decora-src + "-o" ,decora-genera= ted-src + "-t" + "-pkg" "com/sun/sce= nario/effect" + ,outputs + ,file-name)))) + decora-components) + #t))) + + (add-after 'generate-decora-shaders 'compile-decora-sh= aders + (lambda _ + (let ((classes "build/classes/java/main") + (decora-classes "build/classes/jsl-decora/") + (decora-generated-src "build/generated-src/j= sl-decora")) + (mkdir-p decora-classes) + (apply invoke `("javac" + "-d" ,decora-classes + "-cp" ,classes + ,@javac/h-flags + ,@(find-files decora-generated-s= rc "\\.java$")))) + #t)) + + (add-after 'compile-decora-shaders 'compile-decora-nat= ive-lib + (lambda* (#:key inputs #:allow-other-keys) + (let* ((classes "build/classes/java/main") + (decora-generated-headers "build/generated-= src/headers/jsl-decora") + (decora-generated-src "build/generated-src/= jsl-decora") + (decora-native-lib "build/libs/jsl-decora/l= inux/libdecora_sse.so") + (decora-native-obj "build/native/jsl-decora= /linux") + (decora-native-src "src/main/native-decora"= ) + (decora-src "src/main/jsl-decora/") + (decora-classes "build/classes/jsl-decora/"= ) + (decora-cc-flags `(,@cc-flags "-ffast-math"= ))) + (mkdir-p decora-generated-headers) + (apply invoke `("javah" + "-d" ,decora-generated-headers + "-cp" ,(string-join (list classe= s decora-classes) ":") + ,@javac/h-flags + ,@(filter (cut string-prefix? "c= om.sun.scenario.effect.impl.sw.sse" <>) + (append (java-list-cla= sses classes) + (java-list-cla= sses decora-classes))))) + (mkdir-p decora-native-obj) + (for-each (lambda (cc) + (apply invoke `("gcc" + ,@decora-cc-flags + "-I" ,decora-generat= ed-headers + "-I" ,decora-generat= ed-src + "-I" ,decora-native-= src + "-o" ,(string-append= decora-native-obj "/" + = (basename cc ".cc") ".obj") + ,cc))) + (append (find-files decora-generated-s= rc "\\.cc$") + (find-files decora-native-src = "\\.cc$"))) + (mkdir-p (dirname decora-native-lib)) + (apply invoke `("g++" + "-o" ,decora-native-lib + ,@link-flags + ,@(find-files decora-native-obj = "\\.obj$")))) + #t)) + + (add-after 'compile-decora-native-lib 'compile-linux-f= ont-native-lib + (lambda* (#:key inputs #:allow-other-keys) + (let* ((classes "build/classes/java/main") + (font-generated-headers "build/generated-sr= c/headers/font/linux") + (font-native-lib "build/libs/font/linux/lib= javafx_font.so") + (font-native-obj "build/native/font/linux") + (font-native-src "src/main/native-font") + ;; + (font-cc-flags `("-DJFXFONT_PLUS" ,@cc-flag= s))) + (mkdir-p font-generated-headers) + (apply invoke `("javah" + "-d" ,font-generated-headers + "-cp" ,classes + ,@javac/h-flags + ,@(filter (lambda (class) + (or (string-prefix? = "com.sun.javafx.font" class) + (string-prefix? = "com.sun.javafx.text" class))) + (java-list-classes cla= sses)))) + (mkdir-p font-native-obj) + (for-each (lambda (cc) + (apply invoke `("gcc" + ,@font-cc-flags + "-I" ,font-generated= -headers + "-I" ,font-native-sr= c + "-o" ,(string-append= font-native-obj "/" + = (basename cc ".c") ".obj") + ,cc))) + (find-files font-native-src "\\.c$")) + (mkdir-p (dirname font-native-lib)) + (apply invoke `("g++" + "-o" ,font-native-lib + ,@link-flags + ,@(find-files font-native-obj "\= \.obj$")))) + #t)) + + (add-after 'compile-linux-font-native-lib 'compile-lin= ux-font-freetype + (lambda* (#:key inputs #:allow-other-keys) + (let* ((classes "build/classes/java/main") + ;; + (font-freetype-generated-headers "build/gen= erated-src/headers/fontFreetype/linux") + (font-freetype-native-lib "build/libs/fontF= reetype/linux/libjavafx_font_freetype.so") + (font-freetype-native-obj "build/native/fon= tFreetype/linux") + (font-freetype-native-src "src/main/native-= font/freetype.c") + (font-freetype-cc-flags `("-DJFXFONT_PLUS" = "-D_ENABLE_PANGO" + "$(pkg-config --c= flags freetype2)" ,@cc-flags)) + (font-freetype-link-flags `("$(pkg-config -= -libs freetype2)" ,@link-flags))) + (mkdir-p font-freetype-generated-headers) + (apply invoke `("javah" + "-d" ,font-freetype-generated-he= aders + "-cp" ,classes + ,@javac/h-flags + ,@(filter (cut string-prefix? "c= om.sun.javafx.font.freetype.OSFreetype" <>) + (java-list-classes cla= sses)))) + (mkdir-p font-freetype-native-obj) + (invoke "bash" "-c" + (string-join `("gcc" + ,@font-freetype-cc-flags + "-I" ,font-freetype-gener= ated-headers + "-I" ,(dirname font-freet= ype-native-src) + "-o" ,(string-append font= -freetype-native-obj "/" + (bas= ename font-freetype-native-src ".c") ".obj") + ,font-freetype-native-src= ))) + (mkdir-p (dirname font-freetype-native-lib)) + (invoke "bash" "-c" + (string-join `("g++" + "-o" ,font-freetype-nativ= e-lib + ,@font-freetype-link-flag= s + ,@(find-files font-freety= pe-native-obj "\\.obj$")))) + #t))) + + (add-after 'compile-linux-font-freetype 'compile-linux= -font-pango-lib + (lambda* (#:key inputs #:allow-other-keys) + (let* ((classes "build/classes/java/main") + (font-pango-generated-headers "build/genera= ted-src/headers/fontPango/linux") + (font-pango-native-lib "build/libs/fontPang= o/linux/libjavafx_font_pango.so") + (font-pango-native-obj "build/native/fontPa= ngo/linux") + (font-pango-native-src "src/main/native-fon= t/pango.c") + (font-pango-cc-flags `("-DJFXFONT_PLUS" "-D= _ENABLE_PANGO" + "$(pkg-config --cfla= gs pangoft2)" ,@cc-flags)) + (font-pango-link-flags `("$(pkg-config --li= bs pangoft2)" ,@link-flags))) + (mkdir-p font-pango-generated-headers) + (apply invoke `("javah" + "-d" ,font-pango-generated-heade= rs + "-cp" ,classes + ,@javac/h-flags + ,@(filter (cut string-prefix? "c= om.sun.javafx.font.freetype.OSPango" <>) + (java-list-classes cla= sses)))) + (mkdir-p font-pango-native-obj) + (invoke "bash" "-c" + (string-join `("gcc" + ,@font-pango-cc-flags + "-I" ,font-pango-generate= d-headers + "-I" ,(dirname font-pango= -native-src) + "-o" ,(string-append font= -pango-native-obj "/" + (bas= ename font-pango-native-src ".c") ".obj") + ,font-pango-native-src))) + (mkdir-p (dirname font-pango-native-lib)) + (invoke "bash" "-c" + (string-join `("g++" + ,@font-pango-link-flags + "-o" ,font-pango-native-l= ib + ,@(find-files font-pango-= native-obj "\\.obj$"))))) + #t)) + + (add-after 'compile-linux-font-pango-lib 'compile-linu= x-glass-lib + (lambda* (#:key inputs #:allow-other-keys) + (let* ((classes "build/classes/java/main") + ;; glass + (glass-generated-headers "build/generated-s= rc/headers/glass/linux") + (glass-native-lib "build/libs/glass/linux/l= ibglass.so") + (glass-native-obj "build/native/glass/linux= /glass") + (glass-native-src "src/main/native-glass/gt= k/launcher.c") + (glass-cc-flags `(,@cc-flags "$(pkg-config = --cflags glib-2.0 gdk-2.0 gtk+-2.0 gthread-2.0 xtst)" "-Werror")) + (glass-link-flags `(,@link-flags "$(pkg-con= fig --libs x11)" "-ldl")) + ;; glass-gtk2 + (gtk (assoc-ref inputs "gtk")) + (glass-gtk2-native-obj "build/native/glass/= linux/glassgtk2") + (glass-gtk2-native-src (dirname glass-nativ= e-src)) + (glass-gtk2-native-lib "build/libs/glass/li= nux/libglassgtk2.so") + (glass-gtk2-cc-flags `(,@cc-flags "$(pkg-co= nfig --cflags gtk+-2.0 gthread-2.0 xtst)" "-Werror")) + (glass-gtk2-link-flags `(,@link-flags "$(pk= g-config --libs gtk+-2.0 gthread-2.0 xtst)")) + ;; glass-gtk3 + (gtk3 (assoc-ref inputs "gtk3")) + (glass-gtk3-native-obj "build/native/glass/= linux/glassgtk3") + (glass-gtk3-native-src (dirname glass-nativ= e-src)) + (glass-gtk3-native-lib "build/libs/glass/li= nux/libglassgtk3.so") + (glass-gtk3-cc-flags `(,@cc-flags "$(pkg-co= nfig --cflags gtk+-3.0 gthread-2.0 xtst)" "-Wno-deprecated-declarations" = "-Werror")) + (glass-gtk3-link-flags `(,@link-flags "$(pk= g-config --libs gtk+-3.0 gthread-2.0 xtst)"))) + ;; glass + (mkdir-p glass-generated-headers) + (apply invoke `("javah" + "-d" ,glass-generated-headers + "-cp" ,(string-append classes ":= " (getenv "CLASSPATH")) + ,@javac/h-flags + ,@(filter (lambda (class) + (or (string-prefix? = "com.sun.glass.events" class) + (string-prefix? = "com.sun.glass.ui.gtk" class) + (string-prefix? = "com.sun.glass.ui" class))) + (java-list-classes cla= sses)))) + (mkdir-p glass-native-obj) + (invoke "bash" "-c" + (string-join `("gcc" + ,@glass-cc-flags + "-I" ,glass-generated-hea= ders + "-I" ,(dirname glass-nati= ve-src) + "-o" ,(string-append glas= s-native-obj "/" + (bas= ename glass-native-src ".c") ".obj") + ,glass-native-src))) + (mkdir-p (dirname glass-native-lib)) + (invoke "bash" "-c" + (string-join `("g++" + ,@glass-link-flags + "-o" ,glass-native-lib + ,@(find-files glass-nativ= e-obj "\\.obj$")))) + ;; gtk2 + (mkdir-p glass-gtk2-native-obj) + (for-each (lambda (cpp) + (invoke "bash" "-c" + (string-join `("gcc" + ,@glass-gtk2-= cc-flags + "-I" ,glass-g= enerated-headers + "-o" ,(string= -append glass-gtk2-native-obj "/" + = (basename cpp ".cpp") ".obj") + ,cpp)))) + (find-files glass-gtk2-native-src "\\.= cpp$")) + (mkdir-p (dirname glass-gtk2-native-lib)) + (invoke "bash" "-c" + (string-join `("g++" + ,@glass-gtk2-link-flags + "-o" ,glass-gtk2-native-l= ib + ,@(find-files glass-gtk2-= native-obj "\\.obj$")))) + ;; gtk3 + (mkdir-p glass-gtk3-native-obj) + (for-each (lambda (cpp) + (invoke "bash" "-c" + (string-join `("gcc" + ,@glass-gtk3-= cc-flags + "-I" ,glass-g= enerated-headers + "-o" ,(string= -append glass-gtk3-native-obj "/" + = (basename cpp ".cpp") ".obj") + ,cpp)))) + (find-files glass-gtk3-native-src "\\.= cpp$")) + (mkdir-p (dirname glass-gtk3-native-lib)) + (invoke "bash" "-c" + (string-join `("g++" + ,@glass-gtk3-link-flags + "-o" ,glass-gtk3-native-l= ib + ,@(find-files glass-gtk3-= native-obj "\\.obj$"))))) + #t)) + + (add-after 'compile-linux-glass-lib 'compile-linux-ii= o + (lambda* (#:key inputs #:allow-other-keys) + (let* ((classes "build/classes/java/main") + (iio-generated-headers "build/generated-src= /headers/iio/linux") + (iio-native-lib "build/libs/iio/linux/libja= vafx_iio.so") + (iio-native-obj "build/native/iio/linux") + (iio-native-src "src/main/native-iio") + (iio-cc-flags cc-flags) + (iio-link-flags link-flags)) + (mkdir-p iio-generated-headers) + (apply invoke `("javah" + "-d" ,iio-generated-headers + "-cp" ,(string-append classes ":= " (getenv "CLASSPATH")) + ,@javac/h-flags + ,@(filter (cut string-prefix? "c= om.sun.javafx.iio" <>) + (java-list-classes cla= sses)))) + (mkdir-p iio-native-obj) + (for-each (lambda (c) + (invoke "bash" "-c" + (string-join `("gcc" + ,@iio-cc-flag= s + "-I" ,iio-gen= erated-headers + "-o" ,(string= -append iio-native-obj "/" + = (basename c ".c") ".obj") + ,c)))) + (find-files iio-native-src "\\.c$")) + (mkdir-p (dirname iio-native-lib)) + (invoke "bash" "-c" + (string-join `("g++" + ,@iio-link-flags + "-o" ,iio-native-lib + ,@(find-files iio-native-= obj "\\.obj$")))) + #t))) + + (add-after 'compile-linux-iio 'compile-linux-prism + (lambda* (#:key inputs #:allow-other-keys) + (let* ((classes "build/classes/java/main") + (prism-generated-headers "build/generated-s= rc/headers/prism/linux") + (prism-native-lib "build/libs/prism/linux/l= ibprism_common.so") + (prism-native-obj "build/native/prism/linux= ") + (prism-native-src "src/main/native-prism") + (prism-cc-flags `(,@cc-flags "-DINLINE=3Din= line")) + (prism-link-flags link-flags)) + (mkdir-p prism-generated-headers) + (apply invoke `("javah" + "-d" ,prism-generated-headers + "-cp" ,(string-append classes ":= " (getenv "CLASSPATH")) + ,@javac/h-flags + ,@(filter (lambda (class) + (or (string-prefix? = "com.sun.prism.impl" class) + (string-prefix? = "com.sun.prism.PresentableState" class))) + (java-list-classes cla= sses)))) + (mkdir-p prism-native-obj) + (for-each (lambda (c) + (invoke "bash" "-c" + (string-join `("gcc" + ,@prism-cc-fl= ags + "-I" ,prism-g= enerated-headers + "-I" ,prism-n= ative-src + "-o" ,(string= -append prism-native-obj "/" + = (basename c ".c") ".obj") + ,c)))) + (find-files prism-native-obj "\\.c$")) + (mkdir-p (dirname prism-native-lib)) + (invoke "bash" "-c" + (string-join `("g++" + ,@prism-link-flags + "-o" ,prism-native-lib + ,@(find-files prism-nativ= e-obj "\\.obj$")))) + #t))) + + (add-after 'compile-linux-prism 'compile-linux-prism-e= s2 + (lambda* (#:key inputs #:allow-other-keys) + (let* ((classes "build/classes/java/main") + (prism-es2-generated-headers "build/generat= ed-src/headers/prismES2/linux") + (prism-es2-native-lib "build/libs/prism/lin= ux/libprism_es2.so") + (prism-es2-native-obj "build/native/prismES= 2/linux") + (prism-es2-native-src "src/main/native-pris= m-es2") + (prism-es2-cc-flags `("-DLINUX" ,@cc-flags)= ) + (prism-es2-link-flags `(,@link-flags "$(pkg= -config --libs x11 xxf86vm gl)"))) + (mkdir-p prism-es2-generated-headers) + (apply invoke `("javah" + "-d" ,prism-es2-generated-header= s + "-cp" ,(string-append classes ":= " (getenv "CLASSPATH")) + ,@javac/h-flags + ,@(filter (cut string-prefix? "c= om.sun.prism.es2" <>) + (java-list-classes cla= sses)))) + (mkdir-p prism-es2-native-obj) + (for-each (lambda (c) + (apply invoke `("gcc" + ,@prism-es2-cc-flags + "-I" ,glass-native-s= rc + "-I" ,prism-es2-gene= rated-headers + "-I" ,prism-es2-nati= ve-src + "-I" ,(string-append= prism-es2-native-src "/GL") + "-I" ,(string-append= prism-es2-native-src "/x11") + "-o" ,(string-append= prism-es2-native-obj "/" + = (basename c ".c") ".obj") + ,c))) + (find-files prism-es2-native-src + (lambda (abs _) + (or (regexp-exec (make-r= egexp (string-append prism-es2-native-src "[^/]*\\.c$")) + abs) + (regexp-exec (make-r= egexp (string-append prism-es2-native-src "(x11/|GL/)")) + abs))))= ) + (mkdir-p (dirname prism-es2-native-lib)) + (invoke "bash" "-c" + (string-join `("g++" + ,@prism-es2-link-flags + "-o" ,prism-es2-native-li= b + ,@(find-files prism-es2-n= ative-obj "\\.obj$")))) + #t))) + + (add-after 'compile-linux-prism-es2 'compile-linux-pri= sm-sw + (lambda* (#:key inputs #:allow-other-keys) + (let* ((classes "build/classes/java/main") + (prism-sw-generated-headers "build/generate= d-src/headers/prismSW/linux") + (prism-sw-native-lib "build/libs/prism/linu= x/libprism_sw.so") + (prism-sw-native-obj "build/native/prismSW/= linux") + (prism-sw-native-src "src/main/native-prism= -sw") + ;; + (prism-sw-cc-flags `(,@cc-flags "-DINLINE=3D= inline")) + (prism-sw-link-flags link-flags)) + (mkdir-p prism-sw-generated-headers) + (apply invoke `("javah" + "-d" ,prism-sw-generated-headers + "-cp" ,(string-append classes ":= " (getenv "CLASSPATH")) + ,@javac/h-flags + ,@(filter (cut string-prefix? "c= om.sun.pisces" <>) + (java-list-classes cla= sses)))) + (mkdir-p prism-sw-native-obj) + (for-each (lambda (c) + (invoke "bash" "-c" + (string-join `("gcc" + ,@prism-sw-cc= -flags + "-I" ,prism-s= w-generated-headers + "-I" ,prism-s= w-native-src + "-o" ,(string= -append prism-sw-native-obj "/" + = (basename c ".c") ".obj") + ,c)))) + (find-files prism-sw-native-src "\\.c$= ")) + (mkdir-p (dirname prism-sw-native-lib)) + (apply invoke `("g++" + ,@prism-sw-link-flags + "-o" ,prism-sw-native-lib + ,@(find-files prism-sw-native-ob= j "\\.obj$"))) + #t))) + + (add-before 'check 'chdir-to-root + (lambda _ + (chdir (dirname (dirname (getcwd)))) + #t)) + + (add-after 'chdir-to-root 'install-native + (lambda* (#:key outputs #:allow-other-keys) + (let ((lib (string-append (assoc-ref outputs "out"= ) "/share/amd64"))) + (for-each (lambda (file) + (install-file file lib)) + (find-files "." "\\.so$")) + #t))) + + (add-after 'install-native 'build-jar + (lambda _ + (let* ((module (string-append (getcwd) "/modules/g= raphics")) + (resources (string-append module "/src/main= /resources")) + (classes (string-append module "/build/clas= ses/java/main"))) + (copy-recursively resources classes) + + (invoke "ant" "jar" (string-append "-Dclasses.di= r=3D" classes))) + #t)) + + )))) + (native-inputs + `(("freetype" ,freetype) + ("fontconfig" ,fontconfig) + ("gcc" ,gcc) + ("glib" ,glib) + ("zlib" ,zlib) + ("gtk" ,gtk+-2) + ("gtk3" ,gtk+) + ("jpeg" ,libjpeg) + ("libxtst" ,libxtst) + ("pango" ,pango) + ("libpng" ,libpng) + ("pkg-config" ,pkg-config))) + (propagated-inputs + `(("java-openjfx-base" ,java-openjfx-base) + ("java-swt" ,java-swt))))) =20 (define-public java-openjfx-media (package (inherit java-openjfx-build) --=20 2.24.1