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"
|
2018-09-20 02:22:52 +02:00
|
|
|
TERMUX_PKG_VERSION=7.0.0
|
|
|
|
TERMUX_PKG_SHA256=(8bc1f844e6cbde1b652c19c1edebc1864456fd9c78b8c1bea038e51b363fe222
|
|
|
|
550212711c752697d2f82c648714a7221b1207fd9441543ff4aa9e3be45bba55
|
|
|
|
fbcf47c5e543f4cdac6bb9bbbc6327ff24217cd7eafc5571549ad6d237287f9c
|
|
|
|
30662b632f5556c59ee9215c1309f61de50b3ea8e89dcc28ba9a9494bba238ff)
|
2018-06-13 02:15:26 +02:00
|
|
|
TERMUX_PKG_SRCURL=(https://releases.llvm.org/${TERMUX_PKG_VERSION}/llvm-${TERMUX_PKG_VERSION}.src.tar.xz
|
|
|
|
https://releases.llvm.org/${TERMUX_PKG_VERSION}/cfe-${TERMUX_PKG_VERSION}.src.tar.xz
|
|
|
|
https://llvm.org/releases/${TERMUX_PKG_VERSION}/lld-${TERMUX_PKG_VERSION}.src.tar.xz
|
|
|
|
https://releases.llvm.org/${TERMUX_PKG_VERSION}/openmp-${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="
|
|
|
|
bin/clang-check
|
2017-03-15 16:28:36 +01:00
|
|
|
bin/clang-import-test
|
|
|
|
bin/clang-offload-bundler
|
2017-02-12 20:57:51 +01:00
|
|
|
bin/git-clang-format
|
|
|
|
bin/macho-dump
|
2018-03-20 23:10:53 +01:00
|
|
|
lib/libgomp.a
|
|
|
|
lib/libiomp5.a
|
2017-02-12 20:57:51 +01:00
|
|
|
"
|
2018-04-07 00:50:40 +02:00
|
|
|
TERMUX_PKG_DEPENDS="binutils, ncurses, ndk-sysroot, ndk-stl, libffi"
|
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)"
|
2016-08-11 15:26:06 +02:00
|
|
|
TERMUX_PKG_REPLACES=gcc
|
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="
|
2018-10-14 23:12:36 +02: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_BUILD_TESTS=OFF
|
|
|
|
-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
|
2017-01-19 08:58:43 +01:00
|
|
|
-DC_INCLUDE_DIRS=$TERMUX_PREFIX/include
|
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
|
|
|
|
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly
|
|
|
|
-DPERL_EXECUTABLE=$(which perl)
|
2018-04-07 00:50:40 +02:00
|
|
|
-DLLVM_ENABLE_FFI=ON
|
2018-03-20 23:10:53 +01:00
|
|
|
"
|
2017-01-18 02:13:57 +01:00
|
|
|
TERMUX_PKG_FORCE_CMAKE=yes
|
2017-07-31 01:35:17 +02:00
|
|
|
TERMUX_PKG_KEEP_STATIC_LIBRARIES=true
|
2018-06-13 02:12:36 +02:00
|
|
|
TERMUX_PKG_HAS_DEBUG=no
|
2015-06-13 01:03:31 +02:00
|
|
|
|
|
|
|
termux_step_post_extract_package () {
|
2018-06-13 02:15:26 +02:00
|
|
|
mv cfe-${TERMUX_PKG_VERSION}.src tools/clang
|
|
|
|
mv lld-${TERMUX_PKG_VERSION}.src tools/lld
|
|
|
|
mv openmp-${TERMUX_PKG_VERSION}.src projects/openmp
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
termux_step_host_build () {
|
2017-01-18 04:06:03 +01:00
|
|
|
termux_setup_cmake
|
2016-09-04 22:17:03 +02:00
|
|
|
cmake -G "Unix Makefiles" $TERMUX_PKG_SRCDIR \
|
|
|
|
-DLLVM_BUILD_TESTS=OFF \
|
|
|
|
-DLLVM_INCLUDE_TESTS=OFF
|
2017-01-08 13:59:46 +01:00
|
|
|
make -j $TERMUX_MAKE_PROCESSES clang-tblgen llvm-tblgen
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
|
|
|
|
2017-01-15 13:48:05 +01:00
|
|
|
termux_step_pre_configure () {
|
2018-03-20 23:10:53 +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
|
|
|
|
|
2015-06-13 01:03:31 +02:00
|
|
|
cd $TERMUX_PKG_BUILDDIR
|
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
|
2015-06-13 01:03:31 +02:00
|
|
|
# see CMakeLists.txt and tools/clang/CMakeLists.txt
|
2017-01-15 13:48:05 +01:00
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_DEFAULT_TARGET_TRIPLE=$LLVM_DEFAULT_TARGET_TRIPLE"
|
2017-08-02 00:07:31 +02:00
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_TARGET_ARCH=$LLVM_TARGET_ARCH -DLLVM_TARGETS_TO_BUILD=all"
|
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
|
|
|
}
|
|
|
|
termux_step_post_make_install () {
|
2018-03-20 23:10:53 +01:00
|
|
|
if [ $TERMUX_ARCH = "arm" ]; then
|
|
|
|
cp ../src/projects/openmp/runtime/exports/common.min.50/include/omp.h $TERMUX_PREFIX/include
|
|
|
|
else
|
|
|
|
cp ../src/projects/openmp/runtime/exports/common.min.50.ompt.optional/include/omp.h $TERMUX_PREFIX/include
|
|
|
|
fi
|
2018-08-22 07:56:49 +02:00
|
|
|
|
|
|
|
if [ $TERMUX_CMAKE_BUILD = Ninja ]; then
|
|
|
|
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
|
2018-09-20 02:22:52 +02:00
|
|
|
ln -f -s clang-${TERMUX_PKG_VERSION:0:1} $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
|
|
|
|
|
|
|
termux_step_post_massage () {
|
|
|
|
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_PREFIX@|$TERMUX_PREFIX|g" \
|
|
|
|
-e "s|@TERMUX_PKG_SRCDIR@|$TERMUX_PKG_SRCDIR|g" \
|
|
|
|
-e "s|@LLVM_TARGET_ARCH@|$LLVM_TARGET_ARCH|g" \
|
|
|
|
-e "s|@LLVM_DEFAULT_TARGET_TRIPLE@|$LLVM_DEFAULT_TARGET_TRIPLE|g" \
|
|
|
|
-e "s|@TERMUX_ARCH@|$TERMUX_ARCH|g" > $TERMUX_PREFIX/bin/llvm-config
|
|
|
|
chmod 755 $TERMUX_PREFIX/bin/llvm-config
|
|
|
|
}
|