blob: de007490edfa28607088a2323d5068eff650e5a6 (
plain)
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{13..14} )
inherit cmake dot-a python-single-r1
MY_PV_GENXRD=1.1
MY_PV_AVOGEN=${PV}
MY_PV_CRYSTALS=${PV}
MY_PV_FRAGMENTS=${PV}
MY_PV_MOLECULES=${PV}
DESCRIPTION="Advanced molecule editor and visualizer 2 - libraries"
HOMEPAGE="https://two.avogadro.cc/ https://www.openchemistry.org/"
SRC_URI="
https://github.com/OpenChemistry/${PN}/archive/${PV}.tar.gz
-> ${P}.tar.gz
qt6? (
https://github.com/OpenChemistry/avogenerators/archive/refs/tags/${MY_PV_AVOGEN}.tar.gz
-> ${PN}-avogenerators-${MY_PV_AVOGEN}.tar.gz
https://github.com/OpenChemistry/crystals/archive/refs/tags/${MY_PV_CRYSTALS}.tar.gz
-> ${PN}-crystals-${MY_PV_CRYSTALS}.tar.gz
https://github.com/OpenChemistry/fragments/archive/refs/tags/${MY_PV_FRAGMENTS}.tar.gz
-> ${PN}-fragments-${MY_PV_FRAGMENTS}.tar.gz
https://github.com/OpenChemistry/molecules/archive/refs/tags/${MY_PV_MOLECULES}.tar.gz
-> ${PN}-molecules-${MY_PV_MOLECULES}.tar.gz
)
jkqtplotter? (
amd64? ( https://github.com/psavery/genXrdPattern/releases/download/${MY_PV_GENXRD}-linux/linux64-genXrdPattern
-> ${PN}-linux64-genXrdPattern-${MY_PV_GENXRD} )
)
test? ( https://github.com/OpenChemistry/avogadrodata/archive/refs/tags/${PV}.tar.gz
-> ${P}-data.tar.gz )
"
LICENSE="BSD GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="archive doc hdf5 jkqtplotter python qt6 spglib static-libs test"
RESTRICT="!test? ( test )"
REQUIRED_USE="
jkqtplotter? ( qt6 )
python? ( ${PYTHON_REQUIRED_USE} )
test? ( qt6 )
"
# TODO: Not yet packaged:
# sci-libs/libmsym (https://github.com/mcodev31/libmsym)
RDEPEND="
dev-cpp/eigen:=
dev-cpp/nlohmann_json
dev-libs/pugixml
hdf5? ( sci-libs/hdf5:= )
python? (
${PYTHON_DEPS}
$(python_gen_cond_dep 'dev-python/pybind11[${PYTHON_USEDEP}]')
)
qt6? (
dev-qt/qtbase:6[concurrent,gui,network,opengl,widgets]
dev-qt/qtsvg:6
media-libs/glew:0=
>=sci-chemistry/openbabel-3.1.1_p20241221:=[json]
virtual/opengl
archive? ( app-arch/libarchive:= )
jkqtplotter? ( sci-libs/jkqtplotter:= )
)
spglib? ( >=sci-libs/spglib-2.6.0:= )
"
DEPEND="
${RDEPEND}
"
BDEPEND="
doc? ( app-text/doxygen )
test? ( dev-cpp/gtest )
"
PATCHES=(
"${FILESDIR}/"${PN}-1.91.0_pre20180406-bundled-genxrdpattern.patch
)
# Static binary (requires ObjCryst++ to build otherwise)
QA_FLAGS_IGNORED="usr/bin/genXrdPattern"
pkg_setup() {
use python && python-single-r1_pkg_setup
}
src_unpack() {
default
rm -rf thirdparty/{nlohmann,pugixml} || die
if use jkqtplotter && use amd64; then
cp "${DISTDIR}"/${PN}-linux64-genXrdPattern-${MY_PV_GENXRD} "${WORKDIR}/genXrdPattern" || die
fi
if use qt6; then
# hardcoded assumptions in
# avogadro/qtplugins/insertfragment/CMakeLists.txt
mv crystals-${MY_PV_CRYSTALS} crystals || die
mv molecules-${MY_PV_MOLECULES} molecules || die
# avogadro/qtplugins/quantuminput/CMakeLists.txt
mv avogenerators-${MY_PV_AVOGEN} avogenerators || die
# avogadro/qtplugins/templatetool/CMakeLists.txt
mv fragments-${MY_PV_FRAGMENTS} fragments || die
fi
if use test; then
mv avogadrodata-${PV} avogadrodata || die
fi
}
src_prepare() {
# fix default value for BABEL_LIBDIR
sed -i -e "s:/../lib/openbabel:/../$(get_libdir)/openbabel:g" \
avogadro/qtplugins/forcefield/obenergy.cpp \
avogadro/qtplugins/forcefield/obmmenergy.cpp \
avogadro/qtplugins/openbabel/obprocess.cpp || die
# avoid cmake_min warning w/ this unused file
rm thirdparty/tinycolormap/CMakeLists.txt || die
if use doc; then
doxygen -u docs/doxyfile.in 2>/dev/null || die
fi
# restore user-LDFLAGS
if use python; then
sed -e 's:CMAKE_MODULE_LINKER_FLAGS "":CMAKE_MODULE_LINKER_FLAGS "'"${LDFLAGS}"'":' \
-i "${S}"/python/CMakeLists.txt || die
fi
cmake_src_prepare
}
src_configure() {
local mycmakeargs=(
-DCMAKE_SKIP_RPATH=ON
-DUSE_EXTERNAL_NLOHMANN=ON
-DUSE_EXTERNAL_PUGIXML=ON
-DUSE_LIBARCHIVE=$(usex archive $(usex qt6))
-DBUILD_DOCUMENTATION=$(usex doc)
-DUSE_HDF5=$(usex hdf5)
# https://github.com/OpenChemistry/avogadrolibs/issues/2200
-DUSE_MMTF=OFF
-DUSE_OPENGL=$(usex qt6)
-DUSE_PLOTTER=$(usex jkqtplotter)
-DUSE_PYTHON=$(usex python)
-DUSE_QT=$(usex qt6)
-DUSE_SPGLIB=$(usex spglib)
-DENABLE_TESTING=$(usex test)
# disabled libraries
-DUSE_LIBMSYM=OFF
)
if use jkqtplotter && use amd64; then
mycmakeargs+=(
-DBUNDLED_GENXRDPATTERN="${WORKDIR}/genXrdPattern"
-DUSE_SYSTEM_GENXRDPATTERN=OFF
)
fi
if use qt6; then
mycmakeargs+=(
-DBUILD_GPL_PLUGINS=ON
-DBUILD_STATIC_PLUGINS=$(usex static-libs)
-DQT_VERSION=6
)
# use python's abilities to define the interpreter path for qtplugins,
# it can also be set with:
# - AVO_PYTHON_INTERPRETER (absolute path)
# - extensions settings
# otherwise default is python
use python && mycmakeargs+=( -DPython3_EXECUTABLE="${PYTHON}" )
# even w/o static-libs due to libgwavi.a, required for avogadro2
lto-guarantee-fat
fi
cmake_src_configure
}
src_compile() {
cmake_src_compile
use doc && cmake_build documentation
}
src_test() {
local -x LD_LIBRARY_PATH="${BUILD_DIR}/lib"
cmake_src_test
}
src_install() {
if use doc; then
local DOCS+=( "${BUILD_DIR}"/docs/xml )
local HTML_DOCS=( "${BUILD_DIR}"/docs/html/. )
docompress -x /usr/share/doc/${PF}/xml
fi
cmake_src_install
if use python; then
python_fix_shebang "${ED}"
python_optimize "${ED}"
fi
# always strip due to libgwavi.a
use qt6 && strip-lto-bytecode "${ED}"
# remove CONTRIBUTING, LICENSE and duplicate README
rm -r "${ED}/usr/share/doc/${PF}/avogadrolibs" || die
}
|