aboutsummaryrefslogtreecommitdiffstats
path: root/community/emscripten-fastcomp/APKBUILD
blob: bdab4978a75573b119c3f9026dc2b3fea461bb81 (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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>

# NOTE: This is a fork of LLVM project needed for emscripten. It provides
#   JSBackend and WebAssembly, these will be hopefully someday merged into
#   upstream LLVM.
# TODO: Remove unneeded binaries.
pkgname=emscripten-fastcomp
# Keep in sync with package emscripten!
pkgver=1.37.10
pkgrel=2
pkgdesc="The Clang + LLVM backend for Emscripten"
url="https://kripken.github.io/emscripten-site/"
arch="all"
license="UOI-NCSA"
depends="python2"
makedepends="cmake paxmark zlib-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/kripken/$pkgname/archive/$pkgver.tar.gz
	$pkgname-clang-$pkgver.tar.gz::https://github.com/kripken/$pkgname-clang/archive/$pkgver.tar.gz
	llvm-fix-build-with-musl-libc.patch
	llvm-fix-DynamicLibrary-to-build-with-musl-libc.patch
	llvm-fix-return-type-in-ORC-readMem-client-interface.patch
	"
builddir="$srcdir/$pkgname-$pkgver"
options="!check"  # some tests are broken, don't bother with it for now

_prefix="usr/lib/$pkgname"
ldpath="/$_prefix/lib"
# Avoid conflicts in provided so:* names with llvm package.
sonameprefix="$pkgname:"

prepare() {
	ln -sf ../../$pkgname-clang-$pkgver "$builddir"/tools/clang

	default_prepare
}

build() {
	mkdir -p "$builddir"/build
	cd "$builddir"/build

	# XXX: Is it a good idea to omit X86 in LLVM_TARGETS_TO_BUILD?
	# https://github.com/kripken/emscripten-fastcomp/issues/174
	cmake .. \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX="/$_prefix" \
		-DCMAKE_VERBOSE_MAKEFILE=NO \
		-DPYTHON_EXECUTABLE=/usr/bin/python2 \
		-DCLANG_BUILD_EXAMPLES=OFF \
		-DCLANG_INCLUDE_TESTS=OFF \
		-DLLVM_BUILD_DOCS=OFF \
		-DLLVM_BUILD_LLVM_DYLIB=ON \
		-DLLVM_BUILD_RUNTIME=OFF \
		-DLLVM_ENABLE_ZLIB=ON \
		-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \
		-DLLVM_HOST_TRIPLE="$CHOST" \
		-DLLVM_INCLUDE_EXAMPLES=OFF \
		-DLLVM_INCLUDE_TESTS=OFF \
		-DLLVM_LINK_LLVM_DYLIB=ON \
		-DLLVM_TARGETS_TO_BUILD=JSBackend
	make -j ${JOBS:-2}

	paxmark m \
		bin/llvm-rtdyld \
		bin/lli \
		bin/lli-child-target
}

package() {
	cd "$builddir"/build
	make install DESTDIR="$pkgdir"

	cd "$pkgdir"/$_prefix

	# emcc -v expects this file to exist.
	cp "$builddir"/emscripten-version.txt .

	# Remove unneeded files and clutter.
	rm -r include libexec share lib/clang lib/cmake
	rm lib/*.a bin/*-test
}

sha512sums="8a7ab29f2b239eef43bfcea3359847d9566aecd1252f6f27685e43bb71ef9031d3dffc14f07fdf97979461ea4e07140510aebec315ab4fdfaec9fcb944370c6a  emscripten-fastcomp-1.37.10.tar.gz
54442b598001204420087b7ff6168c34a626e39a3992a343294cdc9c9a93020ca8de19365d15afc97d35ff94f584f50663e0b843696596f3ad3441608d974270  emscripten-fastcomp-clang-1.37.10.tar.gz
f84cd65d7042e89826ba6e8d48c4c302bf4980da369d7f19a55f217e51c00ca8ed178d453df3a3cee76598a7cecb94aed0775a6d24fe73266f82749913fc3e71  llvm-fix-build-with-musl-libc.patch
19bfb9282455d39d07dbb2b1293b03a45c57d522fbb9c5e58dac034200669628b97e7a90cd4ff5d52d9bb79acfccbef653d8a1140a7f0589ecd6f9b7c4ba0eb6  llvm-fix-DynamicLibrary-to-build-with-musl-libc.patch
f57c734687c8ceae8d1bbfcbfdeecb75a5059a112967f4ba639d78d2484e0cc1deabf02ba2d3a6f5283443bf8b3230f38ad143800f8f3327cca0d2691a3ddc3d  llvm-fix-return-type-in-ORC-readMem-client-interface.patch"