void-packages/srcpkgs/llvm10/template
2020-11-17 04:14:14 +01:00

109 lines
3 KiB
Bash

# Template file for 'llvm10'
pkgname=llvm10
version=10.0.0
revision=7
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="libllvm10"
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="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
lib32disabled=yes
python_version=3
conflicts="llvm11>=0"
subpackages="libllvm10"
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
mips*-musl|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_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
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
}
libllvm10_package() {
short_desc+=" - runtime library"
pkg_install() {
vmove "usr/lib/libLLVM-*.so*"
}
}