diff --git a/gpkg/libllvm/build.sh b/gpkg/libllvm/build.sh new file mode 100644 index 000000000..6f3a7671d --- /dev/null +++ b/gpkg/libllvm/build.sh @@ -0,0 +1,65 @@ +TERMUX_PKG_HOMEPAGE=https://llvm.org/ +TERMUX_PKG_DESCRIPTION="LLVM runtime libraries (test)" +TERMUX_PKG_LICENSE="Apache-2.0, NCSA" +TERMUX_PKG_LICENSE_FILE="LICENSE.TXT" +TERMUX_PKG_MAINTAINER="@termux-pacman" +TERMUX_PKG_VERSION=17.0.3 +_SOURCE=https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION +TERMUX_PKG_SRCURL=($_SOURCE/llvm-$TERMUX_PKG_VERSION.src.tar.xz + $_SOURCE/cmake-$TERMUX_PKG_VERSION.src.tar.xz + $_SOURCE/third-party-$TERMUX_PKG_VERSION.src.tar.xz) +TERMUX_PKG_SHA256=(18fa6b5f172ddf5af9b3aedfdb58ba070fd07fc45e7e589c46c350b3cc066bc1 + 54fc534f0da09088adbaa6c3bfc9899a500153b96e60c2fb9322a7aa37b1027a + 6e84ff16044d698ff0f24e7445f9f47818e6523913a006a5e1ea79625b429b7b) +TERMUX_PKG_DEPENDS="gcc-libs-glibc, zlib-glibc, zstd-glibc, libffi-glibc, libedit-glibc, ncurses-glibc, libxml2-glibc, perl-glibc" +TERMUX_PKG_BUILD_DEPENDS="binutils-libs-glibc" + +termux_step_post_get_source() { + for i in cmake third-party; do + rm -fr $TERMUX_TOPDIR/$TERMUX_PKG_NAME/${i} + mv $TERMUX_PKG_SRCDIR/$i-$TERMUX_PKG_VERSION.src $TERMUX_TOPDIR/$TERMUX_PKG_NAME + mv $TERMUX_TOPDIR/$TERMUX_PKG_NAME/$i-$TERMUX_PKG_VERSION.src $TERMUX_TOPDIR/$TERMUX_PKG_NAME/$i + done +} + +termux_step_configure() { + termux_setup_cmake + termux_setup_ninja + + CFLAGS=${CFLAGS/-g /-g1 } + CXXFLAGS=${CXXFLAGS/-g /-g1 } + + local LLVM_TARGET_ARCH="X86" + if [ $TERMUX_ARCH = "arm" ]; then + LLVM_TARGET_ARCH="ARM" + elif [ $TERMUX_ARCH = "aarch64" ]; then + LLVM_TARGET_ARCH="AArch64" + fi + + cmake ${TERMUX_PKG_SRCDIR} \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_FIND_ROOT_PATH=$TERMUX_PREFIX \ + -DCMAKE_INSTALL_DOCDIR=share/doc \ + -DCMAKE_INSTALL_PREFIX=$TERMUX_PREFIX \ + -DCMAKE_SKIP_RPATH=ON \ + -DLLVM_BINUTILS_INCDIR=$TERMUX_PREFIX/include \ + -DLLVM_BUILD_DOCS=ON \ + -DLLVM_BUILD_LLVM_DYLIB=ON \ + -DLLVM_BUILD_TESTS=ON \ + -DLLVM_ENABLE_BINDINGS=OFF \ + -DLLVM_ENABLE_FFI=ON \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_ENABLE_SPHINX=ON \ + -DCMAKE_SYSTEM_NAME=Linux \ + -DLLVM_HOST_TRIPLE=$TERMUX_HOST_PLATFORM \ + -DCMAKE_LIBRARY_ARCHITECTURE=$TERMUX_HOST_PLATFORM \ + -DCMAKE_SYSTEM_PROCESSOR=$LLVM_TARGET_ARCH \ + -DCMAKE_C_COMPILER=$CC \ + -DCMAKE_CXX_COMPILER=$CXX \ + -DLLVM_INCLUDE_BENCHMARKS=OFF \ + -DLLVM_INSTALL_UTILS=ON \ + -DLLVM_LINK_LLVM_DYLIB=ON \ + -DLLVM_USE_PERF=ON \ + -DSPHINX_WARNINGS_AS_ERRORS=OFF +}