;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015, 2016, 2017, 2018 Ricardo Wurmus ;;; Copyright © 2016 Leo Famulari ;;; Copyright © 2016, 2017 Roel Janssen ;;; Copyright © 2017 Carlo Zancanaro ;;; Copyright © 2017, 2018 Julien Lepiller ;;; Copyright © 2017 Thomas Danckaert ;;; Copyright © 2016, 2017, 2018 Alex Vong ;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; Copyright © 2018 Gábor Boskovits ;;; Copyright © 2018 Chris Marusich ;;; Copyright © 2018 Efraim Flashner ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages java) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix hg-download) #:use-module (guix git-download) #:use-module (guix svn-download) #:use-module (guix utils) #:use-module (guix build-system ant) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) #:use-module (gnu packages) #:use-module (gnu packages attr) #:use-module (gnu packages autotools) #:use-module (gnu pack
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au>
;;; Copyright © 2017, 2020, 2024 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2019 Kristofer Buffington <kristoferbuffington@gmail.com>
;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de>
;;; Copyright © 2023 Thomas Ieong <th.ieong@free.fr>
;;; Copyright © 2023 Saku Laesvuori <saku@laesvuori.fi>
;;; Copyright © 2023, 2024 Wojtek Kosior <koszko@koszko.org>
;;; Additions and modifications by Wojtek Kosior are additionally
;;; dual-licensed under the Creative Commons Zero v1.0.
;;; Copyright © 2024 Juliana Sims <juli@incana.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
;;;
;;; Some of the help text was taken from the default dovecot.conf files.

(define-module (gnu services mail)
  #:use-module (gnu services)
  #:use-module (gnu services base)
  #:use-module (gnu services configuration)
  #:use-module (gnu services shepherd)
  #:use-module (gnu system pam)
  #:use-module (gnu system privilege)
  #:use-module (gnu system shadow)
  #:use-module (gnu packages mail)
  #:use-module (gnu packages admin)
  #:use-module (gnu packages dav)
  #:use-module (gnu packages tls)
  #:use-module (guix deprecation)
  #:use-module ((guix diagnostics) #:select (source-properties->location))
  #:use-module (guix modules)
  #:use-module (guix records)
  #:use-module (guix packages)
  #:use-module (guix gexp)
  #:use-module (ice-9 curried-definitions)
  #:use-module (ice-9 match)
  #:use-module (ice-9 format)
  #:use-module (srfi srfi-1)
  #:export (dovecot-service  ; deprecated
            dovecot-service-type
            dovecot-configuration
            opaque-dovecot-configuration

            dict-configuration
            passdb-configuration
            userdb-configuration
            unix-listener-configuration
            fifo-listener-configuration
            inet-listener-configuration
            service-configuration
            protocol-configuration
            plugin-configuration
            mailbox-configuration
            namespace-configuration

            opensmtpd-configuration
            opensmtpd-configuration?
            opensmtpd-service-type
            %default-opensmtpd-config-file

            mail-aliases-service-type

            exim-configuration
            exim-configuration?
            exim-service-type
            %default-exim-config-file

            imap4d-configuration
            imap4d-configuration?
            imap4d-service-type
            %default-imap4d-config-file

            radicale-auth-configuration
            radicale-auth-configuration?
            radicale-encoding-configuration
            radicale-encoding-configuration?
            radicale-logging-configuration
            radicale-logging-configuration?
            radicale-rights-configuration
            radicale-rights-configuration?
            radicale-server-configuration
            radicale-server-configuration?
            radicale-storage-configuration
            radicale-storage-configuration?
            radicale-configuration
            radicale-configuration?
            radicale-service-type

            rspamd-configuration
            rspamd-service-type
            %default-rspamd-account
            %default-rspamd-config-file
            %default-rspamd-group))

;;; Commentary:
;;;
;;; This module provides service definitions for the Dovecot POP3 and IMAP
;;; mail server.
;;;
;;; Code:

(define (uglify-field-name field-name)
  (let ((str (symbol->string field-name)))
    (string-join (string-split (if (string-suffix? "?" str)
                                   (substring str 0 (1- (string-length str)))
                                   str)
                               #\-)
                 "_")))

(define (serialize-field field-name val)
  (format #t "~a=~a\n" (uglify-field-name field-name) val))

(define (serialize-string field-name val)
  (serialize-field field-name val))

(define (space-separated-string-list? val)
  (and (list? val)
       (and-map (lambda (x)
                  (and (string? x) (not (string-index x #\space))))
                val)))
(define (serialize-space-separated-string-list field-name val)
  (match val
    (() #f)
    (_ (serialize-field field-name (string-join val " ")))))

(define (comma-separated-string-list? val)
  (and (list? val)
       (and-map (lambda (x)
                  (and (string? x) (not (string-index x #\,))))
                val)))
(define (serialize-comma-separated-string-list field-name val)
  (serialize-field field-name (string-join val ",")))

(define (file-name? val)
  (and (string? val)
       (string-prefix? "/" val)))
(define (serialize-file-name field-name val)
  (serialize-string field-name val))

(define (colon-separated-file-name-list? val)
  (and (list? val)
       ;; Trailing slashes not needed and not
       (and-map file-name? val)))
(define (serialize-colon-separated-file-name-list field-name val)
  (serialize-field field-name (string-join val ":")))

(define (serialize-boolean field-name val)
  (serialize-string field-name (if val "yes" "no")))

(define (non-negative-integer? val)
  (and (exact-integer? val) (not (negative? val))))
(define (serialize-non-negative-integer field-name val)
  (serialize-field field-name val))

(define (hours? val) (non-negative-integer? val))
(define (serialize-hours field-name val)
  (serialize-field field-name (format #f "~a hours" val)))

(define (free-form-fields? val)
  (match val
    (() #t)
    ((((? symbol?) . (? string?)) . val) (free-form-fields? val))
    (_ #f)))
(define (serialize-free-form-fields field-name val)
  (for-each (match-lambda ((k . v) (serialize-field k v))) val))

(define (free-form-args? val)
  (match val
    (() #t)
    ((((? symbol?) . (? string?)) . val) (free-form-args? val))
    (_ #f)))
(define (serialize-free-form-args field-name val)
  (serialize-field field-name
                   (string-join
                    (map (match-lambda ((k . v) (format #f "~a=~a" k v))) val)
                    " ")))

(define-configuration dict-configuration
  (entries
   (free-form-fields '())
   "A list of key-value pairs that this dict should hold."))

(define (serialize-dict-configuration field-name val)
  (format #t "dict {\n")
  (serialize-configuration val dict-configuration-fields)
  (format #t "}\n"))

(define-configuration passdb-configuration
  (driver
   (string "pam")
   "The driver that the passdb should use.  Valid values include
@samp{pam}, @samp{passwd}, @samp{shadow}, @samp{bsdauth}, and
@samp{static}.")
  (args
   (space-separated-string-list '())
   "Space separated list of arguments to the passdb driver."))

(define (serialize-passdb-configuration field-name val)
  (format #t "passdb {\n")
  (serialize-configuration val passdb-configuration-fields)
  (format #t "}\n"))
(define (passdb-configuration-list? val)
  (and (list? val) (and-map passdb-configuration? val)))
(define (serialize-passdb-configuration-list field-name val)
  (for-each (lambda (val) (serialize-passdb-configuration field-name val)) val))

(define-configuration userdb-configuration
  (driver
   (string "passwd")
   "The driver that the userdb should use.  Valid values include
@samp{passwd} and @samp{static}.")
  (args
   (space-separated-string-list '())
   "Space separated list of arguments to the userdb driver.")
  (override-fields
   (free-form-args '())
   "Override fields from passwd."))

(define (serialize-userdb-configuration field-name val)
  (format #t "userdb {\n")
  (serialize-configuration val userdb-configuration-fields)
  (format #t "}\n"))
(define (userdb-configuration-list? val)
  (and (list? val) (and-map userdb-configuration? val)))
(define (serialize-userdb-configuration-list field-name val)
  (for-each (lambda (val) (serialize-userdb-configuration field-name val)) val))

(define-configuration unix-listener-configuration
  (path
   (string (configuration-missing-field 'unix-listener 'path))
   "Path to the file, relative to @code{base-dir} field.  This is also used as
the section name.")
  (mode
   (string "0600")
   "The access mode for the socket.")
  (user
   (string "")
   "The user to own the the socket.")
  (group
   (string "")
   "The group to own the socket."))

(define (serialize-unix-listener-configuration field-name val)
  (format #t "unix_listener ~a {\n" (unix-listener-configuration-path val))
  (serialize-configuration val (cdr unix-listener-configuration-fields))
  (format #t "}\n"))

(define-configuration fifo-listener-configuration
  (path
   (string (configuration-missing-field 'fifo-listener 'path))
   "Path to the file, relative to @code{base-dir} field.  This is also used as
the section name.")
  (mode
   (string "0600")
   "The access mode for the socket.")
  (user
   (string "")
   "The user to own the the socket.")
  (group
   (string "")
   "The group to own the socket."))

(define (serialize-fifo-listener-configuration field-name val)
  (format #t "fifo_listener ~a {\n" (fifo-listener-configuration-path val))
  (serialize-configuration val (cdr fifo-listener-configuration-fields))
  (format #t "}\n"))

(define-configuration inet-listener-configuration
  (protocol
   (string (configuration-missing-field 'inet-listener 'protocol))
   "The protocol to listen for.")
  (address
   (string "")
   "The address on which to listen, or empty for all addresses.")
  (port
   (non-negative-integer
    (configuration-missing-field 'inet-listener 'port))
   "The port on which to listen.")
  (ssl?
   (boolean #t)
   "Whether to use SSL for this service; @samp{yes}, @samp{no}, or
@samp{required}."))

(define (serialize-inet-listener-configuration field-name val)
  (format #t "inet_listener ~a {\n" (inet-listener-configuration-protocol val))
  (serialize-configuration val (cdr inet-listener-configuration-fields))
  (format #t "}\n"))

(define (listener-configuration? val)
  (or (unix-listener-configuration? val)
      (fifo-listener-configuration? val)
      (inet-listener-configuration? val)))
(define (serialize-listener-configuration field-name val)
  (cond
   ((unix-listener-configuration? val)
    (serialize-unix-listener-configuration field-name val))
   ((fifo-listener-configuration? val)
    (serialize-fifo-listener-configuration field-name val))
   ((inet-listener-configuration? val)
    (serialize-inet-listener-configuration field-name val))
   (else (configuration-field-error #f field-name val))))
(define (listener-configuration-list? val)
  (and (list? val) (and-map listener-configuration? val)))
(define (serialize-listener-configuration-list field-name val)
  (for-each (lambda (val)
              (serialize-listener-configuration field-name val))
            val))

(define-configuration service-configuration
  (kind
   (string (configuration-missing-field 'service 'kind))
   "The service kind.  Valid values include @code{director},
@code{imap-login}, @code{pop3-login}, @code{lmtp}, @code{imap},
@code{pop3}, @code{auth}, @code{auth-worker}, @code{dict},
@code{tcpwrap}, @code{quota-warning}, or anything else.")
  (listeners
   (listener-configuration-list '())
   "Listeners for the service.  A listener is either an
@code{unix-listener-configuration}, a @code{fifo-listener-configuration}, or
an @code{inet-listener-configuration}.")
  (client-limit
   (non-negative-integer 0)
   "Maximum number of simultaneous client connections per process.  Once this
number of connections is received, the next incoming connection will prompt
Dovecot to spawn another process.  If set to 0, @code{default-client-limit} is
used instead.")
  (service-count
   (non-negative-integer 1)
   "Number of connections to handle before starting a new process.
Typically the only useful values are 0 (unlimited) or 1.  1 is more
secure, but 0 is faster.  <doc/wiki/LoginProcess.txt>.")
  (process-limit
   (non-negative-integer 0)
   "Maximum number of processes that can exist for this service.  If set to 0,
@code{default-process-limit} is used instead.")
  (process-min-avail
   (non-negative-integer 0)
   "Number of processes to always keep waiting for more connections.")
  ;; FIXME: Need to be able to take the default for this value from other
  ;; parts of the config.
  (vsz-limit
   (non-negative-integer #e256e6)
   "If you set @samp{service-count 0}, you probably need to grow
this."))

(define (serialize-service-configuration field-name val)
  (format #t "service ~a {\n" (service-configuration-kind val))
  (serialize-configuration val (cdr service-configuration-fields))
  (format #t "}\n"))
(define (service-configuration-list? val)
  (and (list? val) (and-map service-configuration? val)))
(define (serialize-service-configuration-list field-name val)
  (for-each (lambda (val)
              (serialize-service-configuration field-name val))
            val))

(define-configuration protocol-configuration
  (name
   (string (configuration-missing-field 'protocol 'name))
   "The name of the protocol.")
  (auth-socket-path
   (string "/var/run/dovecot/auth-userdb")
   "UNIX socket path to master authentication server to find users.
This is used by imap (for shared users) and lda.")
  (mail-plugins
   (space-separated-string-list '("$mail_plugins"))
   "Space separated list of plugins to load.")
  (mail-max-userip-connections
   (non-negative-integer 10)
   "Maximum number of IMAP connections allowed for a user from each IP
address.  NOTE: The username is compared case-sensitively.")
  (imap-metadata?
   (boolean #f)
   "Whether to enable the @code{IMAP METADATA} extension as defined in
@uref{https://tools.ietf.org/html/rfc5464, RFC@tie{}5464}, which provides
a means for clients to set and retrieve per-mailbox, per-user metadata
and annotations over IMAP.

If this is @samp{#t}, you must also specify a dictionary @i{via} the
@code{mail-attribute-dict} setting.")
  (managesieve-notify-capability
   (space-separated-string-list '())
   "Which NOTIFY capabilities to report to clients that first connect to
the ManageSieve service, before authentication.  These may differ from the
capabilities offered to authenticated users.  If this field is left empty,
report what the Sieve interpreter supports by default.")
  (managesieve-sieve-capability
   (space-separated-string-list '())
   "Which SIEVE capabilities to report to clients that first connect to
the ManageSieve service, before authentication.  These may differ from the
capabilities offered to authenticated users.  If this field is left empty,
report what the Sieve interpreter supports by default."))

(define (serialize-protocol-configuration field-name val)
  (format #t "protocol ~a {\n" (protocol-configuration-name val))
  (serialize-configuration val (cdr protocol-configuration-fields))
  (format #t "}\n"))
(define (protocol-configuration-list? val)
  (and (list? val) (and-map protocol-configuration? val)))
(define (serialize-protocol-configuration-list field-name val)
  (serialize-field 'protocols
                   (string-join (map protocol-configuration-name val) " "))
  (for-each (lambda (val)
              (serialize-protocol-configuration field-name val))
            val))

(define-configuration plugin-configuration
  (entries
   (free-form-fields '())
   "A list of key-value pairs that this dict should hold."))

(define (serialize-plugin-configuration field-name val)
  (format #t "plugin {\n")
  (serialize-configuration val plugin-configuration-fields)
  (format #t "}\n"))

(define-configuration mailbox-configuration
  (name
   (string (error "mailbox name is required"))
   "Name for this mailbox.")

  (auto
   (string "no")
   "@samp{create} will automatically create this mailbox.
@samp{subscribe} will both create and subscribe to the mailbox.")

  (special-use
   (space-separated-string-list '())
   "List of IMAP @code{SPECIAL-USE} attributes as specified by RFC 6154.
Valid values are @code{\\All}, @code{\\Archive}, @code{\\Drafts},
@code{\\Flagged}, @code{\\Junk}, @code{\\Sent}, and @code{\\Trash}."))

(define (serialize-mailbox-configuration field-name val)
  (format #t "mailbox \"~a\" {\n" (mailbox-configuration-name val))
  (serialize-configuration val (cdr mailbox-configuration-fields))
  (format #t "}\n"))
(define (mailbox-configuration-list? val)
  (and (list? val) (and-map mailbox-configuration? val)))
(define (serialize-mailbox-configuration-list field-name val)
  (for-each (lambda (val)
              (serialize-mailbox-configuration field-name val))
            val))

(define-configuration namespace-configuration
  (name
   (string (error "namespace name is required"))
   "Name for this namespace.")

  (type
   (string "private")
   "Namespace type: @samp{private}, @samp{shared} or @samp{public}.")

  (separator
   (string "")
   "Hierarchy separator to use. You should use the same separator for
all namespaces or some clients get confused.  @samp{/} is usually a good
one.  The default however depends on the underlying mail storage
format.")

  (prefix
   (string "")
   "Prefix required to access this namespace.  This needs to be
different for all namespaces. For example @samp{Public/}.")

  (location
   (string "")
   "Physical location of the mailbox. This is in same format as
mail_location, which is also the default for it.")

  (inbox?
   (boolean #f)
   "There can be only one INBOX, and this setting defines which
namespace has it.")

  (hidden?
   (boolean #f)
   "If namespace is hidden, it's not advertised to clients via NAMESPACE
extension. You'll most likely also want to set @samp{list? #f}.  This is mostly
useful when converting from another server with different namespaces
which you want to deprecate but still keep working.  For example you can
create hidden namespaces with prefixes @samp{~/mail/}, @samp{~%u/mail/}
and @samp{mail/}.")

  (list?
   (boolean #t)
   "Show the mailboxes under this namespace with LIST command. This
makes the namespace visible for clients that don't support NAMESPACE
extension.  The special @code{children} value lists child mailboxes, but
hides the namespace prefix.")

  (subscriptions?
   (boolean #t)
   "Namespace handles its own subscriptions.  If set to @code{#f}, the
parent namespace handles them.  The empty prefix should always have this
as @code{#t}.)")

  (mailboxes
   (mailbox-configuration-list '())
   "List of predefined mailboxes in this namespace."))

(define (serialize-namespace-configuration field-name val)
  (format #t "namespace ~a {\n" (namespace-configuration-name val))
  (serialize-configuration val (cdr namespace-configuration-fields))
  (format #t "}\n"))
(define (list-of-namespace-configuration? val)
  (and (list? val) (and-map namespace-configuration? val)))
(define (serialize-list-of-namespace-configuration field-name val)
  (for-each (lambda (val)
              (serialize-namespace-configuration field-name val))
            val))

(define-configuration dovecot-configuration
  (dovecot
   (file-like dovecot)
   "The dovecot package.")

  (listen
   (comma-separated-string-list '("*" "::"))
   "A list of IPs or hosts where to listen in for connections.  @samp{*}
listens in all IPv4 interfaces, @samp{::} listens in all IPv6
interfaces.  If you want to specify non-default ports or anything more
complex, customize the address and port fields of the
@samp{inet-listener} of the specific services you are interested in.")

  (dict
   (dict-configuration (dict-configuration))
   "Dict configuration, as created by the @code{dict-configuration}
constructor.")

  (passdbs
   (passdb-configuration-list (list (passdb-configuration (driver "pam"))))
   "List of passdb configurations, each one created by the
@code{passdb-configuration} constructor.")

  (userdbs
   (userdb-configuration-list (list (userdb-configuration (driver "passwd"))))
   "List of userdb configurations, each one created by the
@code{userdb-configuration} constructor.")

  (plugin-configuration
   (plugin-configuration (plugin-configuration))
   "Plug-in configuration, created by the @code{plugin-configuration}
constructor.")

  (namespaces
   (list-of-namespace-configuration
    (list
     (namespace-configuration
      (name "inbox")
      (prefix "")
      (inbox? #t)
      (mailboxes
       (list
        (mailbox-configuration (name "Drafts") (special-use '("\\Drafts")))
        (mailbox-configuration (name "Junk") (special-use '("\\Junk")))
        (mailbox-configuration (name "Trash") (special-use '("\\Trash")))
        (mailbox-configuration (name "Sent") (special-use '("\\Sent")))
        (mailbox-configuration (name "Sent Messages") (special-use '("\\Sent")))
        (mailbox-configuration (name "Drafts") (special-use '("\\Drafts"))))))))
   "List of namespaces.  Each item in the list is created by the
@code{namespace-configuration} constructor.")

  (base-dir
   (file-name "/var/run/dovecot/")
   "Base directory where to store runtime data.")

  (login-greeting
   (string "Dovecot ready.")
   "Greeting message for clients.")

  (login-trusted-networks
   (space-separated-string-list '())
   "List of trusted network ranges.  Connections from these IPs are
allowed to override their IP addresses and ports (for logging and for
authentication checks).  @samp{disable-plaintext-auth} is also ignored
for these networks.  Typically you'd specify your IMAP proxy servers
here.")

  (login-access-sockets
   (space-separated-string-list '())
   "List of login access check sockets (e.g. tcpwrap).")

  (verbose-proctitle?
   (boolean #f)
   "Show more verbose process titles (in ps).  Currently shows user name
and IP address.  Useful for seeing who are actually using the IMAP
processes (e.g. shared mailboxes or if same uid is used for multiple
accounts).")

  (shutdown-clients?
   (boolean #t)
   "Should all processes be killed when Dovecot master process shuts down.
Setting this to @code{#f} means that Dovecot can be upgraded without
forcing existing client connections to close (although that could also
be a problem if the upgrade is e.g. because of a security fix).")

  (doveadm-worker-count
   (non-negative-integer 0)
   "If non-zero, run mail commands via this many connections to doveadm
server, instead of running them directly in the same process.")

  (doveadm-socket-path
   (string "doveadm-server")
   "UNIX socket or host:port used for connecting to doveadm server.")

  (import-environment
   (space-separated-string-list '("TZ"))
   "List of environment variables that are preserved on Dovecot startup
and passed down to all of its child processes.  You can also give
key=value pairs to always set specific settings.")

;;; Authentication processes

  (disable-plaintext-auth?
   (boolean #t)
   "Disable LOGIN command and all other plaintext authentications unless
SSL/TLS is used (LOGINDISABLED capability).  Note that if the remote IP
matches the local IP (i.e. you're connecting from the same computer),
the connection is considered secure and plaintext authentication is
allowed.  See also ssl=required setting.")

  (auth-cache-size
   (non-negative-integer 0)
   "Authentication cache size (e.g. @samp{#e10e6}).  0 means it's disabled.
Note that bsdauth, PAM and vpopmail require @samp{cache-key} to be set
for caching to be used.")

  (auth-cache-ttl
   (string "1 hour")
   "Time to live for cached data.  After TTL expires the cached record
is no longer used, *except* if the main database lookup returns internal
failure.  We also try to handle password changes automatically: If
user's previous authentication was successful, but this one wasn't, the
cache isn't used.  For now this works only with plaintext
authentication.")

  (auth-cache-negative-ttl
   (string "1 hour")
   "TTL for negative hits (user not found, password mismatch).
0 disables caching them completely.")

  (auth-realms
   (space-separated-string-list '())
   "List of realms for SASL authentication mechanisms that need them.
You can leave it empty if you don't want to support multiple realms.
Many clients simply use the first one listed here, so keep the default
realm first.")

  (auth-default-realm
   (string "")
   "Default realm/domain to use if none was specified.  This is used for
both SASL realms and appending @@domain to username in plaintext
logins.")

  (auth-username-chars
   (string
    "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@")
   "List of allowed characters in username.  If the user-given username
contains a character not listed in here, the login automatically fails.
This is just an extra check to make sure user can't exploit any
potential quote escaping vulnerabilities with SQL/LDAP databases.  If
you want to allow all characters, set this value to empty.")

  (auth-username-translation
   (string "")
   "Username character translations before it's looked up from
databases.  The value contains series of from -> to characters.  For
example @samp{#@@/@@} means that @samp{#} and @samp{/} characters are
translated to @samp{@@}.")

  (auth-username-format
   (string "%Lu")
   "Username formatting before it's looked up from databases.  You can
use the standard variables here, e.g. %Lu would lowercase the username,
%n would drop away the domain if it was given, or @samp{%n-AT-%d} would
change the @samp{@@} into @samp{-AT-}.  This translation is done after
@samp{auth-username-translation} changes.")

  (auth-master-user-separator
   (string "")
   "If you want to allow master users to log in by specifying the master
username within the normal username string (i.e. not using SASL
mechanism's support for it), you can specify the separator character
here.  The format is then <username><separator><master username>.
UW-IMAP uses @samp{*} as the separator, so that could be a good
choice.")

  (auth-anonymous-username
   (string "anonymous")
   "Username to use for users logging in with ANONYMOUS SASL
mechanism.")

  (auth-worker-max-count
   (non-negative-integer 30)
   "Maximum number of dovecot-auth worker processes.  They're used to
execute blocking passdb and userdb queries (e.g. MySQL and PAM).
They're automatically created and destroyed as needed.")

  (auth-gssapi-hostname
   (string "")
   "Host name to use in GSSAPI principal names.  The default is to use
the name returned by gethostname().  Use @samp{$ALL} (with quotes) to
allow all keytab entries.")

  (auth-krb5-keytab
   (string "")
   "Kerberos keytab to use for the GSSAPI mechanism.  Will use the
system default (usually /etc/krb5.keytab) if not specified.  You may
need to change the auth service to run as root to be able to read this
file.")

  (auth-use-winbind?
   (boolean #f)
   "Do NTLM and GSS-SPNEGO authentication using Samba's winbind daemon
and @samp{ntlm-auth} helper.
<doc/wiki/Authentication/Mechanisms/Winbind.txt>.")

  (auth-winbind-helper-path
   (file-name "/usr/bin/ntlm_auth")
   "Path for Samba's @samp{ntlm-auth} helper binary.")

  (auth-failure-delay
   (string "2 secs")
   "Time to delay before replying to failed authentications.")

  (auth-ssl-require-client-cert?
   (boolean #f)
   "Require a valid SSL client certificate or the authentication
fails.")

  (auth-ssl-username-from-cert?
   (boolean #f)
   "Take the username from client's SSL certificate, using
@code{X509_NAME_get_text_by_NID()} which returns the subject's DN's
CommonName.")

  (auth-mechanisms
   (space-separated-string-list '("plain"))
   "List of wanted authentication mechanisms.  Supported mechanisms are:
@samp{plain}, @samp{login}, @samp{digest-md5}, @samp{cram-md5},
@samp{ntlm}, @samp{rpa}, @samp{apop}, @samp{anonymous}, @samp{gssapi},
@samp{otp}, @samp{skey}, and @samp{gss-spnego}.  NOTE: See also
@samp{disable-plaintext-auth} setting.")

  (director-servers
   (space-separated-string-list '())
   "List of IPs or hostnames to all director servers, including ourself.
Ports can be specified as ip:port.  The default port is the same as what
director service's @samp{inet-listener} is using.")

  (director-mail-servers
   (space-separated-string-list '())
   "List of IPs or hostnames to all backend mail servers.  Ranges are
allowed too, like 10.0.0.10-10.0.0.30.")

  (director-user-expire
   (string "15 min")
   "How long to redirect users to a specific server after it no longer
has any connections.")

  (director-username-hash
   (string "%Lu")
   "How the username is translated before being hashed.  Useful values
include %Ln if user can log in with or without @@domain, %Ld if mailboxes
are shared within domain.")

;;; Log destination.

  (log-path
   (string "syslog")
   "Log file to use for error messages.  @samp{syslog} logs to syslog,
@samp{/dev/stderr} logs to stderr.")

  (info-log-path
   (string "")
   "Log file to use for informational messages.  Defaults to
@samp{log-path}.")

  (debug-log-path
   (string "")
   "Log file to use for debug messages.  Defaults to
@samp{info-log-path}.")

  (syslog-facility
   (string "mail")
   "Syslog facility to use if you're logging to syslog.  Usually if you
don't want to use @samp{mail}, you'll use local0..local7.  Also other
standard facilities are supported.")

  (auth-verbose?
   (boolean #f)
   "Log unsuccessful authentication attempts and the reasons why they
failed.")

  (auth-verbose-passwords
   (string "no")
   "In case of password mismatches, log the attempted password.  Valid
values are no, plain and sha1.  sha1 can be useful for detecting brute
force password attempts vs.  user simply trying the same password over
and over again.  You can also truncate the value to n chars by appending
\":n\" (e.g. sha1:6).")

  (auth-debug?
   (boolean #f)
   "Even more verbose logging for debugging purposes.  Shows for example
SQL queries.")

  (auth-debug-passwords?
   (boolean #f)
   "In case of password mismatches, log the passwords and used scheme so
the problem can be debugged.  Enabling this also enables
@samp{auth-debug}.")

  (mail-debug?
   (boolean #f)
   "Enable mail process debugging.  This can help you figure out why
Dovecot isn't finding your mails.")

  (verbose-ssl?
   (boolean #f)
   "Show protocol level SSL errors.")

  (log-timestamp
   (string "\"%b %d %H:%M:%S \"")
   "Prefix for each line written to log file.  % codes are in
strftime(3) format.")

  (login-log-format-elements
   (space-separated-string-list
    '("user=<%u>" "method=%m" "rip=%r" "lip=%l" "mpid=%e" "%c"))
   "List of elements we want to log.  The elements which have a
non-empty variable value are joined together to form a comma-separated
string.")

  (login-log-format
   (string "%$: %s")
   "Login log format.  %s contains @samp{login-log-format-elements}
string, %$ contains the data we want to log.")

  (mail-log-prefix
   (string "\"%s(%u)<%{pid}><%{session}>: \"")
   "Log prefix for mail processes.  See doc/wiki/Variables.txt for list
of possible variables you can use.")

  (deliver-log-format
   (string "msgid=%m: %$")
   "Format to use for logging mail deliveries.  You can use variables:
@table @code
@item %$
Delivery status message (e.g. @samp{saved to INBOX})
@item %m
Message-ID
@item %s
Subject
@item %f
From address
@item %p
Physical size
@item %w
Virtual size.
@end table")

;;; Mailbox locations and namespaces

  (mail-location
   (string "")
   "Location for users' mailboxes.  The default is empty, which means
that Dovecot tries to find the mailboxes automatically.  This won't work
if the user doesn't yet have any mail, so you should explicitly tell
Dovecot the full location.

If you're using mbox, giving a path to the INBOX
file (e.g. /var/mail/%u) isn't enough.  You'll also need to tell Dovecot
where the other mailboxes are kept.  This is called the \"root mail
directory\", and it must be the first path given in the
@samp{mail-location} setting.

There are a few special variables you can use, eg.:

@table @samp
@item %u
username
@item %n
user part in user@@domain, same as %u if there's no domain
@item %d
domain part in user@@domain, empty if there's no domain
@item %h
home director
@end table

See doc/wiki/Variables.txt for full list.  Some examples:
@table @samp
@item maildir:~/Maildir
@item mbox:~/mail:INBOX=/var/mail/%u
@item mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%
@end table")

  (mail-uid
   (string "")
   "System user and group used to access mails.  If you use multiple,
userdb can override these by returning uid or gid fields.  You can use
either numbers or names.  <doc/wiki/UserIds.txt>.")

  (mail-gid
   (string "")
   "")

  (mail-privileged-group
   (string "")
   "Group to enable temporarily for privileged operations.  Currently
this is used only with INBOX when either its initial creation or
dotlocking fails.  Typically this is set to \"mail\" to give access to
/var/mail.")

  (mail-access-groups
   (string "")
   "Grant access to these supplementary groups for mail processes.
Typically these are used to set up access to shared mailboxes.  Note
that it may be dangerous to set these if users can create
symlinks (e.g. if \"mail\" group is set here, ln -s /var/mail ~/mail/var
could allow a user to delete others' mailboxes, or ln -s
/secret/shared/box ~/mail/mybox would allow reading it).")

  (mail-full-filesystem-access?
   (boolean #f)
   "Allow full file system access to clients.  There's no access checks
other than what the operating system does for the active UID/GID.  It
works with both maildir and mboxes, allowing you to prefix mailboxes
names with e.g. /path/ or ~user/.")

;;; Mail processes

  (mmap-disable?
   (boolean #f)
   "Don't use mmap() at all.  This is required if you store indexes to
shared file systems (NFS or clustered file system).")

  (dotlock-use-excl?
   (boolean #t)
   "Rely on @samp{O_EXCL} to work when creating dotlock files.  NFS
supports @samp{O_EXCL} since version 3, so this should be safe to use
nowadays by default.")

  (mail-fsync
   (string "optimized")
   "When to use fsync() or fdatasync() calls:
@table @code
@item optimized
Whenever necessary to avoid losing important data
@item always
Useful with e.g. NFS when write()s are delayed
@item never
Never use it (best performance, but crashes can lose data).
@end table")

  (mail-nfs-storage?
   (boolean #f)
   "Mail storage exists in NFS.  Set this to yes to make Dovecot flush
NFS caches whenever needed.  If you're using only a single mail server
this isn't needed.")

  (mail-nfs-index?
   (boolean #f)
   "Mail index files also exist in NFS.  Setting this to yes requires
@samp{mmap-disable? #t} and @samp{fsync-disable? #f}.")

  (lock-method
   (string "fcntl")
   "Locking method for index files.  Alternatives are fcntl, flock and
dotlock.  Dotlocking uses some tricks which may create more disk I/O
than other locking methods.  NFS users: flock doesn't work, remember to
change @samp{mmap-disable}.")

  (mail-temp-dir
   (file-name "/tmp")
   "Directory in which LDA/LMTP temporarily stores incoming mails >128
kB.")

  (first-valid-uid
   (non-negative-integer 500)
   "Valid UID range for users.  This is mostly to make sure that users can't
log in as daemons or other system users.  Note that denying root logins is
hardcoded to dovecot binary and can't be done even if @samp{first-valid-uid}
is set to 0.")

  (last-valid-uid
   (non-negative-integer 0)
   "")

  (first-valid-gid
   (non-negative-integer 1)
   "Valid GID range for users.  Users having non-valid GID as primary group ID
aren't allowed to log in.  If user belongs to supplementary groups with
non-valid GIDs, those groups are not set.")

  (last-valid-gid
   (non-negative-integer 0)
   "")

  (mail-max-keyword-length
   (non-negative-integer 50)
   "Maximum allowed length for mail keyword name.  It's only forced when
trying to create new keywords.")

  (valid-chroot-dirs
   (colon-separated-file-name-list '())
   "List of directories under which chrooting is allowed for mail
processes (i.e. /var/mail will allow chrooting to /var/mail/foo/bar
too).  This setting doesn't affect @samp{login-chroot}
@samp{mail-chroot} or auth chroot settings.  If this setting is empty,
\"/./\" in home dirs are ignored.  WARNING: Never add directories here
which local users can modify, that may lead to root exploit.  Usually
this should be done only if you don't allow shell access for users.
<doc/wiki/Chrooting.txt>.")

  (mail-chroot
   (string "")
   "Default chroot directory for mail processes.  This can be overridden
for specific users in user database by giving /./ in user's home
directory (e.g. /home/./user chroots into /home).  Note that usually
there is no real need to do chrooting, Dovecot doesn't allow users to
access files outside their mail directory anyway.  If your home
directories are prefixed with the chroot directory, append \"/.\" to
@samp{mail-chroot}.  <doc/wiki/Chrooting.txt>.")

  (auth-socket-path
   (file-name "/var/run/dovecot/auth-userdb")
   "UNIX socket path to master authentication server to find users.
This is used by imap (for shared users) and lda.")

  (mail-plugin-dir
   (file-name "/usr/lib/dovecot")
   "Directory where to look up mail plugins.")

  (mail-plugins
   (space-separated-string-list '())
   "List of plugins to load for all services.  Plugins specific to IMAP,
LDA, etc. are added to this list in their own .conf files.")


  (mail-cache-min-mail-count
   (non-negative-integer 0)
   "The minimum number of mails in a mailbox before updates are done to
cache file.  This allows optimizing Dovecot's behavior to do less disk
writes at the cost of more disk reads.")

  (mailbox-idle-check-interval
   (string "30 secs")
   "When IDLE command is running, mailbox is checked once in a while to
see if there are any new mails or other changes.  This setting defines
the minimum time to wait between those checks.  Dovecot can also use
dnotify, inotify and kqueue to find out immediately when changes
occur.")

  (mail-save-crlf?
   (boolean #f)
   "Save mails with CR+LF instead of plain LF.  This makes sending those
mails take less CPU, especially with sendfile() syscall with Linux and
FreeBSD.  But it also creates a bit more disk I/O which may just make it
slower.  Also note that if other software reads the mboxes/maildirs,
they may handle the extra CRs wrong and cause problems.")

  (maildir-stat-dirs?
   (boolean #f)
   "By default LIST command returns all entries in maildir beginning
with a dot.  Enabling this option makes Dovecot return only entries
which are directories.  This is done by stat()ing each entry, so it
causes more disk I/O.
 (For systems setting struct @samp{dirent->d_type} this check is free
and it's done always regardless of this setting).")

  (maildir-copy-with-hardlinks?
   (boolean #t)
   "When copying a message, do it with hard links whenever possible.
This makes the performance much better, and it's unlikely to have any
side effects.")

  (maildir-very-dirty-syncs?
   (boolean #f)
   "Assume Dovecot is the only MUA accessing Maildir: Scan cur/
directory only when its mtime changes unexpectedly or when we can't find
the mail otherwise.")

  (mbox-read-locks
   (space-separated-string-list '("fcntl"))
   "Which locking methods to use for locking mbox.  There are four
available:

@table @code
@item dotlock
Create <mailbox>.lock file.  This is the oldest and most NFS-safe
solution.  If you want to use /var/mail/ like directory, the users will
need write access to that directory.
@item dotlock-try
Same as dotlock, but if it fails because of permissions or because there
isn't enough disk space, just skip it.
@item fcntl
Use this if possible.  Works with NFS too if lockd is used.
@item flock
May not exist in all systems.  Doesn't work with NFS. 
@item lockf
May not exist in all systems.  Doesn't work with NFS.
@end table

You can use multiple locking methods; if you do the order they're declared
in is important to avoid deadlocks if other MTAs/MUAs are using multiple
locking methods as well.  Some operating systems don't allow using some of
them simultaneously.")

  (mbox-write-locks
   (space-separated-string-list '("dotlock" "fcntl"))
   "")

  (mbox-lock-timeout
   (string "5 mins")
   "Maximum time to wait for lock (all of them) before aborting.")

  (mbox-dotlock-change-timeout
   (string "2 mins")
   "If dotlock exists but the mailbox isn't modified in any way,
override the lock file after this much time.")

  (mbox-dirty-syncs?
   (boolean #t)
   "When mbox changes unexpectedly we have to fully read it to find out
what changed.  If the mbox is large this can take a long time.  Since
the change is usually just a newly appended mail, it'd be faster to
simply read the new mails.  If this setting is enabled, Dovecot does
this but still safely fallbacks to re-reading the whole mbox file
whenever something in mbox isn't how it's expected to be.  The only real
downside to this setting is that if some other MUA changes message
flags, Dovecot doesn't notice it immediately.  Note that a full sync is
done with SELECT, EXAMINE, EXPUNGE and CHECK commands.")

  (mbox-very-dirty-syncs?
   (boolean #f)
   "Like @samp{mbox-dirty-syncs}, but don't do full syncs even with SELECT,
EXAMINE, EXPUNGE or CHECK commands.  If this is set,
@samp{mbox-dirty-syncs} is ignored.")

  (mbox-lazy-writes?
   (boolean #t)
   "Delay writing mbox headers until doing a full write sync (EXPUNGE
and CHECK commands and when closing the mailbox).  This is especially
useful for POP3 where clients often delete all mails.  The downside is
that our changes aren't immediately visible to other MUAs.")

  (mbox-min-index-size
   (non-negative-integer 0)
   "If mbox size is smaller than this (e.g. 100k), don't write index
files.  If an index file already exists it's still read, just not
updated.")

  (mdbox-rotate-size
   (non-negative-integer #e10e6)
   "Maximum dbox file size until it's rotated.")

  (mdbox-rotate-interval
   (string "1d")
   "Maximum dbox file age until it's rotated.  Typically in days.  Day
begins from midnight, so 1d = today, 2d = yesterday, etc.  0 = check
disabled.")

  (mdbox-preallocate-space?
   (boolean #f)
   "When creating new mdbox files, immediately preallocate their size to
@samp{mdbox-rotate-size}.  This setting currently works only in Linux
with some file systems (ext4, xfs).")

  (mail-attribute-dict
   (string "")
   "The location of a dictionary used to store @code{IMAP METADATA}
as defined by @uref{https://tools.ietf.org/html/rfc5464, RFC@tie{}5464}.

The IMAP METADATA commands are available only if the ``imap''
protocol configuration's @code{imap-metadata?} field is @samp{#t}.")

  (mail-attachment-dir
   (string "")
   "sdbox and mdbox support saving mail attachments to external files,
which also allows single instance storage for them.  Other backends
don't support this for now.

WARNING: This feature hasn't been tested much yet.  Use at your own risk.

Directory root where to store mail attachments.  Disabled, if empty.")

  (mail-attachment-min-size
   (non-negative-integer #e128e3)
   "Attachments smaller than this aren't saved externally.  It's also
possible to write a plugin to disable saving specific attachments
externally.")

  (mail-attachment-fs
   (string "sis posix")
   "File system backend to use for saving attachments:
@table @code
@item posix
No SiS done by Dovecot (but this might help FS's own deduplication)
@item sis posix
SiS with immediate byte-by-byte comparison during saving
@item sis-queue posix
SiS with delayed comparison and deduplication.
@end table")

  (mail-attachment-hash
   (string "%{sha1}")
   "Hash format to use in attachment filenames.  You can add any text and
variables: @code{%@{md4@}}, @code{%@{md5@}}, @code{%@{sha1@}},
@code{%@{sha256@}}, @code{%@{sha512@}}, @code{%@{size@}}.  Variables can be
truncated, e.g. @code{%@{sha256:80@}} returns only first 80 bits.")

  (default-process-limit
    (non-negative-integer 100)
    "")

  (default-client-limit
    (non-negative-integer 1000)
    "")

  (default-vsz-limit
    (non-negative-integer #e256e6)
    "Default VSZ (virtual memory size) limit for service processes.
This is mainly intended to catch and kill processes that leak memory
before they eat up everything.")

  (default-login-user
    (string "dovenull")
    "Login user is internally used by login processes.  This is the most
untrusted user in Dovecot system.  It shouldn't have access to anything
at all.")

  (default-internal-user
    (string "dovecot")
    "Internal user is used by unprivileged processes.  It should be
separate from login user, so that login processes can't disturb other
processes.")

  (ssl?
   (string "required")
   "SSL/TLS support: yes, no, required.  <doc/wiki/SSL.txt>.")

  (ssl-cert
   (string "</etc/dovecot/default.pem")
   "PEM encoded X.509 SSL/TLS certificate (public key).")

  (ssl-key
   (string "</etc/dovecot/private/default.pem")
   "PEM encoded SSL/TLS private key.  The key is opened before
dropping root privileges, so keep the key file unreadable by anyone but
root.")

  (ssl-key-password
   (string "")
   "If key file is password protected, give the password here.
Alternatively give it when starting dovecot with -p parameter.  Since
this file is often world-readable, you may want to place this setting
instead to a different.")

  (ssl-ca
   (string "")
   "PEM encoded trusted certificate authority.  Set this only if you
intend to use @samp{ssl-verify-client-cert? #t}.  The file should
contain the CA certificate(s) followed by the matching
CRL(s).  (e.g. @samp{ssl-ca </etc/ssl/certs/ca.pem}).")
  (ssl-require-crl?
   (boolean #t)
   "Require that CRL check succeeds for client certificates.")
  (ssl-verify-client-cert?
   (boolean #f)
   "Request client to send a certificate.  If you also want to require
it, set @samp{auth-ssl-require-client-cert? #t} in auth section.")

  (ssl-cert-username-field
   (string "commonName")
   "Which field from certificate to use for username.  commonName and
x500UniqueIdentifier are the usual choices.  You'll also need to set
@samp{auth-ssl-username-from-cert? #t}.")

  (ssl-min-protocol
   (string "TLSv1")
   "Minimum SSL protocol version to accept.")

  (ssl-cipher-list
   (string "ALL:!kRSA:!SRP:!kDHd:!DSS:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!RC4:!ADH:!LOW@STRENGTH")
   "SSL ciphers to use.")

  (ssl-crypto-device
   (string "")
   "SSL crypto device to use, for valid values run \"openssl engine\".")

  (postmaster-address
   (string "postmaster@%d")
   "Address to use when sending rejection mails.
Default is postmaster@@<your domain>.  %d expands to recipient domain.")

  (hostname
   (string "")
   "Hostname to use in various parts of sent mails (e.g. in Message-Id)
and in LMTP replies.  Default is the system's real hostname@@domain.")

  (quota-full-tempfail?
   (boolean #f)
   "If user is over quota, return with temporary failure instead of
bouncing the mail.")

  (sendmail-path
   (file-name "/usr/sbin/sendmail")
   "Binary to use for sending mails.")

  (submission-host
   (string "")
   "If non-empty, send mails via this SMTP host[:port] instead of
sendmail.")

  (rejection-subject
   (string "Rejected: %s")
   "Subject: header to use for rejection mails.  You can use the same
variables as for @samp{rejection-reason} below.")

  (rejection-reason
   (string "Your message to <%t> was automatically rejected:%n%r")
   "Human readable error message for rejection mails.  You can use
variables:

@table @code
@item %n
CRLF
@item %r
reason
@item %s
original subject
@item %t
recipient
@end table")

  (recipient-delimiter
   (string "+")
   "Delimiter character between local-part and detail in email
address.")

  (lda-original-recipient-header
   (string "")
   "Header where the original recipient address (SMTP's RCPT TO:
address) is taken from if not available elsewhere.  With dovecot-lda -a
parameter overrides this.  A commonly used header for this is
X-Original-To.")

  (lda-mailbox-autocreate?
   (boolean #f)
   "Should saving a mail to a nonexistent mailbox automatically create
it?.")

  (lda-mailbox-autosubscribe?
   (boolean #f)
   "Should automatically created mailboxes be also automatically
subscribed?.")


  (imap-max-line-length
   (non-negative-integer #e64e3)
   "Maximum IMAP command line length.  Some clients generate very long
command lines with huge mailboxes, so you may need to raise this if you
get \"Too long argument\" or \"IMAP command line too large\" errors
often.")

  (imap-logout-format
   (string "in=%i out=%o deleted=%{deleted} expunged=%{expunged} trashed=%{trashed} hdr_count=%{fetch_hdr_count} hdr_bytes=%{fetch_hdr_bytes} body_count=%{fetch_body_count} body_bytes=%{fetch_body_bytes}")
   "IMAP logout format string:
@table @code
@item %i
total number of bytes read from client
@item %o
total number of bytes sent to client.
@end table
See @file{doc/wiki/Variables.txt} for a list of all the variables you can use.")

  (imap-capability
   (string "")
   "Override the IMAP CAPABILITY response.  If the value begins with '+',
add the given capabilities on top of the defaults (e.g. +XFOO XBAR).")

  (imap-idle-notify-interval
   (string "2 mins")
   "How long to wait between \"OK Still here\" notifications when client
is IDLEing.")

  (imap-id-send
   (string "")
   "ID field names and values to send to clients.  Using * as the value
makes Dovecot use the default value.  The following fields have default
values currently: name, version, os, os-version, support-url,
support-email.")

  (imap-id-log
   (string "")
   "ID fields sent by client to log.  * means everything.")

  (imap-client-workarounds
   (space-separated-string-list '())
   "Workarounds for various client bugs:

@table @code
@item delay-newmail
Send EXISTS/RECENT new mail notifications only when replying to NOOP and
CHECK commands.  Some clients ignore them otherwise, for example OSX
Mail (<v2.1).  Outlook Express breaks more badly though, without this it
may show user \"Message no longer in server\" errors.  Note that OE6
still breaks even with this workaround if synchronization is set to
\"Headers Only\".

@item tb-extra-mailbox-sep
Thunderbird gets somehow confused with LAYOUT=fs (mbox and dbox) and
adds extra @samp{/} suffixes to mailbox names.  This option causes Dovecot to
ignore the extra @samp{/} instead of treating it as invalid mailbox name.

@item tb-lsub-flags
Show \\Noselect flags for LSUB replies with LAYOUT=fs (e.g. mbox).
This makes Thunderbird realize they aren't selectable and show them
greyed out, instead of only later giving \"not selectable\" popup error.
@end table
")

  (imap-urlauth-host
   (string "")
   "Host allowed in URLAUTH URLs sent by client.  \"*\" allows all.")

  (protocols
   (protocol-configuration-list
    (list (protocol-configuration
           (name "imap"))))
   "List of protocols we want to serve.  Available protocols include
@samp{imap}, @samp{pop3}, and @samp{lmtp}.")

  (services
   (service-configuration-list
    (list
     (service-configuration
      (kind "imap-login")
      (client-limit 0)
      (process-limit 0)
      (listeners
       (list
        (inet-listener-configuration (protocol "imap") (port 143) (ssl? #f))
        (inet-listener-configuration (protocol "imaps") (port 993) (ssl? #t)))))
     (service-configuration
      (kind "pop3-login")
      (listeners
       (list
        (inet-listener-configuration (protocol "pop3") (port 110) (ssl? #f))
        (inet-listener-configuration (protocol "pop3s") (port 995) (ssl? #t)))))
     (service-configuration
      (kind "lmtp")
      (client-limit 1)
      (process-limit 0)
      (listeners
       (list (unix-listener-configuration (path "lmtp") (mode "0666")))))
     (service-configuration
      (kind "imap")
      (client-limit 1)
      (process-limit 1024))
     (service-configuration
      (kind "pop3")
      (client-limit 1)
      (process-limit 1024))
     (service-configuration
      (kind "auth")
      (service-count 0)
      (client-limit 0)
      (process-limit 1)
      (listeners
       (list (unix-listener-configuration (path "auth-userdb")))))
     (service-configuration
      (kind "auth-worker")
      (client-limit 1)
      (process-limit 0))
     (service-configuration
      (kind "dict")
      (client-limit 1)
      (process-limit 0)
      (listeners (list (unix-listener-configuration (path "dict")))))))
   "List of services to enable.  Available services include @samp{imap},
@samp{imap-login}, @samp{pop3}, @samp{pop3-login}, @samp{auth}, and
@samp{lmtp}."))

(define-configuration opaque-dovecot-configuration
  (dovecot
   (file-like dovecot)
   "The dovecot package.")

  (string
   (string (configuration-missing-field 'opaque-dovecot-configuration
                                        'string))
   "The contents of the @code{dovecot.conf} to use."))

(define %dovecot-accounts
  ;; Account and group for the Dovecot daemon.
  (list (user-group (name "dovecot") (system? #t))
        (user-account
         (name "dovecot")
         (group "dovecot")
         (system? #t)
         (comment "Dovecot daemon user")
         (home-directory "/var/empty")
         (shell (file-append shadow "/sbin/nologin")))

        (user-group (name "dovenull") (system? #t))
        (user-account
         (name "dovenull")
         (group "dovenull")
         (system? #t)
         (comment "Dovecot daemon login user")
         (home-directory "/var/empty")
         (shell (file-append shadow "/sbin/nologin")))))

(define (%dovecot-activation config)
  ;; Activation gexp.
  (let ((config-str
         (cond
          ((opaque-dovecot-configuration? config)
           (opaque-dovecot-configuration-string config))
          (else
           (with-output-to-string
             (lambda ()
               (serialize-configuration config
                                        dovecot-configuration-fields)))))))
    (with-imported-modules (source-module-closure '((gnu build activation)))
      #~(begin
          (use-modules (guix build utils) (gnu build activation))
          (define (build-subject parameters)
            (string-concatenate
             (map (lambda (pair)
                    (let ((k (car pair)) (v (cdr pair)))
                      (define (escape-char str chr)
                        (string-join (string-split str chr) (string #\\ chr)))
                      (string-append "/" k "="
                                     (escape-char (escape-char v #\=) #\/))))
                  (filter (lambda (pair) (cdr pair)) parameters))))
          (define* (create-self-signed-certificate-if-absent
                    #:key private-key public-key (owner (getpwnam "root"))
                    (common-name (gethostname))
                    (organization-name "Guix")
                    (organization-unit-name "Default Self-Signed Certificate")
                    (subject-parameters `(("CN" . ,common-name)
                                          ("O" . ,organization-name)
                                          ("OU" . ,organization-unit-name)))
                    (subject (build-subject subject-parameters)))
            ;; Note that by default, OpenSSL outputs keys in PEM format.  This
            ;; is what we want.
            (unless (file-exists? private-key)
              (cond
               ((zero? (system* (string-append #$openssl "/bin/openssl")
                                "genrsa" "-out" private-key "2048"))
                (chown private-key (passwd:uid owner) (passwd:gid owner))
                (chmod private-key #o400))
               (else
                (format (current-error-port)
                        "Failed to create private key at ~a.\n" private-key))))
            (unless (file-exists? public-key)
              (cond
               ((zero? (system* (string-append #$openssl "/bin/openssl")
                                "req" "-new" "-x509" "-key" private-key
                                "-out" public-key "-days" "3650"
                                "-batch" "-subj" subject))
                (chown public-key (passwd:uid owner) (passwd:gid owner))
                (chmod public-key #o444))
               (else
                (format (current-error-port)
                        "Failed to create public key at ~a.\n" public-key)))))
          (let ((user (getpwnam "dovecot")))
            (mkdir-p/perms "/var/run/dovecot" user #o755)
            (mkdir-p/perms "/var/lib/dovecot" user #o755)
            (mkdir-p/perms "/etc/dovecot" user #o755)
            (copy-file #$(plain-file "dovecot.conf" config-str)
                       "/etc/dovecot/dovecot.conf")
            (mkdir-p/perms "/etc/dovecot/private" user #o700)
            (create-self-signed-certificate-if-absent
             #:private-key "/etc/dovecot/private/default.pem"
             #:public-key "/etc/dovecot/default.pem"
             #:owner (getpwnam "root")
             #:common-name (format #f "Dovecot service on ~a" (gethostname))))))))

(define (dovecot-shepherd-service config)
  "Return a list of <shepherd-service> for CONFIG."
  (let ((dovecot (if (opaque-dovecot-configuration? config)
                     (opaque-dovecot-configuration-dovecot config)
                     (dovecot-configuration-dovecot config))))
    (list (shepherd-service
           (documentation "Run the Dovecot POP3/IMAP mail server.")
           (provision '(dovecot))
           (requirement '(pam networking))
           (start #~(make-forkexec-constructor
                     (list (string-append #$dovecot "/sbin/dovecot")
                           "-F")))
           (stop #~(lambda _
                     (invoke #$(file-append dovecot "/sbin/dovecot")
                             "stop")
                     #f))))))

(define %dovecot-pam-services
  (list (unix-pam-service "dovecot")))

(define dovecot-service-type
  (service-type (name 'dovecot)
                (extensions
                 (list (service-extension shepherd-root-service-type
                                          dovecot-shepherd-service)
                       (service-extension account-service-type
                                          (const %dovecot-accounts))
                       (service-extension pam-root-service-type
                                          (const %dovecot-pam-services))
                       (service-extension activation-service-type
                                          %dovecot-activation)))
                (description "Run Dovecot, a mail server that can run POP3,
IMAP, and LMTP.")
                (default-value (dovecot-configuration))))

(define-deprecated (dovecot-service #:key (config (dovecot-configuration)))
  dovecot-service-type
  "Return a service that runs @command{dovecot}, a mail server that can run
POP3, IMAP, and LMTP.  @var{config} should be a configuration object created
by @code{dovecot-configuration}.  @var{config} may also be created by
@code{opaque-dovecot-configuration}, which allows specification of the
@code{dovecot.conf} as a string."
  (service dovecot-service-type config))

;; A little helper to make it easier to document all those fields.
(define (generate-dovecot-documentation)
  (generate-documentation
    `((dovecot-configuration
       ,dovecot-configuration-fields
       (dict dict-configuration)
       (namespaces namespace-configuration)
       (plugin plugin-configuration)
       (passdbs passdb-configuration)
       (userdbs userdb-configuration)
       (services service-configuration)
       (protocols protocol-configuration))
      (dict-configuration ,dict-configuration-fields)
      (plugin-configuration ,plugin-configuration-fields)
      (passdb-configuration ,passdb-configuration-fields)
      (userdb-configuration ,userdb-configuration-fields)
      (unix-listener-configuration ,unix-listener-configuration-fields)
      (fifo-listener-configuration ,fifo-listener-configuration-fields)
      (inet-listener-configuration ,inet-listener-configuration-fields)
      (namespace-configuration
       ,namespace-configuration-fields
       (mailboxes mailbox-configuration))
      (mailbox-configuration ,mailbox-configuration-fields)
      (service-configuration
       ,service-configuration-fields
       (listeners unix-listener-configuration fifo-listener-configuration
                  inet-listener-configuration))
      (protocol-configuration ,protocol-configuration-fields))
  'dovecot-configuration))


;;;
;;; OpenSMTPD.
;;;

(define-record-type* <opensmtpd-configuration>
  opensmtpd-configuration make-opensmtpd-configuration
  opensmtpd-configuration?
  (package     opensmtpd-configuration-package
               (default opensmtpd))
  (shepherd-requirement opensmtpd-configuration-shepherd-requirement
                        (default '())) ; list of symbols
  (config-file opensmtpd-configuration-config-file
               (default %default-opensmtpd-config-file))
  (setgid-commands? opensmtpd-setgid-commands? (default #t)))

(define %default-opensmtpd-config-file
  (plain-file "smtpd.conf" "
listen on lo

action inbound mbox
match for local action inbound

action outbound relay
match from local for any action outbound
"))

(define (opensmtpd-shepherd-service config)
  (match-record config <opensmtpd-configuration>
                       (package config-file shepherd-requirement)
    (list (shepherd-service
           (provision '(smtpd))
           (requirement `(pam loopback ,@shepherd-requirement))
           (documentation "Run the OpenSMTPD daemon.")
           (start (let ((smtpd (file-append package "/sbin/smtpd")))
                    #~(make-forkexec-constructor
                       (list #$smtpd "-f" #$config-file)
                       #:pid-file "/var/run/smtpd.pid")))
           (stop #~(make-kill-destructor))))))

(define %opensmtpd-accounts
  (list (user-group
         (name "smtpq")
         (system? #t))
        (user-account
         (name "smtpd")
         (group "nogroup")
         (system? #t)
         (comment "SMTP Daemon")
         (home-directory "/var/empty")
         (shell (file-append shadow "/sbin/nologin")))
        (user-account
         (name "smtpq")
         (group "smtpq")
         (system? #t)
         (comment "SMTPD Queue")
         (home-directory "/var/empty")
         (shell (file-append shadow "/sbin/nologin")))))

(define (opensmtpd-activation config)
  (match-record config <opensmtpd-configuration> (package config-file)
    (let ((smtpd (file-append package "/sbin/smtpd")))
      #~(begin
          (use-modules (guix build utils))
          ;; Create mbox and spool directories.
          (mkdir-p "/var/mail")
          (mkdir-p "/var/spool/smtpd")
          (chmod "/var/spool/smtpd" #o711)
          (mkdir-p "/var/spool/mail")
          (chmod "/var/spool/mail" #o711)))))

(define %opensmtpd-pam-services
  (list (unix-pam-service "smtpd")))

(define (opensmtpd-set-gids config)
  (match-record config <opensmtpd-configuration> (package config-file setgid-commands?)
    (if setgid-commands?
        (map (lambda (command)
               (privileged-program
                (program (file-append package "/" command))
                (setgid? #t)
                (group "smtpq")))
             (list "sbin/smtpctl"

                   ;; Also privilege the compatibility symlinks created by
                   ;; the Guix opensmtpd package; all synonyms for smtpctl.
                   "sbin/mailq"
                   "sbin/makemap"
                   "sbin/newaliases"
                   "sbin/sendmail"
                   "sbin/send-mail"))
        '())))

(define opensmtpd-service-type
  (service-type
   (name 'opensmtpd)
   (extensions
    (list (service-extension account-service-type
                             (const %opensmtpd-accounts))
          (service-extension activation-service-type
                             opensmtpd-activation)
          (service-extension pam-root-service-type
                             (const %opensmtpd-pam-services))
          (service-extension profile-service-type
                             (compose list opensmtpd-configuration-package))
          (service-extension shepherd-root-service-type
                             opensmtpd-shepherd-service)
          (service-extension privileged-program-service-type
                             opensmtpd-set-gids)))
   (description "Run the OpenSMTPD, a lightweight @acronym{SMTP, Simple Mail
Transfer Protocol} server.")))


;;;
;;; mail aliases.
;;;

(define (mail-aliases-etc aliases)
  `(("aliases" ,(plain-file "aliases"
                            ;; Ideally we'd use a format string like
                            ;; "~:{~a: ~{~a~^,~}\n~}", but it gives a
                            ;; warning that I can't figure out how to fix,
                            ;; so we'll just use string-join below instead.
                            (format #f "~:{~a: ~a\n~}"
                                    (map (match-lambda
                                           ((alias addresses ...)
                                            (list alias (string-join addresses ","))))
                                         aliases))))))

(define mail-aliases-service-type
  (service-type
   (name 'mail-aliases)
   (extensions
    (list (service-extension etc-service-type mail-aliases-etc)))
   (compose concatenate)
   (extend append)
   (description "Provide a @file{/etc/aliases} file---an email alias
database---computed from the given alias list.")))


;;;
;;; Exim.
;;;

(define-record-type* <exim-configuration> exim-configuration
  make-exim-configuration
  exim-configuration?
  (package        exim-configuration-package ;file-like
                  (default exim))
  (config-file    exim-configuration-config-file ;file-like
                  (default #f))
  (setuid-user    exim-configuration-setuid-user
                  (default #f))
  (setgid-group   exim-configuration-setgid-group
                  (default #f)))

(define %exim-accounts
  (list (user-group
         (name "exim")
         (system? #t))
        (user-account
         (name "exim")
         (group "exim")
         (system? #t)
         (comment "Exim Daemon")
         (home-directory "/var/empty")
         (shell (file-append shadow "/sbin/nologin")))))

(define exim-shepherd-service
  (match-lambda
    (($ <exim-configuration> package config-file)
     (list (shepherd-service
            (provision '(exim mta))
            (documentation "Run the exim daemon.")
            (requirement '(networking))
            (start #~(make-forkexec-constructor
                      '(#$(file-append package "/bin/exim") "-bd" "-v")))
            (stop #~(make-kill-destructor)))))))

(define exim-activation
  (match-lambda
    (($ <exim-configuration> package config-file setuid-user setgid-group)
     (with-imported-modules '((guix build utils))
       #~(begin
           (use-modules (guix build utils)
                        (ice-9 format))

           (let ((uid (passwd:uid (getpw "exim")))
                 (gid (group:gid (getgr "exim"))))
             (mkdir-p "/var/spool/exim")
             (chown "/var/spool/exim" uid gid))

           ;; Exim often rereads its config file.  Let's substitute it
           ;; atomically.
           (with-output-to-file "/etc/exim.conf.new"
             (lambda _
               (format #t "
~:[~;exim_path = /run/setuid-programs/exim~%~]
.include ~a"
                       (or #$setuid-user #$setgid-group)
                       #$(or config-file
                             (file-append package "/etc/exim.conf")))))

           (chmod "/etc/exim.conf.new" #o444)
           (rename-file "/etc/exim.conf.new" "/etc/exim.conf")

           (zero? (system* #$(file-append package "/bin/exim") "-bV")))))))

(define exim-profile
  (compose list exim-configuration-package))

(define exim-setuids
  (match-lambda
    (($ <exim-configuration> package config-file setuid-user setgid-group)
     (if (or setuid-user setgid-group)
         (list (privileged-program
                (program (file-append package "/bin/exim"))
                (setuid? #t)
                (user (or setuid-user "exim"))
                (setgid? (not (not setgid-group)))
                (group (or setgid-group 0))))
         '()))))

(define exim-service-type
  (service-type
   (name 'exim)
   (extensions
    (list (service-extension shepherd-root-service-type exim-shepherd-service)
          (service-extension account-service-type (const %exim-accounts))
          (service-extension activation-service-type exim-activation)
          (service-extension profile-service-type exim-profile)
          (service-extension mail-aliases-service-type (const '()))
          (service-extension privileged-program-service-type exim-setuids)))
   (description "Run the Exim mail transfer agent (MTA).")))


;;;
;;; GNU Mailutils IMAP4 Daemon.
;;;

(define %default-imap4d-config-file
  (plain-file "imap4d.conf" "server localhost {};\n"))

(define-record-type* <imap4d-configuration>
  imap4d-configuration make-imap4d-configuration imap4d-configuration?
  (package     imap4d-configuration-package
               (default mailutils))
  (config-file imap4d-configuration-config-file
               (default %default-imap4d-config-file)))

(define imap4d-shepherd-service
  (match-lambda
    (($ <imap4d-configuration> package config-file)
     (list (shepherd-service
            (provision '(imap4d))
            (requirement '(networking syslogd))
            (documentation "Run the imap4d daemon.")
            (start (let ((imap4d (file-append package "/sbin/imap4d")))
                     #~(make-forkexec-constructor
                        (list #$imap4d "--daemon" "--foreground"
                              "--config-file" #$config-file))))
            (stop #~(make-kill-destructor)))))))

(define imap4d-service-type
  (service-type
   (name 'imap4d)
   (description
    "Run the GNU @command{imap4d} to serve e-mail messages through IMAP.")
   (extensions
    (list (service-extension
           shepherd-root-service-type imap4d-shepherd-service)))
   (default-value (imap4d-configuration))))


;;;
;;; Radicale.
;;;

;; Maybe types

(define (comma-separated-ip-list? lst)
  (every (lambda (s)
           (or (string-prefix? "localhost" s)
               ((@@ (gnu services vpn) ipv4-address?) s)
               ((@@ (gnu services vpn) ipv6-address?) s)))
         lst))

(define-maybe boolean (prefix radicale-))
(define-maybe comma-separated-ip-list (prefix radicale-))
(define-maybe file-name (prefix radicale-))
(define-maybe non-negative-integer (prefix radicale-))
(define-maybe string (prefix radicale-))
(define-maybe symbol (prefix radicale-))

;; Serializers and sanitizers

(define (radicale-serialize-field field-name value)
  ;; XXX We quote the un-gexp form here because otherwise symbol-literals are
  ;; treated as variables. We can get away with this because all of our other
  ;; field value types are primitives by the time they get here so are printed
  ;; the same whether or not they are quoted.
  #~(format #f "~a = ~a\n" #$(uglify-field-name field-name) '#$value))

(define (radicale-serialize-boolean field-name value?)
  (radicale-serialize-field field-name (if value? "True" "False")))

(define (radicale-serialize-comma-separated-ip-list field-name value)
  (radicale-serialize-field field-name (string-join value ", ")))

(define radicale-serialize-file-name radicale-serialize-field)

(define radicale-serialize-non-negative-integer radicale-serialize-field)

(define radicale-serialize-string radicale-serialize-field)

(define radicale-serialize-symbol radicale-serialize-field)

(define ((sanitize-delimited-symbols syms location field) value)
  (cond
   ((not (maybe-value-set? value))
    value)
   ((member value syms)
    (string->symbol (uglify-field-name value)))
   (else
    (configuration-field-error (source-properties->location location)
                               field
                               value))))

;; Section configuration types

(define-configuration radicale-auth-configuration
  (type
   maybe-symbol
   "The method to verify usernames and passwords. Options are @code{none},
@code{htpasswd}, @code{remote-user}, and @code{http-x-remote-user}.

This value is tied to @code{htpasswd-filename} and @code{htpasswd-encryption}."
   (sanitizer
    (sanitize-delimited-symbols '(none htpasswd remote-user http-x-remote-user)
                                (current-source-location)
                                'type)))
  (htpasswd-filename
   maybe-file-name
   "Path to the htpasswd file. Use htpasswd or similar to generate this file.")
  (htpasswd-encryption
   maybe-symbol
   "Encryption method used in the htpasswd file. Options are @code{plain},
@code{bcrypt}, and @code{md5}."
   (sanitizer
    (sanitize-delimited-symbols '(plain bcrypt md5)
                                (current-source-location)
                                'htpasswd-encryption)))
  (delay
   maybe-non-negative-integer
   "Average delay after failed login attempts in seconds.")
  (realm
   maybe-string
   "Message displayed in the client when a password is needed.")
  (prefix radicale-))

(define-configuration radicale-encoding-configuration
  (request
   maybe-symbol
   "Encoding for responding requests.")
  (stock
   maybe-symbol
   "Encoding for storing local collections.")
  (prefix radicale-))

(define-configuration radicale-logging-configuration
  (level
   maybe-symbol
   "Set the logging level. One of @code{debug}, @code{info}, @code{warning},
@code{error}, or @code{critical}."
   (sanitizer (sanitize-delimited-symbols '(debug info warning error critical)
                                          (current-source-location)
                                          'level)))
  (mask-passwords?
   maybe-boolean
   "Whether to include passwords in logs.")
  (prefix radicale-))

(define-configuration radicale-rights-configuration
  (type
   maybe-symbol
   "Backend used to check collection access rights. The recommended backend is
@code{owner-only}. If access to calendars and address books outside the home
directory of users is granted, clients won't detect these collections and will
not show them to the user. Choosing any other method is only useful if you
access calendars and address books directly via URL. Options are
@code{authenticate}, @code{owner-only}, @code{owner-write}, and
@code{from-file}."
   (sanitizer
    (sanitize-delimited-symbols '(authenticate owner-only owner-write from-file)
                                (current-source-location)
                                'type)))
  (file
   maybe-file-name
   "File for the rights backend @code{from-file}.")
  (prefix radicale-))

(define-configuration radicale-server-configuration
  (hosts
   maybe-comma-separated-ip-list
   "List of IP addresses that the server will bind to.")
  (max-connections
   maybe-non-negative-integer
   "Maximum number of parallel connections. Set to 0 to disable the limit.")
  (max-content-length
   maybe-non-negative-integer
   "Maximum size of the request body in byetes.")
  (timeout
   maybe-non-negative-integer
   "Socket timeout in seconds.")
  (ssl?
   maybe-boolean
   "Whether to enable transport layer encryption.")
  (certificate
   maybe-file-name
   "Path of the SSL certificate.")
  (key
   maybe-file-name
   "Path to the private key for SSL. Only effective if @code{ssl?} is
@code{#t}.")
  (certificate-authority
   maybe-file-name
   "Path to CA certificate for validating client certificates. This can be used
to secure TCP traffic between Radicale and a reverse proxy. If you want to
authenticate users with client-side certificates, you also have to write an
authentication plugin that extracts the username from the certificate.")
  (prefix radicale-))

(define-configuration radicale-storage-configuration
  (type
   maybe-symbol
   "Backend used to store data. Options are @code{multifilesystem} and
@code{multifilesystem-nolock}."
   (sanitizer
    (sanitize-delimited-symbols '(multifilesystem multifilesystem-nolock)
                                (current-source-location)
                                'type)))
  (filesystem-folder
   maybe-file-name
   "Folder for storing local collections. Created if not present.")
  (max-sync-token-age
   maybe-non-negative-integer
   "Delete sync-tokens that are older than the specified time in seconds.")
  (hook
   maybe-string
   "Command run after changes to storage.")
  (prefix radicale-))

;; Helpers for using section configurations in the main configuration

;; XXX These indirections are necessary to avoid creating semantic ambiguity
(define auth-config? radicale-auth-configuration?)
(define encoding-config? radicale-encoding-configuration?)
(define headers-file? file-like?)
(define logging-config? radicale-logging-configuration?)
(define rights-config? radicale-rights-configuration?)
(define server-config? radicale-server-configuration?)
(define storage-config? radicale-storage-configuration?)

(define-maybe auth-config)
(define-maybe encoding-config)
(define-maybe headers-file)
(define-maybe logging-config)
(define-maybe rights-config)
(define-maybe server-config)
(define-maybe storage-config)

(define ((serialize-radicale-section fields) name cfg)
  #~(format #f "[~a]\n~a\n" '#$name #$(serialize-configuration cfg fields)))

(define serialize-auth-config
  (serialize-radicale-section radicale-auth-configuration-fields))
(define serialize-encoding-config
  (serialize-radicale-section radicale-encoding-configuration-fields))
(define serialize-logging-config
  (serialize-radicale-section radicale-logging-configuration-fields))
(define serialize-rights-config
  (serialize-radicale-section radicale-rights-configuration-fields))
(define serialize-server-config
  (serialize-radicale-section radicale-server-configuration-fields))
(define serialize-storage-config
  (serialize-radicale-section radicale-storage-configuration-fields))

(define (serialize-radicale-configuration cfg)
  (mixed-text-file
   "radicale.conf"
   (serialize-configuration cfg radicale-configuration-fields)))

(define-configuration radicale-configuration
  ;; Only fields whose default value does not match upstream are not maybe-types
  (package
   (file-like radicale)
   "Package that provides @command{radicale}.")
  (auth
   maybe-auth-config
   "Configuration for auth-related variables.")
  (encoding
   maybe-encoding-config
   "Configuration for encoding-related variables.")
  (headers-file
   maybe-headers-file
   "Custom HTTP headers."
   (serializer
    (lambda (field-name value)
      #~(begin
          (use-modules (ice-9 rdelim))
          (format #f "[headers]\n~a\n\n"
                  (with-input-from-file #$value read-string))))))
  (logging
   maybe-logging-config
   "Configuration for logging-related variables.")
  (rights
   maybe-rights-config
   "Configuration for rights-related variables.")
  (server
   maybe-server-config
   "Configuration for server-related variables. Ignored if WSGI is used.")
  (storage
   maybe-storage-config
   "Configuration for storage-related variables.")
  (web-interface?
   maybe-boolean
   "Whether to use Radicale's built-in web interface."
   (serializer
    (lambda (_ use?)
      #~(format #f "[web]\ntype = ~a\n\n" #$(if use? "internal" "none"))))))

(define %radicale-accounts
  (list (user-group
         (name "radicale")
         (system? #t))
        (user-account
         (name "radicale")
         (group "radicale")
         (system? #t)
         (comment "Radicale Daemon")
         (home-directory "/var/empty")
         (shell (file-append shadow "/sbin/nologin")))))

(define (radicale-shepherd-service cfg)
  (list (shepherd-service
         (provision '(radicale))
         (documentation "Run the radicale daemon.")
         (requirement '(networking))
         (start #~(make-forkexec-constructor
                   (list #$(file-append (radicale-configuration-package cfg)
                                        "/bin/radicale")
                         "-C" #$(serialize-radicale-configuration cfg))
                   #:user "radicale"
                   #:group "radicale"))
         (stop #~(make-kill-destructor)))))

(define radicale-activation
  (match-lambda
    (($ <radicale-configuration> _ auth-config _ _ _ _ _ storage-config _)
     ;; Get values for the collections directory
     ;; See https://radicale.org/v3.html#running-as-a-service
     (define filesystem-folder-val
       (if (maybe-value-set? storage-config)
           (radicale-storage-configuration-filesystem-folder storage-config)
           storage-config))
     (define collections-dir
       (if (maybe-value-set? filesystem-folder-val)
           filesystem-folder-val
           "/var/lib/radicale/collections"))
     (define collections-parent-dir (dirname collections-dir))
     ;; Get values for the password file directory
     (define auth-value-set? (maybe-value-set? auth-config))
     ;; If auth's type is 'none or unset, that means there is no authentication
     ;; and we don't need to setup files for it
     (define auth?
       (and auth-value-set?
            (not (eq? (radicale-auth-configuration-type auth-config) 'none))))
     (define password-file-val
       (if auth-value-set?
           (radicale-auth-configuration-htpasswd-filename auth-config)
           auth-config))
     (define password-file-dir
       (if (maybe-value-set? password-file-val)
           (dirname password-file-val)
           "/etc/radicale"))
     (with-imported-modules '((guix build utils))
       #~(begin
           (use-modules (guix build utils))
           (let ((user (getpwnam "radicale")))
             ;; Collections directory perms
             (mkdir-p/perms #$collections-dir user #o700)
             ;; Password file perms
             (when #$auth?
               ;; In theory, the password file and thus this directory should already
               ;; exist because the user has to make them by hand
               (mkdir-p/perms #$password-file-dir user #o700))))))))

(define radicale-service-type
  (service-type
   (name 'radicale)
   (description "Run Radicale, a small CalDAV and CardDAV server.")
   (extensions
    (list (service-extension shepherd-root-service-type radicale-shepherd-service)
          (service-extension account-service-type (const %radicale-accounts))
          (service-extension activation-service-type radicale-activation)))
   (default-value (radicale-configuration))))

(define (generate-radicale-documentation)
  (generate-documentation
   `((radicale-configuration
      ,radicale-configuration-fields
      (auth     radicale-auth-configuration)
      (encoding radicale-encoding-configuration)
      (logging  radicale-logging-configuration)
      (rights   radicale-rights-configuration)
      (server   radicale-server-configuration)
      (storage  radicale-storage-configuration))
     (radicale-auth-configuration     ,radicale-auth-configuration-fields)
     (radicale-encoding-configuration ,radicale-encoding-configuration-fields)
     (radicale-logging-configuration  ,radicale-logging-configuration-fields)
     (radicale-rights-configuration   ,radicale-rights-configuration-fields)
     (radicale-server-configuration   ,radicale-server-configuration-fields)
     (radicale-storage-configuration  ,radicale-storage-configuration-fields))
   'radicale-configuration))

;;;
;;; Rspamd.
;;;

(define (directory-tree? xs)
  (match xs
    ((((? string?) (? file-like?)) ...) #t)
    (_ #f)))

(define-configuration/no-serialization rspamd-configuration
  (package
   (file-like rspamd)
   "The package that provides rspamd.")
  (config-file
   (file-like %default-rspamd-config-file)
   "File-like object of the configuration file to use.  By default
all workers are enabled except fuzzy and they are binded
to their usual ports, e.g localhost:11334, localhost:11333 and so on")
  (local.d-files
   (directory-tree '())
   "Configuration files in local.d, provided as a list of two element lists where
the first element is the filename and the second one is a file-like object.  Settings
in these files will be merged with the defaults.")
  (override.d-files
   (directory-tree '())
   "Configuration files in override.d, provided as a list of two element lists where
the first element is the filename and the second one is a file-like object.  Settings
in these files will override the defaults.")
  (user
   (user-account %default-rspamd-account)
   "The user to run rspamd as.")
  (group
   (user-group %default-rspamd-group)
   "The group to run rspamd as.")
  (debug?
   (boolean #f)
   "Force debug output.")
  (insecure?
   (boolean #f)
   "Ignore running workers as privileged users.")
  (skip-template?
   (boolean #f)
   "Do not apply Jinja templates.")
  (shepherd-requirements
   (list-of-symbols '(loopback))
   "This is a list of symbols naming Shepherd services that this service
will depend on."))

(define %default-rspamd-account
  (user-account
      (name "rspamd")
      (group "rspamd")
      (system? #t)
      (comment "Rspamd daemon")
      (home-directory "/var/empty")
      (shell (file-append shadow "/sbin/nologin"))))

(define %default-rspamd-group
  (user-group
    (name "rspamd")
    (system? #t)))

(define %default-rspamd-config-file
  (plain-file "rspamd.conf" "
.include \"$CONFDIR/common.conf\"

options {
    pidfile = \"$RUNDIR/rspamd.pid\";
    .include \"$CONFDIR/options.inc\"
    .include(try=true; priority=1,duplicate=merge) \"$LOCAL_CONFDIR/local.d/options.inc\"
    .include(try=true; priority=10) \"$LOCAL_CONFDIR/override.d/options.inc\"
}

logging {
    type = \"file\";
    filename = \"$LOGDIR/rspamd.log\";
    .include \"$CONFDIR/logging.inc\"
    .include(try=true; priority=1,duplicate=merge) \"$LOCAL_CONFDIR/local.d/logging.inc\"
    .include(try=true; priority=10) \"$LOCAL_CONFDIR/override.d/logging.inc\"
}

worker \"normal\" {
    bind_socket = \"localhost:11333\";
    .include \"$CONFDIR/worker-normal.inc\"
    .include(try=true; priority=1,duplicate=merge) \"$LOCAL_CONFDIR/local.d/worker-normal.inc\"
    .include(try=true; priority=10) \"$LOCAL_CONFDIR/override.d/worker-normal.inc\"
}

worker \"controller\" {
    bind_socket = \"localhost:11334\";
    .include \"$CONFDIR/worker-controller.inc\"
    .include(try=true; priority=1,duplicate=merge) \"$LOCAL_CONFDIR/local.d/worker-controller.inc\"
    .include(try=true; priority=10) \"$LOCAL_CONFDIR/override.d/worker-controller.inc\"
}

worker \"rspamd_proxy\" {
    bind_socket = \"localhost:11332\";
    .include \"$CONFDIR/worker-proxy.inc\"
    .include(try=true; priority=1,duplicate=merge) \"$LOCAL_CONFDIR/local.d/worker-proxy.inc\"
    .include(try=true; priority=10) \"$LOCAL_CONFDIR/override.d/worker-proxy.inc\"
}

# Local fuzzy storage is disabled by default

worker \"fuzzy\" {
    bind_socket = \"localhost:11335\";
    count = -1; # Disable by default
    .include \"$CONFDIR/worker-fuzzy.inc\"
    .include(try=true; priority=1,duplicate=merge) \"$LOCAL_CONFDIR/local.d/worker-fuzzy.inc\"
    .include(try=true; priority=10) \"$LOCAL_CONFDIR/override.d/worker-fuzzy.inc\"
}
"))

(define (rspamd-accounts config)
  (match-record config <rspamd-configuration>
    (user group)
    (list group user)))

(define (rspamd-shepherd-service config)
  (match-record config <rspamd-configuration>
    (package config-file user group debug? insecure? skip-template?
     local.d-files override.d-files shepherd-requirements)
    (list
     (shepherd-service
      (provision '(rspamd))
      (documentation "Run the rspamd daemon.")
      (requirement shepherd-requirements)
      (start (let ((rspamd (file-append package "/bin/rspamd"))
                   (local-confdir
                     (file-union
                      "rspamd-local-confdir"
                      `(("local.d" ,(file-union "local.d" local.d-files))
                        ("override.d" ,(file-union "override.d" override.d-files))))))
               (with-imported-modules (source-module-closure '((gnu build activation)))
                 #~(begin
                     (use-modules (gnu build activation)) ; for mkdir-p/perms
                     (let ((user (getpwnam #$(user-account-name user))))
                       (mkdir-p/perms "/var/run/rspamd" user #o755)
                       (mkdir-p/perms "/var/log/rspamd" user #o755)
                       (mkdir-p/perms "/var/lib/rspamd" user #o755))
                     (make-forkexec-constructor
                      (list #$rspamd "--config" #$config-file
                            "--var" (string-append "LOCAL_CONFDIR=" #$local-confdir)
                            "--no-fork"
                            #$@(if debug?
                                 '("--debug")
                                 '())
                            #$@(if insecure?
                                 '("--insecure")
                                 '())
                            #$@(if skip-template?
                                 '("--skip-template")
                                 '()))
                      #:user #$(user-account-name user)
                      #:group #$(user-group-name group))))))
      (stop #~(make-kill-destructor))
      (actions
       (list
        (shepherd-configuration-action config-file)
        (shepherd-action
         (name 'reload)
         (documentation "Reload rspamd.")
         (procedure
          #~(lambda (pid)
              (if pid
                (begin
                  (kill pid SIGHUP)
                  (display "Service rspamd has been reloaded"))
                (format #t "Service rspamd is not running.")))))
        (shepherd-action
         (name 'reopen)
         (documentation "Reopen log files.")
         (procedure
          #~(lambda (pid)
              (if pid
                (begin
                  (kill pid SIGUSR1)
                  (display "Reopening the logs for rspamd"))
                (format #t "Service rspamd is not running.")))))))))))

(define rspamd-service-type
  (service-type
   (name 'rspamd)
   (description "Run the rapid spam filtering system.")
   (extensions
    (list
     (service-extension shepherd-root-service-type rspamd-shepherd-service)
     (service-extension account-service-type rspamd-accounts)))
   (default-value (rspamd-configuration))))
keys) (let ((jdk (assoc-ref inputs "jdk")) (dir ,(match (%current-system) ("i686-linux" "i386-Linux") ((or "armhf-linux" "aarch64-linux") "arm-Linux") ((or "x86_64-linux") "amd64-Linux") (_ "unknown-Linux")))) (with-directory-excursion "source/c" (invoke "gcc" "-shared" "-O3" "-fPIC" "unix.c" (string-append "-I" jdk "/include") (string-append "-I" jdk "/include/linux") "-o" "libunix.so") (invoke "gcc" "-shared" "-O3" "-fPIC" "-DMACHINE_BYTE_ORDER=1" "copyCommon.c" "copyByteChar.c" "copyByteDouble.c" "copyByteFloat.c" "copyByteInt.c" "copyByteLong.c" "copyByteShort.c" (string-append "-I" jdk "/include") (string-append "-I" jdk "/include/linux") "-o" "libnativedata.so")) (install-file "source/c/libunix.so" (string-append "libs/native/unix/" dir)) (install-file "source/c/libnativedata.so" (string-append "libs/native/nativedata/" dir)) #t))) ;; In the "check" phase we only build the test executable. (add-after 'check 'run-tests (lambda _ (invoke "java" "-jar" "targets/dist/sis-base-test.jar") (delete-file "targets/dist/sis-base-test.jar") #t)) (replace 'install (install-jars "targets/dist"))))) (native-inputs `(("jdk" ,icedtea-8) ("java-commons-lang" ,java-commons-lang) ("java-commons-io" ,java-commons-io) ("java-testng" ,java-testng) ("build-resources" ,(origin (method svn-fetch) (uri (svn-reference (url (string-append "http://svnsis.ethz.ch/repos/cisd/" "base/tags/release/" (version-major+minor base-version) ".x/" base-version "/build_resources/")) (revision revision))) (sha256 (base32 "0b6335gkm4x895rac6kfg9d3rpq0sy19ph4zpg2gyw6asfsisjhk")))))) (home-page "http://svnsis.ethz.ch") (synopsis "Utility classes for libraries from ETH Zurich") (description "This library supplies some utility classes needed for libraries from the SIS division at ETH Zurich like jHDF5.") ;; The C sources are under a non-copyleft license, which looks like a ;; variant of the BSD licenses. The whole package is under the ASL2.0. (license (list license:asl2.0 (license:non-copyleft "file://source/c/COPYING")))))) (define-public java-cisd-args4j (let ((revision 39162) (base-version "9.11.2")) (package (name "java-cisd-args4j") (version (string-append base-version "-" (number->string revision))) (source (origin (method svn-fetch) (uri (svn-reference (url (string-append "http://svnsis.ethz.ch/repos/cisd/" "args4j/tags/release/" (version-major+minor base-version) ".x/" base-version "/args4j/")) (revision revision))) (file-name (string-append "java-cisd-args4j-" version "-checkout")) (sha256 (base32 "0hhqznjaivq7ips7mkwas78z42s6djsm20rrs7g1zd59rcsakxn2")))) (build-system ant-build-system) (arguments `(#:make-flags '("-file" "build/build.xml") #:tests? #f ; there are no tests ;; There are weird build failures with JDK8, such as: "The type ;; java.io.ObjectInputStream cannot be resolved. It is indirectly ;; referenced from required .class files" #:jdk ,icedtea-7 #:modules ((guix build ant-build-system) (guix build utils) (guix build java-utils) (sxml simple) (sxml transform) (sxml xpath)) #:phases (modify-phases %standard-phases (add-after 'unpack 'unpack-build-resources (lambda* (#:key inputs #:allow-other-keys) (mkdir-p "../build_resources") (invoke "tar" "xf" (assoc-ref inputs "build-resources") "-C" "../build_resources" "--strip-components=1") (mkdir-p "../build_resources/lib") #t)) (add-after 'unpack-build-resources 'fix-dependencies (lambda* (#:key inputs #:allow-other-keys) ;; FIXME: There should be a more convenient abstraction for ;; editing XML files. (with-directory-excursion "../build_resources/ant/" (chmod "build-common.xml" #o664) (call-with-output-file "build-common.xml.new" (lambda (port) (sxml->xml (pre-post-order (with-input-from-file "build-common.xml" (lambda _ (xml->sxml #:trim-whitespace? #t))) `(;; Remove dependency on classycle and custom ant tasks (taskdef . ,(lambda (tag . kids) (let ((name ((sxpath '(name *text*)) kids))) (if (or (member "build-info" name) (member "dependency-checker" name) (member "build-java-subprojects" name) (member "project-classpath" name)) '() ; skip `(,tag ,@kids))))) (typedef . ,(lambda (tag . kids) (let ((name ((sxpath '(name *text*)) kids))) (if (member "recursive-jar" name) '() ; skip `(,tag ,@kids))))) (build-java-subprojects . ,(lambda _ '())) ;; Ignore everything else (*default* . ,(lambda (tag . kids) `(,tag ,@kids))) (*text* . ,(lambda (_ txt) txt)))) port))) (rename-file "build-common.xml.new" "build-common.xml")) (substitute* "build/build.xml" (("\\$\\{lib\\}/cisd-base/cisd-base.jar") (string-append (assoc-ref inputs "java-cisd-base") "/share/java/sis-base.jar")) ;; Remove dependency on svn (("string revision)) (("\\$\\{version.number\\}") ,base-version) ;; Don't use custom ant tasks. (("recursive-jar") "jar") (("string revision))) (source (origin (method svn-fetch) (uri (svn-reference (url (string-append "http://svnsis.ethz.ch/repos/cisd/" "jhdf5/tags/release/" (version-major+minor base-version) ".x/" base-version "/jhdf5/")) (revision revision))) (file-name (string-append "java-cisd-jhdf5-" version "-checkout")) (sha256 (base32 "13i17s2hn0q9drdqvp8csy7770p3hdbh9rp30ihln2ldkfawdmz0")) (modules '((guix build utils))) (snippet '(begin ;; Delete included gradle jar (delete-file-recursively "gradle/wrapper") ;; Delete pre-built native libraries (delete-file-recursively "libs") #t)))) (build-system ant-build-system) (arguments `(#:make-flags '("-file" "build/build.xml") #:build-target "jar-all" #:test-target "jar-test" #:jdk ,icedtea-8 #:phases (modify-phases %standard-phases ;; FIXME: this build phase fails. (delete 'generate-jar-indices) ;; Don't erase results from the build phase when building tests. (add-after 'unpack 'separate-test-target-from-clean (lambda _ (substitute* "build/build.xml" (("\"jar-test\" depends=\"clean, ") "\"jar-test\" depends=\"")) #t)) (add-after 'unpack 'unpack-build-resources (lambda* (#:key inputs #:allow-other-keys) (copy-recursively (assoc-ref inputs "build-resources") "../build_resources") (delete-file-recursively "../build_resources/lib/") (mkdir-p "../build_resources/lib") ;; Remove dependency on classycle (substitute* "../build_resources/ant/build-common.xml" (("string revision)) (("\\$\\{version.number\\}") ,base-version)) #t)) (add-after 'unpack-build-resources 'fix-dependencies (lambda* (#:key inputs #:allow-other-keys) (substitute* "../build_resources/ant/build-common.xml" (("../libraries/testng/testng-jdk15.jar") (string-append (assoc-ref inputs "java-testng") "/share/java/java-testng.jar"))) (substitute* "build/build.xml" (("\\$\\{lib\\}/sis-base/sis-base.jar") (string-append (assoc-ref inputs "java-cisd-base") "/share/java/sis-base.jar")) (("\\$\\{lib\\}/cisd-args4j/cisd-args4j.jar") (string-append (assoc-ref inputs "java-cisd-args4j") "/share/java/cisd-args4j.jar")) (("\\$\\{lib\\}/commons-lang/commons-lang.jar") (string-append (assoc-ref inputs "java-commons-lang") "/share/java/commons-lang-" ,(package-version java-commons-lang) ".jar")) (("\\$\\{lib\\}/commons-io/commons-io.jar") (string-append (assoc-ref inputs "java-commons-io") "/share/java/commons-io-" ,(package-version java-commons-io) "-SNAPSHOT.jar")) (("\\$\\{lib\\}/testng/testng-jdk15.jar") (string-append (assoc-ref inputs "java-testng") "/share/java/java-testng.jar")) (("\\$\\{lib\\}/junit4/junit.jar") (string-append (assoc-ref inputs "java-junit") "/share/java/junit.jar")) (("\\$\\{lib\\}/jmock/hamcrest/hamcrest-core.jar") (string-append (assoc-ref inputs "java-hamcrest-core") "/share/java/hamcrest-core.jar"))) ;; Remove dependency on ch.rinn.restrictions (with-directory-excursion "source/java/ch/systemsx/cisd/hdf5/" (substitute* '("BitSetConversionUtils.java" "HDF5Utils.java") (("import ch.rinn.restrictions.Private;") "") (("@Private") ""))) (with-directory-excursion "sourceTest/java/ch/systemsx/cisd/hdf5/" (substitute* '("BitSetConversionTest.java" "h5ar/HDF5ArchiverTest.java") (("import ch.rinn.restrictions.Friend;") "") (("@Friend.*") "")) ;; Remove leftovers from removing @Friend (substitute* "h5ar/HDF5ArchiverTest.java" (("\\{ HDF5Archiver.class, IdCache.class, LinkRecord.class \\}\\)") ""))) #t)) (add-before 'configure 'build-native-library (lambda* (#:key inputs #:allow-other-keys) (let ((jdk (assoc-ref inputs "jdk")) (hdf5 (assoc-ref inputs "hdf5")) (dir ,(match (%current-system) ("i686-linux" "i386-Linux") ((or "armhf-linux" "aarch64-linux") "arm-Linux") ((or "x86_64-linux") "amd64-Linux") (_ "unknown-Linux")))) (with-directory-excursion "source/c" (apply invoke `("gcc" "-shared" "-O3" "-fPIC" "-Wl,--exclude-libs,ALL" ,@(find-files "jhdf5" "\\.c$") ,@(find-files "hdf-java" "\\.c$") ,(string-append "-I" hdf5 "/include") ,(string-append "-I" jdk "/include") ,(string-append "-I" jdk "/include/linux") ,(string-append hdf5 "/lib/libhdf5.a") "-o" "libjhdf5.so" "-lz"))) (install-file "source/c/libjhdf5.so" (string-append "libs/native/jhdf5/" dir)) #t))) ;; In the "check" phase we only build the test executable. (add-after 'check 'run-tests (lambda _ (invoke "java" "-jar" "targets/dist/sis-jhdf5-test.jar") (delete-file "targets/dist/sis-jhdf5-test.jar") #t)) (replace 'install (install-jars "targets/dist"))))) (inputs `(("java-cisd-base" ,java-cisd-base) ("java-cisd-args4j" ,java-cisd-args4j) ("java-commons-lang" ,java-commons-lang) ("java-commons-io" ,java-commons-io) ("hdf5" ,hdf5) ("zlib" ,zlib))) (native-inputs `(("jdk" ,icedtea-8) ("java-testng" ,java-testng) ("java-junit" ,java-junit) ("java-jmock" ,java-jmock) ("java-hamcrest-core" ,java-hamcrest-core) ("build-resources" ,(origin (method svn-fetch) (uri (svn-reference (url (string-append "http://svnsis.ethz.ch/repos/cisd/" "jhdf5/tags/release/" (version-major+minor base-version) ".x/" base-version "/build_resources/")) (revision revision))) (sha256 (base32 "0b6335gkm4x895rac6kfg9d3rpq0sy19ph4zpg2gyw6asfsisjhk")))))) (home-page "https://wiki-bsse.ethz.ch/display/JHDF5/") (synopsis "Java binding for HDF5") (description "JHDF5 is a high-level API in Java for reading and writing HDF5 files, building on the libraries provided by the HDF Group.") ;; The C sources are under a non-copyleft license, which looks like a ;; variant of the BSD licenses. The whole package is under the ASL2.0. (license (list license:asl2.0 (license:non-copyleft "file://source/c/COPYING")))))) (define-public java-classpathx-servletapi (package (name "java-classpathx-servletapi") (version "3.0.1") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/classpathx/servletapi/" "servletapi-" version ".tar.gz")) (sha256 (base32 "07d8h051siga2f33fra72hk12sbq1bxa4jifjg0qj0vfazjjff0x")))) (build-system ant-build-system) (arguments `(#:tests? #f ; there is no test target #:build-target "compile" #:make-flags (list "-Dbuild.compiler=javac1.8" (string-append "-Ddist=" (assoc-ref %outputs "out"))) #:phases (modify-phases %standard-phases (replace 'install (lambda* (#:key make-flags #:allow-other-keys) (apply invoke `("ant" "dist" ,@make-flags))))))) (home-page "https://www.gnu.org/software/classpathx/") (synopsis "Java servlet API implementation") (description "This is the GNU servlet API distribution, part of the ClasspathX project. It provides implementations of version 3.0 of the servlet API and version 2.1 of the Java ServerPages API.") (license license:gpl3+))) (define-public java-javaee-servletapi (package (name "java-javaee-servletapi") (version "3.1.0") (source (origin (method url-fetch) (uri (string-append "https://github.com/javaee/servlet-spec/" "archive/" version ".zip")) (file-name (string-append name "-" version ".zip")) (sha256 (base32 "0m6p13vgfb1ihich1jp5j6fqlhkjsrkn32c86bsbkryp38ipwg8w")))) (build-system ant-build-system) (arguments `(#:jar-name "javax-servletapi.jar" ;; no tests #:tests? #f #:source-dir "src/main/java")) (native-inputs `(("unzip" ,unzip))) (home-page "https://javaee.github.io/servlet-spec/") (synopsis "Java servlet API") (description "Java Servlet is the foundation web specification in the Java Enterprise Platform. Developers can build web applications using the Servlet API to interact with the request/response workflow. This project provides information on the continued development of the Java Servlet specification.") ;; Main code is dual-licensed by Oracle under either GLP2 or CDDL 1.1. ;; Some files are licensed under ASL 2.0. (license (list license:asl2.0 license:gpl2 license:cddl1.1)))) (define-public java-swt (package (name "java-swt") (version "4.7.1a") (source ;; The types of many variables and procedures differ in the sources ;; dependent on whether the target architecture is a 32-bit system or a ;; 64-bit system. Instead of patching the sources on demand in a build ;; phase we download either the 32-bit archive (which mostly uses "int" ;; types) or the 64-bit archive (which mostly uses "long" types). (let ((hash32 "09q0cbh90d90q3a7dx9430kc4m6bijrkr4lajrmzzvi0jjdpq4v9") (hash64 "17k5hs75a87ssmc5xhwdfdm2gn4zba0r837l2455za01krnkaa2q") (file32 "x86") (file64 "x86_64")) (let-values (((hash file) (match (or (%current-target-system) (%current-system)) ("x86_64-linux" (values hash64 file64)) (_ (values hash32 file32))))) (origin (method url-fetch) (uri (string-append "http://download.eclipse.org/eclipse/downloads/drops4/" "R-" version "-201710090410/swt-" version "-gtk-linux-" file ".zip")) (sha256 (base32 hash)))))) (build-system ant-build-system) (arguments `(#:jar-name "swt.jar" #:jdk ,icedtea-8 #:tests? #f ; no "check" target #:phases (modify-phases %standard-phases (replace 'unpack (lambda* (#:key source #:allow-other-keys) (mkdir "swt") (invoke "unzip" source "-d" "swt") (chdir "swt") (mkdir "src") (invoke "unzip" "src.zip" "-d" "src"))) ;; The classpath contains invalid icecat jars. Since we don't need ;; anything other than the JDK on the classpath, we can simply unset ;; it. (add-after 'configure 'unset-classpath (lambda _ (unsetenv "CLASSPATH") #t)) (add-before 'build 'build-native (lambda* (#:key inputs outputs #:allow-other-keys) (let ((lib (string-append (assoc-ref outputs "out") "/lib"))) ;; Build shared libraries. Users of SWT have to set the system ;; property swt.library.path to the "lib" directory of this ;; package output. (mkdir-p lib) (setenv "OUTPUT_DIR" lib) (with-directory-excursion "src" (invoke "bash" "build.sh"))))) (add-after 'install 'install-native (lambda* (#:key outputs #:allow-other-keys) (let ((lib (string-append (assoc-ref outputs "out") "/lib"))) (for-each (lambda (file) (install-file file lib)) (find-files "." "\\.so$")) #t)))))) (inputs `(("gtk" ,gtk+-2) ("libxtst" ,libxtst) ("libxt" ,libxt) ("mesa" ,mesa) ("glu" ,glu))) (native-inputs `(("pkg-config" ,pkg-config) ("unzip" ,unzip))) (home-page "https://www.eclipse.org/swt/") (synopsis "Widget toolkit for Java") (description "SWT is a widget toolkit for Java designed to provide efficient, portable access to the user-interface facilities of the operating systems on which it is implemented.") ;; SWT code is licensed under EPL1.0 ;; Gnome and Gtk+ bindings contain code licensed under LGPLv2.1 ;; Cairo bindings contain code under MPL1.1 ;; XULRunner 1.9 bindings contain code under MPL2.0 (license (list license:epl1.0 license:mpl1.1 license:mpl2.0 license:lgpl2.1+)))) (define-public java-xz (package (name "java-xz") (version "1.6") (source (origin (method url-fetch) (uri (string-append "http://tukaani.org/xz/xz-java-" version ".zip")) (sha256 (base32 "1z3p1ri1gvl07inxn0agx44ck8n7wrzfmvkz8nbq3njn8r9wba8x")))) (build-system ant-build-system) (arguments `(#:tests? #f ; There are no tests to run. #:jar-name ,(string-append "xz-" version ".jar") #:phases (modify-phases %standard-phases ;; The unpack phase enters the "maven" directory by accident. (add-after 'unpack 'chdir (lambda _ (chdir "..") #t))))) (native-inputs `(("unzip" ,unzip))) (home-page "https://tukaani.org/xz/java.html") (synopsis "Implementation of XZ data compression in pure Java") (description "This library aims to be a complete implementation of XZ data compression in pure Java. Single-threaded streamed compression and decompression and random access decompression have been fully implemented.") (license license:public-domain))) ;; java-hamcrest-core uses qdox version 1.12. We package this version instead ;; of the latest release. (define-public java-qdox-1.12 (package (name "java-qdox") (version "1.12.1") (source (origin (method url-fetch) (uri (string-append "http://central.maven.org/maven2/" "com/thoughtworks/qdox/qdox/" version "/qdox-" version "-sources.jar")) (sha256 (base32 "0hlfbqq2avf5s26wxkksqmkdyk6zp9ggqn37c468m96mjv0n9xfl")))) (build-system ant-build-system) (arguments `(;; Tests require junit #:tests? #f #:jar-name "qdox.jar" #:phases (modify-phases %standard-phases (replace 'unpack (lambda* (#:key source #:allow-other-keys) (mkdir "src") (with-directory-excursion "src" (invoke "jar" "-xf" source)))) ;; At this point we don't have junit, so we must remove the API ;; tests. (add-after 'unpack 'delete-tests (lambda _ (delete-file-recursively "src/com/thoughtworks/qdox/junit") #t))))) (home-page "http://qdox.codehaus.org/") (synopsis "Parse definitions from Java source files") (description "QDox is a high speed, small footprint parser for extracting class/interface/method definitions from source files complete with JavaDoc @code{@@tags}. It is designed to be used by active code generators or documentation tools.") (license license:asl2.0))) (define-public java-jarjar (package (name "java-jarjar") (version "1.4") (source (origin (method url-fetch) (uri (string-append "https://storage.googleapis.com/google-code-archive-downloads/v2/" "code.google.com/jarjar/jarjar-src-" version ".zip")) (sha256 (base32 "1v8irhni9cndcw1l1wxqgry013s2kpj0qqn57lj2ji28xjq8ndjl")) (modules '((guix build utils))) (snippet '(begin ;; Delete bundled thirds-party jar archives. ;; TODO: unbundle maven-plugin-api. (delete-file "lib/asm-4.0.jar") (delete-file "lib/asm-commons-4.0.jar") (delete-file "lib/junit-4.8.1.jar") #t)))) (build-system ant-build-system) (arguments `(;; Tests require junit, which ultimately depends on this package. #:tests? #f #:build-target "jar" #:phases (modify-phases %standard-phases (add-before 'build 'do-not-use-bundled-asm (lambda* (#:key inputs #:allow-other-keys) (substitute* "build.xml" (("") (string-append "")) (("") "") (("lib/asm-commons-4.0.jar") (string-append (assoc-ref inputs "java-asm-bootstrap") "/share/java/asm-6.0.jar")) (("") (string-append "" "" "" ""))) #t)) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((target (string-append (assoc-ref outputs "out") "/share/java"))) (install-file (string-append "dist/jarjar-" ,version ".jar") target)) #t))))) (inputs `(("java-asm-bootstrap" ,java-asm-bootstrap))) (native-inputs `(("unzip" ,unzip))) (home-page "https://code.google.com/archive/p/jarjar/") (synopsis "Repackage Java libraries") (description "Jar Jar Links is a utility that makes it easy to repackage Java libraries and embed them into your own distribution. Jar Jar Links includes an Ant task that extends the built-in @code{jar} task.") (license license:asl2.0))) (define-public java-hamcrest-core (package (name "java-hamcrest-core") (version "1.3") (source (origin (method url-fetch) (uri (string-append "https://github.com/hamcrest/JavaHamcrest/" "archive/hamcrest-java-" version ".tar.gz")) (sha256 (base32 "11g0s105fmwzijbv08lx8jlb521yravjmxnpgdx08fvg1kjivhva")) (modules '((guix build utils))) (snippet '(begin ;; Delete bundled thirds-party jar archives. (delete-file-recursively "lib") #t)))) (build-system ant-build-system) (arguments `(#:tests? #f ; Tests require junit #:modules ((guix build ant-build-system) (guix build utils) (srfi srfi-1)) #:make-flags (list (string-append "-Dversion=" ,version)) #:test-target "unit-test" #:build-target "core" #:phases (modify-phases %standard-phases ;; Disable unit tests, because they require junit, which requires ;; hamcrest-core. We also give a fixed value to the "Built-Date" ;; attribute from the manifest for reproducibility. (add-before 'configure 'patch-build.xml (lambda _ (substitute* "build.xml" (("unit-test, ") "") (("\\$\\{build.timestamp\\}") "guix")) #t)) ;; Java's "getMethods()" returns methods in an unpredictable order. ;; To make the output of the generated code deterministic we must ;; sort the array of methods. (add-after 'unpack 'make-method-order-deterministic (lambda _ (substitute* "hamcrest-generator/src/main/java/org/hamcrest/generator/ReflectiveFactoryReader.java" (("import java\\.util\\.Iterator;" line) (string-append line "\n" "import java.util.Arrays; import java.util.Comparator;")) (("allMethods = cls\\.getMethods\\(\\);" line) (string-append "_" line " private Method[] getSortedMethods() { Arrays.sort(_allMethods, new Comparator() { @Override public int compare(Method a, Method b) { return a.toString().compareTo(b.toString()); } }); return _allMethods; } private Method[] allMethods = getSortedMethods();"))) #t)) (add-before 'build 'do-not-use-bundled-qdox (lambda* (#:key inputs #:allow-other-keys) (substitute* "build.xml" (("lib/generator/qdox-1.12.jar") (string-append (assoc-ref inputs "java-qdox-1.12") "/share/java/qdox.jar"))) #t)) ;; build.xml searches for .jar files in this directoy, which ;; we remove from the source archive. (add-before 'build 'create-dummy-directories (lambda _ (mkdir-p "lib/integration") #t)) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((target (string-append (assoc-ref outputs "out") "/share/java/")) (version-suffix ,(string-append "-" version ".jar")) (install-without-version-suffix (lambda (jar) (copy-file jar (string-append target (basename jar version-suffix) ".jar"))))) (mkdir-p target) (for-each install-without-version-suffix (find-files "build" (lambda (name _) (and (string-suffix? ".jar" name) (not (string-suffix? "-sources.jar" name))))))) #t))))) (native-inputs `(("java-qdox-1.12" ,java-qdox-1.12) ("java-jarjar" ,java-jarjar))) (home-page "http://hamcrest.org/") (synopsis "Library of matchers for building test expressions") (description "This package provides a library of matcher objects (also known as constraints or predicates) allowing @code{match} rules to be defined declaratively, to be used in other frameworks. Typical scenarios include testing frameworks, mocking libraries and UI validation rules.") (license license:bsd-2))) (define-public java-junit (package (name "java-junit") (version "4.12") (source (origin (method url-fetch) (uri (string-append "https://github.com/junit-team/junit/" "archive/r" version ".tar.gz")) (file-name (string-append name "-" version ".tar.gz")) (sha256 (base32 "090dn5v1vs0b3acyaqc0gjf6p8lmd2h24wfzsbq7sly6b214anws")) (modules '((guix build utils))) (snippet '(begin ;; Delete bundled jar archives. (delete-file-recursively "lib") #t)))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests #:jar-name "junit.jar")) (inputs `(("java-hamcrest-core" ,java-hamcrest-core))) (home-page "http://junit.org/") (synopsis "Test framework for Java") (description "JUnit is a simple framework to write repeatable tests for Java projects. JUnit provides assertions for testing expected results, test fixtures for sharing common test data, and test runners for running tests.") (license license:epl1.0))) (define-public java-plexus-utils (package (name "java-plexus-utils") (version "3.0.24") (source (origin (method url-fetch) (uri (string-append "https://github.com/codehaus-plexus/" "plexus-utils/archive/plexus-utils-" version ".tar.gz")) (sha256 (base32 "1mlwpc6fms24slygv5yvi6fi9hcha2fh0v73p5znpi78bg36i2js")))) (build-system ant-build-system) ;; FIXME: The default build.xml does not include a target to install ;; javadoc files. (arguments `(#:jar-name "plexus-utils.jar" #:source-dir "src/main" #:phases (modify-phases %standard-phases (add-after 'unpack 'fix-reference-to-/bin-and-/usr (lambda _ (substitute* "src/main/java/org/codehaus/plexus/util/\ cli/shell/BourneShell.java" (("/bin/sh") (which "sh")) (("/usr/") (getcwd))) #t)) (add-after 'unpack 'fix-or-disable-broken-tests (lambda _ (with-directory-excursion "src/test/java/org/codehaus/plexus/util" (substitute* '("cli/CommandlineTest.java" "cli/shell/BourneShellTest.java") (("/bin/sh") (which "sh")) (("/bin/echo") (which "echo"))) ;; This test depends on MavenProjectStub, but we don't have ;; a package for Maven. (delete-file "introspection/ReflectionValueExtractorTest.java") ;; FIXME: The command line tests fail, maybe because they use ;; absolute paths. (delete-file "cli/CommandlineTest.java")) #t))))) (native-inputs `(("java-junit" ,java-junit))) (home-page "http://codehaus-plexus.github.io/plexus-utils/") (synopsis "Common utilities for the Plexus framework") (description "This package provides various Java utility classes for the Plexus framework to ease working with strings, files, command lines, XML and more.") (license license:asl2.0))) (define-public java-plexus-interpolation (package (name "java-plexus-interpolation") (version "1.23") (source (origin (method url-fetch) (uri (string-append "https://github.com/codehaus-plexus/" "plexus-interpolation/archive/" "plexus-interpolation-" version ".tar.gz")) (sha256 (base32 "03377yzlx5q440m6sxxgv6a5qb8fl30zzcgxgc0hxk5qgl2z1jjn")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-interpolation.jar" #:source-dir "src/main")) (native-inputs `(("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core))) (home-page "http://codehaus-plexus.github.io/plexus-interpolation/") (synopsis "Java components for interpolating ${} strings and the like") (description "Plexus interpolator is a modular, flexible interpolation framework for the expression language style commonly seen in Maven, Plexus, and other related projects. It has its foundation in the @code{org.codehaus.plexus.utils.interpolation} package within @code{plexus-utils}, but has been separated in order to allow these two libraries to vary independently of one another.") (license license:asl2.0))) (define-public java-plexus-classworlds (package (name "java-plexus-classworlds") (version "2.5.2") (source (origin (method url-fetch) (uri (string-append "https://github.com/codehaus-plexus/" "plexus-classworlds/archive/plexus-classworlds-" version ".tar.gz")) (sha256 (base32 "1qm4p0rl8d82lzhsiwnviw11jnq44s0gflg78zq152xyyr2xmh8g")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-classworlds.jar" #:source-dir "src/main" #:tests? #f));; FIXME: we need to generate some resources as in pom.xml (native-inputs `(("java-junit" ,java-junit))) (home-page "http://codehaus-plexus.github.io/plexus-classworlds/") (synopsis "Java class loader framework") (description "Plexus classworlds replaces the native @code{ClassLoader} mechanism of Java. It is especially useful for dynamic loading of application components.") (license license:asl2.0))) (define java-plexus-container-default-bootstrap (package (name "java-plexus-container-default-bootstrap") (version "1.7.1") (source (origin (method url-fetch) (uri (string-append "https://github.com/codehaus-plexus/plexus-containers" "/archive/plexus-containers-" version ".tar.gz")) (sha256 (base32 "0xw5g30qf4a83608rw9v2hv8pfsz7d69dkdhk6r0wia4q78hh1pc")))) (build-system ant-build-system) (arguments `(#:jar-name "container-default.jar" #:source-dir "plexus-container-default/src/main/java" #:test-dir "plexus-container-default/src/test" #:jdk ,icedtea-8 #:tests? #f; requires plexus-archiver, which depends on this package #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (copy-recursively "plexus-container-default/src/main/resources/" "build/classes") #t))))) (inputs `(("worldclass" ,java-plexus-classworlds) ("xbean" ,java-geronimo-xbean-reflect) ("utils" ,java-plexus-utils) ("junit" ,java-junit) ("guava" ,java-guava))) (home-page "https://github.com/codehaus-plexus/plexus-containers") (synopsis "Inversion-of-control container") (description "Plexus-default-container is Plexus' inversion-of-control (@dfn{IoC}) container. It is composed of its public API and its default implementation.") (license license:asl2.0))) (define-public java-plexus-io (package (name "java-plexus-io") (version "3.0.0") (source (origin (method url-fetch) (uri (string-append "https://github.com/codehaus-plexus/plexus-io" "/archive/plexus-io-" version ".tar.gz")) (sha256 (base32 "0f2j41kihaymxkpbm55smpxjja235vad8cgz94frfy3ppcp021dw")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-io.jar" #:source-dir "src/main/java" #:test-dir "src/test" #:jdk ,icedtea-8 #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (mkdir-p "build/classes/META-INF/plexus") (copy-file "src/main/resources/META-INF/plexus/components.xml" "build/classes/META-INF/plexus/components.xml") #t))))) (inputs `(("utils" ,java-plexus-utils) ("commons-io" ,java-commons-io) ("java-jsr305" ,java-jsr305))) (native-inputs `(("junit" ,java-junit) ("hamcrest" ,java-hamcrest-core) ("guava" ,java-guava) ("classworlds" ,java-plexus-classworlds) ("xbean" ,java-geronimo-xbean-reflect) ("container-default" ,java-plexus-container-default-bootstrap))) (home-page "https://github.com/codehaus-plexus/plexus-io") (synopsis "I/O plexus components") (description "Plexus IO is a set of plexus components, which are designed for use in I/O operations. This implementation using plexus components allows reusing it in maven.") (license license:asl2.0))) (define-public java-plexus-archiver (package (name "java-plexus-archiver") (version "3.5") (source (origin (method url-fetch) (uri (string-append "https://github.com/codehaus-plexus/plexus-archiver" "/archive/plexus-archiver-" version ".tar.gz")) (sha256 (base32 "0iv1j7khra6icqh3jndng3iipfmkc7l5jq2y802cm8r575v75pyv")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-archiver.jar" #:source-dir "src/main/java" #:jdk ,icedtea-8 #:test-dir "src/test" #:test-exclude (list "**/Abstract*.java" "**/Base*.java") #:phases (modify-phases %standard-phases (add-before 'check 'remove-failing (lambda _ ;; Requires an older version of plexus container (delete-file "src/test/java/org/codehaus/plexus/archiver/DuplicateFilesTest.java") #t)) (add-before 'build 'copy-resources (lambda _ (mkdir-p "build/classes/META-INF/plexus") (copy-file "src/main/resources/META-INF/plexus/components.xml" "build/classes/META-INF/plexus/components.xml") #t))))) (inputs `(("utils" ,java-plexus-utils) ("commons-io" ,java-commons-io) ("snappy" ,java-iq80-snappy) ("io" ,java-plexus-io) ("compress" ,java-commons-compress) ("container-default" ,java-plexus-container-default-bootstrap) ("snappy" ,java-snappy) ("java-jsr305" ,java-jsr305))) (native-inputs `(("junit" ,java-junit) ("classworld" ,java-plexus-classworlds) ("xbean" ,java-geronimo-xbean-reflect) ("xz" ,java-tukaani-xz) ("guava" ,java-guava))) (home-page "https://github.com/codehaus-plexus/plexus-archiver") (synopsis "Archiver component of the Plexus project") (description "Plexus-archiver contains a component to deal with project archives (jar).") (license license:asl2.0))) (define-public java-plexus-container-default (package (inherit java-plexus-container-default-bootstrap) (name "java-plexus-container-default") (arguments `(#:jar-name "container-default.jar" #:source-dir "plexus-container-default/src/main/java" #:test-dir "plexus-container-default/src/test" #:test-exclude (list ;"**/*Test.java" "**/Abstract*.java" ;; Requires plexus-hierarchy "**/PlexusHierarchyTest.java" ;; Failures "**/ComponentRealmCompositionTest.java" "**/PlexusContainerTest.java") #:jdk ,icedtea-8 #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (copy-recursively "plexus-container-default/src/main/resources/" "build/classes") #t)) (add-before 'check 'fix-paths (lambda _ (let ((dir "plexus-container-default/src/test/java/org/codehaus")) (substitute* (string-append dir "/plexus/component/composition/" "ComponentRealmCompositionTest.java") (("src/test") "plexus-container-default/src/test")) #t)))))) (inputs `(("worldclass" ,java-plexus-classworlds) ("xbean" ,java-geronimo-xbean-reflect) ("utils" ,java-plexus-utils) ("junit" ,java-junit) ("guava" ,java-guava))) (native-inputs `(("archiver" ,java-plexus-archiver) ("hamcrest" ,java-hamcrest-core))))) (define-public java-plexus-component-annotations (package (inherit java-plexus-container-default) (name "java-plexus-component-annotations") (arguments `(#:jar-name "plexus-component-annotations.jar" #:source-dir "plexus-component-annotations/src/main/java" #:tests? #f)); no tests (inputs '()) (native-inputs '()) (synopsis "Plexus descriptors generator") (description "This package is a Maven plugin to generate Plexus descriptors from source tags and class annotations."))) (define-public java-plexus-cipher (package (name "java-plexus-cipher") (version "1.7") (source (origin (method url-fetch) (uri (string-append "https://github.com/codehaus-plexus/plexus-cipher" "/archive/plexus-cipher-" version ".tar.gz")) (sha256 (base32 "1j3r8xzlxlk340snkjp6lk2ilkxlkn8qavsfiq01f43xmvv8ymk3")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-cipher.jar" #:source-dir "src/main/java" #:jdk ,icedtea-8 #:tests? #f; FIXME: requires sisu-inject-bean #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (copy-recursively "src/main/resources" "build/classes") (mkdir-p "build/classes/META-INF/sisu") (with-output-to-file "build/classes/META-INF/sisu/javax.inject.Named" (lambda _ (display "org.sonatype.plexus.components.cipher.DefaultPlexusCipher\n"))) #t))))) (inputs `(("java-cdi-api" ,java-cdi-api) ("java-javax-inject" ,java-javax-inject))) (home-page "https://github.com/sonatype/plexus-cipher") (synopsis "Encryption/decryption Component") (description "Plexus-cipher contains a component to deal with encryption and decryption.") (license license:asl2.0))) (define-public java-plexus-compiler-api (package (name "java-plexus-compiler-api") (version "2.8.4") (source (origin (method url-fetch) (uri (string-append "https://github.com/codehaus-plexus/plexus-compiler" "/archive/plexus-compiler-" version ".tar.gz")) (sha256 (base32 "09vmxs0807wsd26nbrwwj5l8ycmzazqycj52l7w6wjvkryywi69h")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-compiler-api.jar" #:source-dir "plexus-compiler-api/src/main/java" #:jdk ,icedtea-8 #:test-dir "plexus-compiler-api/src/test")) (inputs `(("java-plexus-container-default" ,java-plexus-container-default) ("java-plexus-util" ,java-plexus-utils))) (native-inputs `(("java-junit" ,java-junit))) (home-page "https://github.com/codehaus-plexus/plexus-compiler") (synopsis "Plexus Compilers component's API to manipulate compilers") (description "This package contains the API used by components to manipulate compilers.") (license (list license:asl2.0 license:expat)))) (define-public java-plexus-compiler-javac (package (inherit java-plexus-compiler-api) (name "java-plexus-compiler-javac") (arguments `(#:jar-name "plexus-compiler-javac.jar" #:source-dir "plexus-compilers/plexus-compiler-javac/src/main/java" #:jdk ,icedtea-8 #:tests? #f; depends on compiler-test -> maven-core -> ... -> this package. #:test-dir "plexus-compilers/plexus-compiler-javac/src/test")) (inputs `(("java-plexus-compiler-api" ,java-plexus-compiler-api) ("java-plexus-utils" ,java-plexus-utils) ("java-plexus-container-default" ,java-plexus-container-default))) (native-inputs `(("java-junit" ,java-junit))) (synopsis "Javac Compiler support for Plexus Compiler component") (description "This package contains the Javac Compiler support for Plexus Compiler component."))) (define-public java-plexus-sec-dispatcher (package (name "java-plexus-sec-dispatcher") (version "1.4") ;; Newest release listed at the Maven Central Repository. (source (origin ;; This project doesn't tag releases or publish tarballs, so we take ;; the "prepare release plexus-sec-dispatcher-1.4" git commit. (method url-fetch) (uri (string-append "https://github.com/sonatype/plexus-sec-dispatcher/" "archive/7db8f88048.tar.gz")) (sha256 (base32 "1smfrk4n7xbrsxpxcp2j4i0j8q86j73w0w6xg7qz83dp6dagdjgp")) (file-name (string-append name "-" version ".tar.gz")))) (arguments `(#:jar-name "plexus-sec-dispatcher.jar" #:source-dir "src/main/java" #:jdk ,icedtea-8 #:phases (modify-phases %standard-phases (add-before 'build 'generate-models (lambda* (#:key inputs #:allow-other-keys) (define (modello-single-mode file version mode) (invoke "java" "org.codehaus.modello.ModelloCli" file mode "src/main/java" version "false" "true")) (let ((file "src/main/mdo/settings-security.mdo")) (modello-single-mode file "1.0.0" "java") (modello-single-mode file "1.0.0" "xpp3-reader") (modello-single-mode file "1.0.0" "xpp3-writer")) #t)) (add-before 'build 'generate-components.xml (lambda _ (mkdir-p "build/classes/META-INF/plexus") (with-output-to-file "build/classes/META-INF/plexus/components.xml" (lambda _ (display "\n \n \n org.sonatype.plexus.components.sec.dispatcher.SecDispatcher\n default\n org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher\n \n \n \n org.sonatype.plexus.components.cipher.PlexusCipher\n _cipher\n \n \n org.sonatype.plexus.components.sec.dispatcher.PasswordDecryptor\n _decryptors\n \n \n \n <_configuration-file>~/.settings-security.xml\n \n \n \n \n"))) #t)) (add-before 'check 'fix-paths (lambda _ (copy-recursively "src/test/resources" "target") #t))))) (inputs `(("java-plexus-cipher" ,java-plexus-cipher))) (native-inputs `(("java-modello-core" ,java-modello-core) ;; for modello: ("java-plexus-container-default" ,java-plexus-container-default) ("java-plexus-classworlds" ,java-plexus-classworlds) ("java-plexus-utils" ,java-plexus-utils) ("java-guava" ,java-guava) ("java-geronimo-xbean-reflect" ,java-geronimo-xbean-reflect) ("java-sisu-build-api" ,java-sisu-build-api) ;; modello plugins: ("java-modellop-plugins-java" ,java-modello-plugins-java) ("java-modellop-plugins-xml" ,java-modello-plugins-xml) ("java-modellop-plugins-xpp3" ,java-modello-plugins-xpp3) ;; for tests ("java-junit" ,java-junit))) (build-system ant-build-system) (home-page "https://github.com/sonatype/plexus-sec-dispatcher") (synopsis "Plexus Security Dispatcher Component") (description "This package is the Plexus Security Dispatcher Component. This component decrypts a string passed to it.") (license license:asl2.0))) (define-public java-plexus-cli (package (name "java-plexus-cli") (version "1.7") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/sonatype/plexus-cli") (commit "a776afa6bca84e5107bedb69440329cdb24ed645"))) (file-name (string-append name "-" version)) (sha256 (base32 "0xjrlay605rypv3zd7y24vlwf0039bil3n2cqw54r1ddpysq46vx")))) (build-system ant-build-system) (arguments `(#:jar-name "plexus-cli.jar" #:source-dir "src/main/java" #:jdk ,icedtea-8 #:test-dir "src/test")) (inputs `(("java-commons-cli" ,java-commons-cli) ("java-plexus-container-default" ,java-plexus-container-default) ("java-plexus-classworlds" ,java-plexus-classworlds))) (native-inputs `(("java-plexus-utils" ,java-plexus-utils) ("java-junit" ,java-junit) ("java-guava" ,java-guava))) (home-page "https://codehaus-plexus.github.io/plexus-cli") (synopsis "CLI building library for plexus") (description "This package is a library to help creating CLI around Plexus components.") (license license:asl2.0))) (define-public java-sisu-build-api (package (name "java-sisu-build-api") (version "0.0.7") (source (origin (method url-fetch) (uri (string-append "https://github.com/sonatype/sisu-build-api/" "archive/plexus-build-api-" version ".tar.gz")) (sha256 (base32 "1c3rrpma3x634xp2rm2p5iskfhzdyc7qfbhjzr70agrl1jwghgy2")))) (build-system ant-build-system) (arguments `(#:jar-name "sisu-build-api.jar" #:source-dir "src/main/java" #:jdk ,icedtea-8 #:tests? #f; FIXME: how to run the tests? #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (copy-recursively "src/main/resources" "build/classes") (substitute* (find-files "build/classes") (("\\$\\{project.version\\}") ,version)) #t)) (add-before 'build 'generate-plexus-compontent (lambda _ (mkdir-p "build/classes/META-INF/plexus") ;; This file is required for plexus to inject this package. ;; FIXME: how is it generated? (with-output-to-file "build/classes/META-INF/plexus/components.xml" (lambda _ (display "\n \n \n org.sonatype.plexus.build.incremental.BuildContext\n default\n org.sonatype.plexus.build.incremental.DefaultBuildContext\n Filesystem based non-incremental build context implementation\n which behaves as if all files were just created.\n \n \n \n"))) #t))))) (inputs `(("java-plexus-utils" ,java-plexus-utils) ("java-plexus-container-default" ,java-plexus-container-default))) (home-page "https://github.com/sonatype/sisu-build-api/") (synopsis "Base build API for maven") (description "This package contains the base build API for maven and a default implementation of it. This API is about scanning files in a project and determining what files need to be rebuilt.") (license license:asl2.0))) (define-public java-modello-core (package (name "java-modello-core") (version "1.9.1") (source (origin (method url-fetch) (uri (string-append "https://github.com/codehaus-plexus/modello" "/archive/modello-" version ".tar.gz")) (sha256 (base32 "0l2pvns8pmlrmjm3iknp7gpg3654y1m8qhy55b19sdwdchdcyxfh")))) (build-system ant-build-system) (arguments `(#:jar-name "modello-core.jar" #:source-dir "modello-core/src/main/java" #:test-dir "modello-core/src/test" #:main-class "org.codehaus.modello.ModelloCli" #:jdk ,icedtea-8 #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (mkdir-p "build/classes/META-INF/plexus") (copy-file "modello-core/src/main/resources/META-INF/plexus/components.xml" "build/classes/META-INF/plexus/components.xml") #t)) (add-before 'check 'fix-tests (lambda _ (with-directory-excursion "modello-core/src/test/java/org/codehaus" (substitute* '("modello/core/DefaultModelloCoreTest.java" "modello/core/io/ModelReaderTest.java") (("src/test") "modello-core/src/test"))) #t))))) (inputs `(("java-plexus-utils" ,java-plexus-utils) ("java-plexus-container-default" ,java-plexus-container-default) ("java-sisu-build-api" ,java-sisu-build-api))) (native-inputs `(("java-junit" ,java-junit) ("java-plexus-classworlds" ,java-plexus-classworlds) ("java-geronimo-xbean-reflect" ,java-geronimo-xbean-reflect) ("java-guava" ,java-guava))) (home-page "http://codehaus-plexus.github.io/modello/") (synopsis "Framework for code generation from a simple model") (description "Modello is a framework for code generation from a simple model. Modello generates code from a simple model format: based on a plugin architecture, various types of code and descriptors can be generated from the single model, including Java POJOs, XML/JSON/YAML marshallers/unmarshallers, XSD and documentation.") (license (list license:expat ;; Although this package uses only files licensed under expat, ;; other parts of the source are licensed under different ;; licenses. We include them to be inherited by other packages. license:asl2.0 ;; Some files in modello-plugin-java are licensed under a ;; 5-clause BSD license. (license:non-copyleft (string-append "file:///modello-plugins/modello-plugin-java/" "src/main/java/org/codehaus/modello/plugin/" "java/javasource/JNaming.java")))))) (define-public java-modello-plugins-java (package (inherit java-modello-core) (name "java-modello-plugins-java") (arguments `(#:jar-name "modello-plugins-java.jar" #:source-dir "modello-plugins/modello-plugin-java/src/main/java" #:test-dir "modello-plugins/modello-plugin-java/src/test" #:jdk ,icedtea-8 #:tests? #f; requires maven-model, which depends on this package #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (mkdir-p "build/classes") (copy-recursively "modello-plugins/modello-plugin-java/src/main/resources" "build/classes") #t))))) (inputs `(("java-modello-core" ,java-modello-core) ,@(package-inputs java-modello-core))) (synopsis "Modello Java Plugin") (description "Modello Java Plugin generates Java objects for the model."))) (define-public java-modello-plugins-xml (package (inherit java-modello-core) (name "java-modello-plugins-xml") (arguments `(#:jar-name "modello-plugins-xml.jar" #:source-dir "modello-plugins/modello-plugin-xml/src/main/java" #:test-dir "modello-plugins/modello-plugin-xml/src/test" #:jdk ,icedtea-8 #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (mkdir-p "build/classes") (copy-recursively "modello-plugins/modello-plugin-xml/src/main/resources" "build/classes") #t)) (add-before 'check 'fix-paths (lambda _ (with-directory-excursion "modello-plugins/modello-plugin-xml/src/test" (substitute* "java/org/codehaus/modello/plugins/xml/XmlModelloPluginTest.java" (("src/test") "modello-plugins/modello-plugin-xml/src/test"))) #t))))) (inputs `(("java-modello-core" ,java-modello-core) ("java-modello-plugins-java" ,java-modello-plugins-java) ,@(package-inputs java-modello-core))) (synopsis "Modello XML Plugin") (description "Modello XML Plugin contains shared code for every plugins working on XML representation of the model."))) (define-public java-modello-test (package (inherit java-modello-core) (name "java-modello-test") (arguments `(#:jar-name "modello-test.jar" #:source-dir "modello-test/src/main/java" #:tests? #f; no tests #:jdk ,icedtea-8)) (inputs `(("java-plexus-utils" ,java-plexus-utils) ("java-plexus-compiler-api" ,java-plexus-compiler-api) ("java-plexus-compiler-javac" ,java-plexus-compiler-javac) ("java-plexus-container-default" ,java-plexus-container-default))) (synopsis "Modello test package") (description "The modello test package contains the basis to create Modello generator unit-tests, including sample models and xml files to test every feature for every plugin."))) (define-public java-modello-plugins-xpp3 (package (inherit java-modello-core) (name "java-modello-plugins-xpp3") (arguments `(#:jar-name "modello-plugins-xpp3.jar" #:source-dir "modello-plugins/modello-plugin-xpp3/src/main/java" #:test-dir "modello-plugins/modello-plugin-xpp3/src/test" ;; One of the test dependencies is maven-model which depends on this package. #:tests? #f #:jdk ,icedtea-8 #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (mkdir-p "build/classes") (copy-recursively "modello-plugins/modello-plugin-xpp3/src/main/resources" "build/classes") #t))))) (inputs `(("java-modello-core" ,java-modello-core) ("java-modello-plugins-java" ,java-modello-plugins-java) ("java-modello-plugins-xml" ,java-modello-plugins-xml) ,@(package-inputs java-modello-core))) (native-inputs `(("java-xmlunit" ,java-xmlunit) ("java-modello-test" ,java-modello-test) ,@(package-native-inputs java-modello-core))) (synopsis "Modello XPP3 Plugin") (description "The modello XPP3 plugin generates XML readers and writers based on the XPP3 API (XML Pull Parser)."))) (define-public java-asm (package (name "java-asm") (version "6.0") (source (origin (method url-fetch) (uri (string-append "http://download.forge.ow2.org/asm/" "asm-" version ".tar.gz")) (sha256 (base32 "115l5pqblirdkmzi32dxx7gbcm4jy0s14y5wircr6h8jdr9aix00")))) (build-system ant-build-system) (propagated-inputs `(("java-aqute-bndlib" ,java-aqute-bndlib) ("java-aqute-libg" ,java-aqute-libg))) (arguments `(#:build-target "compile" ;; The tests require an old version of Janino, which no longer compiles ;; with the JDK7. #:tests? #f #:make-flags (list ;; We don't need these extra ant tasks, but the build system asks us to ;; provide a path anyway. "-Dobjectweb.ant.tasks.path=dummy-path" ;; The java-aqute.bndlib JAR file will be put onto the classpath and ;; used during the build automatically by ant-build-system, but ;; java-asm's build.xml fails unless we provide something here. "-Dbiz.aQute.bnd.path=dummy-path") #:phases (modify-phases %standard-phases (add-before 'install 'build-jars (lambda* (#:key make-flags #:allow-other-keys) ;; We cannot use the "jar" target because it depends on a couple ;; of unpackaged, complicated tools. (mkdir "dist") (invoke "jar" "-cf" (string-append "dist/asm-" ,version ".jar") "-C" "output/build/tmp" "."))) (replace 'install (install-jars "dist"))))) (native-inputs `(("java-junit" ,java-junit))) (home-page "http://asm.ow2.org/") (synopsis "Very small and fast Java bytecode manipulation framework") (description "ASM is an all purpose Java bytecode manipulation and analysis framework. It can be used to modify existing classes or dynamically generate classes, directly in binary form. The provided common transformations and analysis algorithms allow to easily assemble custom complex transformations and code analysis tools.") (license license:bsd-3))) (define java-asm-bootstrap (package (inherit java-asm) (name "java-asm-bootstrap") (arguments (substitute-keyword-arguments (package-arguments java-asm) ((#:tests? _) #f))) (native-inputs `()) (propagated-inputs `(("java-aqute-bndlib" ,java-aqute-bndlib-bootstrap) ("java-aqute-libg" ,java-aqute-libg-bootstrap) ,@(delete `("java-aqute-bndlib" ,java-aqute-bndlib) (delete `("java-aqute-libg" ,java-aqute-libg) (package-inputs java-asm))))))) (define-public java-cglib (package (name "java-cglib") (version "3.2.4") (source (origin (method url-fetch) (uri (string-append "https://github.com/cglib/cglib/archive/RELEASE_" (string-map (lambda (c) (if (char=? c #\.) #\_ c)) version) ".tar.gz")) (file-name (string-append "cglib-" version ".tar.gz")) (sha256 (base32 "162dvd4fln76ai8prfharf66pn6r56p3sxx683j5vdyccrd5hi1q")))) (build-system ant-build-system) (arguments `(;; FIXME: tests fail because junit runs ;; "net.sf.cglib.transform.AbstractTransformTest", which does not seem ;; to describe a test at all. #:tests? #f #:jar-name "cglib.jar" #:phases (modify-phases %standard-phases (add-after 'unpack 'chdir (lambda _ (chdir "cglib") #t))))) (inputs `(("java-asm" ,java-asm) ("java-junit" ,java-junit))) (home-page "https://github.com/cglib/cglib/") (synopsis "Java byte code generation library") (description "The byte code generation library CGLIB is a high level API to generate and transform Java byte code.") (license license:asl2.0))) (define-public java-objenesis (package (name "java-objenesis") (version "2.5.1") (source (origin (method url-fetch) (uri (string-append "https://github.com/easymock/objenesis/" "archive/" version ".tar.gz")) (file-name (string-append "objenesis-" version ".tar.gz")) (sha256 (base32 "1va5qz1i2wawwavhnxfzxnfgrcaflz9p1pg03irrjh4nd3rz8wh6")))) (build-system ant-build-system) (arguments `(#:jar-name "objenesis.jar" #:source-dir "main/src/" #:test-dir "main/src/test/")) (native-inputs `(("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core))) (home-page "http://objenesis.org/") (synopsis "Bypass the constructor when creating an object") (description "Objenesis is a small Java library that serves one purpose: to instantiate a new object of a particular class. It is common to see restrictions in libraries stating that classes must require a default constructor. Objenesis aims to overcome these restrictions by bypassing the constructor on object instantiation.") (license license:asl2.0))) (define-public java-easymock (package (name "java-easymock") (version "3.4") (source (origin (method url-fetch) (uri (string-append "https://github.com/easymock/easymock/" "archive/easymock-" version ".tar.gz")) (sha256 (base32 "1yzg0kv256ndr57gpav46cyv4a1ns5sj722l50zpxk3j6sk9hnmi")))) (build-system ant-build-system) (arguments `(#:jar-name "easymock.jar" #:source-dir "core/src/main" #:test-dir "core/src/test" #:phases (modify-phases %standard-phases ;; FIXME: Android support requires the following packages to be ;; available: com.google.dexmaker.stock.ProxyBuilder (add-after 'unpack 'delete-android-support (lambda _ (with-directory-excursion "core/src/main/java/org/easymock/internal" (substitute* "MocksControl.java" (("AndroidSupport.isAndroid\\(\\)") "false") (("return classProxyFactory = new AndroidClassProxyFactory\\(\\);") "")) (delete-file "AndroidClassProxyFactory.java")) #t)) (add-after 'unpack 'delete-broken-tests (lambda _ (with-directory-excursion "core/src/test/java/org/easymock" ;; This test depends on dexmaker. (delete-file "tests2/ClassExtensionHelperTest.java") ;; This is not a test. (delete-file "tests/BaseEasyMockRunnerTest.java") ;; This test should be executed with a different runner... (delete-file "tests2/EasyMockAnnotationsTest.java") ;; ...but deleting it means that we also have to delete these ;; dependent files. (delete-file "tests2/EasyMockRunnerTest.java") (delete-file "tests2/EasyMockRuleTest.java") ;; This test fails because the file "easymock.properties" does ;; not exist. (delete-file "tests2/EasyMockPropertiesTest.java")) #t))))) (inputs `(("java-asm" ,java-asm) ("java-cglib" ,java-cglib) ("java-objenesis" ,java-objenesis))) (native-inputs `(("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core))) (home-page "http://easymock.org") (synopsis "Java library providing mock objects for unit tests") (description "EasyMock is a Java library that provides an easy way to use mock objects in unit testing.") (license license:asl2.0))) (define-public java-jmock-1 (package (name "java-jmock") (version "1.2.0") (source (origin (method url-fetch) (uri (string-append "https://github.com/jmock-developers/" "jmock-library/archive/" version ".tar.gz")) (file-name (string-append "jmock-" version ".tar.gz")) (sha256 (base32 "0xmrlhq0fszldkbv281k9463mv496143vvmqwpxp62yzjvdkx9w0")))) (build-system ant-build-system) (arguments `(#:build-target "jars" #:test-target "run.tests" #:phases (modify-phases %standard-phases (replace 'install (install-jars "build"))))) (home-page "http://www.jmock.org") (synopsis "Mock object library for test-driven development") (description "JMock is a library that supports test-driven development of Java code with mock objects. Mock objects help you design and test the interactions between the objects in your programs. The jMock library @itemize @item makes it quick and easy to define mock objects @item lets you precisely specify the interactions between your objects, reducing the brittleness of your tests @item plugs into your favourite test framework @item is easy to extend. @end itemize\n") (license license:bsd-3))) (define-public java-jmock (package (inherit java-jmock-1) (name "java-jmock") (version "2.8.2") (source (origin (method url-fetch) (uri (string-append "https://github.com/jmock-developers/" "jmock-library/archive/" version ".tar.gz")) (file-name (string-append name "-" version ".tar.gz")) (sha256 (base32 "18650a9g8xffcsdb6w91pbswa7f40fp2sh6s3nclkclz5dbzq8f0")))) (inputs `(("java-hamcrest-all" ,java-hamcrest-all) ("java-asm" ,java-asm) ("java-bsh" ,java-bsh) ("java-junit" ,java-junit))) (native-inputs `(("cglib" ,java-cglib))) (arguments `(#:jar-name "java-jmock.jar" #:source-dir "jmock/src/main/java" #:test-dir "jmock/src/test")))) (define-public java-jmock-junit4 (package (inherit java-jmock) (name "java-jmock-junit4") (arguments `(#:jar-name "java-jmock-junit4.jar" #:source-dir "jmock-junit4/src/main/java" #:test-dir "jmock-junit4/src/test")) (inputs `(("java-hamcrest-all" ,java-hamcrest-all) ("java-asm" ,java-asm) ("java-bsh" ,java-bsh) ("java-jmock" ,java-jmock) ("java-jumit" ,java-junit))))) (define-public java-jmock-legacy (package (inherit java-jmock) (name "java-jmock-legacy") (arguments `(#:jar-name "java-jmock-legacy.jar" #:source-dir "jmock-legacy/src/main/java" #:test-dir "jmock-legacy/src/test" #:phases (modify-phases %standard-phases (add-before 'check 'copy-tests (lambda _ ;; This file is a dependancy of some tests (let ((file "org/jmock/test/acceptance/PackageProtectedType.java")) (copy-file (string-append "jmock/src/test/java/" file) (string-append "jmock-legacy/src/test/java/" file)) #t)))))) (inputs `(("java-hamcrest-all" ,java-hamcrest-all) ("java-objenesis" ,java-objenesis) ("java-cglib" ,java-cglib) ("java-jmock" ,java-jmock) ("java-asm" ,java-asm) ("java-bsh" ,java-bsh) ("java-junit" ,java-junit))) (native-inputs `(("java-jmock-junit4" ,java-jmock-junit4))))) (define-public java-hamcrest-all (package (inherit java-hamcrest-core) (name "java-hamcrest-all") (arguments `(#:jdk ,icedtea-8 ,@(substitute-keyword-arguments (package-arguments java-hamcrest-core) ((#:build-target _) "bigjar") ((#:phases phases) `(modify-phases ,phases ;; Some build targets override the classpath, so we need to patch ;; the build.xml to ensure that required dependencies are on the ;; classpath. (add-after 'unpack 'patch-classpath-for-integration (lambda* (#:key inputs #:allow-other-keys) (substitute* "build.xml" ((" build/hamcrest-library-\\$\\{version\\}.jar" line) (string-join (cons line (append (find-files (assoc-ref inputs "java-junit") "\\.jar$") (find-files (assoc-ref inputs "java-jmock") "\\.jar$") (find-files (assoc-ref inputs "java-easymock") "\\.jar$"))) ";")) (("build/hamcrest-core-\\$\\{version\\}\\.jar") (string-append (assoc-ref inputs "java-hamcrest-core") "/share/java/hamcrest-core.jar"))) #t))))))) (inputs `(("java-junit" ,java-junit) ("java-jmock" ,java-jmock-1) ;; This is necessary because of what seems to be a race condition. ;; This package would sometimes fail to build because hamcrest-core.jar ;; could not be found, even though it is built as part of this package. ;; Adding java-hamcrest-core appears to fix this problem. See ;; https://debbugs.gnu.org/31390 for more information. ("java-hamcrest-core" ,java-hamcrest-core) ("java-easymock" ,java-easymock) ,@(package-inputs java-hamcrest-core))))) (define-public java-jopt-simple (package (name "java-jopt-simple") (version "5.0.3") (source (origin (method url-fetch) (uri (string-append "http://repo1.maven.org/maven2/" "net/sf/jopt-simple/jopt-simple/" version "/jopt-simple-" version "-sources.jar")) (sha256 (base32 "1v8bzmwmw6qq20gm42xyay6vrd567dra4vqwhgjnqqjz1gs9f8qa")))) (build-system ant-build-system) (arguments `(#:tests? #f ; there are no tests #:jar-name "jopt-simple.jar")) (home-page "https://pholser.github.io/jopt-simple/") (synopsis "Java library for parsing command line options") (description "JOpt Simple is a Java library for parsing command line options, such as those you might pass to an invocation of @code{javac}. In the interest of striving for simplicity, as closely as possible JOpt Simple attempts to honor the command line option syntaxes of POSIX @code{getopt} and GNU @code{getopt_long}. It also aims to make option parser configuration and retrieval of options and their arguments simple and expressive, without being overly clever.") (license license:expat))) (define-public java-commons-math3 (package (name "java-commons-math3") (version "3.6.1") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/math/source/" "commons-math3-" version "-src.tar.gz")) (sha256 (base32 "19l6yp44qc5g7wg816nbn5z3zq3xxzwimvbm4a8pczgvpi4i85s6")))) (build-system ant-build-system) (arguments `(#:build-target "jar" #:test-target "test" #:make-flags (let ((hamcrest (assoc-ref %build-inputs "java-hamcrest-core")) (junit (assoc-ref %build-inputs "java-junit"))) (list (string-append "-Djunit.jar=" junit "/share/java/junit.jar") (string-append "-Dhamcrest.jar=" hamcrest "/share/java/hamcrest-core.jar"))) #:phases (modify-phases %standard-phases ;; We want to build the jar in the build phase and run the tests ;; later in a separate phase. (add-after 'unpack 'untangle-targets (lambda _ (substitute* "build.xml" (("name=\"jar\" depends=\"test\"") "name=\"jar\" depends=\"compile\"")) #t)) ;; There is no install target. (replace 'install (install-jars "target"))))) (native-inputs `(("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core))) (home-page "http://commons.apache.org/math/") (synopsis "Apache Commons mathematics library") (description "Commons Math is a library of lightweight, self-contained mathematics and statistics components addressing the most common problems not available in the Java programming language or Commons Lang.") (license license:asl2.0))) (define-public java-jmh (package (name "java-jmh") (version "1.17.5") (source (origin (method hg-fetch) (uri (hg-reference (url "http://hg.openjdk.java.net/code-tools/jmh/") (changeset version))) (file-name (string-append name "-" version "-checkout")) (sha256 (base32 "1fxyxhg9famwcg1prc4cgwb5wzyxqavn3cjm5vz8605xz7x5k084")))) (build-system ant-build-system) (arguments `(#:jar-name "jmh-core.jar" #:source-dir "jmh-core/src/main" #:test-dir "jmh-core/src/test" #:phases (modify-phases %standard-phases ;; This seems to be a bug in the JDK. It may not be necessary in ;; future versions of the JDK. (add-after 'unpack 'fix-bug (lambda _ (with-directory-excursion "jmh-core/src/main/java/org/openjdk/jmh/runner/options" (substitute* '("IntegerValueConverter.java" "ThreadsValueConverter.java") (("public Class valueType") "public Class valueType"))) #t))))) (inputs `(("java-jopt-simple" ,java-jopt-simple) ("java-commons-math3" ,java-commons-math3))) (native-inputs `(("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core))) (home-page "http://openjdk.java.net/projects/code-tools/jmh/") (synopsis "Benchmark harness for the JVM") (description "JMH is a Java harness for building, running, and analysing nano/micro/milli/macro benchmarks written in Java and other languages targeting the JVM.") ;; GPLv2 only (license license:gpl2))) (define-public java-commons-collections4 (package (name "java-commons-collections4") (version "4.1") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/collections/source/" "commons-collections4-" version "-src.tar.gz")) (sha256 (base32 "1krfhvggympq4avk7gh6qafzf6b9ip6r1m4lmacikyx04039m0wl")))) (build-system ant-build-system) (arguments `(#:test-target "test" #:make-flags (let ((hamcrest (assoc-ref %build-inputs "java-hamcrest-core")) (junit (assoc-ref %build-inputs "java-junit")) (easymock (assoc-ref %build-inputs "java-easymock"))) (list (string-append "-Djunit.jar=" junit "/share/java/junit.jar") (string-append "-Dhamcrest.jar=" hamcrest "/share/java/hamcrest-core.jar") (string-append "-Deasymock.jar=" easymock "/share/java/easymock.jar"))) #:phases (modify-phases %standard-phases (replace 'install (install-jars "target"))))) (native-inputs `(("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core) ("java-easymock" ,java-easymock))) (home-page "http://commons.apache.org/collections/") (synopsis "Collections framework") (description "The Java Collections Framework is the recognised standard for collection handling in Java. Commons-Collections seek to build upon the JDK classes by providing new interfaces, implementations and utilities. There are many features, including: @itemize @item @code{Bag} interface for collections that have a number of copies of each object @item @code{BidiMap} interface for maps that can be looked up from value to key as well and key to value @item @code{MapIterator} interface to provide simple and quick iteration over maps @item Transforming decorators that alter each object as it is added to the collection @item Composite collections that make multiple collections look like one @item Ordered maps and sets that retain the order elements are added in, including an LRU based map @item Reference map that allows keys and/or values to be garbage collected under close control @item Many comparator implementations @item Many iterator implementations @item Adapter classes from array and enumerations to collections @item Utilities to test or create typical set-theory properties of collections such as union, intersection, and closure. @end itemize\n") (license license:asl2.0))) (define-public java-commons-collections (package (inherit java-commons-collections4) (name "java-commons-collections") (version "3.2.2") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/collections/source/" "commons-collections-" version "-src.tar.gz")) (sha256 (base32 "055r51a5lfc3z7rkxnxmnn1npvkvda7636hjpm4qk7cnfzz98387")) (patches (search-patches "java-commons-collections-fix-java8.patch")))) (arguments (substitute-keyword-arguments (package-arguments java-commons-collections4) ((#:phases phases) `(modify-phases ,phases ;; The manifest is required by the build procedure (add-before 'build 'add-manifest (lambda _ (mkdir-p "build/conf") (call-with-output-file "build/conf/MANIFEST.MF" (lambda (file) (format file "Manifest-Version: 1.0\n"))) #t)) (replace 'install (install-jars "build")))))))) (define java-commons-collections-test-classes (package (inherit java-commons-collections) (arguments `(#:jar-name "commons-collections-test-classes.jar" #:source-dir "src/test" #:tests? #f)) (inputs `(("collection" ,java-commons-collections))))) (define-public java-commons-beanutils (package (name "java-commons-beanutils") (version "1.9.3") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/beanutils/source/" "commons-beanutils-" version "-src.tar.gz")) (sha256 (base32 "03cs0bq3sl1sdc7py9g3qnf8n9h473nrkvd3d251kaqv6a2ab7qk")))) (build-system ant-build-system) (arguments `(#:test-target "test" #:tests? #f #:phases (modify-phases %standard-phases (replace 'install (lambda* (#:key outputs #:allow-other-keys) (rename-file (string-append "dist/commons-beanutils-" ,version "-SNAPSHOT.jar") "commons-beanutils.jar") (install-file "commons-beanutils.jar" (string-append (assoc-ref outputs "out") "/share/java/")) #t))))) (inputs `(("logging" ,java-commons-logging-minimal) ("collections" ,java-commons-collections))) (native-inputs `(("junit" ,java-junit) ("collections-test" ,java-commons-collections-test-classes))) (home-page "http://commons.apache.org/beanutils/") (synopsis "Dynamically set or get properties in Java") (description "BeanUtils provides a simplified interface to reflection and introspection to set or get dynamically determined properties through their setter and getter method.") (license license:asl2.0))) (define-public java-commons-io (package (name "java-commons-io") (version "2.5") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/io/source/" "commons-io-" version "-src.tar.gz")) (sha256 (base32 "0q5y41jrcjvx9hzs47x5kdhnasdy6rm4bzqd2jxl02w717m7a7v3")))) (build-system ant-build-system) (outputs '("out" "doc")) (arguments `(#:test-target "test" #:make-flags (list (string-append "-Djunit.jar=" (assoc-ref %build-inputs "java-junit") "/share/java/junit.jar")) #:phases (modify-phases %standard-phases (add-after 'build 'build-javadoc ant-build-javadoc) (replace 'install (install-jars "target")) (add-after 'install 'install-doc (install-javadoc "target/apidocs"))))) (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 license:asl2.0))) (define-public java-commons-exec-1.1 (package (name "java-commons-exec") (version "1.1") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/exec/source/" "commons-exec-" version "-src.tar.gz")) (sha256 (base32 "025dk8xgj10lxwwwqp0hng2rn7fr4vcirxzydqzx9k4dim667alk")))) (build-system ant-build-system) (arguments `(#:test-target "test" #:make-flags (list (string-append "-Dmaven.junit.jar=" (assoc-ref %build-inputs "java-junit") "/share/java/junit.jar")) #:phases (modify-phases %standard-phases (add-before 'build 'delete-network-tests (lambda _ (delete-file "src/test/java/org/apache/commons/exec/DefaultExecutorTest.java") (substitute* "src/test/java/org/apache/commons/exec/TestRunner.java" (("suite\\.addTestSuite\\(DefaultExecutorTest\\.class\\);") "")) #t)) ;; The "build" phase automatically tests. (delete 'check) (replace 'install (install-jars "target"))))) (native-inputs `(("java-junit" ,java-junit))) (home-page "http://commons.apache.org/proper/commons-exec/") (synopsis "Common program execution related classes") (description "Commons-Exec simplifies executing external processes.") (license license:asl2.0))) (define-public java-commons-exec (package (inherit java-commons-exec-1.1) (version "1.3") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/exec/source/" "commons-exec-" version "-src.tar.gz")) (sha256 (base32 "17yb4h6f8l49c5iyyvda4z2nmw0bxrx857nrwmsr7mmpb7x441yv")))) (arguments `(#:test-target "test" #:make-flags (list (string-append "-Dmaven.junit.jar=" (assoc-ref %build-inputs "java-junit") "/share/java/junit.jar") "-Dmaven.compiler.source=1.7" "-Dmaven.compiler.target=1.7") #:phases (modify-phases %standard-phases (add-before 'build 'delete-network-tests (lambda* (#:key inputs #:allow-other-keys) ;; This test hangs indefinitely. (delete-file "src/test/java/org/apache/commons/exec/issues/Exec60Test.java") (substitute* "src/test/java/org/apache/commons/exec/issues/Exec41Test.java" (("ping -c 10 127.0.0.1") "sleep 10")) (substitute* "src/test/java/org/apache/commons/exec/issues/Exec49Test.java" (("/bin/ls") "ls")) (call-with-output-file "src/test/scripts/ping.sh" (lambda (port) (format port "#!~a/bin/sh\nsleep $1\n" (assoc-ref inputs "bash")))) #t)) ;; The "build" phase automatically tests. (delete 'check) (replace 'install (install-jars "target"))))) (native-inputs `(("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core))))) (define-public java-commons-lang (package (name "java-commons-lang") (version "2.6") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/lang/source/" "commons-lang-" version "-src.tar.gz")) (sha256 (base32 "1mxwagqadzx1b2al7i0z1v0r235aj2njdyijf02szq0vhmqrfiq5")))) (build-system ant-build-system) (outputs '("out" "doc")) (arguments `(#:test-target "test" #:test-exclude (list "**/Abstract*.java" "**/Random*.java") #:phases (modify-phases %standard-phases (add-after 'build 'build-javadoc ant-build-javadoc) (add-before 'check 'disable-failing-test (lambda _ ;; Disable a failing test (substitute* "src/test/java/org/apache/commons/lang/\ time/FastDateFormatTest.java" (("public void testFormat\\(\\)") "public void disabled_testFormat()")) #t)) (replace 'install (install-jars "target")) (add-after 'install 'install-doc (install-javadoc "target/apidocs"))))) (native-inputs `(("java-junit" ,java-junit))) (home-page "http://commons.apache.org/lang/") (synopsis "Extension of the java.lang package") (description "The Commons Lang components contains a set of Java classes that provide helper methods for standard Java classes, especially those found in the @code{java.lang} package in the Sun JDK. The following classes are included: @itemize @item StringUtils - Helper for @code{java.lang.String}. @item CharSetUtils - Methods for dealing with @code{CharSets}, which are sets of characters such as @code{[a-z]} and @code{[abcdez]}. @item RandomStringUtils - Helper for creating randomised strings. @item NumberUtils - Helper for @code{java.lang.Number} and its subclasses. @item NumberRange - A range of numbers with an upper and lower bound. @item ObjectUtils - Helper for @code{java.lang.Object}. @item SerializationUtils - Helper for serializing objects. @item SystemUtils - Utility class defining the Java system properties. @item NestedException package - A sub-package for the creation of nested exceptions. @item Enum package - A sub-package for the creation of enumerated types. @item Builder package - A sub-package for the creation of @code{equals}, @code{hashCode}, @code{compareTo} and @code{toString} methods. @end itemize\n") (license license:asl2.0))) (define-public java-commons-lang3 (package (name "java-commons-lang3") (version "3.4") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/lang/source/" "commons-lang3-" version "-src.tar.gz")) (sha256 (base32 "0xpshb9spjhplq5a7mr0y1bgfw8190ik4xj8f569xidfcki1d6kg")))) (build-system ant-build-system) (outputs '("out" "doc")) (arguments `(#:test-target "test" #:make-flags (let ((hamcrest (assoc-ref %build-inputs "java-hamcrest-all")) (junit (assoc-ref %build-inputs "java-junit")) (easymock (assoc-ref %build-inputs "java-easymock")) (io (assoc-ref %build-inputs "java-commons-io"))) (list (string-append "-Djunit.jar=" junit "/share/java/junit.jar") (string-append "-Dhamcrest.jar=" hamcrest "/share/java/hamcrest-all.jar") (string-append "-Dcommons-io.jar=" io "/share/java/commons-io-" ,(package-version java-commons-io) "-SNAPSHOT.jar") (string-append "-Deasymock.jar=" easymock "/share/java/easymock.jar"))) #:phases (modify-phases %standard-phases (add-after 'build 'build-javadoc ant-build-javadoc) (replace 'install (install-jars "target")) (add-after 'install 'install-doc (install-javadoc "target/apidocs"))))) (native-inputs `(("java-junit" ,java-junit) ("java-commons-io" ,java-commons-io) ("java-hamcrest-all" ,java-hamcrest-all) ("java-easymock" ,java-easymock))) (home-page "http://commons.apache.org/lang/") (synopsis "Extension of the java.lang package") (description "The Commons Lang components contains a set of Java classes that provide helper methods for standard Java classes, especially those found in the @code{java.lang} package. The following classes are included: @itemize @item StringUtils - Helper for @code{java.lang.String}. @item CharSetUtils - Methods for dealing with @code{CharSets}, which are sets of characters such as @code{[a-z]} and @code{[abcdez]}. @item RandomStringUtils - Helper for creating randomised strings. @item NumberUtils - Helper for @code{java.lang.Number} and its subclasses. @item NumberRange - A range of numbers with an upper and lower bound. @item ObjectUtils - Helper for @code{java.lang.Object}. @item SerializationUtils - Helper for serializing objects. @item SystemUtils - Utility class defining the Java system properties. @item NestedException package - A sub-package for the creation of nested exceptions. @item Enum package - A sub-package for the creation of enumerated types. @item Builder package - A sub-package for the creation of @code{equals}, @code{hashCode}, @code{compareTo} and @code{toString} methods. @end itemize\n") (license license:asl2.0))) (define-public java-commons-bsf (package (name "java-commons-bsf") (version "2.4.0") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/bsf/source/bsf-src-" version ".tar.gz")) (sha256 (base32 "1sbamr8jl32p1jgf59nw0b2w9qivyg145954hm6ly54cfgsqrdas")) (modules '((guix build utils))) (snippet '(begin (for-each delete-file (find-files "." "\\.jar$")) #t)))) (build-system ant-build-system) (arguments `(#:build-target "jar" #:tests? #f; No test file #:modules ((guix build ant-build-system) (guix build utils) (guix build java-utils) (sxml simple)) #:phases (modify-phases %standard-phases (add-before 'build 'create-properties (lambda _ ;; This file is missing from the distribution (call-with-output-file "build-properties.xml" (lambda (port) (sxml->xml `(project (@ (basedir ".") (name "build-properties") (default "")) (property (@ (name "project.name") (value "bsf"))) (property (@ (name "source.level") (value "1.5"))) (property (@ (name "build.lib") (value "build/jar"))) (property (@ (name "src.dir") (value "src"))) (property (@ (name "tests.dir") (value "src/org/apache/bsf/test"))) (property (@ (name "build.tests") (value "build/test-classes"))) (property (@ (name "build.dest") (value "build/classes")))) port))) #t)) (replace 'install (install-jars "build"))))) (native-inputs `(("java-junit" ,java-junit))) (inputs `(("java-commons-logging-minimal" ,java-commons-logging-minimal))) (home-page "https://commons.apache.org/proper/commons-bsf") (synopsis "Bean Scripting Framework") (description "The Bean Scripting Framework (BSF) is a set of Java classes which provides scripting language support within Java applications, and access to Java objects and methods from scripting languages. BSF allows one to write JSPs in languages other than Java while providing access to the Java class library. In addition, BSF permits any Java application to be implemented in part (or dynamically extended) by a language that is embedded within it. This is achieved by providing an API that permits calling scripting language engines from within Java, as well as an object registry that exposes Java objects to these scripting language engines.") (license license:asl2.0))) (define-public java-commons-jxpath (package (name "java-commons-jxpath") (version "1.3") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/jxpath/source/" "commons-jxpath-" version "-src.tar.gz")) (sha256 (base32 "1rpgg31ayn9fwr4bfi2i1ij0npcg79ad2fv0w9hacvawsyc42cfs")))) (build-system ant-build-system) (arguments `(#:jar-name "commons-jxpath.jar" ;; tests require more dependencies, including mockrunner which depends on old software #:tests? #f #:source-dir "src/java")) (inputs `(("servlet" ,java-classpathx-servletapi) ("java-jdom" ,java-jdom) ("java-commons-beanutils" ,java-commons-beanutils))) (native-inputs `(("java-junit" ,java-junit))) (home-page "http://commons.apache.org/jxpath/") (synopsis "Simple interpreter of an expression language called XPath.") (description "The org.apache.commons.jxpath package defines a simple interpreter of an expression language called XPath. JXPath applies XPath expressions to graphs of objects of all kinds: JavaBeans, Maps, Servlet contexts, DOM etc, including mixtures thereof.") (license license:asl2.0))) (define-public java-jsr250 (package (name "java-jsr250") (version "1.3") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "javax/annotation/javax.annotation-api/" version "/javax.annotation-api-" version "-sources.jar")) (sha256 (base32 "08clh8n4n9wfglf75qsqfjs6yf79f7x6hqx38cn856pksszv50kz")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jdk ,icedtea-8 #:jar-name "jsr250.jar")) (home-page "https://jcp.org/en/jsr/detail?id=250") (synopsis "Security-related annotations") (description "This package provides annotations for security. It provides packages in the @code{javax.annotation} and @code{javax.annotation.security} namespaces.") ;; either cddl or gpl2 only, with classpath exception (license (list license:cddl1.0 license:gpl2)))) (define-public java-jsr305 (package (name "java-jsr305") (version "3.0.1") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "com/google/code/findbugs/" "jsr305/" version "/jsr305-" version "-sources.jar")) (sha256 (base32 "1rh6jin9v7jqpq3kf1swl868l8i94r636n03pzpsmgr8v0lh9j2n")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "jsr305.jar")) (home-page "http://findbugs.sourceforge.net/") (synopsis "Annotations for the static analyzer called findbugs") (description "This package provides annotations for the findbugs package. It provides packages in the @code{javax.annotations} namespace.") (license license:asl2.0))) (define-public java-guava (package (name "java-guava") ;; This is the last release of Guava that can be built with Java 7. (version "20.0") (source (origin (method url-fetch) (uri (string-append "https://github.com/google/guava/" "releases/download/v" version "/guava-" version "-sources.jar")) (sha256 (base32 "1gawrs5gi6j5hcfxdgpnfli75vb9pfi4sn09pnc8xacr669yajwr")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "guava.jar" #:phases (modify-phases %standard-phases (add-after 'unpack 'trim-sources (lambda _ (with-directory-excursion "src/com/google/common" ;; Remove annotations to avoid extra dependencies: ;; * "j2objc" annotations are used when converting Java to ;; Objective C; ;; * "errorprone" annotations catch common Java mistakes at ;; compile time; ;; * "IgnoreJRERequirement" is used for Android. (substitute* (find-files "." "\\.java$") (("import com.google.j2objc.*") "") (("import com.google.errorprone.annotation.*") "") (("import org.codehaus.mojo.animal_sniffer.*") "") (("@CanIgnoreReturnValue") "") (("@LazyInit") "") (("@WeakOuter") "") (("@RetainedWith") "") (("@Weak") "") (("@ForOverride") "") (("@J2ObjCIncompatible") "") (("@IgnoreJRERequirement") ""))) #t))))) (inputs `(("java-jsr305" ,java-jsr305))) (home-page "https://github.com/google/guava") (synopsis "Google core libraries for Java") (description "Guava is a set of core libraries that includes new collection types (such as multimap and multiset), immutable collections, a graph library, functional types, an in-memory cache, and APIs/utilities for concurrency, I/O, hashing, primitives, reflection, string processing, and much more!") (license license:asl2.0))) ;; The java-commons-logging package provides adapters to many different ;; logging frameworks. To avoid an excessive dependency graph we try to build ;; it with only a minimal set of adapters. (define-public java-commons-logging-minimal (package (name "java-commons-logging-minimal") (version "1.2") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/logging/source/" "commons-logging-" version "-src.tar.gz")) (sha256 (base32 "10bwcy5w8d7y39n0krlwhnp8ds3kj5zhmzj0zxnkw0qdlsjmsrj9")))) (build-system ant-build-system) (arguments `(#:tests? #f ; avoid dependency on logging frameworks #:jar-name "commons-logging-minimal.jar" #:phases (modify-phases %standard-phases (add-after 'unpack 'delete-adapters-and-tests (lambda _ ;; Delete all adapters except for NoOpLog, SimpleLog, and ;; LogFactoryImpl. NoOpLog is required to build; LogFactoryImpl ;; is used by applications; SimpleLog is the only actually usable ;; implementation that does not depend on another logging ;; framework. (for-each (lambda (file) (delete-file (string-append "src/main/java/org/apache/commons/logging/impl/" file))) (list "Jdk13LumberjackLogger.java" "WeakHashtable.java" "Log4JLogger.java" "ServletContextCleaner.java" "Jdk14Logger.java" "AvalonLogger.java" "LogKitLogger.java")) (delete-file-recursively "src/test") #t))))) (home-page "http://commons.apache.org/logging/") (synopsis "Common API for logging implementations") (description "The Logging package is a thin bridge between different logging implementations. A library that uses the commons-logging API can be used with any logging implementation at runtime.") (license license:asl2.0))) ;; This is the last release of the 1.x series. (define-public java-mockito-1 (package (name "java-mockito") (version "1.10.19") (source (origin (method url-fetch) (uri (string-append "http://repo1.maven.org/maven2/" "org/mockito/mockito-core/" version "/mockito-core-" version "-sources.jar")) (sha256 (base32 "0vmiwnwpf83g2q7kj1rislmja8fpvqkixjhawh7nxnygx6pq11kc")))) (build-system ant-build-system) (arguments `(#:jar-name "mockito.jar" #:tests? #f ; no tests included ;; FIXME: patch-and-repack does not support jars, so we have to apply ;; patches in build phases. #:phases (modify-phases %standard-phases ;; Mockito was developed against a different version of hamcrest, ;; which does not require matcher implementations to provide an ;; implementation of the "describeMismatch" method. We add this ;; simple definition to pass the build with our version of hamcrest. (add-after 'unpack 'fix-hamcrest-build-error (lambda _ (substitute* "src/org/mockito/internal/matchers/LocalizedMatcher.java" (("public Matcher getActualMatcher\\(\\) .*" line) (string-append " public void describeMismatch(Object item, Description description) { actualMatcher.describeMismatch(item, description); }" line))) #t)) ;; Mockito bundles cglib. We have a cglib package, so let's use ;; that instead. (add-after 'unpack 'use-system-libraries (lambda _ (with-directory-excursion "src/org/mockito/internal/creation/cglib" (substitute* '("CGLIBHacker.java" "CglibMockMaker.java" "ClassImposterizer.java" "DelegatingMockitoMethodProxy.java" "MethodInterceptorFilter.java" "MockitoNamingPolicy.java" "SerializableMockitoMethodProxy.java" "SerializableNoOp.java") (("import org.mockito.cglib") "import net.sf.cglib"))) #t))))) (inputs `(("java-junit" ,java-junit) ("java-objenesis" ,java-objenesis) ("java-cglib" ,java-cglib) ("java-hamcrest-core" ,java-hamcrest-core))) (home-page "http://mockito.org") (synopsis "Mockito is a mock library for Java") (description "Mockito is a mocking library for Java which lets you write tests with a clean and simple API. It generates mocks using reflection, and it records all mock invocations, including methods arguments.") (license license:asl2.0))) (define-public java-httpcomponents-httpcore (package (name "java-httpcomponents-httpcore") (version "4.4.6") (source (origin (method url-fetch) (uri (string-append "mirror://apache//httpcomponents/httpcore/" "source/httpcomponents-core-" version "-src.tar.gz")) (sha256 (base32 "02bwcf38y4vgwq7kj2s6q7qrmma641r5lacivm16kgxvb2j6h1vy")))) (build-system ant-build-system) (arguments `(#:jar-name "httpcomponents-httpcore.jar" #:phases (modify-phases %standard-phases (add-after 'unpack 'chdir (lambda _ (chdir "httpcore") #t))))) (inputs `(("java-commons-logging-minimal" ,java-commons-logging-minimal) ("java-commons-lang3" ,java-commons-lang3))) (native-inputs `(("java-junit" ,java-junit) ("java-mockito" ,java-mockito-1))) (home-page "https://hc.apache.org/httpcomponents-core-4.4.x/index.html") (synopsis "Low level HTTP transport components") (description "HttpCore is a set of low level HTTP transport components that can be used to build custom client and server side HTTP services with a minimal footprint. HttpCore supports two I/O models: blocking I/O model based on the classic Java I/O and non-blocking, event driven I/O model based on Java NIO. This package provides the blocking I/O model library.") (license license:asl2.0))) (define-public java-httpcomponents-httpcore-nio (package (inherit java-httpcomponents-httpcore) (name "java-httpcomponents-httpcore-nio") (arguments `(#:jar-name "httpcomponents-httpcore-nio.jar" #:phases (modify-phases %standard-phases (add-after 'unpack 'chdir (lambda _ (chdir "httpcore-nio") #t))))) (inputs `(("java-httpcomponents-httpcore" ,java-httpcomponents-httpcore) ("java-hamcrest-core" ,java-hamcrest-core) ,@(package-inputs java-httpcomponents-httpcore))) (description "HttpCore is a set of low level HTTP transport components that can be used to build custom client and server side HTTP services with a minimal footprint. HttpCore supports two I/O models: blocking I/O model based on the classic Java I/O and non-blocking, event driven I/O model based on Java NIO. This package provides the non-blocking I/O model library based on Java NIO."))) (define-public java-httpcomponents-httpcore-ab (package (inherit java-httpcomponents-httpcore) (name "java-httpcomponents-httpcore-ab") (arguments `(#:jar-name "httpcomponents-httpcore-ab.jar" #:phases (modify-phases %standard-phases (add-after 'unpack 'chdir (lambda _ (chdir "httpcore-ab") #t))))) (inputs `(("java-httpcomponents-httpcore" ,java-httpcomponents-httpcore) ("java-commons-cli" ,java-commons-cli) ("java-hamcrest-core" ,java-hamcrest-core) ,@(package-inputs java-httpcomponents-httpcore))) (synopsis "Apache HttpCore benchmarking tool") (description "This package provides the HttpCore benchmarking tool. It is an Apache AB clone based on HttpCore."))) (define-public java-httpcomponents-httpclient (package (name "java-httpcomponents-httpclient") (version "4.5.3") (source (origin (method url-fetch) (uri (string-append "mirror://apache/httpcomponents/httpclient/" "source/httpcomponents-client-" version "-src.tar.gz")) (sha256 (base32 "1428399s7qy3cim5wc6f3ks4gl9nf9vkjpfmnlap3jflif7g2pj1")))) (build-system ant-build-system) (arguments `(#:jar-name "httpcomponents-httpclient.jar" #:phases (modify-phases %standard-phases (add-after 'unpack 'chdir (lambda _ (chdir "httpclient") #t))))) (inputs `(("java-commons-logging-minimal" ,java-commons-logging-minimal) ("java-commons-codec" ,java-commons-codec) ("java-hamcrest-core" ,java-hamcrest-core) ("java-httpcomponents-httpcore" ,java-httpcomponents-httpcore) ("java-mockito" ,java-mockito-1) ("java-junit" ,java-junit))) (home-page "https://hc.apache.org/httpcomponents-client-ga/") (synopsis "HTTP client library for Java") (description "Although the @code{java.net} package provides basic functionality for accessing resources via HTTP, it doesn't provide the full flexibility or functionality needed by many applications. @code{HttpClient} seeks to fill this void by providing an efficient, up-to-date, and feature-rich package implementing the client side of the most recent HTTP standards and recommendations.") (license license:asl2.0))) (define-public java-httpcomponents-httpmime (package (inherit java-httpcomponents-httpclient) (name "java-httpcomponents-httpmime") (arguments `(#:jar-name "httpcomponents-httpmime.jar" #:phases (modify-phases %standard-phases (add-after 'unpack 'chdir (lambda _ (chdir "httpmime") #t))))) (inputs `(("java-httpcomponents-httpclient" ,java-httpcomponents-httpclient) ("java-httpcomponents-httpcore" ,java-httpcomponents-httpcore) ("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core))))) (define-public java-commons-net (package (name "java-commons-net") (version "3.6") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/net/source/" "commons-net-" version "-src.tar.gz")) (sha256 (base32 "0n0cmnddk9qdqhjvka8pc6hd9mn2qi3166f1s6xk32h7rfy1adxr")))) (build-system ant-build-system) (arguments `(;; FIXME: MainTest.java tries to read "examples.properties" (which ;; should be "resources/examples/examples.properties"), but gets "null" ;; instead. #:tests? #f #:jar-name "commons-net.jar")) (native-inputs `(("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core))) (home-page "http://commons.apache.org/net/") (synopsis "Client library for many basic Internet protocols") (description "The Apache Commons Net library implements the client side of many basic Internet protocols. The purpose of the library is to provide fundamental protocol access, not higher-level abstractions.") (license license:asl2.0))) (define-public java-jsch (package (name "java-jsch") (version "0.1.54") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/jsch/jsch/" version "/jsch-" version ".zip")) (sha256 (base32 "029rdddyq1mh3ghryh3ki99kba1xkf1d1swjv2vi6lk6zzjy2wdb")))) (build-system ant-build-system) (arguments `(#:build-target "dist" #:tests? #f ; no tests included #:phases (modify-phases %standard-phases (replace 'install (install-jars "dist"))))) (native-inputs `(("unzip" ,unzip))) (home-page "http://www.jcraft.com/jsch/") (synopsis "Pure Java implementation of SSH2") (description "JSch is a pure Java implementation of SSH2. JSch allows you to connect to an SSH server and use port forwarding, X11 forwarding, file transfer, etc., and you can integrate its functionality into your own Java programs.") (license license:bsd-3))) (define-public java-commons-compress (package (name "java-commons-compress") (version "1.13") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/compress/source/" "commons-compress-" version "-src.tar.gz")) (sha256 (base32 "1vjqvavrn0babffn1kciz6v52ibwq2vwhzlb95hazis3lgllnxc8")))) (build-system ant-build-system) (arguments `(#:jar-name "commons-compress.jar" #:phases (modify-phases %standard-phases (add-after 'unpack 'delete-bad-tests (lambda _ (with-directory-excursion "src/test/java/org/apache/commons/compress/" ;; FIXME: These tests really should not fail. Maybe they are ;; indicative of problems with our Java packaging work. ;; This test fails with a null pointer exception. (delete-file "archivers/sevenz/SevenZOutputFileTest.java") ;; This test fails to open test resources. (delete-file "archivers/zip/ExplodeSupportTest.java") ;; FIXME: This test adds a dependency on powermock, which is hard to ;; package at this point. ;; https://github.com/powermock/powermock (delete-file "archivers/sevenz/SevenZNativeHeapTest.java")) #t))))) (inputs `(("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core) ("java-mockito" ,java-mockito-1) ("java-xz" ,java-xz))) (home-page "https://commons.apache.org/proper/commons-compress/") (synopsis "Java library for working with compressed files") (description "The Apache Commons Compress library defines an API for working with compressed files such as ar, cpio, Unix dump, tar, zip, gzip, XZ, Pack200, bzip2, 7z, arj, lzma, snappy, DEFLATE, lz4 and Z files.") (license license:asl2.0))) (define-public java-commons-csv (package (name "java-commons-csv") (version "1.4") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/csv/source/" "commons-csv-" version "-src.tar.gz")) (sha256 (base32 "1l89m0fm2s3xx3v3iynvangymfg2vlyngaj6fgsi457nmsw7m7ij")))) (build-system ant-build-system) (arguments `(#:jar-name "commons-csv.jar" #:source-dir "src/main/java" #:tests? #f)); FIXME: requires java-h2 (inputs `(("java-hamcrest-core" ,java-hamcrest-core) ("java-commons-io" ,java-commons-io) ("java-commons-lang3" ,java-commons-lang3) ("junit" ,java-junit))) (home-page "https://commons.apache.org/proper/commons-csv/") (synopsis "Read and write CSV documents") (description "Commons CSV reads and writes files in variations of the Comma Separated Value (CSV) format. The most common CSV formats are predefined in the CSVFormat class: @itemize @item Microsoft Excel @item Informix UNLOAD @item Informix UNLOAD CSV @item MySQL @item RFC 4180 @item TDF @end itemize Custom formats can be created using a fluent style API.") (license license:asl2.0))) (define-public java-osgi-annotation (package (name "java-osgi-annotation") (version "6.0.0") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/osgi/org.osgi.annotation/" version "/" "org.osgi.annotation-" version "-sources.jar")) (sha256 (base32 "1q718mb7gqg726rh6pc2hcisn8v50nv35abbir0jypmffhiii85w")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests #:jar-name "osgi-annotation.jar")) (home-page "https://www.osgi.org") (synopsis "Annotation module of OSGi framework") (description "OSGi, for Open Services Gateway initiative framework, is a module system and service platform for the Java programming language. This package contains the OSGi annotation module, providing additional services to help dynamic components.") (license license:asl2.0))) (define-public java-osgi-core (package (name "java-osgi-core") (version "6.0.0") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/osgi/org.osgi.core/" version "/" "org.osgi.core-" version "-sources.jar")) (sha256 (base32 "19bpf5jx32jq9789gyhin35q5v7flmw0p9mk7wbgqpxqfmxyiabv")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests #:jar-name "osgi-core.jar")) (inputs `(("java-osgi-annotation" ,java-osgi-annotation))) (home-page "https://www.osgi.org") (synopsis "Core module of OSGi framework") (description "OSGi, for Open Services Gateway initiative framework, is a module system and service platform for the Java programming language. This package contains the OSGi Core module.") (license license:asl2.0))) (define-public java-osgi-service-event (package (name "java-osgi-service-event") (version "1.3.1") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/osgi/org.osgi.service.event/" version "/org.osgi.service.event-" version "-sources.jar")) (sha256 (base32 "1nyhlgagwym75bycnjczwbnpymv2iw84zbhvvzk84g9q736i6qxm")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests #:jar-name "osgi-service-event.jar")) (inputs `(("java-osgi-annotation" ,java-osgi-annotation) ("java-osgi-core" ,java-osgi-core))) (home-page "https://www.osgi.org") (synopsis "OSGi service event module") (description "OSGi, for Open Services Gateway initiative framework, is a module system and service platform for the Java programming language. This package contains the OSGi @code{org.osgi.service.event} module.") (license license:asl2.0))) (define-public java-eclipse-osgi (package (name "java-eclipse-osgi") (version "3.11.3") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.osgi/" version "/org.eclipse.osgi-" version "-sources.jar")) (sha256 (base32 "00cqc6lb29n0zv68b4l842vzkwawvbr7gshfdygsk8sicvcq2c7b")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-equinox-osgi.jar")) (inputs `(("java-osgi-annotation" ,java-osgi-annotation))) (home-page "http://www.eclipse.org/equinox/") (synopsis "Eclipse Equinox OSGi framework") (description "This package provides an implementation of the OSGi Core specification.") (license license:epl1.0))) (define-public java-eclipse-equinox-common (package (name "java-eclipse-equinox-common") (version "3.8.0") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.equinox.common/" version "/org.eclipse.equinox.common-" version "-sources.jar")) (sha256 (base32 "12aazpkgw46r1qj0pr421jzwhbmsizd97r37krd7njnbrdgfzksc")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-equinox-common.jar")) (inputs `(("java-eclipse-osgi" ,java-eclipse-osgi))) (home-page "http://www.eclipse.org/equinox/") (synopsis "Common Eclipse runtime") (description "This package provides the common Eclipse runtime.") (license license:epl1.0))) (define-public java-eclipse-core-jobs (package (name "java-eclipse-core-jobs") (version "3.8.0") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.core.jobs/" version "/org.eclipse.core.jobs-" version "-sources.jar")) (sha256 (base32 "0395b8lh0km8vhzjnchvs1rii1qz48hyvb2wqfaq4yhklbwihq4b")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-core-jobs.jar")) (inputs `(("java-eclipse-equinox-common" ,java-eclipse-equinox-common) ("java-eclipse-osgi" ,java-eclipse-osgi))) (home-page "http://www.eclipse.org/equinox/") (synopsis "Eclipse jobs mechanism") (description "This package provides the Eclipse jobs mechanism.") (license license:epl1.0))) (define-public java-eclipse-equinox-registry (package (name "java-eclipse-equinox-registry") (version "3.6.100") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.equinox.registry/" version "/org.eclipse.equinox.registry-" version "-sources.jar")) (sha256 (base32 "1i9sgymh2fy5vdgk5y7s3qvrlbgh4l93ddqi3v4zmca7hwrlhf9k")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-equinox-registry.jar")) (inputs `(("java-eclipse-core-jobs" ,java-eclipse-core-jobs) ("java-eclipse-equinox-common" ,java-eclipse-equinox-common) ("java-eclipse-osgi" ,java-eclipse-osgi))) (home-page "http://www.eclipse.org/equinox/") (synopsis "Eclipse extension registry support") (description "This package provides support for the Eclipse extension registry.") (license license:epl1.0))) (define-public java-eclipse-equinox-app (package (name "java-eclipse-equinox-app") (version "1.3.400") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.equinox.app/" version "/org.eclipse.equinox.app-" version "-sources.jar")) (sha256 (base32 "0nhvbp93y203ar7y59gb0mz3w2d3jlqhr0c9hii9bcfpmr7imdab")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-equinox-app.jar")) (inputs `(("java-eclipse-equinox-common" ,java-eclipse-equinox-common) ("java-eclipse-equinox-registry" ,java-eclipse-equinox-registry) ("java-eclipse-osgi" ,java-eclipse-osgi) ("java-osgi-service-event" ,java-osgi-service-event))) (home-page "http://www.eclipse.org/equinox/") (synopsis "Equinox application container") (description "This package provides the Equinox application container for Eclipse.") (license license:epl1.0))) (define-public java-eclipse-equinox-preferences (package (name "java-eclipse-equinox-preferences") (version "3.6.1") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.equinox.preferences/" version "/org.eclipse.equinox.preferences-" version "-sources.jar")) (sha256 (base32 "0k7w6c141sqym4fy3af0qkwpy4pdh2vsjpjba6rp5fxyqa24v0a2")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-equinox-preferences.jar")) (inputs `(("java-eclipse-equinox-common" ,java-eclipse-equinox-common) ("java-eclipse-equinox-registry" ,java-eclipse-equinox-registry) ("java-eclipse-osgi" ,java-eclipse-osgi))) (home-page "http://www.eclipse.org/equinox/") (synopsis "Eclipse preferences mechanism") (description "This package provides the Eclipse preferences mechanism with the module @code{org.eclipse.equinox.preferences}.") (license license:epl1.0))) (define-public java-eclipse-core-contenttype (package (name "java-eclipse-core-contenttype") (version "3.5.100") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.core.contenttype/" version "/org.eclipse.core.contenttype-" version "-sources.jar")) (sha256 (base32 "1wcqcv7ijwv5rh748vz3x9pkmjl9w1r0k0026k56n8yjl4rrmspi")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-core-contenttype.jar")) (inputs `(("java-eclipse-equinox-common" ,java-eclipse-equinox-common) ("java-eclipse-equinox-preferences" ,java-eclipse-equinox-preferences) ("java-eclipse-equinox-registry" ,java-eclipse-equinox-registry) ("java-eclipse-osgi" ,java-eclipse-osgi))) (home-page "http://www.eclipse.org/") (synopsis "Eclipse content mechanism") (description "This package provides the Eclipse content mechanism in the @code{org.eclipse.core.contenttype} module.") (license license:epl1.0))) (define-public java-eclipse-core-runtime (package (name "java-eclipse-core-runtime") (version "3.12.0") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.core.runtime/" version "/org.eclipse.core.runtime-" version "-sources.jar")) (sha256 (base32 "16mkf8jgj35pgzms7w1gyfq0gfm4ixw6c5xbbxzdj1la56c758ya")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-core-runtime.jar")) (inputs `(("java-eclipse-core-contenttype" ,java-eclipse-core-contenttype) ("java-eclipse-core-jobs" ,java-eclipse-core-jobs) ("java-eclipse-equinox-app" ,java-eclipse-equinox-app) ("java-eclipse-equinox-common" ,java-eclipse-equinox-common) ("java-eclipse-equinox-registry" ,java-eclipse-equinox-registry) ("java-eclipse-equinox-preferences" ,java-eclipse-equinox-preferences) ("java-eclipse-osgi" ,java-eclipse-osgi))) (home-page "https://www.eclipse.org/") (synopsis "Eclipse core runtime") (description "This package provides the Eclipse core runtime with the module @code{org.eclipse.core.runtime}.") (license license:epl1.0))) (define-public java-eclipse-core-filesystem (package (name "java-eclipse-core-filesystem") (version "1.6.1") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.core.filesystem/" version "/org.eclipse.core.filesystem-" version "-sources.jar")) (sha256 (base32 "0km1bhwjim4rfy3pkvjhvy31kgsyf2ncx0mlkmbf5n6g57pphdyj")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-core-filesystem.jar")) (inputs `(("java-eclipse-equinox-common" ,java-eclipse-equinox-common) ("java-eclipse-equinox-registry" ,java-eclipse-equinox-registry) ("java-eclipse-osgi" ,java-eclipse-osgi))) (home-page "https://www.eclipse.org/") (synopsis "Eclipse core file system") (description "This package provides the Eclipse core file system with the module @code{org.eclipse.core.filesystem}.") (license license:epl1.0))) (define-public java-eclipse-core-expressions (package (name "java-eclipse-core-expressions") (version "3.5.100") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.core.expressions/" version "/org.eclipse.core.expressions-" version "-sources.jar")) (sha256 (base32 "18bw2l875gmygvpagpgk9l24qzbdjia4ag12nw6fi8v8yaq4987f")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-core-expressions.jar")) (inputs `(("java-eclipse-equinox-common" ,java-eclipse-equinox-common) ("java-eclipse-equinox-registry" ,java-eclipse-equinox-registry) ("java-eclipse-equinox-preferences" ,java-eclipse-equinox-preferences) ("java-eclipse-core-runtime" ,java-eclipse-core-runtime) ("java-eclipse-osgi" ,java-eclipse-osgi))) (home-page "https://www.eclipse.org/") (synopsis "Eclipse core expression language") (description "This package provides the Eclipse core expression language with the @code{org.eclipse.core.expressions} module.") (license license:epl1.0))) (define-public java-eclipse-core-variables (package (name "java-eclipse-core-variables") (version "3.3.0") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.core.variables/" version "/org.eclipse.core.variables-" version "-sources.jar")) (sha256 (base32 "12dirh03zi4n5x5cj07vzrhkmnqy6h9q10h9j605pagmpmifyxmy")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-core-variables.jar")) (inputs `(("java-eclipse-equinox-common" ,java-eclipse-equinox-common) ("java-eclipse-equinox-registry" ,java-eclipse-equinox-registry) ("java-eclipse-equinox-preferences" ,java-eclipse-equinox-preferences) ("java-eclipse-core-runtime" ,java-eclipse-core-runtime) ("java-eclipse-osgi" ,java-eclipse-osgi))) (home-page "https://www.eclipse.org/platform") (synopsis "Eclipse core variables") (description "This package provides the Eclipse core variables module @code{org.eclipse.core.variables}.") (license license:epl1.0))) (define-public java-eclipse-ant-core (package (name "java-eclipse-ant-core") (version "3.4.100") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.ant.core/" version "/org.eclipse.ant.core-" version "-sources.jar")) (sha256 (base32 "11g3if794qjlk98mz9zch22rr56sd7z63vn4i7k2icr8cq5bfqg7")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-ant-core.jar")) (inputs `(("java-eclipse-equinox-app" ,java-eclipse-equinox-app) ("java-eclipse-equinox-common" ,java-eclipse-equinox-common) ("java-eclipse-equinox-registry" ,java-eclipse-equinox-registry) ("java-eclipse-equinox-preferences" ,java-eclipse-equinox-preferences) ("java-eclipse-core-contenttype" ,java-eclipse-core-contenttype) ("java-eclipse-core-runtime" ,java-eclipse-core-runtime) ("java-eclipse-core-variables" ,java-eclipse-core-variables) ("java-eclipse-osgi" ,java-eclipse-osgi))) (home-page "https://www.eclipse.org/platform") (synopsis "Ant build tool core libraries") (description "This package provides the ant build tool core libraries with the module @code{org.eclipse.ant.core}.") (license license:epl1.0))) (define-public java-eclipse-core-resources (package (name "java-eclipse-core-resources") (version "3.11.1") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.core.resources/" version "/org.eclipse.core.resources-" version "-sources.jar")) (sha256 (base32 "1hrfxrll6cpcagfksk2na1ypvkcnsp0fk6n3vcsrn97qayf9mx9l")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-core-resources.jar")) (inputs `(("java-eclipse-equinox-common" ,java-eclipse-equinox-common) ("java-eclipse-equinox-preferences" ,java-eclipse-equinox-preferences) ("java-eclipse-equinox-registry" ,java-eclipse-equinox-registry) ("java-eclipse-core-contenttype" ,java-eclipse-core-contenttype) ("java-eclipse-core-expressions" ,java-eclipse-core-expressions) ("java-eclipse-core-filesystem" ,java-eclipse-core-filesystem) ("java-eclipse-core-jobs" ,java-eclipse-core-jobs) ("java-eclipse-core-runtime" ,java-eclipse-core-runtime) ("java-eclipse-ant-core" ,java-eclipse-ant-core) ("java-eclipse-osgi" ,java-eclipse-osgi))) (home-page "https://www.eclipse.org/") (synopsis "Eclipse core resource management") (description "This package provides the Eclipse core resource management module @code{org.eclipse.core.resources}.") (license license:epl1.0))) (define-public java-eclipse-compare-core (package (name "java-eclipse-compare-core") (version "3.6.0") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.compare.core/" version "/org.eclipse.compare.core-" version "-sources.jar")) (sha256 (base32 "10g37r0pbiffyv2wk35c6g5lwzkdipkl0kkjp41v84dln46xm4dg")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-compare-core.jar")) (inputs `(("java-eclipse-core-runtime" ,java-eclipse-core-runtime) ("java-eclipse-equinox-common" ,java-eclipse-equinox-common) ("java-eclipse-osgi" ,java-eclipse-osgi) ("java-icu4j" ,java-icu4j))) (home-page "https://www.eclipse.org/") (synopsis "Eclipse core compare support") (description "This package provides the Eclipse core compare support module @code{org.eclipse.compare.core}.") (license license:epl1.0))) (define-public java-eclipse-team-core (package (name "java-eclipse-team-core") (version "3.8.0") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.team.core/" version "/org.eclipse.team.core-" version "-sources.jar")) (sha256 (base32 "02j2jzqgb26zx2d5ahxmvijw6j4r0la90zl5c3i65x6z19ciyam7")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-team-core.jar")) (inputs `(("java-eclipse-compare-core" ,java-eclipse-compare-core) ("java-eclipse-core-contenttype" ,java-eclipse-core-contenttype) ("java-eclipse-core-filesystem" ,java-eclipse-core-filesystem) ("java-eclipse-core-jobs" ,java-eclipse-core-jobs) ("java-eclipse-core-resources" ,java-eclipse-core-resources) ("java-eclipse-core-runtime" ,java-eclipse-core-runtime) ("java-eclipse-equinox-common" ,java-eclipse-equinox-common) ("java-eclipse-equinox-registry" ,java-eclipse-equinox-registry) ("java-eclipse-equinox-preferences" ,java-eclipse-equinox-preferences) ("java-eclipse-osgi" ,java-eclipse-osgi))) (home-page "https://www.eclipse.org/platform") (synopsis "Eclipse team support core") (description "This package provides the Eclipse team support core module @code{org.eclipse.team.core}.") (license license:epl1.0))) (define-public java-eclipse-core-commands (package (name "java-eclipse-core-commands") (version "3.8.1") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.core.commands/" version "/org.eclipse.core.commands-" version "-sources.jar")) (sha256 (base32 "0yjn482qndcfrsq3jd6vnhcylp16420f5aqkrwr8spsprjigjcr9")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-core-commands.jar")) (inputs `(("java-eclipse-equinox-common" ,java-eclipse-equinox-common))) (home-page "https://www.eclipse.org/platform") (synopsis "Eclipse core commands") (description "This package provides Eclipse core commands in the module @code{org.eclipse.core.commands}.") (license license:epl1.0))) (define-public java-eclipse-text (package (name "java-eclipse-text") (version "3.6.0") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/platform/org.eclipse.text/" version "/org.eclipse.text-" version "-sources.jar")) (sha256 (base32 "0scz70vzz5qs5caji9f5q01vkqnvip7dpri1q07l8wbbdcxn4cq1")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-text.jar" #:phases (modify-phases %standard-phases ;; When creating a new category we must make sure that the new list ;; matches List. By default it seems to be too generic ;; (ArrayList), so we specialize it to ArrayList. ;; Without this we get this error: ;; ;; [javac] .../src/org/eclipse/jface/text/AbstractDocument.java:376: ;; error: method put in interface Map cannot be applied to given types; ;; [javac] fPositions.put(category, new ArrayList<>()); ;; [javac] ^ ;; [javac] required: String,List ;; [javac] found: String,ArrayList ;; [javac] reason: actual argument ArrayList cannot be converted ;; to List by method invocation conversion ;; [javac] where K,V are type-variables: ;; [javac] K extends Object declared in interface Map ;; [javac] V extends Object declared in interface Map ;; ;; I don't know if this is a good fix. I suspect it is not, but it ;; seems to work. (add-after 'unpack 'fix-compilation-error (lambda _ (substitute* "src/org/eclipse/jface/text/AbstractDocument.java" (("Positions.put\\(category, new ArrayList<>\\(\\)\\);") "Positions.put(category, new ArrayList());")) #t))))) (inputs `(("java-eclipse-equinox-common" ,java-eclipse-equinox-common) ("java-eclipse-core-commands" ,java-eclipse-core-commands) ("java-icu4j" ,java-icu4j))) (home-page "http://www.eclipse.org/platform") (synopsis "Eclipse text library") (description "Platform Text is part of the Platform UI project and provides the basic building blocks for text and text editors within Eclipse and contributes the Eclipse default text editor.") (license license:epl1.0))) (define-public java-eclipse-jdt-core (package (name "java-eclipse-jdt-core") (version "3.12.3") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "org/eclipse/jdt/org.eclipse.jdt.core/" version "/org.eclipse.jdt.core-" version "-sources.jar")) (sha256 (base32 "191xw4lc7mjjkprh4ji5vnpjvr5r4zvbpwkriy4bvsjqrz35vh1j")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests included #:jar-name "eclipse-jdt-core.jar")) (inputs `(("java-eclipse-core-contenttype" ,java-eclipse-core-contenttype) ("java-eclipse-core-filesystem" ,java-eclipse-core-filesystem) ("java-eclipse-core-jobs" ,java-eclipse-core-jobs) ("java-eclipse-core-resources" ,java-eclipse-core-resources) ("java-eclipse-core-runtime" ,java-eclipse-core-runtime) ("java-eclipse-equinox-app" ,java-eclipse-equinox-app) ("java-eclipse-equinox-common" ,java-eclipse-equinox-common) ("java-eclipse-equinox-preferences" ,java-eclipse-equinox-preferences) ("java-eclipse-equinox-registry" ,java-eclipse-equinox-registry) ("java-eclipse-osgi" ,java-eclipse-osgi) ("java-eclipse-text" ,java-eclipse-text))) (home-page "https://www.eclipse.org/jdt") (synopsis "Java development tools core libraries") (description "This package provides the core libraries of the Eclipse Java development tools.") (license license:epl1.0))) (define-public java-javax-mail (package (name "java-javax-mail") (version "1.5.6") (source (origin (method url-fetch) (uri (string-append "https://repo1.maven.org/maven2/" "com/sun/mail/javax.mail/" version "/javax.mail-" version "-sources.jar")) (sha256 (base32 "0sdlfgsc2b5s89xv1261y8i0jijcja019k2x1c8ngfn582w4jly9")))) (build-system ant-build-system) (arguments `(#:tests? #f ; no tests #:jar-name "javax-mail.jar")) (home-page "https://javamail.java.net") (synopsis "Reference implementation of the JavaMail API") (description "This package provides versions of the JavaMail API implementation, IMAP, SMTP, and POP3 service providers, some examples, and documentation for the JavaMail API.") ;; GPLv2 only with "classpath exception". (license license:gpl2))) (define-public java-log4j-api (package (name "java-log4j-api") (version "2.4.1") (source (origin (method url-fetch) (uri (string-append "mirror://apache/logging/log4j/" version "/apache-log4j-" version "-src.tar.gz")) (sha256 (base32 "0j5p9gik0jysh37nlrckqbky12isy95cpwg2gv5fas1rcdqbraxd")))) (build-system ant-build-system) (arguments `(#:tests? #f ; tests require unpackaged software #:jar-name "log4j-api.jar" #:make-flags (list (string-append "-Ddist.dir=" (assoc-ref %outputs "out") "/share/java")) #:phases (modify-phases %standard-phases (add-after 'unpack 'enter-dir (lambda _ (chdir "log4j-api") #t)) ;; FIXME: The tests require additional software that has not been ;; packaged yet, such as ;; * org.apache.maven ;; * org.apache.felix (add-after 'enter-dir 'delete-tests (lambda _ (delete-file-recursively "src/test") #t))))) (inputs `(("java-osgi-core" ,java-osgi-core) ("java-hamcrest-core" ,java-hamcrest-core) ("java-junit" ,java-junit))) (home-page "http://logging.apache.org/log4j/2.x/") (synopsis "API module of the Log4j logging framework for Java") (description "This package provides the API module of the Log4j logging framework for Java.") (license license:asl2.0))) (define-public java-log4j-core (package (inherit java-log4j-api) (name "java-log4j-core") (inputs `(("java-osgi-core" ,java-osgi-core) ("java-hamcrest-core" ,java-hamcrest-core) ("java-log4j-api" ,java-log4j-api) ("java-mail" ,java-mail) ("java-jboss-jms-api-spec" ,java-jboss-jms-api-spec) ("java-lmax-disruptor" ,java-lmax-disruptor) ("java-kafka" ,java-kafka-clients) ("java-datanucleus-javax-persistence" ,java-datanucleus-javax-persistence) ("java-fasterxml-jackson-annotations" ,java-fasterxml-jackson-annotations) ("java-fasterxml-jackson-core" ,java-fasterxml-jackson-core) ("java-fasterxml-jackson-databind" ,java-fasterxml-jackson-databind) ("java-fasterxml-jackson-dataformat-xml" ,java-fasterxml-jackson-dataformat-xml) ("java-fasterxml-jackson-dataformat-yaml" ,java-fasterxml-jackson-dataformat-yaml) ("java-commons-compress" ,java-commons-compress) ("java-commons-csv" ,java-commons-csv) ("java-jeromq" ,java-jeromq) ("java-junit" ,java-junit))) (native-inputs `(("hamcrest" ,java-hamcrest-all) ("java-commons-io" ,java-commons-io) ("java-commons-lang3" ,java-commons-lang3) ("slf4j" ,java-slf4j-api))) (arguments `(#:tests? #f ; tests require more dependencies #:test-dir "src/test" #:source-dir "src/main/java" #:jar-name "log4j-core.jar" #:jdk ,icedtea-8 #:make-flags (list (string-append "-Ddist.dir=" (assoc-ref %outputs "out") "/share/java")) #:phases (modify-phases %standard-phases (add-after 'unpack 'enter-dir (lambda _ (chdir "log4j-core") #t))))) (synopsis "Core component of the Log4j framework") (description "This package provides the core component of the Log4j logging framework for Java."))) (define-public java-log4j-1.2-api (package (inherit java-log4j-api) (name "java-log4j-1.2-api") (arguments `(#:jar-name "java-log4j-1.2-api.jar" #:source-dir "log4j-1.2-api/src/main/java" #:jdk ,icedtea-8 ;; Tests require maven-model (and other maven subprojects), which is a ;; cyclic dependency. #:tests? #f)) (inputs `(("log4j-api" ,java-log4j-api) ("log4j-core" ,java-log4j-core) ("osgi-core" ,java-osgi-core) ("eclipse-osgi" ,java-eclipse-osgi) ("java-lmax-disruptor" ,java-lmax-disruptor))))) (define-public java-commons-cli (package (name "java-commons-cli") (version "1.4") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/cli/source/" "commons-cli-" version "-src.tar.gz")) (sha256 (base32 "05hgi2z01fqz374y719gl1dxzqvzci5af071zm7vxrjg9vczipm1")))) (build-system ant-build-system) ;; TODO: javadoc (arguments `(#:jar-name "commons-cli.jar")) (native-inputs `(("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core))) (home-page "http://commons.apache.org/cli/") (synopsis "Command line arguments and options parsing library") (description "The Apache Commons CLI library provides an API for parsing command line options passed to programs. It is also able to print help messages detailing the options available for a command line tool. Commons CLI supports different types of options: @itemize @item POSIX like options (ie. tar -zxvf foo.tar.gz) @item GNU like long options (ie. du --human-readable --max-depth=1) @item Java like properties (ie. java -Djava.awt.headless=true Foo) @item Short options with value attached (ie. gcc -O2 foo.c) @item long options with single hyphen (ie. ant -projecthelp) @end itemize This is a part of the Apache Commons Project.") (license license:asl2.0))) (define-public java-commons-codec (package (name "java-commons-codec") (version "1.10") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/codec/source/" "commons-codec-" version "-src.tar.gz")) (sha256 (base32 "1w9qg30y4s0x8gnmr2fgj4lyplfn788jqxbcz27lf5kbr6n8xr65")))) (build-system ant-build-system) (outputs '("out" "doc")) (arguments `(#:test-target "test" #:make-flags (let ((hamcrest (assoc-ref %build-inputs "java-hamcrest-core")) (junit (assoc-ref %build-inputs "java-junit"))) (list (string-append "-Djunit.jar=" junit "/share/java/junit.jar") (string-append "-Dhamcrest.jar=" hamcrest "/share/java/hamcrest-core.jar") ;; Do not append version to jar. "-Dfinal.name=commons-codec")) #:phases (modify-phases %standard-phases (add-after 'build 'build-javadoc ant-build-javadoc) (replace 'install (install-jars "dist")) (add-after 'install 'install-doc (install-javadoc "dist/docs/api"))))) (native-inputs `(("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core))) (home-page "http://commons.apache.org/codec/") (synopsis "Common encoders and decoders such as Base64, Hex, Phonetic and URLs") (description "The codec package contains simple encoder and decoders for various formats such as Base64 and Hexadecimal. In addition to these widely used encoders and decoders, the codec package also maintains a collection of phonetic encoding utilities. This is a part of the Apache Commons Project.") (license license:asl2.0))) (define-public java-commons-daemon (package (name "java-commons-daemon") (version "1.0.15") (source (origin (method url-fetch) (uri (string-append "mirror://apache/commons/daemon/source/" "commons-daemon-" version "-src.tar.gz")) (sha256 (base32 "0ci46kq8jpz084ccwq0mmkahcgsmh20ziclp2jf5i0djqv95gvhi")))) (build-system ant-build-system) (arguments `(#:test-target "test" #:phases (modify-phases %standard-phases (add-after 'build 'build-javadoc ant-build-javadoc) (replace 'install (install-jars "dist")) (add-after 'install 'install-doc (install-javadoc "dist/docs/api"))))) (native-inputs `(("java-junit" ,java-junit))) (home-page "http://commons.apache.org/daemon/") (synopsis "Library to launch Java applications as daemons") (description "The Daemon package from Apache Commons can be used to implement Java applications which can be launched as daemons. For example the program will be notified about a shutdown so that it can perform cleanup tasks before its process of execution is destroyed by the operation system. This package contains the Java library. You will also need the actual binary for your architecture which is provided by the jsvc package. This is a part of the Apache Commons Project.") (license license:asl2.0))) (define-public java-javaewah (package (name "java-javaewah") (version "1.1.6") (source (origin (method url-fetch) (uri (string-append "https://github.com/lemire/javaewah/" "archive/JavaEWAH-" version ".tar.gz")) (sha256 (base32 "1n7j1r1h24wlhwv9zdcj6yqjrhma2ixwyzm15l5vrv6yqjs6753b")))) (build-system ant-build-system) (arguments `(#:jar-name "javaewah.jar")) (inputs `(("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core))) (home-page "https://github.com/lemire/javaewah") (synopsis "Compressed alternative to the Java @code{BitSet} class") (description "This is a word-aligned compressed variant of the Java @code{Bitset} class. It provides both a 64-bit and a 32-bit RLE-like compression scheme. It can be used to implement bitmap indexes. The goal of word-aligned compression is not to achieve the best compression, but rather to improve query processing time. Hence, JavaEWAH tries to save CPU cycles, maybe at the expense of storage. However, the EWAH scheme is always more efficient storage-wise than an uncompressed bitmap (as implemented in the @code{BitSet} class by Sun).") ;; GPL2.0 derivates are explicitly allowed. (license license:asl2.0))) (define-public java-slf4j-api (package (name "java-slf4j-api") (version "1.7.25") (source (origin (method url-fetch) (uri (string-append "https://www.slf4j.org/dist/slf4j-" version ".tar.gz")) (sha256 (base32 "13j51sgzmhhdrfa74gkal5zpip7r1440dh7zsi2c8bpb2zs1v8kb")) (modules '((guix build utils))) ;; Delete bundled jars. (snippet '(begin (for-each delete-file (find-files "." "\\.jar$")) #t)))) (build-system ant-build-system) (arguments `(#:jar-name "slf4j-api.jar" #:source-dir "slf4j-api/src/main" #:test-dir "slf4j-api/src/test" #:phases (modify-phases %standard-phases (add-after 'build 'regenerate-jar (lambda _ ;; pom.xml ignores these files in the jar creation process. If we don't, ;; we get the error "This code should have never made it into slf4j-api.jar" (delete-file-recursively "build/classes/org/slf4j/impl") (invoke "jar" "-cf" "build/jar/slf4j-api.jar" "-C" "build/classes" "."))) (add-before 'check 'dont-test-abstract-classes (lambda _ ;; abstract classes are not meant to be run with junit (substitute* "build.xml" (("") (string-append "" ""))) #t))))) (inputs `(("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core))) (home-page "https://www.slf4j.org/") (synopsis "Simple logging facade for Java") (description "The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks (e.g. @code{java.util.logging}, @code{logback}, @code{log4j}) allowing the end user to plug in the desired logging framework at deployment time.") (license license:expat))) (define java-slf4j-api-bootstrap (package (inherit java-slf4j-api) (name "java-slf4j-api-bootstrap") (inputs `()) (arguments (substitute-keyword-arguments (package-arguments java-slf4j-api) ((#:tests? _ #f) #f))))) (define-public java-slf4j-simple (package (name "java-slf4j-simple") (version "1.7.25") (source (package-source java-slf4j-api)) (build-system ant-build-system) (arguments `(#:jar-name "slf4j-simple.jar" #:source-dir "slf4j-simple/src/main" #:test-dir "slf4j-simple/src/test" #:phases (modify-phases %standard-phases ;; The tests need some test classes from slf4j-api (add-before 'check 'build-slf4j-api-test-helpers (lambda _ ;; Add current dir to CLASSPATH ... (setenv "CLASSPATH" (string-append (getcwd) ":" (getenv "CLASSPATH"))) ;; ... and build test helper classes here: (apply invoke `("javac" "-d" "." ,@(find-files "slf4j-api/src/test" ".*\\.java")))))))) (inputs `(("java-junit" ,java-junit) ("java-hamcrest-core" ,java-hamcrest-core) ("java-slf4j-api" ,java-slf4j-api))) (home-page "https://www.slf4j.org/") (synopsis "Simple implementation of simple logging facade for Java") (description "SLF4J binding for the Simple implementation, which outputs all events to System.err. Only messages of level INFO and higher are printed.") (license license:expat))) (define-public antlr2 (package (name "antlr2") (version "2.7.7") (source (origin (method url-fetch) (uri (string-append "http://www.antlr2.org/download/antlr-" version ".tar.gz")) (sha256 (base32 "1ffvcwdw73id0dk6pj2mlxjvbg0662qacx4ylayqcxgg381fnfl5")) (modules '((guix build utils))) (snippet '(begin (delete-file "antlr.jar") (substitute* "lib/cpp/antlr/CharScanner.hpp" (("#include ") (string-append "#include \n" "#define EOF (-1)\n" "#include "))) (substitute* "configure" (("/bin/sh") "sh")) #t)))) (build-system gnu-build-system) (arguments `(#:tests? #f ; no test target #:imported-modules ((guix build ant-build-system) (guix build syscalls) ,@%gnu-build-system-modules) #:modules (((guix build ant-build-system) #:prefix ant:) (guix build gnu-build-system) (guix build utils)) #:phases (modify-phases %standard-phases (add-after 'install 'strip-jar-timestamps (assoc-ref ant:%standard-phases 'strip-jar-timestamps)) (add-before 'configure 'fix-timestamp (lambda _ (substitute* "configure" (("^TIMESTAMP.*") "TIMESTAMP=19700101\n")) #t)) (add-after 'configure 'fix-bin-ls (lambda _ (substitute* (find-files "." "Makefile") (("/bin/ls") "ls")) #t))))) (native-inputs `(("which" ,which) ("zip" ,zip) ("java" ,icedtea "jdk"))) (inputs `(("java" ,icedtea))) (home-page "http://www.antlr2.org") (synopsis "Framework for constructing recognizers, compilers, and translators") (description "ANTLR, ANother Tool for Language Recognition, (formerly PCCTS) is a language tool that provides a framework for constructing recognizers, compilers, and translators from grammatical descriptions containing Java, C#, C++, or Python actions. ANTLR provides excellent support for tree construction, tree walking, and translation.") (license license:public-domain))) (define-public java-stringtemplate-3 (package (name "java-stringtemplate") (version "3.2.1") (source (origin (method url-fetch) (uri (string-append "https://github.com/antlr/website-st4/raw/" "gh-pages/download/stringtemplate-" version ".tar.gz")) (sha256 (base32 "086yj68np1vqhkj7483diz3km6s6y4gmwqswa7524a0ca6vxn2is")))) (build-system ant-build-system) (arguments `(#:jar-name (string-append ,name "-" ,version ".jar") #:test-dir "test" #:modules ((guix build ant-build-system) (guix build utils) (srfi srfi-1)) #:phases (modify-phases %standard-phases (add-before 'check 'fix-tests (lambda _ (substitute* "build.xml" (("\\$\\{test.home\\}/java") "${test.home}/org")) #t)) (add-before 'build 'generate-grammar (lambda _ (with-directory-excursion "src/org/antlr/stringtemplate/language/" (for-each (lambda (file) (format #t "~a\n" file) (invoke "antlr" file)) '("template.g" "angle.bracket.template.g" "action.g" "eval.g" "group.g" "interface.g"))) #t))))) (native-inputs `(("antlr" ,antlr2) ("java-junit" ,java-junit))) (home-page "http://www.stringtemplate.org") (synopsis "Template engine to generate formatted text output") (description "StringTemplate is a java template engine (with ports for C#, Objective-C, JavaScript, Scala) for generating source code, web pages, emails, or any other formatted text output. StringTemplate is particularly good at code generators, multiple site skins, and internationalization / localization. StringTemplate also powers ANTLR.") (license license:bsd-3))) ;; antlr3 is partially written using antlr3 grammar files. It also depends on ;; ST4 (stringtemplate4), which is also partially written using antlr3 grammar ;; files and uses antlr3 at runtime. The latest version requires a recent version ;; of antlr3 at runtime. ;; Fortunately, ST4 4.0.6 can be built with an older antlr3, and we use antlr3.3. ;; This version of ST4 is sufficient for the latest antlr3. ;; We use ST4 4.0.6 to build a boostrap antlr3 (latest version), and build ;; the latest ST4 with it. Then we build our final antlr3 that will be linked ;; against the latest ST4. ;; antlr3.3 still depends on antlr3 to generate some files, so we use an ;; even older version, antlr3.1, to generate them. Fortunately antlr3.1 uses ;; only grammar files with the antlr2 syntax. ;; So we build antlr3.1 -> antlr3.3 -> ST4.0.6 -> antlr3-bootstrap -> ST4 -> antlr3. (define-public java-stringtemplate (package (inherit java-stringtemplate-3) (name "java-stringtemplate") (version "4.0.8") (source (origin (method url-fetch) (uri (string-append "https://github.com/antlr/stringtemplate4/archive/" version ".tar.gz")) (file-name (string-append name "-" version ".tar.gz")) (sha256 (base32 "1pri8hqa95rfdkjy55icl5q1m09zwp5k67ib14abas39s4v3w087")))) (build-system ant-build-system) (arguments `(#:jar-name (string-append ,name "-" ,version ".jar") #:tests? #f ; FIXME: tests fail for unknown reasons #:test-dir "test" #:modules ((guix build ant-build-system) (guix build utils) (srfi srfi-1)) #:phases (modify-phases %standard-phases (add-before 'check 'fix-test-target (lambda _ (substitute* "build.xml" (("\\$\\{test.home\\}/java") "${test.home}/") (("\\*Test.java") "Test*.java")) #t)) (add-before 'build 'generate-grammar (lambda _ (with-directory-excursion "src/org/stringtemplate/v4/compiler/" (for-each (lambda (file) (format #t "~a\n" file) (invoke "antlr3" file)) '("STParser.g" "Group.g" "CodeGenerator.g"))) #t))))) (inputs `(("antlr3" ,antlr3-bootstrap) ("antlr2" ,antlr2) ("java-stringtemplate" ,java-stringtemplate-3) ("java-junit" ,java-junit))))) (define java-stringtemplate-4.0.6 (package (inherit java-stringtemplate) (name "java-stringtemplate") (version "4.0.6") (source (origin (method url-fetch) (uri (string-append "https://github.com/antlr/stringtemplate4/archive/ST-" version ".tar.gz")) (file-name (string-append name "-" version ".tar.gz")) (sha256 (base32 "0hjmh1ahdsh3w825i67mli9l4nncc4l6hdbf9ma91jvlj590sljp")))) (inputs `(("antlr3" ,antlr3-3.3) ("antlr2" ,antlr2) ("java-stringtemplate" ,java-stringtemplate-3))))) (define-public antlr3 (package (name "antlr3") (version "3.5.2") (source (origin (method url-fetch) (uri (string-append "https://github.com/antlr/antlr3/archive/" version ".tar.gz")) (file-name (string-append name "-" version ".tar.gz")) (sha256 (base32 "0218v683081lg54z9hvjxinhxd4dqp870jx6n39gslm0bkyi4vd6")))) (build-system ant-build-system) (arguments `(#:jar-name (string-append ,name "-" ,version ".jar") #:source-dir "tool/src/main/java:runtime/Java/src/main/java:tool/src/main/antlr3" #:tests? #f #:phases (modify-phases %standard-phases (add-after 'install 'bin-install (lambda* (#:key inputs outputs #:allow-other-keys) (let ((jar (string-append (assoc-ref outputs "out") "/share/java")) (bin (string-append (assoc-ref outputs "out") "/bin"))) (mkdir-p bin) (with-output-to-file (string-append bin "/antlr3") (lambda _ (display (string-append "#!" (which "sh") "\n" "java -cp " jar "/" ,name "-" ,version ".jar:" (string-concatenate (find-files (assoc-ref inputs "stringtemplate") ".*\\.jar")) ":" (string-concatenate (find-files (assoc-ref inputs "stringtemplate4") ".*\\.jar")) ":" (string-concatenate (find-files (string-append (assoc-ref inputs "antlr") "/lib") ".*\\.jar")) " org.antlr.Tool $*")))) (chmod (string-append bin "/antlr3") #o755)) #t)) (add-before 'build 'generate-grammar (lambda _ (chdir "tool/src/main/antlr3/org/antlr/grammar/v3/") (for-each (lambda (file) (display file) (newline) (invoke "antlr3" file)) '("ANTLR.g" "ANTLRTreePrinter.g" "ActionAnalysis.g" "AssignTokenTypesWalker.g" "ActionTranslator.g" "TreeToNFAConverter.g" "ANTLRv3.g" "ANTLRv3Tree.g" "LeftRecursiveRuleWalker.g" "CodeGenTreeWalker.g" "DefineGrammarItemsWalker.g")) (substitute* "ANTLRParser.java" (("public Object getTree") "public GrammarAST getTree")) (substitute* "ANTLRv3Parser.java" (("public Object getTree") "public CommonTree getTree")) (chdir "../../../../../java") (substitute* "org/antlr/tool/LeftRecursiveRuleAnalyzer.java" (("import org.antlr.grammar.v3.\\*;") "import org.antlr.grammar.v3.*; import org.antlr.grammar.v3.ANTLRTreePrinter;")) (substitute* "org/antlr/tool/ErrorManager.java" (("case NO_SUCH_ATTRIBUTE_PASS_THROUGH:") "")) (chdir "../../../..") #t)) (add-before 'build 'fix-build-xml (lambda _ (substitute* "build.xml" ((" ") "") (("") "")) #t)) ;; We don't have groovy (add-after 'unpack 'delete-groovy-tests (lambda _ (delete-file-recursively "src/test/java/test/dependent/issue1648/") (substitute* "src/test/resources/testng.xml" (("") "")) #t)) (add-before 'build 'copy-resources (lambda _ (copy-recursively "src/main/resources" "build/classes") #t)) (add-before 'check 'copy-test-resources (lambda _ (copy-recursively "src/test/resources" "build/test-classes") #t)) (replace 'check (lambda _ (invoke "ant" "compile-tests") ;; we don't have groovy (substitute* "src/test/resources/testng.xml" (("") "")) (invoke "java" "-cp" (string-append (getenv "CLASSPATH") ":build/classes" ":build/test-classes") "-Dtest.resources.dir=src/test/resources" "org.testng.TestNG" "src/test/resources/testng.xml")))))) (propagated-inputs `(("junit" ,java-junit) ("java-jsr305" ,java-jsr305) ("java-bsh" ,java-bsh) ("java-jcommander" ,java-jcommander) ("java-guice" ,java-guice) ("snakeyaml" ,java-snakeyaml))) (native-inputs `(("guava" ,java-guava) ("java-javax-inject" ,java-javax-inject) ("java-hamcrest" ,java-hamcrest-all) ("java-assertj" ,java-assertj) ("java-mockito" ,java-mockito-1) ("cglib" ,java-cglib) ("asm" ,java-asm) ("aopalliance" ,java-aopalliance))) (home-page "http://testng.org") (synopsis "Testing framework") (description "TestNG is a testing framework inspired from JUnit and NUnit but introducing some new functionalities that make it more powerful and easier to use.") (license license:asl2.0))) (define-public java-jnacl (let ((commit "094e819afdd63ea81a499b3bcb42a271006bebd9") (revision "2")) (package (name "java-jnacl") (version (string-append "0.1.0-" revision "." (string-take commit 7))) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/neilalexander/jnacl.git") (commit commit))) (file-name (git-file-name name version)) (sha256 (base32 "1d6g6xhn83byv5943n7935wwjsk0ibk0qdvqgr699qqgqqmwisbb")))) (build-system ant-build-system) (arguments `(#:jar-name "jnacl.jar" #:source-dir "src/main/java" #:jdk ,icedtea-8 #:phases (modify-phases %standard-phases (add-before 'build 'fix-tests (lambda _ (substitute* '("src/test/java/com/neilalexander/jnacl/NaClTest.java" "src/test/java/com/neilalexander/jnacl/NaclSecretBoxTest.java") (("assertions.Assertions") "assertions.api.Assertions")) #t)) (replace 'check (lambda _ (invoke "ant" "compile-tests") (invoke "java" "-cp" (string-append (getenv "CLASSPATH") ":build/classes" ":build/test-classes") "org.testng.TestNG" "-testclass" "build/test-classes/com/neilalexander/jnacl/NaclSecretBoxTest.class") (invoke "java" "-cp" (string-append (getenv "CLASSPATH") ":build/classes" ":build/test-classes") "org.testng.TestNG" "-testclass" "build/test-classes/com/neilalexander/jnacl/NaClTest.class")))))) (native-inputs `(("java-testng" ,java-testng) ("java-fest-util" ,java-fest-util) ("java-fest-assert" ,java-fest-assert))) (home-page "https://github.com/neilalexander/jnacl") (synopsis "Java implementation of NaCl") (description "Pure Java implementation of the NaCl: Networking and Cryptography library.") (license license:bsd-2)))) (define-public java-mvel2 (package (name "java-mvel2") (version "2.3.1") (source (origin (method url-fetch) (uri (string-append "https://github.com/mvel/mvel/archive/mvel2-" version ".Final.tar.gz")) (sha256 (base32 "01ph5s9gm16l2qz58lg21w6fna7xmmrj7f9bzqr1jim7h9557d3z")))) (build-system ant-build-system) (arguments `(#:jar-name "mvel2.jar" #:source-dir "src/main/java" #:test-exclude (list "**/Abstract*.java" ;; Base class with no tests "**/MVELThreadTest.java") #:phases (modify-phases %standard-phases (add-after 'install 'install-bin (lambda* (#:key outputs #:allow-other-keys) (let ((bin (string-append (assoc-ref outputs "out") "/bin"))) (mkdir-p bin) (with-output-to-file (string-append bin "/mvel2") (lambda _ (display (string-append "#!" (which "bash") "\n" "if [ \"$#\" -ne \"2\" ]; then\n" "echo 'Usage: mvel2