summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-devtools/lapack/lapack_3.12.1.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-devtools/lapack/lapack_3.12.1.bb')
-rw-r--r--meta-oe/recipes-devtools/lapack/lapack_3.12.1.bb105
1 files changed, 105 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/lapack/lapack_3.12.1.bb b/meta-oe/recipes-devtools/lapack/lapack_3.12.1.bb
new file mode 100644
index 0000000000..63069b4b83
--- /dev/null
+++ b/meta-oe/recipes-devtools/lapack/lapack_3.12.1.bb
@@ -0,0 +1,105 @@
1SUMMARY = "Linear Algebra PACKage"
2URL = "http://www.netlib.org/lapack"
3LICENSE = "BSD-3-Clause"
4LIC_FILES_CHKSUM = "file://LICENSE;md5=d0e7a458f9fcbf0a3ba97cef3128b85d"
5
6# Recipe needs FORTRAN support (copied from conf/local.conf.sample.extended)
7# Enabling FORTRAN
8# Note this is not officially supported and is just illustrated here to
9# show an example of how it can be done
10# You'll also need your fortran recipe to depend on libgfortran
11#FORTRAN:forcevariable = ",fortran"
12#RUNTIMETARGET:append:pn-gcc-runtime = " libquadmath"
13
14DEPENDS = "libgfortran \
15 ${@bb.utils.contains('PTEST_ENABLED', '1', 'rsync-native', '', d)} \
16 "
17RDEPENDS:${PN}-ptest += "cmake"
18
19SRCREV = "5ebe92156143a341ab7b14bf76560d30093cfc54"
20SRC_URI = "git://github.com/Reference-LAPACK/lapack.git;protocol=https;branch=master \
21 ${@bb.utils.contains('PTEST_ENABLED', '1', 'file://run-ptest', '', d)} \
22 "
23
24PACKAGECONFIG ?= ""
25PACKAGECONFIG[lapacke] = "-DLAPACKE=ON,-DLAPACKE=OFF"
26PACKAGECONFIG[cblas] = "-DCBLAS=ON,-DCBLAS=OFF"
27
28EXTRA_OECMAKE = " -DBUILD_SHARED_LIBS=ON \
29 ${@bb.utils.contains('PTEST_ENABLED', '1', ' -DBUILD_TESTING=ON', '', d)} \
30 "
31OECMAKE_GENERATOR = "Unix Makefiles"
32
33inherit cmake pkgconfig ptest
34EXCLUDE_FROM_WORLD = "1"
35
36# The `xerbla.o` file contains an absolute path in `xerbla.f.o`, but the options
37# `-fdebug-prefix-map` and `-ffile-prefix-map` cannot be used because gfortran does
38# not support them. And we cannot easily change CMake to use relative paths, because
39# it will convert them to absolute paths when generating Unix Makefiles or Ninja:
40# https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#why-does-cmake-use-full-paths-or-can-i-copy-my-build-tree
41# https://gitlab.kitware.com/cmake/cmake/-/issues/13894
42#
43# To address this issue, we manually replace the absolute path with a relative path
44# in the generated `build.make` file.
45#
46# An issue has been reported: https://github.com/Reference-LAPACK/lapack/issues/1087,
47# requesting a fix in the source code.
48#
49# This workaround resolves the TMPDIR [buildpaths] issue by converting the absolute path
50# of `xerbla.f` to a relative path. The steps are as follows:
51#
52# 1. Locate all `build.make` files after the `do_configure` step is completed.
53# 2. Compute the relative path for various `*.f` files based on the current build directory.
54# 3. Replace the absolute path with the calculated relative path in the `build.make` files
55#
56# Additionally, when ptests are enabled, apply a simpler workaround for ptest code:
57# - Replace occurrences of `${WORKDIR}` in all `build.make` files under the TESTING directory, excluding
58# the MATGEN subdirectory, with a relative path prefix of `"../../.."`.
59do_configure:append(){
60 for file in `find ${B} -name build.make`; do
61 # Replacing all .f files found with:
62 # for f in $(find ${S} -name \*.f -printf " %f" | sort -u); do
63 # would be more reliable with other optional PACKAGECONFIGs, but also very slow as there are
64 # ~ 3500 of them and this loop takes around 20 minutes
65 for f in xerbla.f c_cblat1.f c_cblat2.f c_cblat3.f c_dblat1.f c_dblat2.f c_dblat3.f c_sblat1.f c_sblat2.f c_sblat3.f c_zblat1.f c_zblat2.f c_zblat3.f cchkdmd.f90 dchkdmd.f90 schkdmd.f90 zchkdmd.f90; do
66 sed -i -e "s#\(.*-c \).*\(/$f \)#\1$(grep "\-c .*$f" $file | awk -F'cd ' '{print $2}'| \
67 awk "{src=\$1; sub(/.*-c /, \"\"); sub(/$f.*/, \"\"); obj=\$0; print src, obj}" | \
68 while read src obj; do echo "$(realpath --relative-to="$src" "$obj")"; done)\2#g" $file
69 done
70 done
71 if ${@bb.utils.contains('PTEST_ENABLED', '1', 'true', 'false', d)} ; then
72 for file in `find . -name build.make -path '*TESTING*' -not -path '*MATGEN*'`; do
73 sed -i -e "s#\(.*-c \)\(${WORKDIR}\)\(.*.[f|F] \)#\1../../..\3#g" $file
74 done
75 fi
76}
77
78do_install_ptest () {
79 rsync -a ${B}/TESTING ${D}${PTEST_PATH} \
80 --exclude CMakeFiles \
81 --exclude cmake_install.cmake \
82 --exclude Makefile
83 rsync -a ${B}/BLAS ${D}${PTEST_PATH} \
84 --exclude CMakeFiles \
85 --exclude cmake_install.cmake \
86 --exclude Makefile
87 rsync -a ${B}/LAPACKE ${D}${PTEST_PATH} \
88 --exclude CMakeFiles \
89 --exclude cmake_install.cmake \
90 --exclude Makefile \
91 --exclude lapacke.pc
92 cp -r ${B}/bin ${D}${PTEST_PATH}
93 cp -r ${B}/lapack_testing.py ${D}${PTEST_PATH}
94 cp ${B}/CTestTestfile.cmake ${D}${PTEST_PATH}
95 cp ${S}/TESTING/*.in ${S}/TESTING/runtest.cmake ${D}${PTEST_PATH}/TESTING
96 cp ${S}/BLAS/TESTING/*.in ${D}${PTEST_PATH}/BLAS/TESTING
97 sed -i -e 's#${B}#${PTEST_PATH}#g' `find ${D}${PTEST_PATH} -name CTestTestfile.cmake`
98 sed -i -e 's#${S}#${PTEST_PATH}#g' `find ${D}${PTEST_PATH} -name CTestTestfile.cmake`
99 sed -i -e 's#${RECIPE_SYSROOT_NATIVE}##g' `find ${D}${PTEST_PATH} -name CTestTestfile.cmake`
100 sed -i -e 's#${PYTHON}#/usr/bin/python3#g' `find ${D}${PTEST_PATH} -name CTestTestfile.cmake`
101 sed -i -e 's#${WORKDIR}##g' `find ${D}${PTEST_PATH} -name CTestTestfile.cmake`
102}
103
104# It needs fortran compiler and we do not enable fortran with clang yet
105TOOLCHAIN = "gcc"