2015-06-13 01:03:31 +02:00
|
|
|
TERMUX_PKG_HOMEPAGE=http://clang.llvm.org/
|
|
|
|
TERMUX_PKG_DESCRIPTION="C and C++ frontend for the LLVM compiler"
|
2016-09-04 22:17:03 +02:00
|
|
|
_PKG_MAJOR_VERSION=3.9
|
2016-12-21 02:34:42 +01:00
|
|
|
TERMUX_PKG_VERSION=${_PKG_MAJOR_VERSION}.1
|
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
|
2016-12-21 02:34:42 +01:00
|
|
|
TERMUX_PKG_SHA256=1fd90354b9cf19232e8f168faf2220e79be555df3aa743242700879e8fd329ee
|
2015-06-13 01:03:31 +02:00
|
|
|
TERMUX_PKG_HOSTBUILD=true
|
|
|
|
TERMUX_PKG_RM_AFTER_INSTALL="bin/macho-dump bin/bugpoint bin/llvm-tblgen lib/BugpointPasses.so lib/LLVMHello.so"
|
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.
|
|
|
|
TERMUX_PKG_CONFLICTS=gcc
|
|
|
|
TERMUX_PKG_REPLACES=gcc
|
2015-06-13 01:03:31 +02:00
|
|
|
|
|
|
|
termux_step_post_extract_package () {
|
|
|
|
CLANG_SRC_TAR=cfe-${TERMUX_PKG_VERSION}.src.tar.xz
|
2016-09-04 22:17:03 +02:00
|
|
|
test ! -f $TERMUX_PKG_CACHEDIR/$CLANG_SRC_TAR && termux_download http://llvm.org/releases/${TERMUX_PKG_VERSION}/$CLANG_SRC_TAR \
|
|
|
|
$TERMUX_PKG_CACHEDIR/$CLANG_SRC_TAR \
|
2016-12-21 02:34:42 +01:00
|
|
|
e6c4cebb96dee827fa0470af313dff265af391cb6da8d429842ef208c8f25e63
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2015-12-14 01:10:44 +01:00
|
|
|
# COMPILERRT_SRC_TAR=compiler-rt-${TERMUX_PKG_VERSION}.src.tar.xz
|
|
|
|
# test ! -f $TERMUX_PKG_CACHEDIR/$COMPILERRT_SRC_TAR && curl http://llvm.org/releases/${TERMUX_PKG_VERSION}/${COMPILERRT_SRC_TAR} > $TERMUX_PKG_CACHEDIR/$COMPILERRT_SRC_TAR
|
|
|
|
|
2015-06-13 01:03:31 +02:00
|
|
|
cd $TERMUX_PKG_SRCDIR
|
2015-12-14 01:10:44 +01:00
|
|
|
|
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
|
2015-09-04 17:09:19 +02:00
|
|
|
|
2015-12-14 01:10:44 +01:00
|
|
|
# tar -xf $TERMUX_PKG_CACHEDIR/$COMPILERRT_SRC_TAR -C projects
|
|
|
|
# mv projects/compiler-rt-${TERMUX_PKG_VERSION}.src projects/compiler-rt
|
|
|
|
|
2015-09-04 17:09:19 +02:00
|
|
|
# Remove symlinks which are not overwritten on repeated builds even with CMAKE_INSTALL_ALWAYS=1:
|
|
|
|
rm -f $TERMUX_PREFIX/{bin/llvm*,lib/libLLVM*,lib/libclang*}
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
termux_step_host_build () {
|
2016-09-04 22:17:03 +02:00
|
|
|
cmake -G "Unix Makefiles" $TERMUX_PKG_SRCDIR \
|
|
|
|
-DLLVM_BUILD_TESTS=OFF \
|
|
|
|
-DLLVM_INCLUDE_TESTS=OFF
|
|
|
|
make -j $TERMUX_MAKE_PROCESSES
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
termux_step_configure () {
|
|
|
|
cd $TERMUX_PKG_BUILDDIR
|
2016-06-20 00:30:31 +02:00
|
|
|
LLVM_DEFAULT_TARGET_TRIPLE=$TERMUX_HOST_PLATFORM
|
|
|
|
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
|
|
|
|
echo "Invalid arch: $TERMUX_ARCH"
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-06-13 01:03:31 +02:00
|
|
|
# see CMakeLists.txt and tools/clang/CMakeLists.txt
|
2016-09-04 22:17:03 +02:00
|
|
|
cmake -G "Unix Makefiles" $TERMUX_PKG_SRCDIR \
|
2015-06-13 01:03:31 +02:00
|
|
|
-DCMAKE_AR=`which ${TERMUX_HOST_PLATFORM}-ar` \
|
|
|
|
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
|
|
|
-DCMAKE_CROSSCOMPILING=True \
|
|
|
|
-DCMAKE_CXX_FLAGS="$CXXFLAGS -lgnustl_shared" \
|
2015-09-04 17:09:19 +02:00
|
|
|
-DCMAKE_INSTALL_ALWAYS=1 \
|
2015-06-13 01:03:31 +02:00
|
|
|
-DCMAKE_INSTALL_PREFIX=$TERMUX_PREFIX \
|
|
|
|
-DCMAKE_LINKER=`which ${TERMUX_HOST_PLATFORM}-ld` \
|
|
|
|
-DCMAKE_RANLIB=`which ${TERMUX_HOST_PLATFORM}-ranlib` \
|
2016-08-16 19:09:51 +02:00
|
|
|
-DCMAKE_SYSTEM_NAME=Android \
|
2015-06-13 01:03:31 +02:00
|
|
|
-DLLVM_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/llvm-tblgen \
|
2015-10-11 10:11:08 +02:00
|
|
|
-DLLVM_DEFAULT_TARGET_TRIPLE=$LLVM_DEFAULT_TARGET_TRIPLE \
|
2015-06-13 01:03:31 +02:00
|
|
|
-DLLVM_TARGET_ARCH=$LLVM_TARGET_ARCH \
|
|
|
|
-DLLVM_TARGETS_TO_BUILD=$LLVM_TARGET_ARCH \
|
|
|
|
-DLLVM_ENABLE_PIC=ON \
|
2016-09-04 22:17:03 +02:00
|
|
|
-DLLVM_BUILD_TESTS=OFF \
|
|
|
|
-DLLVM_INCLUDE_TESTS=OFF \
|
2015-06-13 01:03:31 +02:00
|
|
|
-DCLANG_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/clang-tblgen \
|
2016-09-04 22:17:03 +02:00
|
|
|
-DCLANG_INCLUDE_TESTS=OFF \
|
|
|
|
-DCLANG_TOOL_C_INDEX_TEST_BUILD=OFF \
|
2015-06-13 01:03:31 +02:00
|
|
|
-DC_INCLUDE_DIRS=$TERMUX_PREFIX/include \
|
2016-09-04 22:17:03 +02:00
|
|
|
-DBUILD_SHARED_LIBS=ON
|
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
|
|
|
|
|
2016-08-16 19:09:51 +02:00
|
|
|
for tool in clang clang++ cc c++ cpp gcc g++ ${TERMUX_HOST_PLATFORM}-{gcc,g++,cpp}; do
|
|
|
|
ln -f -s clang-${_PKG_MAJOR_VERSION} $tool
|
|
|
|
done
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|