lfortran: update to 0.15.0

This commit is contained in:
Chongyun Lee 2022-07-09 00:03:24 +08:00 committed by Uchiha Kakashi
parent 1fe284d818
commit 61bb2e835e
5 changed files with 32 additions and 43 deletions

View File

@ -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
}

View File

@ -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()

View File

@ -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();

View File

@ -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)

View File

@ -1,8 +1,8 @@
--- a/src/runtime/impure/lfortran_intrinsics.c
+++ b/src/runtime/impure/lfortran_intrinsics.c
@@ -5,6 +5,15 @@
#include <complex.h>
#include <string.h>
@@ -9,6 +9,15 @@
#include <float.h>
#include <limits.h>
+#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"