2017-12-26 23:27:38 +01:00
|
|
|
TERMUX_PKG_HOMEPAGE=https://clang.llvm.org/
|
2017-02-12 20:57:51 +01:00
|
|
|
TERMUX_PKG_DESCRIPTION="Modular compiler and toolchain technologies library"
|
2019-01-21 13:53:58 +01:00
|
|
|
TERMUX_PKG_LICENSE="NCSA"
|
2020-07-24 14:45:11 +02:00
|
|
|
TERMUX_PKG_VERSION=10.0.1
|
2020-09-27 08:28:31 +02:00
|
|
|
TERMUX_PKG_REVISION=4
|
2020-07-24 14:45:11 +02:00
|
|
|
TERMUX_PKG_SHA256=(c5d8e30b57cbded7128d78e5e8dad811bff97a8d471896812f57fa99ee82cdf3
|
|
|
|
f99afc382b88e622c689b6d96cadfa6241ef55dca90e87fc170352e12ddb2b24
|
|
|
|
591449e0aa623a6318d5ce2371860401653c48bb540982ccdd933992cb88df7a
|
|
|
|
d19f728c8e04fb1e94566c8d76aef50ec926cd2f95ef3bf1e0a5de4909b28b44
|
2020-09-21 03:42:12 +02:00
|
|
|
d093782bcfcd0c3f496b67a5c2c997ab4b85816b62a7dd5b27026634ccf5c11a
|
2020-09-21 03:44:33 +02:00
|
|
|
d90dc8e121ca0271f0fd3d639d135bfaa4b6ed41e67bd6eb77808f72629658fa
|
|
|
|
d2fb0bb86b21db1f52402ba231da7c119c35c21dfb843c9496fe901f2d6aa25a)
|
2019-12-22 02:22:55 +01:00
|
|
|
TERMUX_PKG_SRCURL=(https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/llvm-$TERMUX_PKG_VERSION.src.tar.xz
|
|
|
|
https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/clang-$TERMUX_PKG_VERSION.src.tar.xz
|
|
|
|
https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/lld-$TERMUX_PKG_VERSION.src.tar.xz
|
2020-07-09 01:18:41 +02:00
|
|
|
https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/openmp-$TERMUX_PKG_VERSION.src.tar.xz
|
2020-09-21 03:42:12 +02:00
|
|
|
https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/clang-tools-extra-$TERMUX_PKG_VERSION.src.tar.xz
|
2020-09-21 03:44:33 +02:00
|
|
|
https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/compiler-rt-$TERMUX_PKG_VERSION.src.tar.xz
|
|
|
|
https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/polly-$TERMUX_PKG_VERSION.src.tar.xz)
|
2015-06-13 01:03:31 +02:00
|
|
|
TERMUX_PKG_HOSTBUILD=true
|
2017-02-12 20:57:51 +01:00
|
|
|
TERMUX_PKG_RM_AFTER_INSTALL="
|
2018-03-20 23:10:53 +01:00
|
|
|
lib/libgomp.a
|
|
|
|
lib/libiomp5.a
|
2017-02-12 20:57:51 +01:00
|
|
|
"
|
2019-06-19 20:45:54 +02:00
|
|
|
TERMUX_PKG_DEPENDS="binutils, libc++, ncurses, ndk-sysroot, libffi, zlib"
|
2016-08-11 15:26:06 +02:00
|
|
|
# Replace gcc since gcc is deprecated by google on android and is not maintained upstream.
|
2017-02-26 14:52:04 +01:00
|
|
|
# Conflict with clang versions earlier than 3.9.1-3 since they bundled llvm.
|
|
|
|
TERMUX_PKG_CONFLICTS="gcc, clang (<< 3.9.1-3)"
|
2019-07-20 10:42:33 +02:00
|
|
|
TERMUX_PKG_BREAKS="libclang, libclang-dev, libllvm-dev"
|
|
|
|
TERMUX_PKG_REPLACES="gcc, libclang, libclang-dev, libllvm-dev"
|
2017-02-12 20:57:51 +01:00
|
|
|
# See http://llvm.org/docs/CMake.html:
|
2017-01-18 02:09:52 +01:00
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
|
2019-02-12 09:41:30 +01:00
|
|
|
-DPYTHON_EXECUTABLE=$(which python3)
|
2017-01-18 02:09:52 +01:00
|
|
|
-DLLVM_ENABLE_PIC=ON
|
2017-07-04 13:45:47 +02:00
|
|
|
-DLLVM_ENABLE_LIBEDIT=OFF
|
2017-01-18 02:09:52 +01:00
|
|
|
-DLLVM_INCLUDE_TESTS=OFF
|
2017-07-14 00:23:37 +02:00
|
|
|
-DCLANG_DEFAULT_CXX_STDLIB=libc++
|
2017-01-18 02:09:52 +01:00
|
|
|
-DCLANG_INCLUDE_TESTS=OFF
|
|
|
|
-DCLANG_TOOL_C_INDEX_TEST_BUILD=OFF
|
2020-03-28 16:53:46 +01:00
|
|
|
-DDEFAULT_SYSROOT=$(dirname $TERMUX_PREFIX)
|
2017-02-12 20:57:51 +01:00
|
|
|
-DLLVM_LINK_LLVM_DYLIB=ON
|
2017-01-18 02:09:52 +01:00
|
|
|
-DLLVM_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/llvm-tblgen
|
2018-03-20 23:10:53 +01:00
|
|
|
-DCLANG_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/clang-tblgen
|
|
|
|
-DLIBOMP_ENABLE_SHARED=FALSE
|
|
|
|
-DOPENMP_ENABLE_LIBOMPTARGET=OFF
|
|
|
|
-DLLVM_BINUTILS_INCDIR=$TERMUX_PREFIX/include
|
|
|
|
-DLLVM_ENABLE_SPHINX=ON
|
|
|
|
-DSPHINX_OUTPUT_MAN=ON
|
2019-03-21 05:42:58 +01:00
|
|
|
-DLLVM_TARGETS_TO_BUILD=all
|
2020-04-10 08:56:52 +02:00
|
|
|
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR;RISCV
|
2018-03-20 23:10:53 +01:00
|
|
|
-DPERL_EXECUTABLE=$(which perl)
|
2018-04-07 00:50:40 +02:00
|
|
|
-DLLVM_ENABLE_FFI=ON
|
2020-09-24 09:47:23 +02:00
|
|
|
-DANDROID_NDK_VERSION=${TERMUX_NDK_VERSION_NUM}
|
2018-03-20 23:10:53 +01:00
|
|
|
"
|
2020-09-23 21:55:12 +02:00
|
|
|
|
|
|
|
if [ $TERMUX_ARCH_BITS = 32 ]; then
|
|
|
|
# Do not set _FILE_OFFSET_BITS=64
|
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_FORCE_SMALLFILE_FOR_ANDROID=on"
|
|
|
|
fi
|
|
|
|
|
2019-08-12 17:28:41 +02:00
|
|
|
TERMUX_PKG_FORCE_CMAKE=true
|
|
|
|
TERMUX_PKG_HAS_DEBUG=false
|
2019-06-01 11:17:01 +02:00
|
|
|
# Debug build succeeds but make install with:
|
|
|
|
# cp: cannot stat '../src/projects/openmp/runtime/exports/common.min.50.ompt.optional/include/omp.h': No such file or directory
|
|
|
|
# common.min.50.ompt.optional should be common.deb.50.ompt.optional when doing debug build
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2020-07-16 23:58:48 +02:00
|
|
|
termux_step_post_get_source() {
|
2020-03-26 13:53:28 +01:00
|
|
|
if [ "$TERMUX_PKG_QUICK_REBUILD" = "false" ]; then
|
2020-02-15 08:19:37 +01:00
|
|
|
mv clang-${TERMUX_PKG_VERSION}.src tools/clang
|
2020-07-09 01:18:41 +02:00
|
|
|
mv clang-tools-extra-${TERMUX_PKG_VERSION}.src tools/clang/tools/extra
|
2020-02-15 08:19:37 +01:00
|
|
|
mv lld-${TERMUX_PKG_VERSION}.src tools/lld
|
|
|
|
mv openmp-${TERMUX_PKG_VERSION}.src projects/openmp
|
2020-09-21 03:42:12 +02:00
|
|
|
mv compiler-rt-${TERMUX_PKG_VERSION}.src projects/compiler-rt
|
2020-09-21 03:44:33 +02:00
|
|
|
mv polly-${TERMUX_PKG_VERSION}.src tools/polly
|
2020-02-15 08:19:37 +01:00
|
|
|
fi
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
|
|
|
|
2019-02-08 10:37:29 +01:00
|
|
|
termux_step_host_build() {
|
2017-01-18 04:06:03 +01:00
|
|
|
termux_setup_cmake
|
2020-04-10 08:56:52 +02:00
|
|
|
termux_setup_ninja
|
|
|
|
|
|
|
|
cmake -G Ninja $TERMUX_PKG_SRCDIR
|
|
|
|
ninja -j $TERMUX_MAKE_PROCESSES clang-tblgen llvm-tblgen
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
|
|
|
|
2019-02-08 10:37:29 +01:00
|
|
|
termux_step_pre_configure() {
|
2020-03-26 13:53:28 +01:00
|
|
|
if [ "$TERMUX_PKG_QUICK_REBUILD" = "false" ]; then
|
2020-02-15 08:19:37 +01:00
|
|
|
mkdir projects/openmp/runtime/src/android
|
|
|
|
cp $TERMUX_PKG_BUILDER_DIR/nl_types.h projects/openmp/runtime/src/android
|
|
|
|
cp $TERMUX_PKG_BUILDER_DIR/nltypes_stubs.cpp projects/openmp/runtime/src/android
|
|
|
|
fi
|
2018-03-20 23:10:53 +01:00
|
|
|
|
2017-07-01 02:41:21 +02:00
|
|
|
export LLVM_DEFAULT_TARGET_TRIPLE=$TERMUX_HOST_PLATFORM
|
|
|
|
export LLVM_TARGET_ARCH
|
2016-06-20 00:30:31 +02:00
|
|
|
if [ $TERMUX_ARCH = "arm" ]; then
|
|
|
|
LLVM_TARGET_ARCH=ARM
|
2016-01-05 15:15:12 +01:00
|
|
|
elif [ $TERMUX_ARCH = "aarch64" ]; then
|
|
|
|
LLVM_TARGET_ARCH=AArch64
|
2016-06-20 00:30:31 +02:00
|
|
|
elif [ $TERMUX_ARCH = "i686" ]; then
|
|
|
|
LLVM_TARGET_ARCH=X86
|
|
|
|
elif [ $TERMUX_ARCH = "x86_64" ]; then
|
|
|
|
LLVM_TARGET_ARCH=X86
|
|
|
|
else
|
2017-03-05 03:30:38 +01:00
|
|
|
termux_error_exit "Invalid arch: $TERMUX_ARCH"
|
2016-06-20 00:30:31 +02:00
|
|
|
fi
|
2019-02-09 12:16:54 +01:00
|
|
|
# see CMakeLists.txt and tools/clang/CMakeLists.txt
|
2020-04-10 08:56:52 +02:00
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_TARGET_ARCH=$LLVM_TARGET_ARCH"
|
2018-04-07 00:50:40 +02:00
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_HOST_TRIPLE=$LLVM_DEFAULT_TARGET_TRIPLE"
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
2020-04-10 08:56:52 +02:00
|
|
|
|
2019-02-08 10:37:29 +01:00
|
|
|
termux_step_post_make_install() {
|
2018-03-20 23:10:53 +01:00
|
|
|
if [ $TERMUX_ARCH = "arm" ]; then
|
2020-05-09 04:26:35 +02:00
|
|
|
cp $TERMUX_PKG_SRCDIR/projects/openmp/runtime/exports/common/include/omp.h $TERMUX_PREFIX/include
|
2018-03-20 23:10:53 +01:00
|
|
|
else
|
2020-05-09 04:26:35 +02:00
|
|
|
cp $TERMUX_PKG_SRCDIR/projects/openmp/runtime/exports/common.ompt.optional/include/omp.h $TERMUX_PREFIX/include
|
2020-04-10 08:56:52 +02:00
|
|
|
fi
|
|
|
|
|
2019-08-13 00:39:35 +02:00
|
|
|
if [ "$TERMUX_CMAKE_BUILD" = Ninja ]; then
|
2018-08-22 07:56:49 +02:00
|
|
|
ninja docs-llvm-man
|
|
|
|
else
|
|
|
|
make docs-llvm-man
|
|
|
|
fi
|
|
|
|
|
2018-03-20 23:10:53 +01:00
|
|
|
cp docs/man/* $TERMUX_PREFIX/share/man/man1
|
2016-08-11 15:26:06 +02:00
|
|
|
cd $TERMUX_PREFIX/bin
|
|
|
|
|
2017-01-16 11:48:20 +01:00
|
|
|
for tool in clang clang++ cc c++ cpp gcc g++ ${TERMUX_HOST_PLATFORM}-{clang,clang++,gcc,g++,cpp}; do
|
2020-04-10 08:56:52 +02:00
|
|
|
ln -f -s clang-${TERMUX_PKG_VERSION:0:2} $tool
|
2016-08-16 19:09:51 +02:00
|
|
|
done
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
2017-07-01 02:41:21 +02:00
|
|
|
|
2019-02-08 10:37:29 +01:00
|
|
|
termux_step_post_massage() {
|
2020-04-10 08:56:52 +02:00
|
|
|
# Not added to the package but kept around on the host for other packages like rust,
|
|
|
|
# which relies on LLVM, to use for configuration.
|
2017-07-01 02:41:21 +02:00
|
|
|
sed $TERMUX_PKG_BUILDER_DIR/llvm-config.in \
|
2018-04-07 00:50:40 +02:00
|
|
|
-e "s|@TERMUX_PKG_VERSION@|$TERMUX_PKG_VERSION|g" \
|
2017-07-01 02:41:21 +02:00
|
|
|
-e "s|@TERMUX_PKG_SRCDIR@|$TERMUX_PKG_SRCDIR|g" \
|
|
|
|
-e "s|@LLVM_DEFAULT_TARGET_TRIPLE@|$LLVM_DEFAULT_TARGET_TRIPLE|g" \
|
2020-04-10 08:56:52 +02:00
|
|
|
-e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|g" > $TERMUX_PREFIX/bin/llvm-config
|
2017-07-01 02:41:21 +02:00
|
|
|
chmod 755 $TERMUX_PREFIX/bin/llvm-config
|
|
|
|
}
|