Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/flang/0003-fix-missing-CHECK_MSG-macro.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/flang/include/flang/Common/idioms.h
+++ b/flang/include/flang/Common/idioms.h
@@ -89,6 +89,8 @@
#define CHECK(x) ((x) || (DIE("CHECK(" #x ") failed"), false))
// Same as above, but with a custom error message.
#define CHECK_MSG(x, y) ((x) || (DIE("CHECK(" #x ") failed: " #y), false))
+#elif !defined(CHECK_MSG)
+#define CHECK_MSG(x, y) CHECK(x)
#endif

// User-defined type traits that default to false:
11 changes: 11 additions & 0 deletions packages/flang/0004-do-not-call-timespec_get.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/flang/runtime/time-intrinsic.cpp
+++ b/flang/runtime/time-intrinsic.cpp
@@ -139,7 +139,7 @@
}
}

-#ifndef _AIX
+#if !defined(_AIX) && !(defined(__ANDROID__) && __ANDROID__ < 29)
// This is the fallback implementation, which should work everywhere.
template <typename Unused = void>
count_t GetSystemClockCount(int kind, fallback_implementation) {
26 changes: 26 additions & 0 deletions packages/flang/0005-use-libandroid-complex-math.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--- a/flang/runtime/Float128Math/complex-math.h
+++ b/flang/runtime/Float128Math/complex-math.h
@@ -34,6 +34,23 @@
#elif LDBL_MANT_DIG == 113
/* Use 'long double' versions of libm functions. */
#include <complex.h>
+#if defined(__ANDROID__) && __ANDROID_API__ < 26
+long double complex cacosl (long double complex);
+long double complex cacoshl(long double complex);
+long double complex casinl (long double complex);
+long double complex casinhl(long double complex);
+long double complex catanl (long double complex);
+long double complex catanhl(long double complex);
+long double complex ccosl (long double complex);
+long double complex ccoshl (long double complex);
+long double complex cexpl (long double complex);
+long double complex clogl (long double complex);
+long double complex cpowl (long double complex, long double complex);
+long double complex csinl (long double complex);
+long double complex csinhl (long double complex);
+long double complex ctanl (long double complex);
+long double complex ctanhl (long double complex);
+#endif

#define CAbs(x) cabsl(x)
#define CAcos(x) cacosl(x)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--- a/flang/runtime/Float128Math/math-entries.h
+++ b/flang/runtime/Float128Math/math-entries.h
@@ -185,9 +185,11 @@
DEFINE_SIMPLE_ALIAS(Ilogb, std::ilogb)
DEFINE_SIMPLE_ALIAS(Isinf, std::isinf)
DEFINE_SIMPLE_ALIAS(Isnan, std::isnan)
+#ifndef __ANDROID__
DEFINE_SIMPLE_ALIAS(J0, j0l)
DEFINE_SIMPLE_ALIAS(J1, j1l)
DEFINE_SIMPLE_ALIAS(Jn, jnl)
+#endif
DEFINE_SIMPLE_ALIAS(Ldexp, std::ldexp)
DEFINE_SIMPLE_ALIAS(Lgamma, std::lgamma)
DEFINE_SIMPLE_ALIAS(Llround, std::llround)
@@ -204,9 +206,11 @@
DEFINE_SIMPLE_ALIAS(Tanh, std::tanh)
DEFINE_SIMPLE_ALIAS(Tgamma, std::tgamma)
DEFINE_SIMPLE_ALIAS(Trunc, std::trunc)
+#ifndef __ANDROID__
DEFINE_SIMPLE_ALIAS(Y0, y0l)
DEFINE_SIMPLE_ALIAS(Y1, y1l)
DEFINE_SIMPLE_ALIAS(Yn, ynl)
+#endif

// Use numeric_limits to produce infinity of the right type.
#define F128_RT_INFINITY \
8 changes: 4 additions & 4 deletions packages/flang/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ TERMUX_PKG_DESCRIPTION="LLVM's Fortran frontend"
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_LICENSE_FILE="flang/LICENSE.TXT"
TERMUX_PKG_MAINTAINER="@termux"
LLVM_MAJOR_VERSION=18
TERMUX_PKG_VERSION=${LLVM_MAJOR_VERSION}.1.8
LLVM_MAJOR_VERSION=19
TERMUX_PKG_VERSION=${LLVM_MAJOR_VERSION}.1.1
TERMUX_PKG_SRCURL=https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/llvm-project-$TERMUX_PKG_VERSION.src.tar.xz
TERMUX_PKG_SHA256=0b58557a6d32ceee97c8d533a59b9212d87e0fc4d2833924eb6c611247db2f2a
TERMUX_PKG_SHA256=d40e933e2a208ee142898f85d886423a217e991abbcd42dd8211f507c93e1266
TERMUX_PKG_AUTO_UPDATE=false
TERMUX_PKG_HOSTBUILD=true
# `flang-new` should be rebuilt when libllvm bumps version.
# See https://github.com/termux/termux-packages/issues/19362
DEP_QUALIFIER=$TERMUX_PKG_VERSION-$TERMUX_PKG_REVISION
TERMUX_PKG_DEPENDS="libc++, libllvm (= $DEP_QUALIFIER), clang (= $DEP_QUALIFIER), lld (= $DEP_QUALIFIER), mlir (= $DEP_QUALIFIER)"
TERMUX_PKG_DEPENDS="libandroid-complex-math-static, libc++, libllvm (= $DEP_QUALIFIER), clang (= $DEP_QUALIFIER), lld (= $DEP_QUALIFIER), mlir (= $DEP_QUALIFIER)"
TERMUX_PKG_BUILD_DEPENDS="libllvm-static"

# Upstream doesn't support 32-bit arches well. See https://github.com/llvm/llvm-project/issues/57621.
Expand Down
13 changes: 7 additions & 6 deletions packages/flang/postinst.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ generate_module_files() {
"ieee_exceptions"
"ieee_features"
"iso_c_binding"
"iso_fortran_env_impl"
"iso_fortran_env"
"omp_lib"
)

local file
Expand All @@ -25,11 +25,12 @@ generate_module_files() {
cp "$file".mod "$file".f18.mod
done

file="__ppc_intrinsics"
echo "Generating ${file}.mod..."
cd "$TERMUX_PREFIX"/include/flang
flang-new -cpp -fsyntax-only --target=ppc64le -module-dir "$TERMUX_PREFIX"/include/flang "$TERMUX_PREFIX"/opt/flang/module/"$file".f90
cp "$file".mod "$file".f18.mod
for file in "__ppc_intrinsics" "mma"; do
echo "Generating ${file}.mod..."
cd "$TERMUX_PREFIX"/include/flang
flang-new -cpp -fsyntax-only --target=ppc64le -module-dir "$TERMUX_PREFIX"/include/flang "$TERMUX_PREFIX"/opt/flang/module/"$file".f90
cp "$file".mod "$file".f18.mod
done
}

generate_module_files
5 changes: 3 additions & 2 deletions packages/flang/prerm.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ cleanup_module_files() {
"__fortran_type_info"
"__fortran_ieee_exceptions"
"__ppc_types"
"__ppc_intrinsics"
"__cuda_builtins"
"ieee_arithmetic"
"ieee_exceptions"
"ieee_features"
"iso_c_binding"
"iso_fortran_env_impl"
"iso_fortran_env"
"omp_lib"
"__ppc_intrinsics"
"mma"
)

local file
Expand Down
6 changes: 3 additions & 3 deletions packages/libllvm/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ TERMUX_PKG_LICENSE="Apache-2.0, NCSA"
TERMUX_PKG_LICENSE_FILE="llvm/LICENSE.TXT"
TERMUX_PKG_MAINTAINER="@finagolfin"
# Keep flang version and revision in sync when updating (enforced by check in termux_step_pre_configure).
LLVM_MAJOR_VERSION=18
TERMUX_PKG_VERSION=${LLVM_MAJOR_VERSION}.1.8
TERMUX_PKG_SHA256=0b58557a6d32ceee97c8d533a59b9212d87e0fc4d2833924eb6c611247db2f2a
LLVM_MAJOR_VERSION=19
TERMUX_PKG_VERSION=${LLVM_MAJOR_VERSION}.1.1
TERMUX_PKG_SHA256=d40e933e2a208ee142898f85d886423a217e991abbcd42dd8211f507c93e1266
TERMUX_PKG_AUTO_UPDATE=false
TERMUX_PKG_SRCURL=https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/llvm-project-${TERMUX_PKG_VERSION}.src.tar.xz
TERMUX_PKG_HOSTBUILD=true
Expand Down
10 changes: 5 additions & 5 deletions packages/libllvm/clang-include-clang-Driver-Options.td.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ index 59e1337599b2..656545555349 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5370,6 +5370,12 @@
Flags<[NoArgumentUnused]>,
HelpText<"Do not add -rpath with architecture-specific resource directory to the linker flags. "
"When --hip-link is specified, do not add -rpath with HIP runtime library directory to the linker flags">;
Visibility<[ClangOption, FlangOption]>,
HelpText<"Add -rpath with architecture-specific resource directory to the linker flags. "
"When --hip-link is specified, also add -rpath with HIP runtime library directory to the linker flags">;
+defm openmp_implicit_rpath: BoolFOption<"openmp-implicit-rpath",
+ LangOpts<"OpenMP">,
+ DefaultTrue,
+ PosFlag<SetTrue, [], [ClangOption, CC1Option, FlangOption, FC1Option], "Useless option, for compatibility only">,
+ NegFlag<SetFalse>,
+ BothFlags<[NoArgumentUnused]>>;
def offload_add_rpath: Flag<["--"], "offload-add-rpath">,
def fno_rtlib_add_rpath: Flag<["-"], "fno-rtlib-add-rpath">,
Flags<[NoArgumentUnused]>,
Alias<frtlib_add_rpath>;
Visibility<[ClangOption, FlangOption]>,
@@ -4879,6 +4879,10 @@ defm spec_constr_count : BooleanFFlag<"spec-constr-count">, Group<clang_ignored_
defm stack_check : BooleanFFlag<"stack-check">, Group<clang_ignored_f_Group>;
defm strength_reduce :
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1281,6 +1281,9 @@
if (AsNeeded)
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/false);
}
+ if (TC.getTriple().isAndroid()) {
+ CmdArgs.push_back("-l:libandroid-complex-math.a");
+ }
CmdArgs.push_back("-lFortranRuntime");
CmdArgs.push_back("-lFortranDecimal");
}
2 changes: 2 additions & 0 deletions packages/libllvm/clang.subpackage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ lib/clang/*/include/openmp_wrappers/
lib/clang/*/include/orc/
lib/clang/*/include/ppc_wrappers/
lib/clang/*/include/profile/
lib/clang/*/include/zos_wrappers/
lib/clang/latest
lib/cmake/clang
lib/cmake/openmp
Expand All @@ -37,6 +38,7 @@ lib/libomp.a
lib/libscanbuild/
libexec/
share/clang
share/clang-doc
share/man/man1/clang.1.gz
share/man/man1/diagtool.1.gz
share/man/man1/scan-build.1.gz
Expand Down
8 changes: 4 additions & 4 deletions packages/libllvm/llvm-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgputargetmca amdgpuuti
analysis arc arccodegen arcdesc arcdisassembler arcinfo arm armasmparser armcodegen \
armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser \
avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader \
bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen \
bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen codegendata \
codegentypes core coroutines coverage csky cskyasmparser cskycodegen cskydesc cskydisassembler \
cskyinfo debuginfobtf debuginfocodeview debuginfodwarf debuginfogsym debuginfologicalview \
debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker dwarflinkerclassic dwarflinkerparallel \
Expand All @@ -71,7 +71,7 @@ nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts objcopy object
objectyaml option orcdebugging orcjit orcshared orctargetprocess passes powerpc powerpcasmparser \
powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks \
riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvtargetmca \
runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc \
runtimedyld sandboxir scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc \
sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen \
systemzdesc systemzdisassembler systemzinfo tablegen target targetparser textapi textapibinaryreader \
transformutils ve veasmparser vecodegen vectorize vedesc vedisassembler veinfo \
Expand Down Expand Up @@ -112,9 +112,9 @@ static_libs="-lLLVMWindowsManifest -lLLVMXRay -lLLVMLibDriver -lLLVMDlltoolDrive
-lLLVMFrontendOpenACC -lLLVMFrontendHLSL -lLLVMExtensions -lPolly -lPollyISL -lLLVMPasses \
-lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMLinker \
-lLLVMFrontendOpenMP -lLLVMDWARFLinkerClassic -lLLVMDWARFLinkerParallel -lLLVMDWARFLinker \
-lLLVMGlobalISel -lLLVMMIRParser -lLLVMAsmPrinter -lLLVMSelectionDAG -lLLVMCodeGen -lLLVMCodeGenTypes \
-lLLVMGlobalISel -lLLVMMIRParser -lLLVMAsmPrinter -lLLVMSelectionDAG -lLLVMCodeGen -lLLVMCodeGenData -lLLVMCodeGenTypes \
-lLLVMObjCARCOpts -lLLVMIRPrinter -lLLVMInterfaceStub -lLLVMFileCheck -lLLVMFuzzMutate \
-lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMTransformUtils \
-lLLVMTarget -lLLVMSandboxIR -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMTransformUtils \
-lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMSymbolize -lLLVMDebugInfoBTF -lLLVMDebugInfoPDB \
-lLLVMDebugInfoMSF -lLLVMDebugInfoDWARF -lLLVMObject -lLLVMTextAPI -lLLVMTextAPIBinaryReader -lLLVMMCParser \
-lLLVMIRReader -lLLVMAsmParser -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMBitReader \
Expand Down
1 change: 1 addition & 0 deletions packages/libllvm/llvm.subpackage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ bin/llc
bin/lli
bin/llvm!(-jitlink-executor|-PerfectShuffle)
bin/opt
bin/reduce-chunk-list
bin/sancov
bin/sanstats
bin/split-file
Expand Down
4 changes: 2 additions & 2 deletions packages/libllvm/mlir.subpackage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ bin/tblgen-lsp-server
bin/tblgen-to-irdl
include/mlir*
lib/cmake/mlir/
lib/libMLIR.so
lib/libmlir*so
lib/libMLIR*.so
lib/libmlir*.so
"
TERMUX_SUBPKG_DESCRIPTION="A Multi-Level Intermediate Representation for compilers from LLVM"
TERMUX_SUBPKG_DEPENDS="libc++, ncurses"