summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c2900d1c9fdbae5ad60b62b4e6412d257f78cdc7 (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
pkgname=mbedtls-git
pkgver=2.3.0.r144.g9fa2e86
pkgrel=1
pkgdesc="Portable cryptographic and SSL/TLS library, aka polarssl - git checkout"
arch=('i686' 'x86_64')
url="https://tls.mbed.org"
license=('Apache')
provides=('polarssl' 'mbedtls')
replaces=('polarssl')
conflicts=('polarssl' 'mbedtls')
source=("git://github.com/ARMmbed/mbedtls")
sha256sums=('SKIP')
depends=('glibc')
options=('staticlibs')

pkgver() {
	cd mbedtls/

	if GITTAG="$(git describe --abbrev=0 --tags 2>/dev/null)"; then
		echo "$(sed -e "s/^${pkgname%%-git}//" -e 's/^[-_/a-zA-Z]\+//' -e 's/[-_+]/./g' <<< ${GITTAG}).r$(git rev-list --count ${GITTAG}..).g$(git log -1 --format="%h")"
	else
		echo "0.r$(git rev-list --count development).g$(git log -1 --format="%h")"
	fi
}

prepare() {
  cd mbedtls/
  # enable flags for non-embedded systems
  sed -i 's|//\(#define MBEDTLS_THREADING_C\)|\1|' include/mbedtls/config.h
  sed -i 's|//\(#define MBEDTLS_THREADING_PTHREAD\)|\1|' include/mbedtls/config.h
}

build() {
  cd mbedtls/
  LDFLAGS+=" -I../include " make SHARED=1 no_test
}

check() {
  cd mbedtls/
  make SHARED=1 check
}

package() {
  cd mbedtls/
  make DESTDIR="$pkgdir/usr" install
}