all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Hartmut Goebel <h.goebel@goebel-consult.de>
To: guix-devel@gnu.org
Subject: Re: Using a function as build-step? (w/ attachement)
Date: Sun, 4 Sep 2016 13:43:30 +0200	[thread overview]
Message-ID: <71b4f428-e04e-4577-c6b9-dbf0d7105df0@goebel-consult.de> (raw)
In-Reply-To: <CAL1_im=pj_-nBv9t+5A4W1nvjjO9Ok8EkuRZOafuOTodFY10-w@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 624 bytes --]

Am 04.09.2016 um 13:29 schrieb David Craven:(
> Mmh. Maybe you could post a patch so that we can test it? Or maybe
> someone more knowledgeable has an answer...
>

Enclosed. I assume for someone knowledgeable in guile this is a no-brainer.

-- 
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP, ISO 27001 Lead Implementer
Information Security Management, Security Governance, Secure Software
Development

Goebel Consult, Landshut
http://www.goebel-consult.de

Blog: http://www.goebel-consult.de/blog/get-current-locale-with-ansible
Kolumne: http://www.cissp-gefluester.de/2010-08-scheingefechte-um-rim


[-- Attachment #1.2: Type: text/html, Size: 1735 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: commons.scm --]
[-- Type: text/x-scheme; name="commons.scm", Size: 3849 bytes --]

(use-modules (guix)
             (guix build-system ant)
             (guix licenses)
(gnu packages base)
(gnu packages java)
(gnu packages zip)
)

(define* (apache-commons-url projname version 
                             #:optional (basename 
                                         (string-append "commons-" projname)))
  (string-append
   "https://archive.apache.org/dist/commons/" projname "/source/"
   basename "-" version "-src.tar.gz"))

; todo: how to use these as a phase, like
;  (replace 'install install-jars)
;  (add-after 'build build-javadoc)

(define* (symlink-junit-jar #:key outputs #:allow-other-keys)
; Put a symlink to the acutal junit.jar into lib/jsunit-VERSION.jar
  (let ((junit (assoc-ref inputs "java-junit"))
        (junit-version "4.12")) ; from build.xml
    (mkdir-p "lib")
    (symlink (string-append junit "/share/java/junit.jar")
             (string-append "lib/junit-" junit-version ".jar"))))


(define* (install-jars #:key outputs #:allow-other-keys)
  (let ((share (string-append (assoc-ref outputs "out")
                              "/share/java")))
    (for-each (λ (f) (install-file f share))
              (find-files "." "\\.jar2$"))))

(define* (build-javadoc #:key (make-flags '()) #:allow-other-keys)
; build command for calling the ant task "javadoc"
  (zero? (apply system* `("ant" "javadoc" ,@make-flags))))

(define* (install-javadoc #:key outputs #:allow-other-keys)
; build command for installing the javs docs into
; DOC/share/doc/NAME-VERSION
  (let ((docs (string-append (assoc-ref outputs "doc")
                             "/share/doc/" name "-" version "/")))
    (mkdir-p docs)
    (copy-recursively "target/apidocs" docs)))


(define-public java-commons-io
  (package
    (name "java-commons-io")
    (version "2.5")
    (source (origin
      (method url-fetch)
      (uri (apache-commons-url "io" version))
      (sha256 (base32 "0q5y41jrcjvx9hzs47x5kdhnasdy6rm4bzqd2jxl02w717m7a7v3"))))
    (build-system ant-build-system)
    (outputs '("out" "doc"))
    (arguments
     `(#:test-target "test"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'symlink-junit.jar ;symlink-junit-jar)
           (lambda* (#:key inputs #:allow-other-keys)
             (let ((junit (assoc-ref inputs "java-junit"))
                   (junit-version "4.12")) ; from build.xml
               (mkdir-p "lib")
	       (symlink (string-append junit "/share/java/junit.jar")
			(string-append "lib/junit-" junit-version ".jar")))
             ))
         (add-after 'build 'build-javadoc ;`build-javadoc)
           (lambda* (#:key (make-flags '()) #:allow-other-keys)
             (zero? (apply system* `("ant" "javadoc" ,@make-flags)))))
         (replace 'install ;`install-jars)
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((share (string-append (assoc-ref outputs "out") 
                                         "/share/java")))
               (for-each (λ (f) (install-file f share))
                         (find-files "target" "\\.jar$")))))
         (add-after 'install 'install-doc ;install-javadoc)
           (lambda* (#:key outputs #:allow-other-keys)
;             (`install-javadoc outputs ,name ,version)
             (let ((docs (string-append (assoc-ref outputs "doc")
                                        "/share/doc/" ,name "-" ,version "/")))
               (mkdir-p docs)
               (copy-recursively "target/apidocs" docs)
               )))

)))
    (native-inputs
     `(("java-junit" ,java-junit)
       ("(java-hamcrest-core" ,java-hamcrest-core)))
    (home-page "http://commons.apache.org/io/")
    (synopsis "Common useful IO related classes")
    (description "Commons-IO contains utility classes, stream implementations,
file filters and endian classes.")
    (license asl2.0)
))

java-commons-io

  parent reply	other threads:[~2016-09-04 11:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-03 18:22 Using a function as build-step? Hartmut Goebel
2016-09-03 18:35 ` David Craven
2016-09-04 11:25   ` Hartmut Goebel
2016-09-04 11:29     ` David Craven
2016-09-04 11:43       ` Hartmut Goebel
2016-09-04 11:43       ` Hartmut Goebel [this message]
2016-09-04 15:33         ` Using a function as build-step? (w/ attachement) David Craven
2016-09-05 21:01 ` Using a function as build-step? Ludovic Courtès
2016-09-06  7:20   ` Ricardo Wurmus
2016-09-06  7:35     ` Hartmut Goebel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=71b4f428-e04e-4577-c6b9-dbf0d7105df0@goebel-consult.de \
    --to=h.goebel@goebel-consult.de \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.