You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
4.2 KiB
128 lines
4.2 KiB
TERMUX_PKG_HOMEPAGE=http://clang.llvm.org/
|
|
TERMUX_PKG_DESCRIPTION="Modular compiler and toolchain technologies library"
|
|
_PKG_MAJOR_VERSION=5.0
|
|
TERMUX_PKG_VERSION=${_PKG_MAJOR_VERSION}.0
|
|
TERMUX_PKG_SRCURL=http://releases.llvm.org/${TERMUX_PKG_VERSION}/llvm-${TERMUX_PKG_VERSION}.src.tar.xz
|
|
TERMUX_PKG_SHA256=e35dcbae6084adcf4abb32514127c5eabd7d63b733852ccdb31e06f1373136da
|
|
TERMUX_PKG_HOSTBUILD=true
|
|
TERMUX_PKG_RM_AFTER_INSTALL="
|
|
bin/bugpoint
|
|
bin/clang-check
|
|
bin/clang-import-test
|
|
bin/clang-offload-bundler
|
|
bin/git-clang-format
|
|
bin/llvm-tblgen
|
|
bin/macho-dump
|
|
bin/sancov
|
|
bin/sanstats
|
|
bin/scan-build
|
|
bin/scan-view
|
|
lib/BugpointPasses.so
|
|
lib/libclang*.a
|
|
lib/libLLVM*.a
|
|
lib/libLTO.so
|
|
lib/LLVMHello.so
|
|
share/man/man1/scan-build.1
|
|
share/scan-build
|
|
share/scan-view
|
|
"
|
|
TERMUX_PKG_DEPENDS="binutils, ncurses, ndk-sysroot, ndk-stl, libgcc"
|
|
# Replace gcc since gcc is deprecated by google on android and is not maintained upstream.
|
|
# Conflict with clang versions earlier than 3.9.1-3 since they bundled llvm.
|
|
TERMUX_PKG_CONFLICTS="gcc, clang (<< 3.9.1-3)"
|
|
TERMUX_PKG_REPLACES=gcc
|
|
# See http://llvm.org/docs/CMake.html:
|
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
|
|
-DPYTHON_EXECUTABLE=`which python`
|
|
-DLLVM_ENABLE_PIC=ON
|
|
-DLLVM_ENABLE_LIBEDIT=OFF
|
|
-DLLVM_BUILD_TESTS=OFF
|
|
-DLLVM_INCLUDE_TESTS=OFF
|
|
-DCLANG_DEFAULT_CXX_STDLIB=libc++
|
|
-DCLANG_INCLUDE_TESTS=OFF
|
|
-DCLANG_TOOL_C_INDEX_TEST_BUILD=OFF
|
|
-DC_INCLUDE_DIRS=$TERMUX_PREFIX/include
|
|
-DLLVM_LINK_LLVM_DYLIB=ON
|
|
-DLLVM_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/llvm-tblgen
|
|
-DCLANG_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/clang-tblgen"
|
|
TERMUX_PKG_FORCE_CMAKE=yes
|
|
TERMUX_PKG_KEEP_STATIC_LIBRARIES=true
|
|
|
|
termux_step_post_extract_package () {
|
|
local CLANG_SRC_TAR=cfe-${TERMUX_PKG_VERSION}.src.tar.xz
|
|
termux_download \
|
|
http://releases.llvm.org/${TERMUX_PKG_VERSION}/$CLANG_SRC_TAR \
|
|
$TERMUX_PKG_CACHEDIR/$CLANG_SRC_TAR \
|
|
019f23c2192df793ac746595e94a403908749f8e0c484b403476d2611dd20970
|
|
|
|
tar -xf $TERMUX_PKG_CACHEDIR/$CLANG_SRC_TAR -C tools
|
|
mv tools/cfe-${TERMUX_PKG_VERSION}.src tools/clang
|
|
|
|
local LLD_SRC_TAR=lld-${TERMUX_PKG_VERSION}.src.tar.xz
|
|
termux_download \
|
|
http://llvm.org/releases/${TERMUX_PKG_VERSION}/$LLD_SRC_TAR \
|
|
$TERMUX_PKG_CACHEDIR/$LLD_SRC_TAR \
|
|
399a7920a5278d42c46a7bf7e4191820ec2301457a7d0d4fcc9a4ac05dd53897
|
|
|
|
tar -xf $TERMUX_PKG_CACHEDIR/$LLD_SRC_TAR -C tools
|
|
mv tools/lld-${TERMUX_PKG_VERSION}.src tools/lld
|
|
}
|
|
|
|
termux_step_host_build () {
|
|
termux_setup_cmake
|
|
cmake -G "Unix Makefiles" $TERMUX_PKG_SRCDIR \
|
|
-DLLVM_BUILD_TESTS=OFF \
|
|
-DLLVM_INCLUDE_TESTS=OFF
|
|
make -j $TERMUX_MAKE_PROCESSES clang-tblgen llvm-tblgen
|
|
}
|
|
|
|
termux_step_pre_configure () {
|
|
cd $TERMUX_PKG_BUILDDIR
|
|
export LLVM_DEFAULT_TARGET_TRIPLE=$TERMUX_HOST_PLATFORM
|
|
export LLVM_TARGET_ARCH
|
|
if [ $TERMUX_ARCH = "arm" ]; then
|
|
LLVM_TARGET_ARCH=ARM
|
|
# See https://github.com/termux/termux-packages/issues/282
|
|
LLVM_DEFAULT_TARGET_TRIPLE="armv7a-linux-androideabi"
|
|
elif [ $TERMUX_ARCH = "aarch64" ]; then
|
|
LLVM_TARGET_ARCH=AArch64
|
|
elif [ $TERMUX_ARCH = "i686" ]; then
|
|
LLVM_TARGET_ARCH=X86
|
|
elif [ $TERMUX_ARCH = "x86_64" ]; then
|
|
LLVM_TARGET_ARCH=X86
|
|
else
|
|
termux_error_exit "Invalid arch: $TERMUX_ARCH"
|
|
fi
|
|
# see CMakeLists.txt and tools/clang/CMakeLists.txt
|
|
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=all"
|
|
}
|
|
|
|
termux_step_post_make_install () {
|
|
cd $TERMUX_PREFIX/bin
|
|
|
|
for tool in clang clang++ cc c++ cpp gcc g++ ${TERMUX_HOST_PLATFORM}-{clang,clang++,gcc,g++,cpp}; do
|
|
ln -f -s clang-${_PKG_MAJOR_VERSION} $tool
|
|
done
|
|
|
|
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
|
|
}
|
|
|
|
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
|
|
}
|
|
|