diff options
Diffstat (limited to 'java-ugly/maven/PKGBUILD')
-rw-r--r-- | java-ugly/maven/PKGBUILD | 91 |
1 files changed, 61 insertions, 30 deletions
diff --git a/java-ugly/maven/PKGBUILD b/java-ugly/maven/PKGBUILD index 2bd99940e..3f8e5071d 100644 --- a/java-ugly/maven/PKGBUILD +++ b/java-ugly/maven/PKGBUILD @@ -2,51 +2,72 @@ # Maintainer (Arch): Sergej Pupykin <pupykin.s+arch@gmail.com> # Contributor: William Rea <sillywilly@gmail.com> -_pkgname=maven -pkgname=maven-libre -pkgver=3.0.4 +pkgname=maven +pkgver=3.0.5 +pkgdesc="A Java project management and project comprehension tool" +url="http://maven.apache.org" +license=('Apache') -provides=("$_pkgname=$pkgver") -replaces=("$_pkgname") -conflicts=("$_pkgname") +replaces=('maven-libre') +conflicts=('maven-libre') pkgrel=1 -pkgdesc="A Java project management and project comprehension tool" arch=('any') -url="http://maven.apache.org" -license=('Apache') -depends=('java-environment') -makedepends=('apache-ant') +options=(!emptydirs) +conflicts=('maven') +depends=('java-environment' 'sh') +makedepends=('apache-ant' 'jh' 'imake' + java-antlr2 + java-asm3 +) backup=('etc/maven/settings.xml') _mirror=http://archive.apache.org/dist -source=($_mirror/maven/source/apache-maven-$pkgver-src.tar.gz +source=($_mirror/maven/maven-${pkgver%%.*}/$pkgver/source/apache-maven-$pkgver-src.tar.gz maven.sh maven.csh) -_M2_LOCALREPO="/usr/share/maven/repository" - -# FIXME: This also does tasks for package() -build() { - cd $srcdir/apache-maven-$pkgver - +_setup_env() { + unset _JAVA_OPTIONS . /etc/profile.d/jre.sh . /etc/profile.d/jdk.sh - export MAVEN_OPTS=-Xmx512m export M2_HOME="$pkgdir"/opt/maven export PATH="$PATH:$M2_HOME/bin" + _M2_LOCALREPO=$(jh mvn-localrepo) + ant_args=( + -Dmaven.repo.local="$srcdir"/maven.repo.local + ) +} - # FIXME: Downloads many deps from Internet. They should be - # packaged separately and added to depends=() - install -d "$pkgdir`dirname $_M2_LOCALREPO`" - cp -r $_M2_LOCALREPO "$pkgdir$_M2_LOCALREPO" - install -d "$pkgdir"/opt - ant -Dmaven.repo.local="$pkgdir$_M2_LOCALREPO" - rm "$pkgdir"/opt/maven/*.txt +prepare() { + if type mvn &>/dev/null; then + error "maven cannot be built while an existing version is installed" + return 1 + fi } -package() { - install -d "$pkgdir$_M2_LOCALREPO" +build() ( + _setup_env + install -d "$srcdir"/maven.repo.local + lndir "$_M2_LOCALREPO" "$srcdir"/maven.repo.local + + cd "$srcdir"/apache-maven-$pkgver + + # FIXME: downloads makedepends from the Internet. Add them to makedepends=() + ant "${ant_args[@]}" maven-assembly 2>&1|tee "$srcdir"/ant-log.txt + + < "$srcdir"/ant-log.txt \ + sed -nr 's/.*Download(ed|ing):\s*//p' | \ + sed 's/ .*//' | \ + sed -r -e 's|^http://repo.maven.apache.org/maven2/||' -e 's/\.(jar|pom)$//' | \ + sort -u > "$srcdir"/downloaded-artifacts.txt +) + +package() ( + _setup_env + cd "$srcdir"/apache-maven-$pkgver + ant "${ant_args[@]}" extract-assembly + #rm "$pkgdir"/opt/maven/*.txt # Install config file in /etc # Unlike the other directories, we symlink from the system to /opt/maven @@ -69,8 +90,18 @@ package() { # Link jar files to appropriate place in /usr/share install -d "$pkgdir"/usr/share/java ln -s /opt/maven/lib "$pkgdir"/usr/share/java/maven -} -md5sums=('17ca94d5be05a78c6ab12425b7a0ee10' + # Install the local repo + mkdir -p "$pkgdir"${_M2_LOCALREPO%/*} + cp -a "$srcdir"/maven.repo.local "$pkgdir"$_M2_LOCALREPO + # Remove extra artifacts + find "$pkgdir"$_M2_LOCALREPO -type l -delete + find "$pkgdir"$_M2_LOCALREPO -name _maven.repositories -delete + cat "$srcdir"/downloaded-artifacts.txt | while read artifact; do + rm -f "$pkgdir"$_M2_LOCALREPO/$artifact* + done +) + +md5sums=('b88becd8fe5a9665191e05945942db64' '58820067a4d7384477daa134023d9b57' 'e2bbdeffed100cd51d05b2ba8ebd6321') |