Browse Source

ldc: Update from 1.10 to 1.11, add AArch64 build, update llvm-config

script, and use Ninja to build.
android-5
Joakim 6 years ago
committed by Fredrik Fornwall
parent
commit
d793c38a93
  1. 108
      packages/ldc/build.sh
  2. 2
      packages/ldc/ldc-linker-flags.patch
  3. 62
      packages/ldc/ldc-phobos.patch.beforehostbuild
  4. 2
      packages/ldc/ldc-readme.patch
  5. 52
      packages/ldc/llvm-config.in

108
packages/ldc/build.sh

@ -1,24 +1,26 @@
TERMUX_PKG_HOMEPAGE=https://github.com/ldc-developers/ldc TERMUX_PKG_HOMEPAGE=https://github.com/ldc-developers/ldc
TERMUX_PKG_DESCRIPTION="D programming language compiler, built with LLVM" TERMUX_PKG_DESCRIPTION="D programming language compiler, built with LLVM"
_PKG_MAJOR_VERSION=1.10
TERMUX_PKG_VERSION=() TERMUX_PKG_VERSION=()
TERMUX_PKG_VERSION+=(${_PKG_MAJOR_VERSION}.0) TERMUX_PKG_VERSION+=(1.11.0)
TERMUX_PKG_VERSION+=(6.0.0) # LLVM version TERMUX_PKG_VERSION+=(6.0.1-2) # LLVM version
TERMUX_PKG_VERSION+=(2.080.1) # TOOLS version TERMUX_PKG_VERSION+=(2.081.2) # TOOLS version
TERMUX_PKG_VERSION+=(1.9.0) # DUB version TERMUX_PKG_VERSION+=(1.10.0) # DUB version
TERMUX_PKG_SRCURL=(https://github.com/ldc-developers/ldc/releases/download/v${TERMUX_PKG_VERSION}/ldc-${TERMUX_PKG_VERSION}-src.tar.gz TERMUX_PKG_SRCURL=(https://github.com/ldc-developers/ldc/releases/download/v${TERMUX_PKG_VERSION}/ldc-${TERMUX_PKG_VERSION}-src.tar.gz
https://github.com/ldc-developers/llvm/releases/download/ldc-v${TERMUX_PKG_VERSION[1]}/llvm-${TERMUX_PKG_VERSION[1]}.src.tar.xz https://github.com/ldc-developers/llvm/releases/download/ldc-v${TERMUX_PKG_VERSION[1]}/llvm-${TERMUX_PKG_VERSION[1]}.src.tar.xz
https://github.com/dlang/tools/archive/v${TERMUX_PKG_VERSION[2]}.tar.gz https://github.com/dlang/tools/archive/v${TERMUX_PKG_VERSION[2]}.tar.gz
https://github.com/dlang/dub/archive/v${TERMUX_PKG_VERSION[3]}.tar.gz) https://github.com/dlang/dub/archive/v${TERMUX_PKG_VERSION[3]}.tar.gz
TERMUX_PKG_SHA256=(99b6e2b8dcaf28a2947318fb25e43fa0b96dd3a6377995146f987c4d17dd8371 https://github.com/ldc-developers/ldc/releases/download/v${TERMUX_PKG_VERSION}/ldc2-${TERMUX_PKG_VERSION}-linux-x86_64.tar.xz)
5444d9da5929fd9062ac3d7793f484366de8b372411e0e5602ea23c2ff3fdb05 TERMUX_PKG_SHA256=(85464fae47bc605308910afd6cfc6ddeafe95a8ad5b61e2c0c23caff82119f70
d8fe0af45ba0e19a95ad3e1bbb19c005176346bb264c8ddd8272e9195304b625 768a78f5a6e918da7bd8180f9afad94182056fcf2f9b7d1d9bdb67953d7122d0
48f7387e93977d0ece686106c9725add2c4f5f36250da33eaa0dbb66900f9d57) d7dc67d258499e5ee401467f0570b4ca2547deb7720e7cd163b73fccb039a60e
db6c3a9e45408d2431bc3d1138a31b561fb71665c1d89db4b0cb3725b2b12faa
43b826ef2bd0c249115bc83dad12f3638fd6997fdc80a6a7db147f9ae0fa3fe8)
TERMUX_PKG_DEPENDS="clang" TERMUX_PKG_DEPENDS="clang"
TERMUX_PKG_HOSTBUILD=true TERMUX_PKG_HOSTBUILD=true
TERMUX_PKG_BLACKLISTED_ARCHES="aarch64,i686,x86_64" TERMUX_PKG_BLACKLISTED_ARCHES="i686,x86_64"
TERMUX_PKG_FORCE_CMAKE=yes TERMUX_PKG_FORCE_CMAKE=yes
TERMUX_CMAKE_BUILD="Ninja"
#These CMake args are only used to configure a patched LLVM #These CMake args are only used to configure a patched LLVM
TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DLLVM_ENABLE_PIC=ON -DLLVM_ENABLE_PIC=ON
@ -26,7 +28,6 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DLLVM_BUILD_UTILS=OFF -DLLVM_BUILD_UTILS=OFF
-DLLVM_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/llvm-tblgen -DLLVM_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/llvm-tblgen
-DPYTHON_EXECUTABLE=`which python` -DPYTHON_EXECUTABLE=`which python`
-DCOMPILER_RT_INCLUDE_TESTS=OFF
" "
TERMUX_PKG_KEEP_STATIC_LIBRARIES=true TERMUX_PKG_KEEP_STATIC_LIBRARIES=true
TERMUX_PKG_NO_DEVELSPLIT=yes TERMUX_PKG_NO_DEVELSPLIT=yes
@ -37,28 +38,18 @@ termux_step_post_extract_package () {
mv tools-${TERMUX_PKG_VERSION[2]} rdmd mv tools-${TERMUX_PKG_VERSION[2]} rdmd
mv dub-${TERMUX_PKG_VERSION[3]} dub mv dub-${TERMUX_PKG_VERSION[3]} dub
sed "s#\@TERMUX_PKG_HOSTBUILD\@#$TERMUX_PKG_HOSTBUILD_DIR#" $TERMUX_PKG_BUILDER_DIR/ldc-linker-flags.patch.in > \ export LLVM_TRIPLE=$TERMUX_HOST_PLATFORM
$TERMUX_PKG_BUILDER_DIR/ldc-linker-flags.patch if [ $TERMUX_ARCH = arm ]; then LLVM_TRIPLE=${LLVM_TRIPLE/arm-/armv7a-}; fi
sed $TERMUX_PKG_BUILDER_DIR/llvm-config.in \ sed $TERMUX_PKG_BUILDER_DIR/llvm-config.in \
-e "s|@LLVM_VERSION@|${TERMUX_PKG_VERSION[1]}|g" \ -e "s|@LLVM_VERSION@|${TERMUX_PKG_VERSION[1]}|g" \
-e "s|@LLVM_BUILD_DIR@|$TERMUX_PKG_BUILDDIR/llvm|g" \ -e "s|@LLVM_BUILD_DIR@|$TERMUX_PKG_BUILDDIR/llvm|g" \
-e "s|@TERMUX_PKG_SRCDIR@|$TERMUX_PKG_SRCDIR|g" \ -e "s|@TERMUX_PKG_SRCDIR@|$TERMUX_PKG_SRCDIR|g" \
-e "s|@LLVM_TARGETS@|ARM AArch64 X86|g" \ -e "s|@LLVM_DEFAULT_TARGET_TRIPLE@|$LLVM_TRIPLE|g" \
-e "s|@LLVM_DEFAULT_TARGET_TRIPLE@|armv7-none-linux-android|g" \ -e "s|@LLVM_TARGETS@|ARM AArch64 X86|g" > $TERMUX_PKG_BUILDDIR/llvm-config
-e "s|@TERMUX_ARCH@|$TERMUX_ARCH|g" > $TERMUX_PKG_BUILDDIR/llvm-config
chmod 755 $TERMUX_PKG_BUILDDIR/llvm-config chmod 755 $TERMUX_PKG_BUILDDIR/llvm-config
} }
termux_step_host_build () { termux_step_host_build () {
termux_download \
https://github.com/ldc-developers/ldc/releases/download/v${TERMUX_PKG_VERSION}/ldc2-${TERMUX_PKG_VERSION}-linux-x86_64.tar.xz \
$TERMUX_PKG_CACHEDIR/ldc2-${TERMUX_PKG_VERSION}-linux-x86_64.tar.xz \
9f93c3c6f2e6e967e2db81ac1c3cb6539bd9147db25213480d436b6a95cf7f06
tar xf $TERMUX_PKG_CACHEDIR/ldc2-${TERMUX_PKG_VERSION}-linux-x86_64.tar.xz
mv ldc2-${TERMUX_PKG_VERSION}-linux-x86_64 ldc-bootstrap
termux_setup_cmake termux_setup_cmake
termux_setup_ninja termux_setup_ninja
cmake -GNinja $TERMUX_PKG_SRCDIR/llvm \ cmake -GNinja $TERMUX_PKG_SRCDIR/llvm \
@ -66,19 +57,23 @@ termux_step_host_build () {
-DLLVM_BUILD_UTILS=OFF \ -DLLVM_BUILD_UTILS=OFF \
-DCOMPILER_RT_INCLUDE_TESTS=OFF -DCOMPILER_RT_INCLUDE_TESTS=OFF
ninja -j $TERMUX_MAKE_PROCESSES llvm-tblgen ninja -j $TERMUX_MAKE_PROCESSES llvm-tblgen
CC="$TERMUX_STANDALONE_TOOLCHAIN/bin/$TERMUX_HOST_PLATFORM-clang" \
./ldc-bootstrap/bin/ldc-build-runtime --ninja -j $TERMUX_MAKE_PROCESSES \
--dFlags="-mtriple=armv7-none-linux-android;-w;-mcpu=cortex-a8" \
--cFlags="-march=armv7-a -mfpu=neon -mfloat-abi=softfp -mthumb -Os -I$TERMUX_PREFIX/include" \
--targetSystem="Android;Linux;UNIX" --ldcSrcDir="$TERMUX_PKG_SRCDIR"
} }
termux_step_pre_configure () { termux_step_pre_configure () {
rm $TERMUX_PKG_BUILDER_DIR/ldc-linker-flags.patch local LLVM_TARGET_ARCH
if [ $TERMUX_ARCH = "arm" ]; then
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_DEFAULT_TARGET_TRIPLE=armv7a-linux-androideabi" LLVM_TARGET_ARCH=ARM
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_TARGET_ARCH=ARM -DLLVM_TARGETS_TO_BUILD=AArch64;ARM;X86" 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
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TRIPLE}"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_TARGET_ARCH=${LLVM_TARGET_ARCH} -DLLVM_TARGETS_TO_BUILD=AArch64;ARM;X86"
# CPPFLAGS adds the system llvm to the include path, which causes # CPPFLAGS adds the system llvm to the include path, which causes
# conflicts with the local patched llvm when compiling ldc # conflicts with the local patched llvm when compiling ldc
@ -98,38 +93,54 @@ termux_step_post_configure () {
cd "$TERMUX_PKG_BUILDDIR" cd "$TERMUX_PKG_BUILDDIR"
mv llvm-config llvm/bin mv llvm-config llvm/bin
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="-DLLVM_CONFIG=$TERMUX_PKG_BUILDDIR/llvm/bin/llvm-config"
export DMD="$TERMUX_PKG_HOSTBUILD_DIR/ldc-bootstrap/bin/ldmd2" export LDC_FLAGS="-mtriple=$LLVM_TRIPLE"
export DFLAGS="-mtriple=armv7-none-linux-android -mcpu=cortex-a8" if [ $TERMUX_ARCH = arm ]; then LDC_FLAGS="$LDC_FLAGS;-mcpu=cortex-a8"; fi
export LDC_PATH=$TERMUX_PKG_SRCDIR/ldc2-$TERMUX_PKG_VERSION-linux-x86_64
# Couldn't use -DD_COMPILER_FLAGS_ENV_INIT=\"${LDC_FLAGS//;/ }\"" because of the space
TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -DD_FLAGS=$LDC_FLAGS \
-DLLVM_CONFIG=$TERMUX_PKG_BUILDDIR/llvm/bin/llvm-config \
-DD_COMPILER=$LDC_PATH/bin/ldmd2"
termux_step_configure_cmake termux_step_configure_cmake
} }
termux_step_make () { termux_step_make () {
$LDC_PATH/bin/ldc-build-runtime --ninja -j $TERMUX_MAKE_PROCESSES \
--dFlags="$LDC_FLAGS" --cFlags="$CFLAGS -I$TERMUX_PREFIX/include" \
--targetSystem="Android;Linux;UNIX" --ldcSrcDir="$TERMUX_PKG_SRCDIR"
cd llvm cd llvm
if ls ./*akefile &> /dev/null; then if test -f build.ninja; then
make -j $TERMUX_MAKE_PROCESSES ninja -j $TERMUX_MAKE_PROCESSES
fi fi
cd .. cd ..
if ls ./*akefile &> /dev/null; then export DFLAGS="${LDC_FLAGS//;/ }"
make -j $TERMUX_MAKE_PROCESSES ldc2 ldmd2 ldc-build-runtime
if test -f build.ninja; then
ninja -j $TERMUX_MAKE_PROCESSES ldc2 ldmd2 ldc-build-runtime
fi fi
# Build the rdmd scripting wrapper and the dub package manager # Build the rdmd scripting wrapper and the dub package manager
D_FLAGS="-w -dw -O" DMD=$LDC_PATH/bin/ldmd2
D_FLAGS="-w -de -O"
D_LDFLAGS="-fuse-ld=bfd -L$TERMUX_PKG_BUILDDIR/ldc-build-runtime.tmp/lib -lphobos2-ldc -ldruntime-ldc -Wl,--gc-sections -ldl -lm -fPIE -pie -Wl,-z,nocopyreloc ${LDFLAGS}"
if [ $TERMUX_ARCH = arm ]; then D_LDFLAGS="$D_LDFLAGS -Wl,--fix-cortex-a8"; fi
$DMD $D_FLAGS -c $TERMUX_PKG_SRCDIR/rdmd/rdmd.d -of=$TERMUX_PKG_BUILDDIR/bin/rdmd.o $DMD $D_FLAGS -c $TERMUX_PKG_SRCDIR/rdmd/rdmd.d -of=$TERMUX_PKG_BUILDDIR/bin/rdmd.o
D_LDFLAGS="-fuse-ld=bfd -L${TERMUX_PKG_HOSTBUILD_DIR}/ldc-build-runtime.tmp/lib -lphobos2-ldc -ldruntime-ldc -Wl,--gc-sections -ldl -lm -Wl,--fix-cortex-a8 -fPIE -pie -Wl,-z,nocopyreloc ${LDFLAGS}"
$CC $TERMUX_PKG_BUILDDIR/bin/rdmd.o $D_LDFLAGS -o $TERMUX_PKG_BUILDDIR/bin/rdmd $CC $TERMUX_PKG_BUILDDIR/bin/rdmd.o $D_LDFLAGS -o $TERMUX_PKG_BUILDDIR/bin/rdmd
cd $TERMUX_PKG_SRCDIR/dub cd $TERMUX_PKG_SRCDIR/dub
$DMD $D_FLAGS -version=DubUseCurl -Isource -c @build-files.txt -of=$TERMUX_PKG_BUILDDIR/bin/dub.o $DMD $D_FLAGS -version=DubUseCurl -Isource -c @build-files.txt -of=$TERMUX_PKG_BUILDDIR/bin/dub.o
cd $TERMUX_PKG_BUILDDIR
$CC $TERMUX_PKG_BUILDDIR/bin/dub.o $D_LDFLAGS -o $TERMUX_PKG_BUILDDIR/bin/dub $CC $TERMUX_PKG_BUILDDIR/bin/dub.o $D_LDFLAGS -o $TERMUX_PKG_BUILDDIR/bin/dub
} }
termux_step_make_install () { termux_step_make_install () {
cp bin/{dub,ldc-build-runtime,ldc2,ldmd2,rdmd} $TERMUX_PREFIX/bin cp bin/{dub,ldc-build-runtime,ldc2,ldmd2,rdmd} $TERMUX_PREFIX/bin
cp $TERMUX_PKG_HOSTBUILD_DIR/ldc-build-runtime.tmp/lib/lib{druntime,phobos2}*.a $TERMUX_PREFIX/lib cp $TERMUX_PKG_BUILDDIR/ldc-build-runtime.tmp/lib/lib{druntime,phobos2}*.a $TERMUX_PREFIX/lib
sed -i "/runtime\/druntime\/src/d" bin/ldc2.conf sed -i "/runtime\/druntime\/src/d" bin/ldc2.conf
sed -i "/runtime\/jit-rt\/d/d" bin/ldc2.conf sed -i "/runtime\/jit-rt\/d/d" bin/ldc2.conf
sed -i "s|$TERMUX_PKG_SRCDIR/runtime/phobos|%%ldcbinarypath%%/../include/d|" bin/ldc2.conf sed -i "s|$TERMUX_PKG_SRCDIR/runtime/phobos|%%ldcbinarypath%%/../include/d|" bin/ldc2.conf
@ -138,10 +149,9 @@ termux_step_make_install () {
rm -Rf $TERMUX_PREFIX/include/d rm -Rf $TERMUX_PREFIX/include/d
mkdir $TERMUX_PREFIX/include/d mkdir $TERMUX_PREFIX/include/d
cp -r $TERMUX_PKG_SRCDIR/runtime/druntime/src/{core,etc,ldc,object.d} $TERMUX_PREFIX/include/d cp -r $TERMUX_PKG_SRCDIR/runtime/druntime/src/{core,etc,ldc,object.d} $TERMUX_PREFIX/include/d
cp $TERMUX_PKG_HOSTBUILD_DIR/ldc-bootstrap/import/ldc/gccbuiltins_arm.di $TERMUX_PREFIX/include/d/ldc cp $LDC_PATH/import/ldc/gccbuiltins_{aarch64,arm,x86}.di $TERMUX_PREFIX/include/d/ldc
cp -r $TERMUX_PKG_SRCDIR/runtime/phobos/etc/c $TERMUX_PREFIX/include/d/etc cp -r $TERMUX_PKG_SRCDIR/runtime/phobos/etc/c $TERMUX_PREFIX/include/d/etc
rm -Rf $TERMUX_PREFIX/include/d/etc/c/zlib rm -Rf $TERMUX_PREFIX/include/d/etc/c/zlib
find $TERMUX_PKG_SRCDIR/runtime/phobos/std -name "*.orig" -delete
cp -r $TERMUX_PKG_SRCDIR/runtime/phobos/std $TERMUX_PREFIX/include/d cp -r $TERMUX_PKG_SRCDIR/runtime/phobos/std $TERMUX_PREFIX/include/d
rm -Rf $TERMUX_PREFIX/share/ldc rm -Rf $TERMUX_PREFIX/share/ldc

2
packages/ldc/ldc-linker-flags.patch.in → packages/ldc/ldc-linker-flags.patch

@ -8,7 +8,7 @@ index 336bbdbc..4b9e8c88 100644
- include(ExtractDMDSystemLinker) - include(ExtractDMDSystemLinker)
+ #include(ExtractDMDSystemLinker) + #include(ExtractDMDSystemLinker)
+ set(D_LINKER_ARGS "-fuse-ld=bfd;-L@TERMUX_PKG_HOSTBUILD@/ldc-build-runtime.tmp/lib;-lphobos2-ldc;-ldruntime-ldc;-Wl,--gc-sections") + set(D_LINKER_ARGS "-fuse-ld=bfd;-Lldc-build-runtime.tmp/lib;-lphobos2-ldc;-ldruntime-ldc;-Wl,--gc-sections")
message(STATUS "Host D compiler linker program: ${D_LINKER_COMMAND}") message(STATUS "Host D compiler linker program: ${D_LINKER_COMMAND}")
message(STATUS "Host D compiler linker flags: ${D_LINKER_ARGS}") message(STATUS "Host D compiler linker flags: ${D_LINKER_ARGS}")
list(APPEND LDC_LINKERFLAG_LIST ${D_LINKER_ARGS}) list(APPEND LDC_LINKERFLAG_LIST ${D_LINKER_ARGS})

62
packages/ldc/ldc-phobos.patch.beforehostbuild

@ -1,62 +0,0 @@
diff --git a/std/stdio.d b/std/stdio.d
index 0c315026..8b1860d0 100644
--- a/std/stdio.d
+++ b/runtime/phobos/std/stdio.d
@@ -310,6 +310,45 @@ else version (GENERIC_IO)
void funlockfile(FILE*);
}
+ version(CRuntime_Bionic)
+ {
+ import core.stdc.wchar_ : mbstate_t;
+ import core.sys.posix.sys.types : pthread_mutex_t;
+
+ extern(C) struct wchar_io_data
+ {
+ mbstate_t wcio_mbstate_in;
+ mbstate_t wcio_mbstate_out;
+ wchar_t[1] wcio_ungetwc_buf;
+ size_t wcio_ungetwc_inbuf;
+ int wcio_mode;
+ }
+
+ extern(C) struct __sfileext
+ {
+ __sbuf _ub;
+ wchar_io_data _wcio;
+ pthread_mutex_t _lock;
+ }
+
+ void bionic_lock(FILE* foo)
+ {
+ if( foo == stdout._p.handle || foo == stdin._p.handle || foo == stderr._p.handle)
+ {
+ auto ext = cast(__sfileext*) foo._ext._base;
+ if (ext._lock.value == 0)
+ {
+ // A bionic regression in Android 5.0 leaves
+ // the mutex for stdout/err/in uninitialized,
+ // so check for that and initialize it.
+ printf("lock is zero, initializing...\n");
+ ext._lock.value = 0x4000;
+ }
+ }
+ flockfile(foo);
+ }
+ }
+
int fputc_unlocked(int c, _iobuf* fp) { return fputc(c, cast(shared) fp); }
int fputwc_unlocked(wchar_t c, _iobuf* fp)
{
@@ -328,7 +367,10 @@ else version (GENERIC_IO)
alias FGETC = fgetc_unlocked;
alias FGETWC = fgetwc_unlocked;
- alias FLOCK = flockfile;
+ version(CRuntime_Bionic)
+ alias FLOCK = bionic_lock;
+ else
+ alias FLOCK = flockfile;
alias FUNLOCK = funlockfile;
}
else

2
packages/ldc/ldc-readme.patch

@ -5,7 +5,7 @@ index 00000000..cd578cb7
+++ b/README +++ b/README
@@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
+This is LDC, the LLVM-based D compiler. It will natively +This is LDC, the LLVM-based D compiler. It will natively
+compile D on Android/ARM devices. +compile D on Android devices.
+ +
+The compiler configuration file is etc/ldc2.conf, and by +The compiler configuration file is etc/ldc2.conf, and by
+default only include/d is on the module search path. +default only include/d is on the module search path.

52
packages/ldc/llvm-config.in

@ -40,25 +40,54 @@ Typical components:
engine Either a native JIT or a bitcode interpreter." engine Either a native JIT or a bitcode interpreter."
} }
arch=@TERMUX_ARCH@
version=@LLVM_VERSION@ version=@LLVM_VERSION@
prefix=@LLVM_BUILD_DIR@ prefix=@LLVM_BUILD_DIR@
has_rtti=NO has_rtti=NO
CPPFLAGS="-I@TERMUX_PKG_SRCDIR@/llvm/include -I${prefix}/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" CPPFLAGS="-I@TERMUX_PKG_SRCDIR@/llvm/include -I${prefix}/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
CFLAGS="${CPPFLAGS} -Os -fPIC -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers" CFLAGS="${CPPFLAGS} ${CFLAGS} -fPIC -Werror=date-time -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic \
CFLAGS="${CFLAGS} -pedantic -Wno-long-long -Wdelete-non-virtual-dtor -Werror=date-time -ffunction-sections" -Wno-long-long -Wcovered-switch-default -Wdelete-non-virtual-dtor -Wstring-conversion \
CFLAGS="${CFLAGS} -fdata-sections -DNDEBUG" -ffunction-sections -fdata-sections -Os -DNDEBUG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS \
-D__STDC_LIMIT_MACROS"
CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden -Wcast-qual -Wnon-virtual-dtor -std=c++11 -fno-exceptions" CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden -Wcast-qual -Wnon-virtual-dtor -std=c++11 -fno-exceptions"
if [ "$has_rtti" != "YES" ]; then CXXFLAGS="$CXXFLAGS -fno-rtti"; fi if [ "$has_rtti" != "YES" ]; then CXXFLAGS="$CXXFLAGS -fno-rtti"; fi
LDFLAGS="-L${prefix}/lib" LDFLAGS="-L${prefix}/lib"
LIBFILE="${prefix}/lib/libLLVM-$version.so" LIBFILE="${prefix}/lib/libLLVM-$version.so"
LLVM_LIBRARIES="-lLLVMTableGen -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMARMUtils -lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMTestingSupport -lLLVMCoverage -lLLVMLineEditor -lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMOrcJIT -lLLVMObjectYAML -lLLVMFuzzMutate -lLLVMInterpreter -lLLVMWindowsManifest -lLLVMMIRParser -lLLVMLibDriver -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMExecutionEngine -lLLVMTarget -lLLVMRuntimeDyld -lgtest_main -lgtest -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMScalarOpts -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMDebugInfoDWARF -lLLVMDlltoolDriver -lLLVMOption -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle"
components="aarch64 aarch64asmparser aarch64asmprinter aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils all all-targets analysis arm armasmparser armasmprinter armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter binaryformat bitreader bitwriter codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine fuzzmutate globalisel gtest gtest_main instcombine instrumentation interpreter ipo irreader libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser mirparser native nativecodegen objcarcopts object objectyaml option orcjit passes profiledata runtimedyld scalaropts selectiondag support symbolize tablegen target testingsupport transformutils vectorize windowsmanifest x86 x86asmparser x86asmprinter x86codegen x86desc x86disassembler x86info x86utils"
components="aarch64 aarch64asmparser aarch64asmprinter aarch64codegen aarch64desc \
aarch64disassembler aarch64info aarch64utils all all-targets amdgpu amdgpuasmparser amdgpuasmprinter \
amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armasmprinter \
armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter binaryformat bitreader bitwriter \
bpf bpfasmparser bpfasmprinter bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines coverage \
debuginfocodeview debuginfodwarf debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine \
fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo \
instcombine instrumentation interpreter ipo irreader lanai lanaiasmparser lanaiasmprinter lanaicodegen \
lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser \
mips mipsasmparser mipsasmprinter mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 \
msp430asmprinter msp430codegen msp430desc msp430info native nativecodegen nvptx nvptxasmprinter \
nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes powerpc powerpcasmparser \
powerpcasmprinter powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata runtimedyld scalaropts \
selectiondag sparc sparcasmparser sparcasmprinter sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize \
systemz systemzasmparser systemzasmprinter systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target \
transformutils vectorize webassembly webassemblyasmprinter webassemblycodegen webassemblydesc webassemblydisassembler \
webassemblyinfo windowsmanifest x86 x86asmparser x86asmprinter x86codegen x86desc x86disassembler x86info x86utils xcore \
xcoreasmprinter xcorecodegen xcoredesc xcoredisassembler xcoreinfo"
static_libs="-lLLVMTableGen -lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMMIRParser -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoDWARF \
-lLLVMCoverage -lLLVMDlltoolDriver -lLLVMOrcJIT -lLLVMARMDisassembler \
-lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMARMUtils \
-lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter \
-lLLVMAArch64Utils -lLLVMObjectYAML -lLLVMLibDriver -lLLVMOption -lLLVMWindowsManifest -lLLVMFuzzMutate -lLLVMX86Disassembler \
-lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF \
-lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMLineEditor -lLLVMInterpreter \
-lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMCodeGen -lLLVMTarget -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize \
-lLLVMScalarOpts -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis \
-lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle"
shared_libs="-lLLVM-$version"
libs=$shared_libs
handle_args () { handle_args () {
case "${1##--}" in case "${1##--}" in
version) echo "$version";; link-shared) libs=$shared_libs ;;
link-static) libs=$static_libs ;;
version) echo "$version\n";;
prefix) echo "$prefix";; prefix) echo "$prefix";;
src-root) echo "@TERMUX_PKG_SRCDIR@";; src-root) echo "@TERMUX_PKG_SRCDIR@";;
obj-root) echo "$prefix";; obj-root) echo "$prefix";;
@ -69,8 +98,8 @@ handle_args () {
cflags) echo "$CFLAGS";; cflags) echo "$CFLAGS";;
cxxflags) echo "$CXXFLAGS";; cxxflags) echo "$CXXFLAGS";;
ldflags) echo "$LDFLAGS";; ldflags) echo "$LDFLAGS";;
system-libs) echo "-lc -ldl -lncurses -lz -lm";; system-libs) echo "-lc -ldl -lcurses -lz -lm";;
libs) echo "$LLVM_LIBRARIES";; libs) echo "$static_libs";;
libnames) echo "libLLVM-$version.so";; libnames) echo "libLLVM-$version.so";;
libfiles) echo "$LIBFILE";; libfiles) echo "$LIBFILE";;
components) echo "$components";; components) echo "$components";;
@ -83,9 +112,6 @@ handle_args () {
has-global-isel) echo "OFF";; has-global-isel) echo "OFF";;
shared-mode) echo "shared";; shared-mode) echo "shared";;
cmakedir) echo "$prefix/lib/cmake/llvm";; cmakedir) echo "$prefix/lib/cmake/llvm";;
# don't know what these do
link-shared) ;;
link-static) ;;
*) show_help >&2;; *) show_help >&2;;
esac esac
} }

Loading…
Cancel
Save