summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e8791feb9db6d7d082d3c844b497c714ce794618 (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
# Maintainer: envolution
# Contributor: Matt Parnell/ilikenwf <parwok@gmail.com>
pkgname="hardened-malloc-git"
pkgver=13+r726+gc894f3ec1
pkgdesc="Hardened allocator designed for modern systems."
url="https://github.com/GrapheneOS/hardened_malloc"
license=("MIT")
makedepends=("git")
conflicts=("hardened_malloc")
provides=("hardened_malloc")
arch=("x86_64")
pkgrel=1
source=('hardened_malloc::git+https://github.com/GrapheneOS/hardened_malloc#branch=main'
		'preload.sh')
sha256sums=('SKIP'
            'e6dbce7ac1d689fafbc94ffb17d8c4ae5271dd3580421828d35aac2c067b652d')

pkgver(){
  cd "$srcdir/hardened_malloc"
  _version=$(git tag --sort=refname --list | grep "^[0-9]\{2,4\}$" | sort -nr | head -1)
  _commits=$(git rev-list --count HEAD)
  _short_commit_hash=$(git rev-parse --short=9 HEAD)
  echo "${_version}+r${_commits}+g${_short_commit_hash}"
}

build() {
	cd "${srcdir}/hardened_malloc"
	
	CFLAGS="" make
}

package() {
	cd "${srcdir}/hardened_malloc"
	
	mkdir -p "$pkgdir/usr/lib"
	mkdir -p "$pkgdir/usr/bin"
	
	install -D -m755 "out/libhardened_malloc.so" "$pkgdir/usr/lib"
	install -D -m755 "$srcdir/preload.sh" "$pkgdir/usr/bin/hardened-malloc-preload"
	install -D -m755 "calculate_waste.py" "$pkgdir/usr/bin/hardened-malloc-calculate-waste.py"
	
}