Skip to content

Commit 52212b0

Browse files
committed
[new-package] dftbplus 24.1
1 parent 91bc57e commit 52212b0

File tree

3 files changed

+201
-0
lines changed

3 files changed

+201
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--- a/external/mudpack/CMakeLists.txt
2+
+++ b/external/mudpack/CMakeLists.txt
3+
@@ -12,7 +12,11 @@
4+
endif()
5+
6+
if(WITH_API OR BUILD_SHARED_LIBS)
7+
- install(TARGETS mudpack DESTINATION "${CMAKE_INSTALL_LIBDIR}" EXPORT dftbplus-targets)
8+
+ install(TARGETS mudpack
9+
+ EXPORT dftbplus-targets
10+
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
11+
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
12+
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
13+
endif()
14+
15+
list(APPEND PKG_CONFIG_LIBS mudpack)
16+
--- a/src/dftbp/CMakeLists.txt
17+
+++ b/src/dftbp/CMakeLists.txt
18+
@@ -154,8 +154,11 @@
19+
# Installation
20+
21+
if(WITH_API OR BUILD_SHARED_LIBS)
22+
- install(TARGETS dftbplus DESTINATION "${CMAKE_INSTALL_LIBDIR}"
23+
- EXPORT dftbplus-targets)
24+
+ install(TARGETS dftbplus
25+
+ EXPORT dftbplus-targets
26+
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
27+
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
28+
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
29+
endif()
30+
31+
if(INSTALL_INCLUDE_FILES)
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
--- a/src/dftbp/common/envcheck.c
2+
+++ b/src/dftbp/common/envcheck.c
3+
@@ -4,9 +4,9 @@
4+
/* */
5+
/* See the LICENSE file for terms of usage and distribution. */
6+
/*------------------------------------------------------------------------------------------------*/
7+
-
8+
+#ifndef _WIN32
9+
#include <sys/resource.h>
10+
-
11+
+#endif
12+
/**
13+
* Queries current stacksize.
14+
*
15+
@@ -15,10 +15,13 @@
16+
* \param[out] ierr Error status.
17+
*/
18+
void get_stacksize_c(int *cstack, int *ierr) {
19+
-
20+
+#ifdef _WIN32
21+
+ *ierr = 0;
22+
+ *cstack = 0;
23+
+#else
24+
struct rlimit rlim;
25+
*ierr = getrlimit(RLIMIT_STACK, &rlim);
26+
27+
*cstack = rlim.rlim_cur;
28+
-
29+
+#endif
30+
}
31+
--- a/src/dftbp/common/memman.F90
32+
+++ b/src/dftbp/common/memman.F90
33+
@@ -44,12 +44,20 @@
34+
35+
!> Bound to 'posix_memalign' to allocate aligned memory
36+
interface
37+
+ #:if _SYSTEM_ == 'Windows'
38+
+ function AlignedMalloc(size, alignment) result(ptr) bind(C, name="_aligned_malloc")
39+
+ import c_ptr, c_size_t
40+
+ type(c_ptr) :: ptr
41+
+ integer(c_size_t), intent(in), value :: alignment, size
42+
+ end function
43+
+ #:else
44+
function posixMemalign(ptr, alignment, size) result(error) bind(C, name="posix_memalign")
45+
import c_ptr, c_size_t, c_int
46+
type(c_ptr), intent(inout) :: ptr
47+
integer(c_size_t), intent(in), value :: alignment, size
48+
integer(c_int) :: error
49+
end function
50+
+ #:endif
51+
end interface
52+
53+
54+
@@ -105,9 +113,14 @@
55+
56+
this%alignment = alignment
57+
end if
58+
-
59+
+ #:if _SYSTEM_ == 'Windows'
60+
+ this%memoryPointer_ = AlignedMalloc(int(size * dp_size, kind=c_size_t),&
61+
+ & int(this%alignment, kind=c_size_t))
62+
+ if ( .NOT. C_ASSOCIATED(this%memoryPointer_) ) then
63+
+ #:else
64+
if (posixMemalign(this%memoryPointer_, int(this%alignment, kind=c_size_t),&
65+
& int(size * dp_size, kind=c_size_t)) /= 0) then
66+
+ #:endif
67+
call error("Error during allocation of aligned array")
68+
end if
69+
70+
--- a/utils/export/dftbplus.pc.in
71+
+++ b/utils/export/dftbplus.pc.in
72+
@@ -1,3 +1,5 @@
73+
+prefix=@CMAKE_INSTALL_PREFIX@
74+
+
75+
Name: DFTB+
76+
Description: Library interface to DFTB+, a fast and efficient atomistic quantum mechanical simulation tool
77+
Version: @PROJECT_VERSION@

mingw-w64-dftbplus/PKGBUILD

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Contributor: Mehdi Chinoune <[email protected]>
2+
3+
_realname=dftbplus
4+
pkgbase=mingw-w64-${_realname}
5+
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
6+
pkgver=24.1
7+
pkgrel=1
8+
pkgdesc="General package for performing fast atomistic simulations. (mingw-w64)"
9+
arch=('any')
10+
mingw_arch=('ucrt64')
11+
url='https://www.dftbplus.org'
12+
msys2_repository_url="https://github.com/dftbplus/dftbplus"
13+
license=('spdx:LGPL-3.0-or-later')
14+
depends=($([[ ${MINGW_PACKAGE_PREFIX} == *-clang-* ]] || echo "${MINGW_PACKAGE_PREFIX}-gcc-libgfortran")
15+
"${MINGW_PACKAGE_PREFIX}-arpack"
16+
"${MINGW_PACKAGE_PREFIX}-dftd4"
17+
"${MINGW_PACKAGE_PREFIX}-libmbd"
18+
"${MINGW_PACKAGE_PREFIX}-libnegf"
19+
"${MINGW_PACKAGE_PREFIX}-mctc-lib"
20+
"${MINGW_PACKAGE_PREFIX}-omp"
21+
"${MINGW_PACKAGE_PREFIX}-openblas"
22+
"${MINGW_PACKAGE_PREFIX}-s-dftd3")
23+
#"${MINGW_PACKAGE_PREFIX}-tblite")
24+
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
25+
"${MINGW_PACKAGE_PREFIX}-fc"
26+
"${MINGW_PACKAGE_PREFIX}-cmake"
27+
"${MINGW_PACKAGE_PREFIX}-ninja"
28+
"${MINGW_PACKAGE_PREFIX}-python-fypp")
29+
source=("https://github.com/dftbplus/dftbplus/releases/download/${pkgver}/${_realname}-${pkgver}.tar.xz"
30+
"001-fix-install-dll.patch"
31+
"002-fix-build-on-mingw-w64.patch")
32+
sha256sums=('3bc405d1ab834b6b145ca671fb44565ec50a6f576e9e18e7a1ae2c613a311321'
33+
'b0f1626d38c018fd82fcc75dfde019025c7bb3935634fcaa76963a4bf205fc53'
34+
'238ceb0c4fa3fd29042a07b73977d6d631fd6a2a98967bb80b2016712bdb832f')
35+
noextract=("${_realname}-${pkgver}.tar.xz")
36+
37+
prepare() {
38+
echo "Extracting ${_realname}-${pkgver}.tar.xz ..."
39+
tar -xJf ${_realname}-${pkgver}.tar.xz || true
40+
41+
cd "${_realname}-${pkgver}"
42+
43+
patch -Np1 -i "${srcdir}"/001-fix-install-dll.patch
44+
patch -Np1 -i "${srcdir}"/002-fix-build-on-mingw-w64.patch
45+
}
46+
47+
build() {
48+
declare -a extra_config
49+
if check_option "debug" "n"; then
50+
extra_config+=("-DCMAKE_BUILD_TYPE=Release")
51+
else
52+
extra_config+=("-DCMAKE_BUILD_TYPE=Debug")
53+
fi
54+
55+
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
56+
cmake \
57+
-GNinja \
58+
-DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \
59+
"${extra_config[@]}" \
60+
-DBUILD_SHARED_LIBS=ON \
61+
-DCMAKE_DLL_NAME_WITH_SOVERSION=ON \
62+
-DHYBRID_CONFIG_METHODS=Find \
63+
-DWITH_API=ON \
64+
-DWITH_ARPACK=ON \
65+
-DWITH_MBD=ON \
66+
-DWITH_OMP=ON \
67+
-DWITH_SDFTD3=ON \
68+
-DWITH_TRANSPORT=ON \
69+
-DWITH_CHIMES=OFF \
70+
-DWITH_MPI=OFF \
71+
-DWITH_TBLITE=OFF \
72+
-DWITH_UNIT_TESTS=OFF \
73+
-DINSTALL_INCLUDE_FILES=ON \
74+
-DFYPP=${MINGW_PREFIX}/bin/fypp \
75+
-S "${_realname}-${pkgver}" \
76+
-B "build-${MSYSTEM}"
77+
78+
cmake --build "build-${MSYSTEM}"
79+
}
80+
81+
package() {
82+
DESTDIR="${pkgdir}" cmake --install "build-${MSYSTEM}"
83+
84+
# Fix PkgConfig file
85+
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
86+
sed -e "s|${PREFIX_WIN}|\$\{prefix\}|g" \
87+
-i "${pkgdir}"${MINGW_PREFIX}/lib/pkgconfig/dftbplus.pc
88+
sed -e "1n;s|${MINGW_PREFIX}|\$\{prefix\}|g" \
89+
-i "${pkgdir}"${MINGW_PREFIX}/lib/pkgconfig/dftbplus.pc
90+
91+
install -Dm644 "${srcdir}"/${_realname}-${pkgver}/COPYING* \
92+
-t "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}
93+
}

0 commit comments

Comments
 (0)