summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 776b9f454f5d73fbf134256a0414ae88b7fcb9e7 (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
# Maintainer: Jason Nader <jason *add-dot-here* nader *you-know-what-goes-here* protonmail.com>
# Maintainer: Marcell Meszaros < marcell.meszaros AT runbox.eu >

pkgname=android-backup-extractor-git
pkgver=r147.g70730dd
pkgrel=2
pkgdesc='Utility to extract and repack Android backups created with adb backup'
arch=('any')
url="https://github.com/nelenkov/${pkgname%-git}"
license=('custom:Apache') # Apache 2.0 license with copyright notice
depends=('bcprov>=1.71' 'java-runtime-headless>=11' 'sh')
makedepends=('git' 'apache-ant' 'java-environment>=11')
provides=('abe.jar' 'android-backup-extractor')
conflicts=('abe' 'android-backup-extractor')
source=("${pkgname}::git+${url}.git")
b2sums=('SKIP')

pkgver() {
  cd "${pkgname}"
  # use the revision count.hash
  printf "r%s.g%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "${pkgname}"
  # 1. set correct path to system bcprov
  # 2. do not include bcprov classes in the final abe.jar file
  sed -e 's@lib/bcprov-jdk18on-1.77.jar@/usr/share/java/bcprov/bcprov.jar@g' \
    -e 's@<zipfileset.*@@g' \
    -i build.xml || return 1

  # do not use the bundled abe script, a simple wrapper is good enough
  echo '#!/bin/sh' > arch-abe
  echo "CP=\"/usr/share/java/bcprov/bcprov.jar:/usr/share/java/${pkgname}/abe.jar\"" >> arch-abe
  echo 'exec /usr/bin/java -cp "$CP" org.nick.abe.Main "$@"' >> arch-abe
  chmod +x arch-abe
}

build() {
  cd "${pkgname}"
  latest_version="$(archlinux-java status | grep 'java-[0-9][0-9]' | sort --reverse | head --lines 1 | sed 's/(.*)//g' | tr -d '[:space:]')"
  JAVA_HOME="/usr/lib/jvm/${latest_version}" ant
}

package() { 
  cd "${pkgname}"
  install -Dm 755 arch-abe "${pkgdir}/usr/bin/abe"
  install -Dm 755 abe.jar -t "${pkgdir}/usr/share/java/${pkgname}"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}