Created
June 15, 2014 05:09
-
-
Save nikescar/325ba455c199d7eef4d9 to your computer and use it in GitHub Desktop.
ndk-r9c-fortran.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From f5d91957dece0f21caf187ae4569ef382eb0e696 Mon Sep 17 00:00:00 2001 | |
From: "Woojae, Park" <[email protected]> | |
Date: Sun, 15 Jun 2014 14:00:54 +0900 | |
Subject: [PATCH] fortran commit 2 | |
--- | |
build/tools/build-gcc.sh | 10 ++++++++++ | |
1 file changed, 10 insertions(+) | |
diff --git a/build/tools/build-gcc.sh b/build/tools/build-gcc.sh | |
index e1c646a..ad8b9b1 100755 | |
--- a/build/tools/build-gcc.sh | |
+++ b/build/tools/build-gcc.sh | |
@@ -82,6 +82,11 @@ register_var_option "--with-python=<path/to/python-config.sh>" WITH_PYTHON "Spec | |
PACKAGE_DIR= | |
register_var_option "--package-dir=<path>" PACKAGE_DIR "Create archive tarball in specific directory" | |
+ | |
+ENABLE_LANGUAGES="c,c++,fortran" | |
+register_var_option "--enable-languages=<name>" ENABLE_LANGUAGES "Experimental: specify which languages to build" | |
+ | |
+ | |
register_jobs_option | |
register_canadian_option | |
register_try64_option | |
@@ -347,6 +352,11 @@ $BUILD_SRCDIR/configure --target=$ABI_CONFIGURE_TARGET \ | |
--host=$ABI_CONFIGURE_HOST \ | |
--build=$ABI_CONFIGURE_BUILD \ | |
--disable-nls \ | |
+ --enable-languages=$ENABLE_LANGUAGES \ | |
+ --disable-libgomp \ | |
+ --disable-tls \ | |
+ --disable-libitm \ | |
+ --disable-libatomic \ | |
--prefix=$TOOLCHAIN_BUILD_PREFIX \ | |
--with-sysroot=$TOOLCHAIN_BUILD_SYSROOT \ | |
--with-binutils-version=$BINUTILS_VERSION \ | |
-- | |
1.8.3.2 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 9d3b69220e5c3d3dbb6555f306ba07dd33125320 Mon Sep 17 00:00:00 2001 | |
From: "Woojae, Park" <[email protected]> | |
Date: Sun, 15 Jun 2014 13:53:47 +0900 | |
Subject: [PATCH] fortran patch | |
--- | |
build/core/build-binary.mk | 10 ++- | |
build/core/default-build-commands.mk | 3 + | |
build/core/definitions.mk | 148 +++++++++++++++++++++++++++++++++++ | |
build/tools/dev-defaults.sh | 10 +-- | |
4 files changed, 165 insertions(+), 6 deletions(-) | |
diff --git a/build/core/build-binary.mk b/build/core/build-binary.mk | |
index 62e1bb2..a1a504d 100644 | |
--- a/build/core/build-binary.mk | |
+++ b/build/core/build-binary.mk | |
@@ -313,7 +313,7 @@ LOCAL_DEPENDENCY_DIRS := | |
# all_source_patterns contains the list of filename patterns that correspond | |
# to source files recognized by our build system | |
-all_source_extensions := .c .s .S $(LOCAL_CPP_EXTENSION) $(LOCAL_RS_EXTENSION) | |
+all_source_extensions := .c .s .S $(LOCAL_CPP_EXTENSION) $(LOCAL_RS_EXTENSION) .f .f90 | |
all_source_patterns := $(foreach _ext,$(all_source_extensions),%$(_ext)) | |
all_cpp_patterns := $(foreach _ext,$(LOCAL_CPP_EXTENSION),%$(_ext)) | |
all_rs_patterns := $(foreach _ext,$(LOCAL_RS_EXTENSION),%$(_ext)) | |
@@ -393,6 +393,14 @@ $(foreach src,$(filter $(all_rs_patterns),$(LOCAL_SRC_FILES)),\ | |
$(call compile-rs-source,$(src),$(call get-rs-scriptc-name,$(src)),$(call get-rs-bc-name,$(src)),$(call get-rs-so-name,$(src)),$(call get-object-name,$(src)),$(RS_COMPAT))\ | |
) | |
+ | |
+# handle free-form Fortran (.f90) | |
+$(foreach src,$(filter %.f90,$(LOCAL_SRC_FILES)), $(call compile-f90-source,$(src))) | |
+ | |
+# handle fixed form Fortran (.f) | |
+$(foreach src,$(filter %.f,$(LOCAL_SRC_FILES)), $(call compile-fc-source,$(src))) | |
+ | |
+ | |
# | |
# The compile-xxx-source calls updated LOCAL_OBJECTS and LOCAL_DEPENDENCY_DIRS | |
# | |
diff --git a/build/core/default-build-commands.mk b/build/core/default-build-commands.mk | |
index 0deb705..c2ea398 100644 | |
--- a/build/core/default-build-commands.mk | |
+++ b/build/core/default-build-commands.mk | |
@@ -127,6 +127,9 @@ TARGET_CXX = $(TOOLCHAIN_PREFIX)g++ | |
endif | |
TARGET_CXXFLAGS = $(TARGET_CFLAGS) -fno-exceptions -fno-rtti | |
+TARGET_FC = $(TOOLCHAIN_PREFIX)gfortran | |
+TARGET_FFLAGS = | |
+ | |
TARGET_RS_CC = $(RENDERSCRIPT_TOOLCHAIN_PREFIX)llvm-rs-cc | |
TARGET_RS_BCC = $(RENDERSCRIPT_TOOLCHAIN_PREFIX)bcc_compat | |
TARGET_RS_FLAGS = -Wall -Werror | |
diff --git a/build/core/definitions.mk b/build/core/definitions.mk | |
index c80ed7e..0729e79 100644 | |
--- a/build/core/definitions.mk | |
+++ b/build/core/definitions.mk | |
@@ -1573,6 +1573,96 @@ else | |
endif | |
endef | |
+ | |
+# slightly modified version for Fortran source files | |
+define ev-build-fc-file | |
+$$(_OBJ): PRIVATE_SRC := $$(_SRC) | |
+$$(_OBJ): PRIVATE_OBJ := $$(_OBJ) | |
+$$(_OBJ): PRIVATE_DEPS := $$(call host-path,$$(_OBJ).d) | |
+$$(_OBJ): PRIVATE_MODULE := $$(LOCAL_MODULE) | |
+$$(_OBJ): PRIVATE_TEXT := "$$(_TEXT)" | |
+$$(_OBJ): PRIVATE_CC := $$(_CC) | |
+$$(_OBJ): PRIVATE_CFLAGS := $$(_FLAGS) | |
+$$(_OBJ): $$(_SRC) $$(LOCAL_MAKEFILE) $$(NDK_APP_APPLICATION_MK) | |
+ @mkdir -p $$(dir $$(PRIVATE_OBJ)) | |
+ @echo "$$(PRIVATE_TEXT) : $$(PRIVATE_MODULE) <= $$(notdir $$(PRIVATE_SRC))" | |
+ $(hide) $$(PRIVATE_CC) $$(PRIVATE_CFLAGS) $$(call host-path,$$(PRIVATE_SRC)) -o $$(call host-path,$$(PRIVATE_OBJ)) | |
+endef | |
+ | |
+# This assumes the same things than ev-build-fc-file, but will handle | |
+# the definition of LOCAL_FILTER_ASM as well. | |
+define ev-build-fc-source-file | |
+LOCAL_DEPENDENCY_DIRS += $$(dir $$(_OBJ)) | |
+ifndef LOCAL_FILTER_ASM | |
+ # Trivial case: Directly generate an object file | |
+ $$(eval $$(call ev-build-fc-file)) | |
+else | |
+ # This is where things get hairy, we first transform | |
+ # the source into an assembler file, send it to the | |
+ # filter, then generate a final object file from it. | |
+ # | |
+ | |
+ # First, remember the original settings and compute | |
+ # the location of our temporary files. | |
+ # | |
+ _ORG_SRC := $$(_SRC) | |
+ _ORG_OBJ := $$(_OBJ) | |
+ _ORG_FLAGS := $$(_FLAGS) | |
+ _ORG_TEXT := $$(_TEXT) | |
+ | |
+ _OBJ_ASM_ORIGINAL := $$(patsubst %.o,%.s,$$(_ORG_OBJ)) | |
+ _OBJ_ASM_FILTERED := $$(patsubst %.o,%.filtered.s,$$(_ORG_OBJ)) | |
+ | |
+ # If the source file is a plain assembler file, we're going to | |
+ # use it directly in our filter. | |
+ ifneq (,$$(filter %.s,$$(_SRC))) | |
+ _OBJ_ASM_ORIGINAL := $$(_SRC) | |
+ endif | |
+ | |
+ #$$(info SRC=$$(_SRC) OBJ=$$(_OBJ) OBJ_ORIGINAL=$$(_OBJ_ASM_ORIGINAL) OBJ_FILTERED=$$(_OBJ_ASM_FILTERED)) | |
+ | |
+ # We need to transform the source into an assembly file, instead of | |
+ # an object. The proper way to do that depends on the file extension. | |
+ # | |
+ # For C and C++ source files, simply replace the -c by an -S in the | |
+ # compilation command (this forces the compiler to generate an | |
+ # assembly file). | |
+ # | |
+ # For assembler templates (which end in .S), replace the -c with -E | |
+ # to send it to the preprocessor instead. | |
+ # | |
+ # Don't do anything for plain assembly files (which end in .s) | |
+ # | |
+ ifeq (,$$(filter %.s,$$(_SRC))) | |
+ _OBJ := $$(_OBJ_ASM_ORIGINAL) | |
+ ifneq (,$$(filter %.S,$$(_SRC))) | |
+ _FLAGS := $$(patsubst -c,-E,$$(_ORG_FLAGS)) | |
+ else | |
+ _FLAGS := $$(patsubst -c,-S,$$(_ORG_FLAGS)) | |
+ endif | |
+ $$(eval $$(call ev-build-fc-file)) | |
+ endif | |
+ | |
+ # Next, process the assembly file with the filter | |
+ $$(_OBJ_ASM_FILTERED): PRIVATE_SRC := $$(_OBJ_ASM_ORIGINAL) | |
+ $$(_OBJ_ASM_FILTERED): PRIVATE_DST := $$(_OBJ_ASM_FILTERED) | |
+ $$(_OBJ_ASM_FILTERED): PRIVATE_FILTER := $$(LOCAL_FILTER_ASM) | |
+ $$(_OBJ_ASM_FILTERED): PRIVATE_MODULE := $$(LOCAL_MODULE) | |
+ $$(_OBJ_ASM_FILTERED): $$(_OBJ_ASM_ORIGINAL) | |
+ @echo "AsmFilter : $$(PRIVATE_MODULE) <= $$(notdir $$(PRIVATE_SRC))" | |
+ $(hide) $$(PRIVATE_FILTER) $$(PRIVATE_SRC) $$(PRIVATE_DST) | |
+ | |
+ # Then, generate the final object, we need to keep assembler-specific | |
+ # flags which look like -Wa,<option>: | |
+ _SRC := $$(_OBJ_ASM_FILTERED) | |
+ _OBJ := $$(_ORG_OBJ) | |
+ _FLAGS := $$(filter -Wa%,$$(_ORG_FLAGS)) -c | |
+ _TEXT := "Assembly " | |
+ $$(eval $$(call ev-build-fc-file)) | |
+endif | |
+endef | |
+ | |
+ | |
# ----------------------------------------------------------------------------- | |
# Template : ev-compile-c-source | |
# Arguments : 1: single C source file name (relative to LOCAL_PATH) | |
@@ -1663,6 +1753,64 @@ endef | |
# ----------------------------------------------------------------------------- | |
compile-cpp-source = $(eval $(call ev-compile-cpp-source,$1,$2)) | |
+ | |
+ | |
+# ----------------------------------------------------------------------------- | |
+# Template : ev-compile-fc-source | |
+# Arguments : 1: single Fortran source file name (relative to LOCAL_PATH) | |
+# 2: target object file (without path) | |
+# Returns : None | |
+# Usage : $(eval $(call ev-compile-fc-source,<srcfile>,<objfile>) | |
+# Rationale : Internal template evaluated by compile-fc-source | |
+# ----------------------------------------------------------------------------- | |
+ | |
+define ev-compile-fc-source | |
+_SRC:=$$(LOCAL_PATH)/$(1) | |
+_OBJ:=$$(LOCAL_OBJS_DIR)/$(2) | |
+_FLAGS := $$($$(my)FFLAGS) \ | |
+ $$(call get-src-file-target-cflags,$(1)) \ | |
+ $$(call host-c-includes, $$(LOCAL_C_INCLUDES) $$(LOCAL_PATH)) \ | |
+ $$(LOCAL_CFLAGS) \ | |
+ $$(NDK_APP_CFLAGS) \ | |
+ $$(LOCAL_FFLAGS) \ | |
+ $$(NDK_APP_FFLAGS) \ | |
+ $$(call host-c-includes,$$($(my)C_INCLUDES)) \ | |
+ -c \ | |
+ | |
+_CC := $$(TARGET_FC) | |
+_TEXT := "Compile-fortran $$(call get-src-file-text,$1)" | |
+ | |
+$$(eval $$(call ev-build-fc-source-file)) | |
+endef | |
+ | |
+# ----------------------------------------------------------------------------- | |
+# Function : compile-fc-source | |
+# Arguments : 1: single Fortran source file name (relative to LOCAL_PATH) | |
+# Returns : None | |
+# Usage : $(call compile-fc-source,<srcfile>) | |
+# Rationale : Setup everything required to build a single Fortran source file | |
+# ----------------------------------------------------------------------------- | |
+compile-fc-source = $(eval $(call ev-compile-fc-source,$1,$(1:%.f=%.o))) | |
+compile-f90-source = $(eval $(call ev-compile-fc-source,$1,$(1:%.f90=%.o))) | |
+ | |
+ | |
+# ----------------------------------------------------------------------------- | |
+# Command : cmd-install-file | |
+# Arguments : 1: source file | |
+# 2: destination file | |
+# Returns : None | |
+# Usage : $(call cmd-install-file,<srcfile>,<dstfile>) | |
+# Rationale : To be used as a Make build command to copy/install a file to | |
+# a given location. | |
+# ----------------------------------------------------------------------------- | |
+define cmd-install-file | |
+@$$(call host-mkdir,$$(dir $2)) | |
+$$(hide) cp -fp $$(subst /,\,$1 $2) | |
+endef | |
+ | |
+ | |
+ | |
+ | |
# ----------------------------------------------------------------------------- | |
# Template : ev-compile-rs-source | |
# Arguments : 1: single RS source file name (relative to LOCAL_PATH) | |
diff --git a/build/tools/dev-defaults.sh b/build/tools/dev-defaults.sh | |
index 8e31915..86bd618 100644 | |
--- a/build/tools/dev-defaults.sh | |
+++ b/build/tools/dev-defaults.sh | |
@@ -42,18 +42,18 @@ SUPPORT_SUBDIR=sources/android/support | |
TOOLCHAIN_GIT_DATE=now | |
# The space-separated list of all GCC versions we support in this NDK | |
-DEFAULT_GCC_VERSION_LIST="4.6 4.8" | |
+DEFAULT_GCC_VERSION_LIST="4.8.0" | |
# The default GCC version for this NDK, i.e. the first item in | |
# $DEFAULT_GCC_VERSION_LIST | |
# | |
DEFAULT_GCC_VERSION=$(echo "$DEFAULT_GCC_VERSION_LIST" | tr ' ' '\n' | head -n 1) | |
-DEFAULT_BINUTILS_VERSION=2.21 | |
-DEFAULT_GDB_VERSION=7.3.x | |
-DEFAULT_MPFR_VERSION=3.1.1 | |
+DEFAULT_BINUTILS_VERSION=2.22.90 | |
+DEFAULT_GDB_VERSION=7.4.1 | |
+DEFAULT_MPFR_VERSION=3.0.1 | |
DEFAULT_GMP_VERSION=5.0.5 | |
-DEFAULT_MPC_VERSION=1.0.1 | |
+DEFAULT_MPC_VERSION=1.0 | |
DEFAULT_CLOOG_VERSION=0.18.0 | |
DEFAULT_ISL_VERSION=0.11.1 | |
DEFAULT_PPL_VERSION=1.0 | |
-- | |
1.8.3.2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment