# Based on https://aur.archlinux.org/packages/boringssl-git/
# Maintainer: Omar Roth <omarroth@protonmail.com>
pkgname=boringssl
pkgver=1.1.0
pkgrel=0
pkgdesc="BoringSSL is a fork of OpenSSL that is designed to meet Google's needs"
url="https://boringssl.googlesource.com/boringssl"
arch="all"
license="MIT"
replaces="openssl libressl"
depends="!openssl-libs-static"
makedepends_host="linux-headers"
makedepends="cmake git go perl"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
source="251b516.tar.gz::https://github.com/google/boringssl/tarball/251b516"
builddir="$srcdir/google-boringssl-251b516"

prepare() {
	:
}

build() {
	cmake -DCMAKE_BUILD_TYPE=Release .
	make ssl crypto
}

check() {
	make all_tests
}

package() {
	for i in *.md ; do
		install -Dm644 $i "$pkgdir/usr/share/doc/$pkgname/$i"
	done
	install -d "$pkgdir/usr/lib"
	install -d "$pkgdir/usr/include"
	cp -R include/openssl "$pkgdir/usr/include"

	install -Dm755 crypto/libcrypto.a "$pkgdir/usr/lib/libcrypto.a"
	install -Dm755 ssl/libssl.a "$pkgdir/usr/lib/libssl.a"
#	install -Dm755 decrepit/libdecrepit.a "$pkgdir/usr/lib/libdecrepit.a"
#	install -Dm755 libboringssl_gtest.a "$pkgdir/usr/lib/libboringssl_gtest.a"
}
sha512sums="
b1d42ed188cf0cce89d40061fa05de85b387ee4244f1236ea488a431536a2c6b657b4f03daed0ac9328c7f5c4c9330499283b8a67f1444dcf9ba5e97e1199c4e  251b516.tar.gz
"
