diff --git a/packages/lfortran/build.sh b/packages/lfortran/build.sh index e7972c7200..5afb066fea 100644 --- a/packages/lfortran/build.sh +++ b/packages/lfortran/build.sh @@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://lfortran.org/ TERMUX_PKG_DESCRIPTION="A modern open-source interactive Fortran compiler" TERMUX_PKG_LICENSE="BSD 3-Clause" TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION=0.14.0 +TERMUX_PKG_VERSION=0.15.0 TERMUX_PKG_SRCURL=https://gitlab.com/lfortran/lfortran.git TERMUX_PKG_DEPENDS="clang, libc++, libkokkos, zlib" TERMUX_PKG_EXTRA_CONFIGURE_ARGS="-DBUILD_SHARED_LIBS=ON" @@ -37,3 +37,10 @@ termux_step_pre_configure() { LDFLAGS+=" -lm" } + +termux_step_post_make_install() { + # XXX: This file is used in cpp backend but not installed by the build system. + # XXX: So is this an upstream issue? + mkdir -p $PREFIX/share/lfortran/lib/impure + cp ${TERMUX_PKG_SRCDIR}/src/runtime/impure/lfortran_intrinsics.h $PREFIX/share/lfortran/lib/impure +} diff --git a/packages/lfortran/src-bin-CMakeLists.txt.patch b/packages/lfortran/src-bin-CMakeLists.txt.patch index 1850df7479..ce577fe58f 100644 --- a/packages/lfortran/src-bin-CMakeLists.txt.patch +++ b/packages/lfortran/src-bin-CMakeLists.txt.patch @@ -1,15 +1,6 @@ --- a/src/bin/CMakeLists.txt +++ b/src/bin/CMakeLists.txt -@@ -1,7 +1,7 @@ - add_executable(lfortran lfortran.cpp) - target_include_directories(lfortran PRIVATE "tpl") - target_link_libraries(lfortran lfortran_lib) --if (UNIX AND NOT APPLE) -+if (FALSE) - # This is sometimes needed to fix link errors for CLI11 - target_link_libraries(lfortran stdc++fs) - endif() -@@ -42,7 +42,7 @@ +@@ -43,7 +43,7 @@ macro(LFORTRAN_COMPILE_RUNTIME name dir) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/../runtime/${name}.mod @@ -18,12 +9,3 @@ ARGS --backend=cpp -c ${CMAKE_CURRENT_SOURCE_DIR}/../runtime/${dir}/${name}.f90 -o ${name}.o WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../runtime DEPENDS lfortran ${CMAKE_CURRENT_SOURCE_DIR}/../runtime/${dir}/${name}.f90 ${ARGN} -@@ -134,7 +134,7 @@ - - add_executable(cpptranslate cpptranslate.cpp) - target_link_libraries(cpptranslate lfortran_lib) --if (UNIX AND NOT APPLE) -+if (FALSE) - # This is sometimes needed to fix link errors for CLI11 - target_link_libraries(cpptranslate stdc++fs) - endif() diff --git a/packages/lfortran/src-bin-lfortran.cpp.patch b/packages/lfortran/src-bin-lfortran.cpp.patch index ff2e55735e..ea03d19da3 100644 --- a/packages/lfortran/src-bin-lfortran.cpp.patch +++ b/packages/lfortran/src-bin-lfortran.cpp.patch @@ -1,6 +1,6 @@ --- a/src/bin/lfortran.cpp +++ b/src/bin/lfortran.cpp -@@ -81,10 +81,15 @@ +@@ -95,10 +95,15 @@ { char *env_p = std::getenv("LFORTRAN_KOKKOS_DIR"); if (env_p) return env_p; @@ -16,19 +16,7 @@ } #ifdef HAVE_LFORTRAN_LLVM -@@ -873,7 +878,11 @@ - out << " "; - } - char *env_CC = std::getenv("LFORTRAN_CC"); -+#ifdef __ANDROID__ -+ std::string CC="clang"; -+#else - std::string CC="gcc"; -+#endif - if (env_CC) CC = env_CC; - std::string cmd = CC + " -c " + outfile_empty + " -o " + outfile; - int err = system(cmd.c_str()); -@@ -905,7 +914,11 @@ +@@ -1082,7 +1087,11 @@ out << src; } @@ -38,9 +26,9 @@ std::string CXX = "g++"; +#endif std::string options; - if (openmp) { + if (compiler_options.openmp) { options += "-fopenmp "; -@@ -1037,7 +1050,11 @@ +@@ -1212,7 +1221,11 @@ } return 0; } else if (backend == Backend::cpp) { @@ -52,7 +40,7 @@ std::string options, post_options; if (static_executable) { options += " -static "; -@@ -1047,8 +1064,13 @@ +@@ -1222,8 +1235,13 @@ } if (kokkos) { std::string kokkos_dir = get_kokkos_dir(); diff --git a/packages/lfortran/src-libasr-CMakeLists.txt.patch b/packages/lfortran/src-libasr-CMakeLists.txt.patch new file mode 100644 index 0000000000..e45ff3d8a1 --- /dev/null +++ b/packages/lfortran/src-libasr-CMakeLists.txt.patch @@ -0,0 +1,12 @@ +When building with -DBUILD_SHARED_LIBS=ON, libasr will be a shared library but not installed. +--- a/src/libasr/CMakeLists.txt ++++ b/src/libasr/CMakeLists.txt +@@ -72,7 +72,7 @@ + COMPILE_FLAGS -Wno-deprecated-declarations) + endif() + endif() +-add_library(asr ${SRC}) ++add_library(asr STATIC ${SRC}) + target_include_directories(asr BEFORE PUBLIC ${libasr_SOURCE_DIR}/..) + target_include_directories(asr BEFORE PUBLIC ${libasr_BINARY_DIR}/..) + if (WITH_BFD) diff --git a/packages/lfortran/src-runtime-impure-lfortran_intrinsics.c.patch b/packages/lfortran/src-runtime-impure-lfortran_intrinsics.c.patch index 6d28a49da5..059eea59d8 100644 --- a/packages/lfortran/src-runtime-impure-lfortran_intrinsics.c.patch +++ b/packages/lfortran/src-runtime-impure-lfortran_intrinsics.c.patch @@ -1,8 +1,8 @@ --- a/src/runtime/impure/lfortran_intrinsics.c +++ b/src/runtime/impure/lfortran_intrinsics.c -@@ -5,6 +5,15 @@ - #include - #include +@@ -9,6 +9,15 @@ + #include + #include +#if defined __ANDROID__ && __ANDROID_API__ < 26 +#include "s_clog.c" @@ -13,6 +13,6 @@ +#include "s_cpowf.c" +#endif + - struct _lfortran_complex { - float re, im; - }; + #include "lfortran_intrinsics.h" + +