forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPKGBUILD
180 lines (146 loc) · 6.29 KB
/
PKGBUILD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# $Id$
# Maintainer (ArchLinux): Alexander Rødseth <[email protected]>
# Contributor (ArchLinux): William Rea <[email protected]>
# Contributor (ArchLinux): Stefan Husmann <[email protected]>
# Maintainer (MSYS2): Ray Donnelly <[email protected]>
_realname=arpack
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
$([[ "${CARCH}" == "i686" ]] || echo "${MINGW_PACKAGE_PREFIX}-${_realname}64"))
pkgver=3.8.0
pkgrel=4
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64')
pkgdesc="Fortran77 subroutines designed to solve large scale eigenvalue problems (mingw-w64)"
url='https://forge.scilab.org/index.php/p/arpack-ng/'
license=('spdx:BSD-3-Clause')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libgfortran")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc-fortran"
"${MINGW_PACKAGE_PREFIX}-ninja"
"${MINGW_PACKAGE_PREFIX}-cmake"
"${MINGW_PACKAGE_PREFIX}-openblas"
$([[ "${CARCH}" == "i686" ]] || echo "${MINGW_PACKAGE_PREFIX}-openblas64"))
provides=("${MINGW_PACKAGE_PREFIX}-${_realname}-ng")
options=('!buildflags')
source=(${_realname}-${pkgver}.tar.gz::https://github.com/opencollab/arpack-ng/archive/${pkgver}.tar.gz
"0001-cmake-relocate-prefix.patch"
"0002-cmake-set-SUFFIX64.patch"
"0003-blas-lapack-pc.patch")
sha256sums=('ada5aeb3878874383307239c9235b716a8a170c6d096a6625bfd529844df003d'
'94b215a281f115bd91e3370487bcfc97a1100aff82196d226927f7e395dc4cff'
'5b6cec059408fc11e2f4056c73ecbf6cee17ae23a2ce30f11aa4633286ae8e9c'
'f292a44377c02949f3ede48b4521c093982483ff2f85aa90b710457f1dea706b')
# Helper macros to help make tasks easier #
apply_patch_with_msg() {
for _fname in "$@"
do
msg2 "Applying ${_fname}"
patch -Nbp1 -i "${srcdir}"/${_fname}
done
}
prepare() {
cd "${srcdir}/${_realname}-ng-${pkgver}"
# https://github.com/msys2/MINGW-packages/issues/10151
apply_patch_with_msg \
0001-cmake-relocate-prefix.patch \
0002-cmake-set-SUFFIX64.patch \
0003-blas-lapack-pc.patch
}
_build_arpack() {
_idx_opt=$1
declare -a _build_type
if check_option "debug" "n"; then
_build_type+=("Release")
else
_build_type+=("Debug")
fi
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
${MINGW_PREFIX}/bin/cmake \
-GNinja \
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
-DCMAKE_BUILD_TYPE=${_build_type} \
-DICB=ON \
${_idx_opt} \
../${_realname}-ng-${pkgver}
${MINGW_PREFIX}/bin/cmake --build .
}
build() {
[[ -d "${srcdir}/build-${MSYSTEM}-static-32" ]] && rm -rf "${srcdir}/build-${MSYSTEM}-static-32"
mkdir -p "${srcdir}/build-${MSYSTEM}-static-32" && cd "${srcdir}/build-${MSYSTEM}-static-32"
msg2 "Build static ARPACK with 32-bit indexing"
_build_arpack "-DBUILD_SHARED_LIBS=OFF"
[[ -d "${srcdir}/build-${MSYSTEM}-shared-32" ]] && rm -rf "${srcdir}/build-${MSYSTEM}-shared-32"
mkdir -p "${srcdir}/build-${MSYSTEM}-shared-32" && cd "${srcdir}/build-${MSYSTEM}-shared-32"
msg2 "Build shared ARPACK with 32-bit indexing"
_build_arpack ""
if [ "${CARCH}" != "i686" ]; then
[[ -d "${srcdir}/build-${MSYSTEM}-static-64" ]] && rm -rf "${srcdir}/build-${MSYSTEM}-static-64"
mkdir -p "${srcdir}/build-${MSYSTEM}-static-64" && cd "${srcdir}/build-${MSYSTEM}-static-64"
msg2 "Build static ARPACK with 64-bit indexing"
_build_arpack "-DINTERFACE64=1 -DLIBSUFFIX=_64 -DBUILD_SHARED_LIBS=OFF -DBLAS_LIBRARIES=openblas_64"
[[ -d "${srcdir}/build-${MSYSTEM}-shared-64" ]] && rm -rf "${srcdir}/build-${MSYSTEM}-shared-64"
mkdir -p "${srcdir}/build-${MSYSTEM}-shared-64" && cd "${srcdir}/build-${MSYSTEM}-shared-64"
msg2 "Build shared ARPACK with 64-bit indexing"
_build_arpack "-DINTERFACE64=1 -DLIBSUFFIX=_64 -DBLAS_LIBRARIES=openblas_64"
fi
}
check() {
cd "${srcdir}/build-${MSYSTEM}-static-32"
msg2 "Static check with 32-bit indexing"
${MINGW_PREFIX}/bin/cmake --build . --target test || true
cd "${srcdir}/build-${MSYSTEM}-shared-32"
msg2 "Shared check with 32-bit indexing"
${MINGW_PREFIX}/bin/cmake --build . --target test || true
if [ "${CARCH}" != "i686" ]; then
cd "${srcdir}/build-${MSYSTEM}-static-64"
msg2 "Static check with 64-bit indexing"
${MINGW_PREFIX}/bin/cmake --build . --target test || true
cd "${srcdir}/build-${MSYSTEM}-shared-64"
msg2 "Shared check with 64-bit indexing"
${MINGW_PREFIX}/bin/cmake --build . --target test || true
fi
}
package_arpack() {
pkgdesc="Fortran77 subroutines designed to solve large scale eigenvalue problems (mingw-w64)"
depends+=("${MINGW_PACKAGE_PREFIX}-openblas")
#Static Install
cd "${srcdir}/build-${MSYSTEM}-static-32"
DESTDIR=${pkgdir} cmake --build . --target install
#Shared Install
cd "${srcdir}/build-${MSYSTEM}-shared-32"
DESTDIR=${pkgdir} cmake --build . --target install
install -Dm644 ${srcdir}/${_realname}-ng-${pkgver}/COPYING ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
for _f in "${pkgdir}${MINGW_PREFIX}"/lib/cmake/${_realname}-ng/*.cmake; do
sed -e "s|${PREFIX_WIN}|\$\{_IMPORT_PREFIX\}|g" -i ${_f}
sed -e "s|${MINGW_PREFIX}|\$\{_IMPORT_PREFIX\}|g" -i ${_f}
done
}
package_arpack64() {
pkgdesc="Fortran77 subroutines designed to solve large scale eigenvalue problems with 64-bit indexing (mingw-w64)"
depends+=("${MINGW_PACKAGE_PREFIX}-openblas64")
provides=()
conflicts=()
replaces=()
#Static Install
cd "${srcdir}/build-${MSYSTEM}-static-64"
DESTDIR=${pkgdir} cmake --build . --target install
#Shared Install
cd "${srcdir}/build-${MSYSTEM}-shared-64"
DESTDIR=${pkgdir} cmake --build . --target install
install -Dm644 ${srcdir}/${_realname}-ng-${pkgver}/COPYING ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}64/COPYING
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
for _f in "${pkgdir}${MINGW_PREFIX}"/lib/cmake/${_realname}64-ng/*.cmake; do
sed -e "s|${PREFIX_WIN}|\$\{_IMPORT_PREFIX\}|g" -i ${_f}
sed -e "s|${MINGW_PREFIX}|\$\{_IMPORT_PREFIX\}|g" -i ${_f}
done
}
# template start; name=mingw-w64-splitpkg-wrappers; version=1.0;
# vim: set ft=bash :
# generate wrappers
for _name in "${pkgname[@]}"; do
_short="package_${_name#${MINGW_PACKAGE_PREFIX}-}"
_func="$(declare -f "${_short}")"
eval "${_func/#${_short}/package_${_name}}"
done
# template end;