aboutsummaryrefslogtreecommitdiffstats
path: root/testing/openssl1.1/APKBUILD
blob: 7e0b1fd52f58bda8aa38e8a37c47d779bf75f503 (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
78
79
80
81
82
83
84
85
86
87
88
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgver=1.1.0h
_osslver=${pkgver%.*}
pkgname=openssl$_osslver
pkgrel=2
pkgdesc="Toolkit for SSL v2/v3 and TLS v1"
url="https://www.openssl.org"
arch="all"
license="OpenSSL"
depends_dev="zlib-dev"
makedepends_build="perl"
makedepends_host="zlib-dev linux-headers"
makedepends="$makedepends_host $makedepends_build"
subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc openssl$_osslver-libcrypto:_libcrypto openssl$_osslver-libssl:_libssl"
source="http://www.openssl.org/source/openssl-$pkgver.tar.gz
	CVE-2018-0732.patch
	"
builddir="$srcdir/openssl-$pkgver"

build() {
	local _target _optflags
	cd "$builddir"

	# openssl will prepend crosscompile always core CC et al
	CC=${CC#${CROSS_COMPILE}}
	CXX=${CXX#${CROSS_COMPILE}}
	CPP=${CPP#${CROSS_COMPILE}}

	# determine target OS for openssl
	case "$CARCH" in
	aarch64*) _target="linux-aarch64" ;;
	arm*)   _target="linux-armv4" ;;
	ppc64le) _target="linux-ppc64le" ;;
	x86)    _target="linux-elf" ;;
	x86_64) _target="linux-x86_64"; _optflags="enable-ec_nistp_64_gcc_128" ;;
	s390x)	_target="linux64-s390x";;
	*)	msg "Unable to determine architecture from (CARCH=$CARCH)" ; return 1 ;;
	esac

	# Configure assumes --options are for it, so can't use
	# gcc's --sysroot fake this by overriding CC
	[ -n "$CBUILDROOT" ] && CC="$CC --sysroot=${CBUILDROOT}"

	perl ./Configure $_target --prefix=/usr \
		--libdir=lib \
		--openssldir=/etc/ssl \
		shared zlib $_optflags \
		-DOPENSSL_NO_ASYNC \
		$CPPFLAGS $CFLAGS $LDFLAGS -Wa,--noexecstack

	make
}

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

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" MANDIR=/usr/share/man MANSUFFIX=ssl install
	# remove the script c_rehash
	rm "$pkgdir"/usr/bin/c_rehash
}

_libcrypto() {
	pkgdesc="Crypto library from openssl"

	mkdir -p "$subpkgdir"/lib "$subpkgdir"/usr/lib
	for i in "$pkgdir"/usr/lib/libcrypto*; do
		mv $i "$subpkgdir"/lib/
		ln -s ../../lib/${i##*/} "$subpkgdir"/usr/lib/${i##*/}
	done
	mv "$pkgdir"/usr/lib/engines-$_osslver "$subpkgdir"/usr/lib/
}

_libssl() {
	pkgdesc="SSL shared libraries"

	mkdir -p "$subpkgdir"/lib "$subpkgdir"/usr/lib
	for i in "$pkgdir"/usr/lib/libssl*; do
		mv $i "$subpkgdir"/lib/
		ln -s ../../lib/${i##*/} "$subpkgdir"/usr/lib/${i##*/}
	done
}

sha512sums="fb7750fcd98e6126eb5b92e7ed63d811a5cfa3391d98572003d925f6c7b477690df86a9aa1fa6bf6bf33d02c6c7aee6cff50a38faa8911409f310645898fda39  openssl-1.1.0h.tar.gz
ff91298629f157496a012da00ba7325923f5d087bfa54b60e205bf2dfb06374e958912e0df39dbdf39773555455c1a3afa3dcde1ddfec6e85cf89b0b62cc0eb4  CVE-2018-0732.patch"