summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0a531f3cba3d783102ec7fce9308b7eb8312af98 (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
# Maintainer: detiam <dehe_tian at outlook dot com>
# Contributor: Jakob Kreuze <jakob@memeware.net>
# Contributor: Bader <Bad3r@unsigned.sh>

# shellcheck disable=SC1090
# shellcheck disable=SC2206
pkgname=pince-git
pkgver=r1312.edaf531
pkgrel=1
pkgdesc="A Linux reverse engineering tool inspired by Cheat Engine."
arch=('any')
url="https://github.com/korcankaraokcu/PINCE"
license=('GPL3')
depends=('base-devel') # follow upstream, set this later
makedepends=('git' 'intltool')
source=("$pkgname::git+$url.git")
md5sums=('SKIP')
_installpath='usr/share/PINCE'

pkgver() {
  cd "$pkgname"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  # Remove ".venv/PINCE" exist check
  sed -i '/^if \[ ! -d "\.venv\/PINCE" \]; /,/activate$/ s/^/# /' "./$pkgname/PINCE.sh"
  # Create a simple start script
  cat >pince<< \
EOF
pushd /$_installpath
sh PINCE.sh "$@"
popd
EOF
}

build() {
  cd "$pkgname"
  # Source libscanmem installation functions
  . <(sed -n '/^compile_scanmem() /,/^}/p' install_pince.sh)
  . <(sed -n '/^install_scanmem() /,/^}/p' install_pince.sh)
  . <(sed -n '/^exit_on_error() /,/^}/p' install_pince.sh)
  # Run functions
  install_scanmem || exit_on_error
}

package() {
  cd "$pkgname"
  # Source PKG_NAMES* vars
  . <(sed -n '/^PKG_NAMES/p' install_pince.sh)
  # Set new depends
  depends+=($PKG_NAMES_ARCH)
  for pipkg in $PKG_NAMES_PIP; do
    ## why archlinux python package isn't just match "python-$pipkg" format?
    if [ "$pipkg" == "distorm3" ]; then
      depends+=("python-distorm")
    elif [ "$pipkg" == "pygobject" ]; then
      depends+=("python-gobject")
    elif [ "$pipkg" == "keystone-engine" ]; then
      depends+=("python-keystone")
    else
      depends+=("python-$pipkg")
    fi
  done
  # Copy files
  install -d "$pkgdir/usr/bin"
  install -Dm755 ../pince "$pkgdir/usr/bin"
  install -d "$pkgdir/$_installpath"
  install PINCE.sh PINCE.py \
    COPYING COPYING.CC-BY AUTHORS THANKS "$pkgdir/$_installpath"
  cp -r GUI libpince media tr i18n "$pkgdir/$_installpath"
}