summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b31c8deb2147a97dabb12ad7acc6f6c33b87629d (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
# Maintainer: Darren Ng <$(base64 --decode <<<'VW4xR2ZuQGdtYWlsLmNvbQo=')>

pkgname=ldid-git
pkgver=2.1.2.r10.d4a4dbe
pkgrel=4
pkgdesc="a tool used for ad-hoc codesigning iOS binaries - saurik official"
arch=(x86_64)
url="https://git.saurik.com/${pkgname//-/.}"
license=(AGPL3)
depends=(
  libplist
  # libxml2 # libxml-2.0
  openssl
)
makedepends=(git clang)
provides=(${pkgname%-git}{,2{,-git}})
conflicts=(${provides[*]})
# https://stackoverflow.com/questions/10909976/why-do-seemingly-empty-files-and-strings-produce-md5sums
source=(file:///dev/null)
md5sums=(d41d8cd98f00b204e9800998ecf8427e)

prepare(){
  cd "$srcdir"
  rm -rf "${pkgname%-git}"
  echo -n "$url - "
  # https://stackoverflow.com/questions/23885449/unable-to-resolve-unable-to-get-local-issuer-certificate-using-git-on-windows
  # [Workaround] fatal: unable to access 'https://git.saurik.com/ldid.git/': SSL certificate problem: unable to get local issuer certificate
  # git -c http.sslVerify=false clone file:///tmp/ldid.git "${pkgname%-git}"
  git -c http.sslVerify=false clone "$url" "${pkgname%-git}"
}

pkgver(){
  cd "$srcdir/${pkgname%-git}"
  printf "%s" "$(git describe --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g;s/^v//g')"
}

# https://git.saurik.com/ldid.git/blob/HEAD:/make.sh
# https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
# https://www.gnu.org/software/make/manual/html_node/Catalogue-of-Rules.html
build(){
# Blame me or the upstream
# clang -I. -c -o lookup2.o lookup2.c
# clang++ -std=c++11 -o ldid lookup2.o ldid.cpp -I. -lcrypto -lplist-2.0 -lxml2
cd "$srcdir/${pkgname%-git}"
cat <<"EOM" >Makefile
#
CC:=/bin/false
CXX:=/bin/false
CFLAGS:=$(CFLAGS) $(shell pkg-config --cflags libplist-2.0,libcrypto)
#
default: ldid
ldid: CC:=clang++
ldid: LDLIBS:=$(shell pkg-config --libs libplist-2.0,libcrypto)
ldid: ldid.o lookup2.o
#
%.o: CC:=clang
%.o: CXX:=clang++
ldid.o: ldid.cpp
lookup2.o: lookup2.c
#
EOM
make
}

package(){
  cd "$srcdir/${pkgname%-git}"
  install -vDm755 ldid "$pkgdir/usr/bin/ldid"
  ln -sfv "ldid" "$pkgdir/usr/bin/ldid2"
}