kumquat-buildroot/package/clapack/clapack-0003-cmake-do-not-try-to-run-arithchk-when-cross-compilin.patch
Samuel Martin dd5dbe627f clapack: new package
This package provides BLAS and LAPACK libraries.

Though it is common to find implementation of these two libraries in
Fortran, this package provides a C-implementation for both, because:
- Fortran support has been deprecated in Buildroot since the 2013.11
  release;
- most of the external toolchains do not provide a Fortran compiler.

Often BLAS build-systems build some test programs and run them to
generate some source files or adjust some build optimizations, naively
assuming they are building the library for the build-machine. This does
not play well when cross-compiling.

This implementation has this defect too, by building and running a tool
generating a header.
However, the build-system allows to pass an empty header.
So, we have to patch the CMake to build the generator (but never
install it) and correctly support building with and without this header
provided by the user.

Also, some CMake patches are needed to fix the build and install rules.

[Peter: needs largefile, fix _LICENSE_FILES, tweak patch desc]
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-05-04 09:10:55 +02:00

71 lines
2.5 KiB
Diff

From a2f0669fac1f8e7183b15cf7d14f0e99a2d8b012 Mon Sep 17 00:00:00 2001
From: Samuel Martin <s.martin49@gmail.com>
Date: Sat, 11 Jan 2014 21:47:39 +0100
Subject: [PATCH 3/6] cmake: do not try to run arithchk when cross-compiling to
generate sources
Instead, use a predefined arith.h if provided, or generate a default one.
The arithchk binary is still built (but not installed) to allow the user to
run it on its target and use it; so then allowing to build an optimized
blas library.
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
F2CLIBS/libf2c/CMakeLists.txt | 38 ++++++++++++++++++++++++++++----------
1 file changed, 28 insertions(+), 10 deletions(-)
diff --git a/F2CLIBS/libf2c/CMakeLists.txt b/F2CLIBS/libf2c/CMakeLists.txt
index f98d66a..45a0804 100644
--- a/F2CLIBS/libf2c/CMakeLists.txt
+++ b/F2CLIBS/libf2c/CMakeLists.txt
@@ -38,17 +38,35 @@ set(TIME dtime_.c etime_.c)
# For INTEGER*8 support (which requires system-dependent adjustments to
# f2c.h), add ${QINT} to the OFILES assignment below...
-add_executable(arithchk arithchk.c)
-if(UNIX)
- target_link_libraries(arithchk m)
+if(CMAKE_CROSSCOMPILING)
+ if(ARITH_H)
+ message(STATUS "Using the user-defined '${ARITH_H}' as arith.h header.")
+ configure_file("${ARITH_H}" "${CMAKE_CURRENT_BINARY_DIR}/arith.h" COPYONLY)
+ else()
+ message(STATUS "No user-defined arith.h header.")
+ if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/arith.h")
+ message(WARNING "Generating the default non-optimized 'arith.h' header.
+
+To generate and provide a custom arith.h header:
+run the cross-compiled arithchk binary on your target,
+and use its output to fill your custom arith.h header.")
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/arith.h"
+ "/* default, not optimized arith.h */")
+ endif()
+ endif()
+else()
+ add_executable(arithchk arithchk.c)
+ if(UNIX)
+ target_link_libraries(arithchk m)
+ endif()
+ set_target_properties(arithchk PROPERTIES COMPILE_DEFINITIONS
+ "NO_FPINIT;NO_LONG_LONG")
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/arith.h
+ COMMAND arithchk > ${CMAKE_CURRENT_BINARY_DIR}/arith.h
+ DEPENDS arithchk
+ )
endif()
-set_target_properties(arithchk PROPERTIES COMPILE_DEFINITIONS
- "NO_FPINIT;NO_LONG_LONG")
-ADD_CUSTOM_COMMAND(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/arith.h
- COMMAND arithchk > ${CMAKE_CURRENT_BINARY_DIR}/arith.h
- DEPENDS arithchk
- )
set(OFILES ${MISC} ${POW} ${CX} ${DCX} ${REAL} ${DBL} ${INT}
--
1.8.5.3