summaryrefslogblamecommitdiff
path: root/user/clang/APKBUILD
blob: 331c96f56d8189ec254d33ffe0463f0968d72639 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                                 
                                                                                






                                                                              
                        






























                                                              
                                                              



                        
                        



                                                       












                                                                            




                                                            






                                                      
                                         


















                                                                                                                                                                            

                                                                                                                                                    
# Contributor Travis Tilley <ttilley@gmail.com>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=clang
# Note: Update together with llvm.
pkgver=6.0.1
pkgrel=0
_llvmver=${pkgver%%.*}
pkgdesc="A C language family front-end for LLVM"
arch="all"
options="!dbg"
url="https://llvm.org/"
license="NCSA"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="cmake isl-dev libedit-dev libexecinfo-dev libxml2-dev libxml2-utils
	llvm-dev>=$_llvmver llvm-static>=$_llvmver llvm-test-utils>=$_llvmver"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-libs
	$pkgname-analyzer::noarch"
source="https://llvm.org/releases/$pkgver/cfe-$pkgver.src.tar.xz
	0001-Add-support-for-Ad-lie-Linux.patch
	0008-Fix-ClangConfig-cmake-LLVM-path.patch
	use-llvm-lit.patch
	secure-plt.patch
	"
builddir="$srcdir/cfe-$pkgver.src"

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

	cmake .. -Wno-dev \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=OFF \
		-DCLANG_VENDOR=${DISTRO_SHORT_NAME:-Adélie} \
		-DCLANG_BUILD_EXAMPLES=OFF \
		-DCLANG_INCLUDE_DOCS=ON \
		-DCLANG_INCLUDE_TESTS=ON \
		-DCLANG_PLUGIN_SUPPORT=ON \
		-DLIBCLANG_BUILD_STATIC=ON \
		-DLLVM_ENABLE_EH=ON \
		-DLLVM_ENABLE_RTTI=ON

	make clang-tblgen
	# too memory hungry
	if [ -z "$JOBS" -o $JOBS -gt 32 ]; then
		make -j32
	else
		make
	fi
}

check() {
	cd "$builddir"/build
	[ -f bin/llvm-lit ] || ln -s /usr/bin/lit bin/llvm-lit
	make check-clang
}

package() {
	local _dir _file
	cd "$builddir"/build

	make DESTDIR="$pkgdir" install
	install -m 644 lib/libclang.a "$pkgdir"/usr/lib

	# mozilla will never be happy
	mkdir -p "$pkgdir"/usr/lib/llvm$_llvmver/bin
	mkdir -p "$pkgdir"/usr/lib/llvm$_llvmver/lib
	for _dir in bin lib; do
		pushd "$pkgdir"/usr/$_dir
		for _file in *; do
			[ -f $_file ] || continue
			ln -s "../../../$_dir/$_file" \
				"$pkgdir"/usr/lib/llvm$_llvmver/$_dir/$_file
		done
		popd
	done

	# needed for at least Qt Creator
	mkdir -p "$pkgdir"/usr/include/llvm6
	ln -s ../clang "$pkgdir"/usr/include/llvm6/clang
	ln -s ../clang-c "$pkgdir"/usr/include/llvm6/clang-c
}

static() {
	pkgdesc="Static libraries for clang"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/
	strip -d "$subpkgdir"/usr/lib/*.a
}

analyzer() {
	pkgdesc="Clang source code analysis framework"
	depends="$pkgname=$pkgver-r$pkgrel perl python3"

	cd "$pkgdir"

	mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/libexec \
		"$subpkgdir"/usr/share/
	mv usr/bin/scan-* "$subpkgdir"/usr/bin/
	mv usr/libexec/*-analyzer "$subpkgdir"/usr/libexec/
	mv usr/share/scan-* "$subpkgdir"/usr/share/
}

sha512sums="f64ba9290059f6e36fee41c8f32bf483609d31c291fcd2f77d41fecfdf3c8233a5e23b93a1c73fed03683823bd6e72757ed993dd32527de3d5f2b7a64bb031b9  cfe-6.0.1.src.tar.xz
44aa152d50822a9e1a223b9e07e150ffa830c55deb4c4ca29e6218a0103eb263a00b41fd1ca84390e65fa08005901a0a0f88cf529bff8764220e99d06adef5fc  0001-Add-support-for-Ad-lie-Linux.patch
9485fe4fd6182df543735ed8f4ce618693d0faeafa86d3f9574a6c7abf50978e2d56e0a94be3ed94d515cc937c388d66ceff1bbc9bb120d371b6d3e95340da00  0008-Fix-ClangConfig-cmake-LLVM-path.patch
8a596e7369b5791e7e9c3278320aa5bac30d91f27d9a0df335ea862c359623869353d12145c3b64730f721600522f3acc5abe706428091482e0209e4ff308175  use-llvm-lit.patch
23c3de4f8cbfa115b337ee115b4f95eb1ce3b8c6451de590b0ecf196a4b3bc96ab1d88029edf7f0c51299dffb7b2a05cade9c64c72dba18d858686466bb82bad  secure-plt.patch"