aboutsummaryrefslogtreecommitdiffstats
path: root/community/mbedtls/APKBUILD
blob: 42270fc2018421c0d2e580139319447c36b7ea22 (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
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mbedtls
pkgver=2.6.1
pkgrel=0
pkgdesc="Light-weight cryptographic and SSL/TLS library"
url="https://tls.mbed.org/"
arch="all"
license="GPL-2.0-or-later Apache-2.0"
makedepends="cmake perl"
subpackages="$pkgname-static $pkgname-dev $pkgname-utils"
source="$pkgname-$pkgver.tar.gz::https://github.com/ARMmbed/$pkgname/archive/$pkgname-$pkgver.tar.gz
	verbose-testsuite.patch"
builddir="$srcdir/$pkgname-$pkgname-$pkgver"

# secfixes:
#   2.4.2-r0:
#   - CVE-2017-2784
#   2.6.0-r0:
#   - CVE-2017-14032

prepare() {
	default_prepare

	# Enable flags for non-embedded systems.
	sed -i \
		-e 's|//\(#define MBEDTLS_THREADING_C\)|\1|' \
		-e 's|//\(#define MBEDTLS_THREADING_PTHREAD\)|\1|' \
		"$builddir"/include/mbedtls/config.h
}

build() {
	cd "$builddir"

	cmake . \
		-DCMAKE_BUILD_TYPE="MinSizeRel" \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=ON \
		-DUSE_SHARED_MBEDTLS_LIBRARY=ON
	make
}

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

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
}

utils() {
	pkgdesc="Utilities for mbedtls"

	mkdir -p "$subpkgdir"/usr/libexec
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/libexec/mbedtls
}

static() {
	pkgdesc="Static files for mbedtls"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/
	chmod -x "$subpkgdir"/usr/lib/*.a
}

sha512sums="06f8ba2a453164bac01d20ca6f5c80e691857977ef501d56685e81a0e90dddae1bedeab46c18c22f9a3b72894d45d7466f76a5c404417b6613ddae0ee4a881c8  mbedtls-2.6.1.tar.gz
1a0f0c8c794f8aab2a050b660e86f3cba293fcd4d0ffba9a1a1b8fd88f631d68fe194256495ed584d13e577c577829f0bbe821ffaf11165163b5a78c9d68efe8  verbose-testsuite.patch"