: nply/foundationpkgs

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 
# Contributor: Bharatvaj Hemanth <bharatvaj@nonplanar.org>
# Maintainer:
pkgname="asn1c"
pkgver="0.9.29"
pkgrel=0
pkgdesc="ASN.1 compiler with support for BER/OER/PER/XER"
url="https://github.com/vlm/asn1c"
arch="all"
license="BSD-2-Clause"
makedepends="build-essentials-stub"
subpackages="libs dev"
source="https://github.com/vlm/asn1c/releases/download/v${pkgver}/asn1c-${pkgver}.tar.gz"
sha256sums="
a8b7b60475357285ac7250f0f3452d0c7555abffa50e1226a0a671df715cc9ff  asn1c-0.9.29.tar.gz
"

build() {
	cd asn1c-$pkgver
	# The release tarball ships a pre-generated ./configure (real autotools,
	# not asn1c's own thing) - only pass --host when actually cross-building.
	# Passing it unconditionally risks tripping autoconf's cross-compile
	# detection on a native build if our triplet string doesn't exactly
	# match what config.sub would canonicalize to.
	if cross_compiling; then
		./configure --prefix=/usr --host="$CHOST"
	else
		./configure --prefix=/usr
	fi
	make
}

package() {
	cd asn1c-$pkgver
	make install DESTDIR="$pkgdir"
}

# asn1c doesn't build/install a linkable .so/.a - `make install` installs the
# runtime "skeleton" .c/.h files (what upstream's own Makefile.am calls
# libasn1cskeletons) as plain data under $(pkgdatadir) (/usr/share/asn1c);
# the asn1c compiler copies them into a consumer's own output directory to be
# compiled alongside its generated code. That's a different layout than
# default_dev()/default_libs() expect (usr/include, usr/lib), so both are
# overridden here: "library" = the skeleton .c sources, "dev" = the .h
# headers needed to compile against them.
libs() {
	# Unquoted - amove expects the shell to expand this against cwd (which
	# build.sh sets to $pkgdir before calling a split function), matching
	# every real APKBUILD's own split-function convention.
	amove usr/share/asn1c/*.c
}

dev() {
	amove usr/share/asn1c/*.h
}