aboutsummaryrefslogtreecommitdiffstats
path: root/main/libgit2/APKBUILD
blob: 20b60e1ab0ba238b4c9bcbf2c70c7ac63176f70c (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
73
74
75
76
77
# Contributor: Sergei Lukin <sergej.lukin@gmail.com>
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Pierre-Gilas MILLON <pgmillon@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libgit2
pkgver=0.28.3
pkgrel=1
pkgdesc="A linkable library for Git"
url="https://libgit2.org/"
arch="all"
license="GPL-2.0-only WITH GCC-exception-2.0"
depends_dev="curl-dev libssh2-dev http-parser-dev"
makedepends="$depends_dev python3 cmake zlib-dev openssl-dev"
subpackages="$pkgname-static $pkgname-dev $pkgname-tests::noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/libgit2/libgit2/archive/v$pkgver.tar.gz
	"
options="!check" # FIXME some tests fails

# secfixes:
#   0.27.4-r0:
#   - CVE-2018-15501
#   0.27.3-r0:
#   - CVE-2018-10887
#   - CVE-2018-10888
#   0.25.1-r0:
#   - CVE-2016-10128
#   - CVE-2016-10129
#   - CVE-2016-10130
#   0.24.3-r0:
#   - CVE-2016-8568
#   - CVE-2016-8569

prepare() {
	default_prepare
	mkdir -p "$builddir"/build
	sed -i 's|/usr/bin/env python|/usr/bin/env python3|' tests/generate.py
}

build() {
	cd "$builddir"/build

	cmake .. \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_C_FLAGS="$CFLAGS"
	make

	# Build static library
	mkdir -p "$builddir"/build-static
	cd "$builddir"/build-static

	cmake .. \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-DBUILD_SHARED_LIBS=OFF
	make
}

check() {
	cd "$builddir"/build
	make test
}

package() {
	make -C build DESTDIR="$pkgdir" install
	make -C build-static DESTDIR="$pkgdir" install
}

tests() {
	pkgdesc="$pkgdesc (tests)"

	mkdir -p "$subpkgdir"/usr/src/$pkgname/
	cp -a "$builddir"/tests "$subpkgdir"/usr/src/$pkgname/
}

sha512sums="15444823b7d4885f7b8c3982f8905efc4a75913de016a9b2e0a24d5ce9746e6a549dffd5469036529557feff2ce7ece9328266eb312c80b96091ce0f65ee97ee  libgit2-0.28.3.tar.gz"