Skip to content

Commit b8ffcaf

Browse files
committed
[new-package] libnegf 1.1.3
1 parent 9576615 commit b8ffcaf

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- a/src/CMakeLists.txt
2+
+++ b/src/CMakeLists.txt
3+
@@ -87,6 +87,7 @@
4+
5+
install(TARGETS negf
6+
EXPORT negf-targets
7+
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
8+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
9+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
10+
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
--- a/ext_system/sys_calls.c
2+
+++ b/ext_system/sys_calls.c
3+
@@ -3,10 +3,11 @@
4+
#include <stdio.h>
5+
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32))
6+
#include <io.h>
7+
+#include <direct.h>
8+
#else
9+
#include <unistd.h>
10+
-#include <errno.h>
11+
#endif
12+
+#include <errno.h>
13+
14+
// THIS IS DONE IN ORDER TO UNIFORM ERROR NUMBERS BETWEEN OS
15+
#define INT_EEXIST 1
16+
--- a/src/CMakeLists.txt
17+
+++ b/src/CMakeLists.txt
18+
@@ -79,7 +79,7 @@
19+
find_package(MPI REQUIRED)
20+
target_link_libraries(negf PUBLIC MpiFx::MpiFx MPI::MPI_Fortran)
21+
endif()
22+
-target_link_libraries(negf PRIVATE ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
23+
+target_link_libraries(negf PRIVATE BLAS::BLAS LAPACK::LAPACK)
24+
25+
target_include_directories(negf PUBLIC
26+
$<BUILD_INTERFACE:${BUILD_MOD_DIR}>
27+
--- a/src/api/CMakeLists.txt
28+
+++ b/src/api/CMakeLists.txt
29+
@@ -1,13 +1,15 @@
30+
set(negf-interface-headers)
31+
set(all-header-deps libnegf_api.f90 bind_fortran)
32+
33+
+find_package(Python3 REQUIRED COMPONENTS Interpreter)
34+
+
35+
add_custom_target(negf-c-binding ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libnegf.h)
36+
set(c-header-binding-deps binding/map_negf_c.txt binding/begin_c.txt binding/end_c.txt)
37+
add_custom_command(
38+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libnegf.h
39+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${all-header-deps} ${CMAKE_CURRENT_SOURCE_DIR}/${c-header-binding-deps}
40+
COMMENT "Generating C header"
41+
- COMMAND ./bind_fortran -f c -m binding/map_negf_c.txt -b binding/begin_c.txt -n -t -e binding/end_c.txt libnegf_api.f90 > ${CMAKE_CURRENT_BINARY_DIR}/libnegf.h
42+
+ COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/bind_fortran -f c -m binding/map_negf_c.txt -b binding/begin_c.txt -n -t -e binding/end_c.txt libnegf_api.f90 > ${CMAKE_CURRENT_BINARY_DIR}/libnegf.h
43+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
44+
)
45+
list(APPEND negf-interface-headers ${CMAKE_CURRENT_BINARY_DIR}/libnegf.h)
46+
@@ -18,7 +20,7 @@
47+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libnegf.hpp
48+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${all-header-deps} ${CMAKE_CURRENT_SOURCE_DIR}/${cpp-header-binding-deps}
49+
COMMENT "Generating C++ header"
50+
- COMMAND ./bind_fortran -f c++ -m binding/map_negf_cpp_wrapped.txt -b binding/begin_cpp_wrapped.txt -t -e binding/end_cpp_wrapped.txt libnegf_api.f90 > ${CMAKE_CURRENT_BINARY_DIR}/libnegf.hpp
51+
+ COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/bind_fortran -f c++ -m binding/map_negf_cpp_wrapped.txt -b binding/begin_cpp_wrapped.txt -t -e binding/end_cpp_wrapped.txt libnegf_api.f90 > ${CMAKE_CURRENT_BINARY_DIR}/libnegf.hpp
52+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
53+
)
54+
list(APPEND negf-interface-headers ${CMAKE_CURRENT_BINARY_DIR}/libnegf.hpp)

mingw-w64-libnegf/PKGBUILD

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor: Mehdi Chinoune <[email protected]>
2+
3+
_realname=libnegf
4+
pkgbase=mingw-w64-${_realname}
5+
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
6+
pkgver=1.1.3
7+
pkgrel=1
8+
pkgdesc="A general library for Non Equilibrium Green's Functions. (mingw-w64)"
9+
arch=('any')
10+
mingw_arch=('ucrt64' 'clang64' 'clangarm64')
11+
url='https://github.com/libnegf/libnegf'
12+
license=('spdx:LGPL-3.0-or-later')
13+
depends=($([[ ${MINGW_PACKAGE_PREFIX} == *-clang-* ]] || echo "${MINGW_PACKAGE_PREFIX}-gcc-libgfortran")
14+
"${MINGW_PACKAGE_PREFIX}-openblas")
15+
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
16+
"${MINGW_PACKAGE_PREFIX}-fc"
17+
"${MINGW_PACKAGE_PREFIX}-cmake"
18+
"${MINGW_PACKAGE_PREFIX}-ninja"
19+
"${MINGW_PACKAGE_PREFIX}-omp"
20+
"${MINGW_PACKAGE_PREFIX}-python-fypp")
21+
source=("https://github.com/libnegf/libnegf/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz"
22+
"001-fix-install-dll.patch"
23+
"002-fix-build-on-mingw-w64.patch")
24+
sha256sums=('8d2a41791e459a203db4e4f3a9395804434ce2cd91b1bbb09111cffb032f237e'
25+
'8666c458cd9815087a59fbe84d4f2d2e599a2a6f7e312d667f86e54d5e56dffd'
26+
'c95d78ff11dff58051e72e7e351f013d0cc9393e8c48964cf442121222b6bee2')
27+
28+
prepare() {
29+
cd "${_realname}-${pkgver}"
30+
31+
patch -Np1 -i "${srcdir}"/001-fix-install-dll.patch
32+
patch -Np1 -i "${srcdir}"/002-fix-build-on-mingw-w64.patch
33+
}
34+
35+
build() {
36+
declare -a extra_config
37+
if check_option "debug" "n"; then
38+
extra_config+=("-DCMAKE_BUILD_TYPE=Release")
39+
else
40+
extra_config+=("-DCMAKE_BUILD_TYPE=Debug")
41+
fi
42+
43+
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
44+
cmake \
45+
-GNinja \
46+
-DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \
47+
"${extra_config[@]}" \
48+
-DBUILD_SHARED_LIBS=ON \
49+
-DCMAKE_DLL_NAME_WITH_SOVERSION=ON \
50+
-DWITH_MPI=OFF \
51+
-DWITH_OMP=ON \
52+
-DBUILD_TESTING=OFF \
53+
-DPython3_EXECUTABLE=${MINGW_PREFIX}/bin/python \
54+
-DFYPP=${MINGW_PREFIX}/bin/fypp \
55+
-S "${_realname}-${pkgver}" \
56+
-B "build-${MSYSTEM}"
57+
58+
cmake --build "build-${MSYSTEM}"
59+
}
60+
61+
check() {
62+
cmake -S"${_realname}-${pkgver}" -B"build-${MSYSTEM}" -DBUILD_TESTING=ON
63+
cmake --build "build-${MSYSTEM}"
64+
65+
PATH="${srcdir}"/build-${MSYSTEM}/src:$PATH \
66+
ctest --test-dir "build-${MSYSTEM}" --output-on-failure || echo "Tests failed"
67+
}
68+
69+
package() {
70+
DESTDIR="${pkgdir}" cmake --install "build-${MSYSTEM}"
71+
72+
install -Dm644 "${srcdir}"/${_realname}-${pkgver}/LICENSE \
73+
-t "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}
74+
}

0 commit comments

Comments
 (0)