[bug#35570,7/8] gnu: java-tomcat: Build the full Tomcatpackage.
diff mbox series

Message ID 20190505004206.23197eea@alma-ubu
State New
Headers show
  • [bug#35570,1/8] gnu: ant-build-system: Don't overridesymlinks.
Related show


Context Check Description
cbaines/applying patch fail Apply failed

Commit Message

Björn Höfling May 4, 2019, 10:42 p.m. UTC
Currently java-tomcat uses the deploy build target. In that way, it is
built like a library, with only the jar files. This commit will change
the arget to deploy to build the full tomcat package.

* gnu/packages/web.scm (java-tomcat)[source]: Remove bat-files in
snippet. [inputs]: Remove java-eclipse-jdt-core, add
java-commons-daemon, java-ecj. [native-inputs]: Remove.
[arguments]: Use "deploy" build-target, add phases 'modify-deploy,
'symlink-commons-daemon,  'symlink-java-ecj, change 'install phase.
 gnu/packages/web.scm | 40 +++++++++++++++++++++++++++++++++++-----
 1 file changed, 35 insertions(+), 5 deletions(-)

+                    (out-lib (string-append (assoc-ref outputs "out")
+                    (target (string-append out-lib "/java-ecj.jar")))
+               (symlink java-ecj-jar target)
+               #t)))
          (add-after 'unpack 'generate-properties
            (lambda _
              ;; This could have been passed to make-flags, but getcwd
returns @@ -5592,7 +5619,10 @@ encoder/decoder based on the draft-12
specification for UBJSON.") (string-append "base.path=" (getcwd)
"/downloads\n")))) #t))
          (replace 'install
-           (install-jars "output/build/lib")))))
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (copy-recursively "output/build" out))
+             #t)))))
     (home-page "https://tomcat.apache.org")
     (synopsis "Java Servlet, JavaServer Pages, Java Expression
Language and Java WebSocket")

diff mbox series

diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 3d9070f169..cb9af0a781 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -5552,14 +5552,14 @@  encoder/decoder based on the draft-12
specification for UBJSON.") (snippet
                   (for-each delete-file (find-files "." "\\.jar$"))
+                  (for-each delete-file (find-files "." "\\.bat$"))
     (build-system ant-build-system)
-     `(("java-eclipse-jdt-core" ,java-eclipse-jdt-core)))
-    (native-inputs
-     `(("java-junit" ,java-junit)))
+     `(("java-commons-daemon" ,java-commons-daemon)
+       ("java-ecj" ,java-ecj)))
-     `(#:build-target "package"
+     `(#:build-target "deploy"
        #:tests? #f; requires downloading some files.
        (modify-phases %standard-phases
@@ -5582,6 +5582,33 @@  encoder/decoder based on the draft-12
specification for UBJSON.") (("<filter token=\"VERSION_BUILT\"
value=.*") "<filter token=\"VERSION_BUILT\" value=\"Jan 1 1970 00:00:00
UTC\"/>")) #t))
+         (add-after 'unpack 'modify-deploy
+           (lambda _
+             ;; The Tomcat build downloads and copies these files to
+             ;; bin and lib directory.
+             ;; We instead symlink to the input (see below).
+             (substitute* "build.xml"
+               (("<copy
tofile=\"\\$\\{tomcat.build\\}/bin/commons-daemon.jar.*") "")
+               (("<copy file=\"\\$\\{jdt.jar\\}\"
todir=\"\\$\\{tomcat.build\\}/lib\"/>") ""))
+             #t))
+         (add-after 'install 'symlink-commons-daemon
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((commons-daemon (assoc-ref inputs
+                    (files (find-files commons-daemon
+                    (daemon-jar (car files))
+                    (out-bin (string-append (assoc-ref outputs "out")
+                    (target (string-append out-bin
+               (symlink daemon-jar target)
+               #t)))
+         (add-after 'install 'symlink-java-ecj
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((java-ecj (assoc-ref inputs "java-ecj"))
+                    (files (find-files java-ecj "ecj.*\\.jar"))
+                    (java-ecj-jar (car files))