2015-06-13 01:03:31 +02:00
|
|
|
TERMUX_PKG_HOMEPAGE=http://clang.llvm.org/
|
2017-02-12 20:57:51 +01:00
|
|
|
TERMUX_PKG_DESCRIPTION="Modular compiler and toolchain technologies library"
|
2017-09-10 21:50:24 +02:00
|
|
|
_PKG_MAJOR_VERSION=5.0
|
|
|
|
TERMUX_PKG_VERSION=${_PKG_MAJOR_VERSION}.0
|
2015-06-13 01:03:31 +02:00
|
|
|
TERMUX_PKG_SRCURL=http://llvm.org/releases/${TERMUX_PKG_VERSION}/llvm-${TERMUX_PKG_VERSION}.src.tar.xz
|
2017-09-10 21:50:24 +02:00
|
|
|
TERMUX_PKG_SHA256=e35dcbae6084adcf4abb32514127c5eabd7d63b733852ccdb31e06f1373136da
|
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/bugpoint
|
|
|
|
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/llvm-tblgen
|
|
|
|
bin/macho-dump
|
|
|
|
bin/sancov
|
|
|
|
bin/sanstats
|
|
|
|
bin/scan-build
|
|
|
|
bin/scan-view
|
|
|
|
lib/BugpointPasses.so
|
2017-07-31 01:35:17 +02:00
|
|
|
lib/libclang*.a
|
|
|
|
lib/libLLVM*.a
|
2017-02-12 20:57:51 +01:00
|
|
|
lib/libLTO.so
|
|
|
|
lib/LLVMHello.so
|
|
|
|
share/man/man1/scan-build.1
|
|
|
|
share/scan-build
|
|
|
|
share/scan-view
|
|
|
|
"
|
2016-08-11 01:45:41 +02:00
|
|
|
TERMUX_PKG_DEPENDS="binutils, ncurses, ndk-sysroot, ndk-stl, libgcc"
|
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="
|
2017-07-14 00:23:37 +02:00
|
|
|
-DPYTHON_EXECUTABLE=`which python`
|
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
|
|
|
|
-DCLANG_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/clang-tblgen"
|
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
|
2015-06-13 01:03:31 +02:00
|
|
|
|
|
|
|
termux_step_post_extract_package () {
|
2017-04-09 16:54:36 +02:00
|
|
|
local CLANG_SRC_TAR=cfe-${TERMUX_PKG_VERSION}.src.tar.xz
|
2017-03-15 16:28:36 +01:00
|
|
|
termux_download \
|
|
|
|
http://llvm.org/releases/${TERMUX_PKG_VERSION}/$CLANG_SRC_TAR \
|
2016-09-04 22:17:03 +02:00
|
|
|
$TERMUX_PKG_CACHEDIR/$CLANG_SRC_TAR \
|
2017-09-10 21:50:24 +02:00
|
|
|
019f23c2192df793ac746595e94a403908749f8e0c484b403476d2611dd20970
|
2015-06-13 01:03:31 +02:00
|
|
|
|
|
|
|
tar -xf $TERMUX_PKG_CACHEDIR/$CLANG_SRC_TAR -C tools
|
|
|
|
mv tools/cfe-${TERMUX_PKG_VERSION}.src tools/clang
|
|
|
|
}
|
|
|
|
|
|
|
|
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 () {
|
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-05-22 20:54:33 +02:00
|
|
|
# See https://github.com/termux/termux-packages/issues/282
|
|
|
|
LLVM_DEFAULT_TARGET_TRIPLE="armv7a-linux-androideabi"
|
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"
|
|
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_TARGET_ARCH=$LLVM_TARGET_ARCH -DLLVM_TARGETS_TO_BUILD=$LLVM_TARGET_ARCH"
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
termux_step_post_make_install () {
|
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
|
2016-08-16 19:09:51 +02:00
|
|
|
ln -f -s clang-${_PKG_MAJOR_VERSION} $tool
|
|
|
|
done
|
2017-07-31 01:35:17 +02:00
|
|
|
|
|
|
|
local OPENMP_ARCH
|
|
|
|
if [ $TERMUX_ARCH = "i686" ]; then
|
|
|
|
OPENMP_ARCH="i386"
|
|
|
|
else
|
|
|
|
OPENMP_ARCH=$TERMUX_ARCH
|
|
|
|
fi
|
|
|
|
|
|
|
|
local OPENMP_PATH=lib64/clang/5.0/lib/linux/$OPENMP_ARCH/libomp.a
|
|
|
|
cp $TERMUX_STANDALONE_TOOLCHAIN/$OPENMP_PATH $TERMUX_PREFIX/lib
|
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 \
|
|
|
|
-e "s|@_PKG_MAJOR_VERSION@|$_PKG_MAJOR_VERSION|g" \
|
|
|
|
-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
|
|
|
|
}
|