From 6de5db5e295b9187dde9d80bfa8412555b3848c7 Mon Sep 17 00:00:00 2001 From: joakim-noah Date: Tue, 31 Oct 2017 23:40:15 +0530 Subject: [PATCH] ldc: update to 1.5 release (#1731) --- packages/ldc/build.sh | 47 ++++---- ...ldc-config-stdlib.patch.beforehostbuild.in | 11 +- packages/ldc/ldc-linker-flags.patch.in | 2 +- packages/ldc/ldc-llvm-config.patch.in | 68 ----------- packages/ldc/llvm-config.in | 106 ++++++++++++++++++ packages/ldc/rdmd-tempDir.patch | 19 ---- 6 files changed, 136 insertions(+), 117 deletions(-) delete mode 100644 packages/ldc/ldc-llvm-config.patch.in create mode 100644 packages/ldc/llvm-config.in delete mode 100644 packages/ldc/rdmd-tempDir.patch diff --git a/packages/ldc/build.sh b/packages/ldc/build.sh index 7dfbc5eef..fdf0f43bb 100644 --- a/packages/ldc/build.sh +++ b/packages/ldc/build.sh @@ -1,9 +1,9 @@ TERMUX_PKG_HOMEPAGE=https://github.com/ldc-developers/ldc TERMUX_PKG_DESCRIPTION="D programming language compiler, built with LLVM" -_PKG_MAJOR_VERSION=1.4 +_PKG_MAJOR_VERSION=1.5 TERMUX_PKG_VERSION=${_PKG_MAJOR_VERSION}.0 TERMUX_PKG_SRCURL=https://github.com/ldc-developers/ldc/releases/download/v${TERMUX_PKG_VERSION}/ldc-${TERMUX_PKG_VERSION}-src.tar.gz -TERMUX_PKG_SHA256=dd29a5833ae02307c387e87d861d5de588b9b16ea3574ef96f8da1f81bbd7c5c +TERMUX_PKG_SHA256=03659a4b9cafff0cf8d537469dd15579f097c7748a342ea2a5770fa0edd3a084 TERMUX_PKG_DEPENDS="clang" TERMUX_PKG_HOSTBUILD=true TERMUX_PKG_BLACKLISTED_ARCHES="aarch64,i686,x86_64" @@ -21,25 +21,25 @@ TERMUX_PKG_NO_DEVELSPLIT=yes TERMUX_PKG_MAINTAINER="Joakim @joakim-noah" termux_step_post_extract_package () { - local LLVM_SRC_VERSION=4.0.1 + local LLVM_SRC_VERSION=5.0.0-2 termux_download \ https://github.com/ldc-developers/llvm/releases/download/ldc-v${LLVM_SRC_VERSION}/llvm-${LLVM_SRC_VERSION}.src.tar.xz \ $TERMUX_PKG_CACHEDIR/llvm-${LLVM_SRC_VERSION}.src.tar.xz \ - 53dee2054a4da0a292fc55830119ae167812cc0eed5cc670223adc5a8731f71b + 7bb7621ecb05ad9a9a2165bae69c0548c179fdaf7e12e8458897c5e8bc1a6dae tar xf $TERMUX_PKG_CACHEDIR/llvm-${LLVM_SRC_VERSION}.src.tar.xz mv llvm-${LLVM_SRC_VERSION}.src llvm - DMD_COMPILER_VERSION=2.076.0 + DMD_COMPILER_VERSION=2.076.1 termux_download \ http://downloads.dlang.org/releases/2.x/${DMD_COMPILER_VERSION}/dmd.${DMD_COMPILER_VERSION}.linux.tar.xz \ $TERMUX_PKG_CACHEDIR/dmd.${DMD_COMPILER_VERSION}.linux.tar.xz \ - 3e3fc9fbdc61681edea837e9d095a341dda6c325ab4dbc437017239d576ba433 + 1d0b8fb6aadc80f6c5dfe7acf46fc17d2b3de24a0bf46e947352094bb21fef04 termux_download \ https://github.com/dlang/tools/archive/v${DMD_COMPILER_VERSION}.tar.gz \ $TERMUX_PKG_CACHEDIR/tools-v${DMD_COMPILER_VERSION}.tar.gz \ - 5f58dc6492e1abb539291a5fbf2bfb06eed818bd158912f090b55cd712c2a34a + cf42d4e5f9ceb5acfb5bd3000dd9c1ed7120b136f252b33b07fb026f36970e77 tar xf $TERMUX_PKG_CACHEDIR/tools-v${DMD_COMPILER_VERSION}.tar.gz mv tools-${DMD_COMPILER_VERSION} rdmd @@ -56,33 +56,42 @@ termux_step_post_extract_package () { sed "s#\@TERMUX_C_COMPILER\@#$TERMUX_STANDALONE_TOOLCHAIN/bin/$TERMUX_HOST_PLATFORM-clang#" \ $TERMUX_PKG_BUILDER_DIR/ldc-config-stdlib.patch.beforehostbuild.in > \ $TERMUX_PKG_BUILDER_DIR/ldc-config-stdlib.patch.beforehostbuild - sed -i "s#\@TERMUX_C_FLAGS\@#-march=armv7-a -mfpu=neon -mfloat-abi=softfp -mthumb -Oz -I$TERMUX_PREFIX/include#" \ - $TERMUX_PKG_BUILDER_DIR/ldc-config-stdlib.patch.beforehostbuild + sed "s#\@TERMUX_PKG_HOSTBUILD\@#$TERMUX_PKG_HOSTBUILD_DIR#" $TERMUX_PKG_BUILDER_DIR/ldc-linker-flags.patch.in > \ $TERMUX_PKG_BUILDER_DIR/ldc-linker-flags.patch - sed "s#\@TERMUX_PKG_BUILD\@#$TERMUX_PKG_BUILDDIR#" $TERMUX_PKG_BUILDER_DIR/ldc-llvm-config.patch.in > \ - $TERMUX_PKG_BUILDER_DIR/ldc-llvm-config.patch - sed -i "s#\@TERMUX_PKG_SRC\@#$TERMUX_PKG_SRCDIR#" $TERMUX_PKG_BUILDER_DIR/ldc-llvm-config.patch + + sed $TERMUX_PKG_BUILDER_DIR/llvm-config.in \ + -e "s|@LLVM_VERSION@|$LLVM_SRC_VERSION|g" \ + -e "s|@LLVM_BUILD_DIR@|$TERMUX_PKG_BUILDDIR/llvm|g" \ + -e "s|@TERMUX_PKG_SRCDIR@|$TERMUX_PKG_SRCDIR|g" \ + -e "s|@LLVM_TARGETS@|ARM AArch64 X86|g" \ + -e "s|@LLVM_DEFAULT_TARGET_TRIPLE@|armv7-none-linux-android|g" \ + -e "s|@TERMUX_ARCH@|$TERMUX_ARCH|g" > $TERMUX_PKG_BUILDDIR/llvm-config + chmod 755 $TERMUX_PKG_BUILDDIR/llvm-config } termux_step_host_build () { tar xf $TERMUX_PKG_CACHEDIR/dmd.${DMD_COMPILER_VERSION}.linux.tar.xz termux_setup_cmake - cmake -G "Unix Makefiles" $TERMUX_PKG_SRCDIR/llvm \ + termux_setup_ninja + cmake -GNinja $TERMUX_PKG_SRCDIR/llvm \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_TARGETS_TO_BUILD=ARM \ -DLLVM_DEFAULT_TARGET_TRIPLE=armv7-none-linux-android \ -DLLVM_BUILD_TOOLS=OFF \ -DLLVM_BUILD_UTILS=OFF - make -j $TERMUX_MAKE_PROCESSES all llvm-config + ninja -j $TERMUX_MAKE_PROCESSES all llvm-config mkdir ldc-bootstrap cd ldc-bootstrap export DMD="$TERMUX_PKG_HOSTBUILD_DIR/dmd2/linux/bin64/dmd" - cmake -G "Unix Makefiles" $TERMUX_PKG_SRCDIR \ + + cmake -GNinja $TERMUX_PKG_SRCDIR \ + -DD_FLAGS="-w;-mcpu=cortex-a8" \ + -DRT_CFLAGS="-march=armv7-a -mfpu=neon -mfloat-abi=softfp -mthumb -Oz -I$TERMUX_PREFIX/include" \ -DLLVM_CONFIG="$TERMUX_PKG_HOSTBUILD_DIR/bin/llvm-config" - make -j $TERMUX_MAKE_PROCESSES druntime-ldc phobos2-ldc \ + ninja -j $TERMUX_MAKE_PROCESSES druntime-ldc phobos2-ldc \ druntime-ldc-debug phobos2-ldc-debug ldmd2 cd .. } @@ -90,7 +99,6 @@ termux_step_host_build () { termux_step_pre_configure () { rm $TERMUX_PKG_BUILDER_DIR/ldc-config-stdlib.patch.beforehostbuild rm $TERMUX_PKG_BUILDER_DIR/ldc-linker-flags.patch - rm $TERMUX_PKG_BUILDER_DIR/ldc-llvm-config.patch TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_DEFAULT_TARGET_TRIPLE=armv7a-linux-androideabi" TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_TARGET_ARCH=ARM -DLLVM_TARGETS_TO_BUILD=AArch64;ARM;X86" @@ -112,7 +120,8 @@ termux_step_post_configure () { TERMUX_PKG_BUILDDIR=$OLD_TERMUX_PKG_BUILDDIR cd "$TERMUX_PKG_BUILDDIR" - TERMUX_PKG_EXTRA_CONFIGURE_ARGS="" + 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" termux_step_configure_cmake @@ -133,7 +142,7 @@ termux_step_make () { fi # Build the rdmd scripting wrapper and the dub package manager - D_FLAGS="-w -dw -O -inline -release" + D_FLAGS="-w -de -O -inline -release -mcpu=cortex-a8" $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-bootstrap/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 diff --git a/packages/ldc/ldc-config-stdlib.patch.beforehostbuild.in b/packages/ldc/ldc-config-stdlib.patch.beforehostbuild.in index b7e9d888e..c00389e54 100644 --- a/packages/ldc/ldc-config-stdlib.patch.beforehostbuild.in +++ b/packages/ldc/ldc-config-stdlib.patch.beforehostbuild.in @@ -2,20 +2,11 @@ diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 32795da6..091d344b 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt -@@ -78,6 +78,7 @@ file(GLOB_RECURSE DRUNTIME_D_GCSTUB ${RUNTIME_DIR}/src/gcstub/*.d) - list(REMOVE_ITEM DRUNTIME_D ${DRUNTIME_D_GCSTUB}) - # remove some modules in rt/ - list(REMOVE_ITEM DRUNTIME_D -+ ${RUNTIME_DIR}/src/core/stdc/tgmath.d - ${RUNTIME_DIR}/src/rt/alloca.d - ${RUNTIME_DIR}/src/rt/deh.d - ${RUNTIME_DIR}/src/rt/deh_win32.d -@@ -551,6 +551,10 @@ include(profile-rt/DefineBuildProfileRT.cmake) +@@ -551,6 +551,9 @@ include(profile-rt/DefineBuildProfileRT.cmake) # # Set up build and install targets # + -+set(RT_CFLAGS "@TERMUX_C_FLAGS@") +set(CMAKE_C_COMPILER @TERMUX_C_COMPILER@) +set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) diff --git a/packages/ldc/ldc-linker-flags.patch.in b/packages/ldc/ldc-linker-flags.patch.in index 1388209ba..21941a695 100644 --- a/packages/ldc/ldc-linker-flags.patch.in +++ b/packages/ldc/ldc-linker-flags.patch.in @@ -8,7 +8,7 @@ index 336bbdbc..4b9e8c88 100644 - include(ExtractDMDSystemLinker) + #include(ExtractDMDSystemLinker) -+ set(D_LINKER_ARGS "-fuse-ld=bfd;-L@TERMUX_PKG_HOSTBUILD@/ldc-bootstrap/lib;-lphobos2-ldc;-ldruntime-ldc;-Wl,--gc-sections;-ldl;-lm") ++ set(D_LINKER_ARGS "-fuse-ld=bfd;-L@TERMUX_PKG_HOSTBUILD@/ldc-bootstrap/lib;-lphobos2-ldc;-ldruntime-ldc;-Wl,--gc-sections") message(STATUS "Host D compiler linker program: ${D_LINKER_COMMAND}") message(STATUS "Host D compiler linker flags: ${D_LINKER_ARGS}") list(APPEND LDC_LINKERFLAG_LIST ${D_LINKER_ARGS}) diff --git a/packages/ldc/ldc-llvm-config.patch.in b/packages/ldc/ldc-llvm-config.patch.in deleted file mode 100644 index 691653f5b..000000000 --- a/packages/ldc/ldc-llvm-config.patch.in +++ /dev/null @@ -1,68 +0,0 @@ -diff --git a/cmake/Modules/FindLLVM.cmake b/cmake/Modules/FindLLVM.cmake -index a6a0b0b7..06d6c1c1 100644 ---- a/cmake/Modules/FindLLVM.cmake -+++ b/cmake/Modules/FindLLVM.cmake -@@ -35,11 +35,12 @@ set(llvm_config_names llvm-config-5.0 llvm-config50 - llvm-config-3.8 llvm-config38 - llvm-config-3.7 llvm-config37 - llvm-config) --find_program(LLVM_CONFIG -- NAMES ${llvm_config_names} -- PATHS ${LLVM_ROOT_DIR}/bin NO_DEFAULT_PATH -- DOC "Path to llvm-config tool.") --find_program(LLVM_CONFIG NAMES ${llvm_config_names}) -+set(LLVM_CONFIG "/bin/ls") -+#find_program(LLVM_CONFIG -+# NAMES ${llvm_config_names} -+# PATHS ${LLVM_ROOT_DIR}/bin NO_DEFAULT_PATH -+# DOC "Path to llvm-config tool.") -+#find_program(LLVM_CONFIG NAMES ${llvm_config_names}) - - # Prints a warning/failure message depending on the required/quiet flags. Copied - # from FindPackageHandleStandardArgs.cmake because it doesn't seem to be exposed. -@@ -175,12 +176,12 @@ else() - endif() - endmacro() - -- llvm_set(VERSION_STRING version) -- llvm_set(CXXFLAGS cxxflags) -- llvm_set(HOST_TARGET host-target) -- llvm_set(INCLUDE_DIRS includedir true) -- llvm_set(ROOT_DIR prefix true) -- llvm_set(ENABLE_ASSERTIONS assertion-mode) -+ set(LLVM_VERSION_STRING "4.0.1") -+ set(LLVM_CXXFLAGS "-I@TERMUX_PKG_SRC@/llvm/include -I@TERMUX_PKG_BUILD@/llvm/include -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -Werror=date-time -std=c++11 -ffunction-sections -fdata-sections -O3 -DNDEBUG -fno-exceptions -fno-rtti -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS") -+ set(LLVM_HOST_TARGET "armv7-none-linux-android") -+ set(LLVM_INCLUDE_DIRS "@TERMUX_PKG_SRC@/llvm/include") -+ set(LLVM_ROOT_DIR "@TERMUX_PKG_BUILD@/llvm") -+ set(LLVM_ENABLE_ASSERTIONS "OFF") - - if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-8][\\.0-9A-Za-z]*") - # Versions below 3.9 do not support components debuginfocodeview, globalisel -@@ -207,13 +208,13 @@ else() - list(REMOVE_ITEM LLVM_FIND_COMPONENTS "debuginfomsf" index) - endif() - -- llvm_set(LDFLAGS ldflags) -+ set(LLVM_LIBRARY_DIRS "${LLVM_ROOT_DIR}/lib") -+ set(LLVM_LDFLAGS "-L${LLVM_LIBRARY_DIRS}") - # In LLVM 3.5+, the system library dependencies (e.g. "-lz") are accessed - # using the separate "--system-libs" flag. -- llvm_set(SYSTEM_LIBS system-libs) -+ set(LLVM_SYSTEM_LIBS "-ldl -lncurses -lz -lm") - string(REPLACE "\n" " " LLVM_LDFLAGS "${LLVM_LDFLAGS} ${LLVM_SYSTEM_LIBS}") -- llvm_set(LIBRARY_DIRS libdir true) -- llvm_set_libs(LIBRARIES libs) -+ set(LLVM_LIBRARIES "-lLLVMTableGen;-lLLVMLibDriver;-lLLVMOption;-lLLVMSymbolize;-lLLVMDebugInfoPDB;-lLLVMDebugInfoDWARF;-lLLVMAArch64Disassembler;-lLLVMAArch64CodeGen;-lLLVMAArch64AsmParser;-lLLVMAArch64Desc;-lLLVMAArch64Info;-lLLVMAArch64AsmPrinter;-lLLVMAArch64Utils;-lLLVMARMDisassembler;-lLLVMARMCodeGen;-lLLVMARMAsmParser;-lLLVMARMDesc;-lLLVMARMInfo;-lLLVMARMAsmPrinter;-lLLVMLineEditor;-lLLVMMIRParser;-lLLVMLTO;-lLLVMPasses;-lLLVMObjCARCOpts;-lLLVMOrcJIT;-lLLVMInterpreter;-lLLVMObjectYAML;-lLLVMX86Disassembler;-lLLVMX86AsmParser;-lLLVMX86CodeGen;-lLLVMGlobalISel;-lLLVMSelectionDAG;-lLLVMAsmPrinter;-lLLVMDebugInfoCodeView;-lLLVMDebugInfoMSF;-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;-lLLVMCoverage;-lLLVMProfileData;-lLLVMObject;-lLLVMMCParser;-lLLVMMC;-lLLVMBitReader;-lLLVMCore;-lLLVMSupport;-lLLVMDemangle") - # LLVM bug: llvm-config --libs tablegen returns -lLLVM-3.8.0 - # but code for it is not in shared library - if("${LLVM_FIND_COMPONENTS}" MATCHES "tablegen") -@@ -223,7 +224,7 @@ else() - set(LLVM_LIBRARIES "${LLVM_LIBRARIES};-lLLVMTableGen") - endif() - endif() -- llvm_set(TARGETS_TO_BUILD targets-built) -+ set(LLVM_TARGETS_TO_BUILD "AArch64 ARM X86") - string(REGEX MATCHALL "${pattern}[^ ]+" LLVM_TARGETS_TO_BUILD ${LLVM_TARGETS_TO_BUILD}) - endif() - diff --git a/packages/ldc/llvm-config.in b/packages/ldc/llvm-config.in new file mode 100644 index 000000000..6fbce4164 --- /dev/null +++ b/packages/ldc/llvm-config.in @@ -0,0 +1,106 @@ +#!/bin/sh +show_help () { +echo "usage: llvm-config