Сравнение openbabel-2.4.1-r2 с openbabel-3.1.1_p20210225

/usr/portage/sci-chemistry/openbabel/openbabel-3.1.1_p20210225.ebuild 2023-10-09 14:52:35.036368490 +0300
1
# Copyright 1999-2018 Gentoo Foundation
1
# Copyright 1999-2023 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI=6
4
EAPI=8
5 5

  
6
WX_GTK_VER="3.0"
6
PYTHON_COMPAT=( python3_{9..11} )
7
WX_GTK_VER=3.0-gtk3
7 8

  
8
inherit cmake-utils eutils wxwidgets
9
inherit cmake desktop flag-o-matic perl-functions python-r1 toolchain-funcs wxwidgets xdg-utils
9 10

  
10 11
DESCRIPTION="Interconverts file formats used in molecular modeling"
11
HOMEPAGE="http://openbabel.sourceforge.net/"
12
SRC_URI="mirror://sourceforge/openbabel/${P}.tar.gz"
12
HOMEPAGE="https://openbabel.org/"
13

  
14
if [[ "${PV}" == *9999* ]]; then
15
	inherit git-r3
16
	EGIT_REPO_URI="https://github.com/openbabel/${PN}.git"
17
else
18
	if [[ "${PV}" == *_p* ]]; then	# eg., openbabel-3.1.1_p20210325
19
		# Set to commit hash
20
		OPENBABEL_COMMIT=08e23f39b0cc39b4eebd937a5a2ffc1a7bac3e1b
21
		SRC_URI="https://github.com/${PN}/${PN}/archive/${OPENBABEL_COMMIT}.tar.gz -> ${P}.tar.gz"
22
		S="${WORKDIR}/${PN}-${OPENBABEL_COMMIT}"
23
	else
24
		MY_P="${PN}-$(ver_rs 1- -)"
25
		SRC_URI="https://github.com/${PN}/${PN}/archive/${MY_P}.tar.gz -> ${P}.tar.gz"
26
		S="${WORKDIR}/${PN}-${MY_P}"
27
	fi
28
	KEYWORDS="amd64 ~arm ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
29
fi
30

  
31
SRC_URI="${SRC_URI}
32
	https://openbabel.org/docs/dev/_static/babel130.png -> ${PN}.png
33
	https://openbabel.org/OBTitle.jpg ->  ${PN}.jpg"
13 34

  
14 35
# See src/CMakeLists.txt for LIBRARY_VERSION
15
SLOT="0/5.0.0"
36
SLOT="0/7.0.0"
16 37
LICENSE="GPL-2"
17
KEYWORDS="amd64 ~arm x86 ~amd64-linux ~x86-linux ~ppc-macos"
18
IUSE="doc openmp test wxwidgets"
38
IUSE="cpu_flags_arm_neon cpu_flags_x86_sse2 cpu_flags_x86_sse4_2 doc examples +inchi json minimal openmp perl png python test wxwidgets"
19 39

  
20
RDEPEND="
40
RESTRICT="!test? ( test )"
41

  
42
# Inaccurate dependency logic upstream
43
REQUIRED_USE="
44
	python? ( ${PYTHON_REQUIRED_USE} )
45
	test? ( inchi json !minimal wxwidgets )
46
"
47

  
48
BDEPEND="
49
	dev-lang/perl
50
	doc? (
51
		app-doc/doxygen
52
		dev-texlive/texlive-latex
53
	)
54
	perl? ( >=dev-lang/swig-2 )
55
	python? ( >=dev-lang/swig-2 )
56
	test? ( dev-lang/python )
57
"
58

  
59
COMMON_DEPEND="
21 60
	dev-cpp/eigen:3
22 61
	dev-libs/libxml2:2
23
	sci-libs/inchi
24
	sys-libs/zlib
25
	wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X] )"
26
DEPEND="${RDEPEND}
27
	>=dev-util/cmake-2.4.8
28
	doc? ( app-doc/doxygen )"
62
	sys-libs/zlib:=
63
	inchi? ( sci-libs/inchi )
64
	json? ( >=dev-libs/rapidjson-1.1.0 )
65
	png? ( x11-libs/cairo )
66
	python? ( ${PYTHON_DEPS} )
67
	wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X] )
68
"
69

  
70
DEPEND="
71
	${COMMON_DEPEND}
72
	perl? ( dev-lang/perl )
73
"
29 74

  
30
DOCS=( AUTHORS NEWS.md README.md THANKS doc/dioxin.{inc,mol2} doc/README.{dioxin.pov,povray} )
75
RDEPEND="
76
	${COMMON_DEPEND}
77
	perl? (
78
		dev-lang/perl:=
79
		!sci-chemistry/openbabel-perl
80
	)
81
"
31 82

  
32 83
PATCHES=(
33
	"${FILESDIR}"/${PN}-2.3.2-gcc-6_and_7-backport.patch
34
	"${FILESDIR}"/${P}-gcc-8_and_9.patch
35
	)
84
	"${FILESDIR}"/openbabel-3.1.1-fix-time-check-cmake.patch
85
)
86

  
87
pkg_pretend() {
88
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
89
}
36 90

  
37 91
pkg_setup() {
38
	if use openmp; then
39
		if [[ $(tc-getCC) == *gcc ]] && ! tc-has-openmp; then
40
			ewarn "OpenMP is not available in your current selected gcc"
41
			die "need openmp capable gcc"
42
		fi
43
		FORTRAN_NEED_OPENMP=1
44
	fi
92
	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
93
}
94

  
95
prepare_python_bindings() {
96
	mkdir -p scripts/${EPYTHON} || die
97
	# Appends to scripts/CMakeLists.txt, substituting the correct tags, for
98
	# each valid python implementation,
99
	cat "${FILESDIR}"/${PN}-python.cmake | \
100
		sed -e "s|@@EPYTHON@@|${EPYTHON}|" \
101
			-e "s|@@PYTHON_INCUDE_DIR@@|$(python_get_includedir)|" \
102
			-e "s|@@PYTHON_LIBS@@|$(python_get_LIBS)|" \
103
			-e "s|@@PYTHON_SITEDIR@@|$(python_get_sitedir)|" >> \
104
				scripts/CMakeLists.txt || die
45 105
}
46 106

  
47 107
src_prepare() {
48
	sed \
49
		-e '/__GNUC__/s:== 4:>= 4:g' \
50
		-i include/openbabel/shared_ptr.h || die
51
	cmake-utils_src_prepare
108
	cmake_src_prepare
109

  
110
	if use perl; then
111
		perl_set_version
112

  
113
		sed -e "/\${LIB_INSTALL_DIR}\/auto/s|\${LIB_INSTALL_DIR}|${VENDOR_ARCH}|" \
114
			-e "/\${LIB_INSTALL_DIR}\/Chemistry/s|\${LIB_INSTALL_DIR}|${VENDOR_ARCH}|" \
115
			-i scripts/CMakeLists.txt || die
116
	fi
117

  
118
	if use python; then
119
		# Skip the python bindings sections as we'll append our own
120
		sed -e '/^if (PYTHON_BINDINGS)$/s|PYTHON_BINDINGS|false|' \
121
			-i {scripts,test}/CMakeLists.txt || die
122
		if use test; then
123
			# Problems with testbindings built with -O2
124
			local test_skip="@unittest.skip('Similar to Issue #2138')"
125
			sed -e "/def testTemplates/s|^|    ${test_skip}\\n|" \
126
				-i test/testbindings.py || die
127
			test_skip="@unittest.skip('Similar to Issue #2246')"
128
			sed -e "/^def test_write_string/s|^|${test_skip}\\n|" \
129
				-i test/testobconv_writers.py || die
130
			fi
131
		python_foreach_impl prepare_python_bindings
132
	fi
133

  
134
	# Remove dependency automagic
135
	if ! use png; then
136
		sed -e '/^find_package(Cairo/d' -i CMakeLists.txt || die
137
	fi
138
	if ! use wxwidgets; then
139
		sed -e '/^find_package(wxWidgets/d' -i CMakeLists.txt || die
140
	fi
141
	if ! use inchi; then
142
		sed -e '/^else()$/s|else\(\)|elseif\(false\)|' \
143
			-i cmake/modules/FindInchi.cmake || die
144
	fi
145

  
146
	# Don't install example bins to /usr/bin
147
	if use examples; then
148
		sed -e "/RUNTIME DESTINATION/s|bin|share/doc/${PF}/examples|" \
149
			-i doc/examples/CMakeLists.txt || die
150
	fi
151

  
152
	# boost is only used if building with gcc-3.x, which isn't supported in
153
	# Gentoo. Still, it shouldn't look for, and include, its headers
154
	sed -e '/find_package(Boost/d' -i {{tools,src}/,}CMakeLists.txt || die
52 155
}
53 156

  
54 157
src_configure() {
55
	use wxwidgets && need-wxwidgets unicode
158
	if use json; then
159
		# -DOPTIMIZE_NATIVE=ON also forces -march=native so use
160
		# cpu_flags to set defines instead
161
		use cpu_flags_x86_sse2 && append-cppflags -DRAPIDJSON_SSE2
162
		use cpu_flags_x86_sse4_2 && append-cppflags -DRAPIDJSON_SSE42
163
		use cpu_flags_arm_neon && append-cppflags -DRAPIDJSON_NEON
164
	fi
165

  
166
	use wxwidgets && setup-wxwidgets
167

  
168
	use_bindings() {
169
		(use perl || use python) && (echo 'yes' || die) || (echo 'no' || die)
170
	}
171

  
56 172
	local mycmakeargs=(
57
		-DOPENBABEL_USE_SYSTEM_INCHI=ON
58
		-DOPENMP=$(usex openmp)
173
		-DBUILD_DOCS=$(usex doc)
174
		-DBUILD_EXAMPLES=$(usex examples)
59 175
		-DBUILD_GUI=$(usex wxwidgets)
176
		-DENABLE_OPENMP=$(usex openmp)
177
		-DENABLE_TESTS=$(usex test)
178
		-DMINIMAL_BUILD=$(usex minimal)
179
		# Set this, otherwise it defaults to true and forces WITH_INCHI=true
180
		-DOPENBABEL_USE_SYSTEM_INCHI=$(usex inchi)
181
		-DOPTIMIZE_NATIVE=OFF
182
		-DPERL_BINDINGS=$(usex perl)
183
		-DPYTHON_BINDINGS=$(usex python)
184
		-DRUN_SWIG=$(use_bindings)
185
		-DWITH_COORDGEN=false
186
		-DWITH_INCHI=$(usex inchi)
187
		-DWITH_JSON=$(usex json)
188
		-DWITH_MAEPARSER=false
60 189
	)
61 190

  
62
	cmake-utils_src_configure
191
	if use test; then
192
		# Help cmake find the python interpreter when dev-lang/python-exec is built
193
		# without native-symlinks support.
194
		python_setup
195
		mycmakeargs+=( -DPYTHON_EXECUTABLE="${PYTHON}" )
196
	fi
197

  
198
	cmake_src_configure
199
}
200

  
201
src_test() {
202
	# Wierd deadlock causes system_load to keep rising
203
	cmake_src_test -j1
204
}
205

  
206
openbabel-optimize() {
207
	python_optimize "${D}/$(python_get_sitedir)"/openbabel || die
63 208
}
64 209

  
65 210
src_install() {
211
	cmake_src_install
212

  
66 213
	docinto html
67
	dodoc doc/{*.html,*.png}
68
	if use doc ; then
214
	for x in doc/*.html; do
215
		[[ ${x} != doc/api*.html ]] && dodoc ${x}
216
	done
217
	# Rendered in some html pages
218
	newdoc "${DISTDIR}"/${PN}.png babel130.png
219
	newdoc "${DISTDIR}"/${PN}.jpg OBTitle.jpg
220

  
221
	if use doc; then
222
		cmake_src_install docs
69 223
		docinto html/API
70
		dodoc -r doc/API/html/*
224
		dodoc -r doc/API/html/.
71 225
	fi
72 226

  
73
	cmake-utils_src_install
74
}
227
	if use examples; then
228
		# no compression since we want ready-to-run scripts
229
		docompress -x /usr/share/doc/${PF}/examples
230

  
231
		# ${PV} doesn't correspond to the internal BABEL_VERSION for
232
		# live or patch release builds so we grep it
233
		local babel_ver=$(
234
			grep '^#define BABEL_VERSION' < \
235
				"${BUILD_DIR}"/include/openbabel/babelconfig.h | \
236
				cut -d \" -f 2 || die
237
		)
238
		docinto examples/povray
239
		dodoc doc/dioxin.* doc/README*.pov*
240
		# Needed by the povray example
241
		dosym ../../../../${PN}/${babel_ver}/babel_povray3.inc \
242
			/usr/share/doc/${PF}/examples/povray/babel31.inc
75 243

  
76
src_test() {
77
	local mycmakeargs=(
78
		-DOPENBABEL_USE_SYSTEM_INCHI=ON
79
		-DPYTHON_EXECUTABLE=false
80
		-DOPENMP=$(usex openmp)
81
		-DBUILD_GUI=$(usex wxwidgets)
82
		-DTESTS=$(usex test)
83
	)
244
	fi
245

  
246
	if use perl; then
247
		docinto /
248
		newdoc scripts/perl/Changes Changes.perl
249
		newdoc scripts/perl/README README.perl
250
		if use examples; then
251
			docinto examples/perl
252
			dodoc -r scripts/perl/examples/.
253
		fi
254
	fi
255

  
256
	if use python; then
257
		python_foreach_impl openbabel-optimize
258
		docinto /
259
		newdoc scripts/python/README.rst README.python.rst
260
		docinto html
261
		dodoc scripts/python/*.html
262
		if use examples; then
263
			docinto examples/python
264
			dodoc -r scripts/python/examples/.
265
		fi
266
	fi
84 267

  
85
	cmake-utils_src_configure
86
	cmake-utils_src_compile
87
	cmake-utils_src_test -E py
268
	if use wxwidgets; then
269
		make_desktop_entry obgui "Open Babel" ${PN}
270
		doicon "${DISTDIR}"/${PN}.png
271
	fi
88 272
}
89 273

  
90 274
pkg_postinst() {
91
	optfeature "perl support" sci-chemistry/openbabel-perl
92
	optfeature "python support" sci-chemistry/openbabel-python
275
	use wxwidgets && xdg_desktop_database_update
276
}
277

  
278
pkg_postrm() {
279
	use wxwidgets && xdg_desktop_database_update
93 280
}
Спасибо!