109 lines
2.9 KiB
Bash
109 lines
2.9 KiB
Bash
# Template file for 'llvm9'
|
|
pkgname=llvm9
|
|
version=9.0.1
|
|
revision=6
|
|
wrksrc="llvm-${version}.src"
|
|
build_style=cmake
|
|
configure_args="
|
|
-DCMAKE_BUILD_TYPE=Release
|
|
-DLLVM_INSTALL_UTILS=ON
|
|
-DLLVM_BUILD_LLVM_DYLIB=ON
|
|
-DLLVM_LINK_LLVM_DYLIB=ON
|
|
-DLLVM_ENABLE_RTTI=ON
|
|
-DLLVM_ENABLE_FFI=ON
|
|
-DLLVM_BINUTILS_INCDIR=/usr/include"
|
|
hostmakedepends="groff perl python3 zlib-devel libffi-devel swig"
|
|
makedepends="python3-devel zlib-devel libffi-devel libedit-devel
|
|
libxml2-devel binutils-devel libatomic-devel"
|
|
depends="libllvm9"
|
|
short_desc="Low Level Virtual Machine"
|
|
maintainer="q66 <daniel@octaforge.org>"
|
|
license="NCSA"
|
|
homepage="https://www.llvm.org"
|
|
distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
|
|
checksum="00a1ee1f389f81e9979f3a640a01c431b3021de0d42278f6508391a2f0b81c9a"
|
|
lib32disabled=yes
|
|
python_version=3
|
|
|
|
conflicts="llvm10>=0"
|
|
|
|
subpackages="libllvm9"
|
|
|
|
post_patch() {
|
|
# patches
|
|
cd ${XBPS_BUILDDIR}/llvm-${version}.src
|
|
for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do
|
|
msg_normal "Applying $i to llvm\n"
|
|
patch -sNp1 -i ${i}
|
|
done
|
|
}
|
|
|
|
pre_configure() {
|
|
# Vastly reduce size of debugging symbols:
|
|
CFLAGS=${CFLAGS/ -g/ -g1}
|
|
CXXFLAGS=${CXXFLAGS/ -g/ -g1}
|
|
|
|
# since gcc9, the build likes to blow up for ppc32 apparently because
|
|
# of clang being too large for a 24-bit relative call to the PLT, so
|
|
# optimize for size instead
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;;
|
|
esac
|
|
|
|
if [ "$CROSS_BUILD" ]; then
|
|
msg_normal "Building host tblgen\n"
|
|
mkdir -p build/HOST
|
|
cd build/HOST
|
|
CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \
|
|
CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \
|
|
cmake ../.. -DCMAKE_BUILD_TYPE=Release
|
|
make ${makejobs} -C utils/TableGen
|
|
configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
|
|
cd ../..
|
|
fi
|
|
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
i686*) _arch="X86";;
|
|
x86_64*) _arch="X86";;
|
|
armv5*) _arch="Armv5te";;
|
|
armv6*) _arch="Armv6";;
|
|
armv7*) _arch="Armv7";;
|
|
aarch64*) _arch="AArch64";;
|
|
mips*) _arch="Mips";;
|
|
ppc*) _arch="PowerPC";;
|
|
esac
|
|
configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
|
|
configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
|
|
}
|
|
|
|
do_install() {
|
|
vlicense LICENSE.TXT
|
|
|
|
cd build
|
|
cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
|
|
|
|
# Fix permissions of static libs
|
|
chmod -x ${DESTDIR}/usr/lib/*.a
|
|
|
|
# Required for multilib.
|
|
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
|
|
for _header in llvm-config; do
|
|
mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h
|
|
vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
|
|
usr/include/llvm/Config ${_header}.h
|
|
done
|
|
fi
|
|
|
|
# Remove llvm-config-host in cross builds.
|
|
if [ "$CROSS_BUILD" ]; then
|
|
rm -f ${DESTDIR}/usr/bin/llvm-config-host
|
|
fi
|
|
}
|
|
|
|
libllvm9_package() {
|
|
short_desc+=" - runtime library"
|
|
pkg_install() {
|
|
vmove "usr/lib/libLLVM-*.so*"
|
|
}
|
|
}
|