summaryrefslogtreecommitdiff
path: root/pcr/javamail/PKGBUILD
blob: 1ad17d3a337cfd2d9314ce08d9e7d215dff436cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

pkgname=javamail
pkgver=1.5.4
pkgrel=1
pkgdesc="JavaMail API Reference Implementation"
arch=('any')
url="https://javamail.java.net"
license=('CDDL, GPL2 with Classpath Exception')
depends=('java-runtime')
makedepends=('apache-ant' 'jh' 'tomcat8')
source=("https://java.net/downloads/${pkgname}/source/${pkgname}-${pkgver}-src.zip"
        "https://repo1.maven.org/maven2/com/sun/mail/javax.mail/${pkgver}/javax.mail-${pkgver}.pom"
        "https://repo1.maven.org/maven2/javax/mail/javax.mail-api/${pkgver}/javax.mail-api-${pkgver}.pom"
        "https://repo1.maven.org/maven2/com/sun/mail/logging-mailhandler/${pkgver}/logging-mailhandler-${pkgver}.pom")
md5sums=('b544903115ebc14702101e607f0429bd'
         'f41932d909b8511b8ad0a4c711040147'
         '313ab57304d245eeefbac89e0e213801'
         'acc5f53f9bbdac0dd91faa5127cb11b0')

build() {
  cd ${srcdir}
  ant release \
    -Djavaee.jar=/usr/share/java/tomcat8/servlet-api.jar

  cp "target/release/mail.jar" "javax.mail.jar"

  jar -cvf "javax.mail-api.jar" -C "mail/target/classes" "javax"
  jar -cvf "logging-mailhandler.jar" -C "mail/target/classes" "com/sun/mail/util/logging"
}

package() {
  cd "${srcdir}"

  # Install license file
  install -Dm644 "mail/src/main/resources/META-INF/LICENSE.txt" \
    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt"

  # Install documentation
  install -d "${pkgdir}/usr/share/doc/${pkgname}"
  cp -r "target/release/docs/javadocs" "${pkgdir}/usr/share/doc/${pkgname}"

  # Install Maven artifacts
  export DESTDIR=${pkgdir}
  for artifact in "all" "dsn" "gimap" "imap" "mailapi" "pop3" "smtp"; do
    if [[ -f "target/release/lib/${artifact}.jar" ]]; then
      # This artifact has a jar file
      jh mvn-install "com.sun.mail" ${artifact} ${pkgver} \
        "${artifact}/pom.xml" \
        "target/release/lib/${artifact}.jar" \
        "${artifact}.jar"

      # Symlink them to /usr/share/java
      ln -s "/usr/share/java/${artifact}.jar" \
        "${pkgdir}/usr/share/java/${artifact}-${pkgver}.jar"
    else
      # This artifact is just a pom
      jh mvn-install "com.sun.mail" ${artifact} ${pkgver} \
        "pom.xml"
    fi
  done

  for artifact in "javax.mail" "logging-mailhandler"; do
    jh mvn-install "com.sun.mail" ${artifact} ${pkgver} \
      "${artifact}-${pkgver}.pom" \
      "${artifact}.jar" \
      "${artifact}.jar"

    # Symlink them to /usr/share/java
    ln -s "/usr/share/java/${artifact}.jar" \
      "${pkgdir}/usr/share/java/${artifact}-${pkgver}.jar"
  done

  jh mvn-install "javax.mail" "javax.mail-api" ${pkgver} \
    "javax.mail-api-${pkgver}.pom" \
    "javax.mail-api.jar" \
    "javax.mail-api.jar"
  ln -s "/usr/share/java/javax.mail-api.jar" \
    "${pkgdir}/usr/share/java/javax.mail-api-${pkgver}.jar"
}