summaryrefslogtreecommitdiff
path: root/user/boost/APKBUILD
blob: 9e8e7f9f0d0cc16530712fcf7b6b5283b093caff (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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Zach van Rijn <me@zv.io>
pkgname=boost
pkgver=1.79.0
_pkgver=$(printf '%s' "$pkgver" | tr . _)
pkgrel=1
pkgdesc="Free peer-reviewed portable C++ source libraries"
url="https://www.boost.org/"
arch="all"
license="BSL-1.0"
depends=""
depends_dev="linux-headers"
makedepends="$depends_dev byacc bzip2-dev flex python3-dev xz-dev zlib-dev
	zstd-dev"
subpackages="$pkgname-dev $pkgname-doc"
source="https://boostorg.jfrog.io/artifactory/main/release/${pkgver}/source/${pkgname}_${_pkgver}.tar.bz2
	python-311-fix-enum.patch
	python-311-fix-open.patch
	"

builddir="$srcdir/${pkgname}_${_pkgver}"

_libs="
	atomic
	chrono
	container
	context
	contract
	coroutine
	date_time
	fiber
	filesystem
	graph
	iostreams
	json
	locale
	log_setup
	log
	math
	nowide
	prg_exec_monitor
	program_options
	python3
	random
	regex
	serialization
	stacktrace_basic
	stacktrace_noop
	system
	thread
	timer
	type_erasure
	unit_test_framework
	wave
	wserialization
	"
for _lib in $_libs; do
	subpackages="$subpackages $pkgname-${_lib}:_boostlib"
done

prepare() {
	default_prepare

	PY3_VERSION="$(_pyversion python3)"
	abiflags="$(python3-config --abiflags)"

	# create user-config.jam
	cat > user-config.jam <<-__EOF__

	using gcc : : $CC : <cxxflags>"$CXXFLAGS" <linkflags>"$LDFLAGS" ;
	using python : ${PY3_VERSION} : /usr/bin/python3 : /usr/include/python${PY3_VERSION}${abiflags} : "$(python3-config --libs)" : : $abiflags ;

	__EOF__
}

case "$CARCH" in
	s390x)
		_options_s390="--without-coroutine --without-coroutine2" ;;
esac
_enginedir=tools/build/src/engine
_bjam="${builddir}/$_enginedir/bjam"

_options="--user-config=\"$builddir/user-config.jam\"
	--prefix=\"$pkgdir/usr\"
	release
	runtime-link=shared
	link=shared,static
	cflags=-fno-strict-aliasing
	-sPYTHON_ROOT=/usr
	-sTOOLS=gcc
	--layout=system
	-q
	--without-mpi
	-j${JOBS:-2}
	${_options_s390}
	"

build() {
	export BOOST_ROOT="$builddir"

	msg "Building bjam"
	cd "$builddir"/$_enginedir
	CC= ./build.sh gcc

	msg "Building bcp"
	cd "$builddir"/tools/bcp
	"$_bjam" -j${JOBS:-2}

	msg "Building boost"
	cd "$builddir"
	"$_bjam" $_options
}

check() {
	cd "$builddir"/tools/build/test

	PATH="${_bjam%/*}:$PATH" python3 test_all.py --default-bjam
}

package() {
	export BOOST_ROOT="$builddir"

	install -Dm755 $_bjam \
		"$pkgdir"/usr/bin/bjam

	install -Dm755 dist/bin/bcp "$pkgdir"/usr/bin/bcp

	install -Dm644 LICENSE_1_0.txt \
		"$pkgdir"/usr/share/licenses/$pkgname/LICENSE_1_0.txt

	"$pkgdir"/usr/bin/bjam $_options \
		--includedir="$pkgdir"/usr/include \
		--libdir="$pkgdir"/usr/lib \
		install
}

_boostlib() {
	libname="${subpkgname#$pkgname-}"
	pkgdesc="Boost library - $libname"
	case "$subpkgname" in
	boost-python3) depends="$depends python3"
	esac

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libboost_$libname* "$subpkgdir"/usr/lib/
}

_pyversion() {
	$1 -c 'import sys; print("%i.%i" % (sys.version_info.major, sys.version_info.minor))'
}

sha512sums="70909e0561c213d10a1fdd692f9ae7b293d3cdc63e925bdc207da9e9bba6e86474341100e7ee5de6d94f9561196b1a3a1597055a7b7382babf8931131170a312  boost_1_79_0.tar.bz2
04b9bcbd37cf660450aa4ff27b32db514d669caa378a25158d6d1e71ef0b42ea097e9dfda01774fbe80487db0f80d809d10b42e5ebc464f9faff02379bead98d  python-311-fix-enum.patch
4b517dc36719e4e4666d32822a65e650496f9ec534232ae96500538bf8182ce72e08bda3786a598330babda1bc169afa9b38fbc9d5a63d2dc633c03ba428a060  python-311-fix-open.patch"