aboutsummaryrefslogtreecommitdiffstats
path: root/community/mbedtls/APKBUILD
blob: bfcfc5ab85315402fb1baaeb01857dc95911ee24 (plain) (blame)
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
# Contributor: Ɓukasz Jendrysik <scadu@yandex.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mbedtls
pkgver=2.3.0
pkgrel=0
pkgdesc="Light-weight cryptographic and SSL/TLS library"
url="https://tls.mbed.org/"
arch="all"
license="GPL2+ ASL 2.0"
depends=""
depends_dev=""
makedepends="$depends_dev cmake perl"
install=""
subpackages="$pkgname-static $pkgname-dev $pkgname-utils"
source="https://tls.mbed.org/download/$pkgname-$pkgver-gpl.tgz"

builddir="$srcdir"/$pkgname-$pkgver
build() {
	cd "$builddir"

	# this work-around is the same one used in Arch Linux's package
	# see https://github.com/ARMmbed/mbedtls/issues/522
	sed -i 's|<time.h>|"platform.h"|' include/mbedtls/ssl.h

	# enable flags for non-embedded systems
	sed -i -e 's|//\(#define MBEDTLS_THREADING_C\)|\1|' -e 's|//\(#define MBEDTLS_THREADING_PTHREAD\)|\1|' include/mbedtls/config.h
	cmake . \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE="Release" \
		-DUSE_SHARED_MBEDTLS_LIBRARY=1 \
		|| return 1
	make || return 1
	make test || return 1
}

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

utils() {
	pkgdesc="Utilities for mbedtls"
	mkdir -p "$subpkgdir"/usr/libexec
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/libexec/mbedtls || return 1
}

static() {
	pkgdesc="Static files for mbedtls"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/
}

md5sums="3f396d21b9c86c0a11ac9ba0b6e6f999  mbedtls-2.3.0-gpl.tgz"
sha256sums="21237014f779bde70b2d71399cc1ea53365eb7f10cdd74a13ee6329a1910cb49  mbedtls-2.3.0-gpl.tgz"
sha512sums="f86ec87735b919e23ad7eb960a290013e7dfc2a5953d662ecee4eca7b990384c095aea74a313eaa0e1febb74e0c015879f4d680d51bc5eae811ab9e5063ba38a  mbedtls-2.3.0-gpl.tgz"