PKGBUILD 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. # Maintainer: Luke Shumaker <lukeshu@sbcglobal.net>
  2. # Maintainer (Arch): Sergej Pupykin <pupykin.s+arch@gmail.com>
  3. # Contributor (Arch): William Rea <sillywilly@gmail.com>
  4. pkgname=maven
  5. pkgver=3.3.9
  6. pkgdesc="A Java project management and project comprehension tool"
  7. url="http://maven.apache.org"
  8. license=('Apache')
  9. replaces=('maven-libre')
  10. conflicts=('maven-libre')
  11. pkgrel=1.parabola2
  12. arch=('any')
  13. options=(!emptydirs)
  14. conflicts=('maven')
  15. depends=('java-environment' 'sh')
  16. makedepends=('apache-ant' 'jh' 'imake'
  17. java-animal-sniffer
  18. java-antlr2
  19. java-asm
  20. java-asm3
  21. java-commons-codec
  22. java-commons-io
  23. java-commons-lang
  24. java-commons-logging
  25. java-hamcrest
  26. java-xml-commons-external
  27. jna
  28. junit
  29. mockito
  30. objenesis
  31. slf4j
  32. xerces2-java
  33. )
  34. backup=('etc/maven/settings.xml')
  35. _mirror=http://archive.apache.org/dist
  36. source=($_mirror/maven/maven-${pkgver%%.*}/$pkgver/source/apache-maven-$pkgver-src.tar.gz
  37. maven.sh maven.csh)
  38. _setup_env() {
  39. unset _JAVA_OPTIONS
  40. . /etc/profile.d/jre.sh
  41. export MAVEN_OPTS=-Xmx512m
  42. export M2_HOME="$pkgdir"/opt/maven
  43. export PATH="$PATH:$M2_HOME/bin"
  44. _M2_LOCALREPO=$(jh mvn-localrepo)
  45. ant_args=(
  46. -Dmaven.repo.local="$srcdir"/maven.repo.local
  47. )
  48. }
  49. prepare() {
  50. if type mvn &>/dev/null; then
  51. error "maven cannot be built while an existing version is installed"
  52. return 1
  53. fi
  54. }
  55. build() (
  56. _setup_env
  57. install -d "$srcdir"/maven.repo.local
  58. lndir "$_M2_LOCALREPO" "$srcdir"/maven.repo.local
  59. cd "$srcdir"/apache-maven-$pkgver
  60. # FIXME: downloads makedepends from the Internet. Add them to makedepends=()
  61. ant "${ant_args[@]}" maven-compile 2>&1|tee "$srcdir"/ant-log.txt
  62. < "$srcdir"/ant-log.txt \
  63. sed -nr 's/.*Download(ed|ing):\s*//p' | \
  64. sed 's/ .*//' | \
  65. sed -r -e 's|^http://repo.maven.apache.org/maven2/||' -e 's/\.(jar|pom)$//' | \
  66. sort -u > "$srcdir"/downloaded-artifacts.txt
  67. )
  68. package() (
  69. _setup_env
  70. cd "$srcdir"/apache-maven-$pkgver
  71. ant "${ant_args[@]}" extract-assembly
  72. #rm "$pkgdir"/opt/maven/*.txt
  73. # Install config file in /etc
  74. # Unlike the other directories, we symlink from the system to /opt/maven
  75. # because that way all conf files stay in /etc
  76. #install -d "$pkgdir"/etc/maven
  77. sed "55i<localRepository>$_M2_LOCALREPO</localRepository>" \
  78. < "$pkgdir"/opt/maven/conf/settings.xml
  79. # > "$pkgdir"/etc/maven/settings.xml
  80. #rm -rf "$pkgdir"/opt/maven/conf
  81. #ln -s /etc/maven "$pkgdir"/opt/maven/conf
  82. # Install profile.d settings
  83. install -d "$pkgdir"/etc/profile.d
  84. install -m 755 "$srcdir"/maven.{csh,sh} "$pkgdir"/etc/profile.d
  85. # Link executables to /usr/bin
  86. install -d "$pkgdir"/usr/bin
  87. ln -s /opt/maven/bin/{mvn,mvnDebug,mvnyjp} "$pkgdir"/usr/bin
  88. # Link jar files to appropriate place in /usr/share
  89. install -d "$pkgdir"/usr/share/java
  90. ln -s /opt/maven/lib "$pkgdir"/usr/share/java/maven
  91. # Install the local repo
  92. mkdir -p "$pkgdir"${_M2_LOCALREPO%/*}
  93. cp -a "$srcdir"/maven.repo.local "$pkgdir"$_M2_LOCALREPO
  94. # Remove extra artifacts
  95. find "$pkgdir"$_M2_LOCALREPO -type l -delete
  96. find "$pkgdir"$_M2_LOCALREPO -name _maven.repositories -delete
  97. cat "$srcdir"/downloaded-artifacts.txt | while read artifact; do
  98. rm -f "$pkgdir"$_M2_LOCALREPO/$artifact*
  99. done
  100. )
  101. md5sums=('030ce5b3d369f01aca6249b694d4ce03'
  102. '58820067a4d7384477daa134023d9b57'
  103. 'e2bbdeffed100cd51d05b2ba8ebd6321')