From 35bd187553d30e0ee8e5ececb18dec6512e42720 Mon Sep 17 00:00:00 2001 From: Nicolas PARLANT Date: Sun, 19 Jul 2026 08:49:46 +0200 Subject: [PATCH] sci-chemistry/openbabel: add 3.2.1 do not build/install the test program roundtrip automagic w/ wxwidgets is fixed by upstream Closes: https://bugs.gentoo.org/977020 Signed-off-by: Nicolas PARLANT Part-of: https://codeberg.org/gentoo/gentoo/pulls/1473 Signed-off-by: Sam James --- sci-chemistry/openbabel/Manifest | 1 + .../files/openbabel-3.2.1-rm_roundtrip.patch | 28 ++ .../openbabel/openbabel-3.2.1.ebuild | 251 ++++++++++++++++++ 3 files changed, 280 insertions(+) create mode 100644 sci-chemistry/openbabel/files/openbabel-3.2.1-rm_roundtrip.patch create mode 100644 sci-chemistry/openbabel/openbabel-3.2.1.ebuild diff --git a/sci-chemistry/openbabel/Manifest b/sci-chemistry/openbabel/Manifest index ea27a18b1136b..1966b8074de8e 100644 --- a/sci-chemistry/openbabel/Manifest +++ b/sci-chemistry/openbabel/Manifest @@ -1,2 +1,3 @@ DIST openbabel-3.1.1_p20241221.tar.gz 36864825 BLAKE2B 55e6fbdd5c50a557c40fd5ffaca41753f73175b2b4eea22abe5c2b0031363e3c133acf9a8daf5b1cb362a3adb6398204497af036b9a7ba3630c1d8ccbce0f9d3 SHA512 44340c3d08b22783cf6a702c192480869b73fef21104641feaf5cbcd51f693fd17bb05ad31a3520f330aa57733d6f4be707b3c1243b3010d6ceccca8974e732f DIST openbabel-3.2.0.tar.gz 37815471 BLAKE2B b94e4de7a190c8e3b63adcb1f50ad114eb14c30809c2e85f297872b243c4fb6a6001b86d705dc5276d92b74a5122d31a04f26db48547d56e35a6bfacbefac6b1 SHA512 0def0b8c6185ec648c41b32c9c2963329f764b57105efe895fa435fd2ee4878b70141b0ac9e80dddbc82e2ca95281955f612a21ba0dd5c0e7ef715061acf8234 +DIST openbabel-3.2.1.tar.gz 37835590 BLAKE2B 225d6bb38fe494a2406e290a14e49ce2fe66ca2dadd9248d5c6afa6274db7b6c9b2bdac05dd66ff025d083f3ff058164820b9e080d88e7e32d25f00dd6f23cc3 SHA512 fb4faf636a3d46fa88c57582a4a3ffe188feb2b21bdc6c43a5de5757617caa051709fbac38f15acdb51328055722a9a37f5410551bc75e1a825593fc80a2f83a diff --git a/sci-chemistry/openbabel/files/openbabel-3.2.1-rm_roundtrip.patch b/sci-chemistry/openbabel/files/openbabel-3.2.1-rm_roundtrip.patch new file mode 100644 index 0000000000000..373a6e4212384 --- /dev/null +++ b/sci-chemistry/openbabel/files/openbabel-3.2.1-rm_roundtrip.patch @@ -0,0 +1,28 @@ +this test is skipped because it's really long and heavy, could be >1500s +do not build/install it either +see https://bugs.gentoo.org/977020 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -233,22 +233,6 @@ if(WITH_INCHI) + endforeach(test ${inchitests}) + endif(WITH_INCHI) + +-# ########################################################### +-# roundtrip +-# ########################################################### +-add_executable(roundtrip roundtrip.cpp) +-target_link_libraries(roundtrip ${libs}) +- +-if(NOT BUILD_SHARED AND NOT BUILD_MIXED) +- set_target_properties(roundtrip PROPERTIES LINK_SEARCH_END_STATIC TRUE) +-endif() +- +-install(TARGETS roundtrip +- RUNTIME DESTINATION bin +- LIBRARY DESTINATION lib${LIB_SUFFIX} +- ARCHIVE DESTINATION lib${LIB_SUFFIX} +-) +- + # ########################## + # Tests wrapped in Python # + # ########################## diff --git a/sci-chemistry/openbabel/openbabel-3.2.1.ebuild b/sci-chemistry/openbabel/openbabel-3.2.1.ebuild new file mode 100644 index 0000000000000..b7ef4af26601c --- /dev/null +++ b/sci-chemistry/openbabel/openbabel-3.2.1.ebuild @@ -0,0 +1,251 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +GENTOO_DEPEND_ON_PERL="no" +PYTHON_COMPAT=( python3_{12..15} ) +WX_GTK_VER=3.2-gtk3 + +inherit cmake desktop flag-o-matic perl-module python-r1 toolchain-funcs wxwidgets xdg + +DESCRIPTION="Interconverts file formats used in molecular modeling" +HOMEPAGE="https://openbabel.org/ https://github.com/openbabel/openbabel/" + +if [[ "${PV}" == *9999* ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/openbabel/${PN}.git" +else + if [[ "${PV}" == *_p* ]]; then + # Set to commit hash + OPENBABEL_COMMIT="" + SRC_URI="https://github.com/${PN}/${PN}/archive/${OPENBABEL_COMMIT}.tar.gz -> ${P}.tar.gz" + S="${WORKDIR}/${PN}-${OPENBABEL_COMMIT}" + else + MY_P="${PN}-$(ver_rs 1- -)" + SRC_URI="https://github.com/${PN}/${PN}/archive/${MY_P}.tar.gz -> ${P}.tar.gz" + S="${WORKDIR}/${PN}-${MY_P}" + fi + KEYWORDS="~amd64 ~arm ~x86" +fi + +LICENSE="GPL-2" +# See src/CMakeLists.txt for LIBRARY_VERSION +SLOT="0/8.0.0" +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 ${GENTOO_PERL_USESTRING}" +RESTRICT="!test? ( test )" +REQUIRED_USE=" + python? ( ${PYTHON_REQUIRED_USE} ) + test? ( inchi !minimal python? ( json png ) ${PYTHON_REQUIRED_USE} ) +" + +RDEPEND=" + dev-cpp/eigen:= + virtual/zlib:= + inchi? ( sci-libs/inchi ) + json? ( >=dev-libs/rapidjson-1.1.0 ) + !minimal? ( + dev-libs/libxml2:2= + png? ( x11-libs/cairo ) + ) + perl? ( + ${GENTOO_PERL_DEPSTRING} + dev-lang/perl:= + ) + python? ( ${PYTHON_DEPS} ) + wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}=[X] ) +" +DEPEND="${RDEPEND}" +BDEPEND=" + dev-lang/perl + doc? ( + app-text/doxygen + dev-texlive/texlive-latex + ) + perl? ( dev-lang/swig ) + python? ( dev-lang/swig ) + test? ( dev-lang/python ) +" + +PATCHES=( + # prevent installation of examples in /usr/bin + "${FILESDIR}"/${PN}-3.1.1_p2024-fix_examples.patch + # filter -O2 + "${FILESDIR}"/${PN}-3.2.0-cflags.patch + # do not build/install the test program 'roundtrip', bug #977020 + "${FILESDIR}"/${PN}-3.2.1-rm_roundtrip.patch +) + +pkg_pretend() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp +} + +pkg_setup() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp +} + +gen_python_bindings() { + mkdir -p scripts/${EPYTHON} || die + # Appends to scripts/CMakeLists.txt, substituting the correct tags, for + # each valid python implementation, + cat "${FILESDIR}"/${PN}-python-3.2.cmake | \ + sed -e "s|@@EPYTHON@@|${EPYTHON}|" \ + -e "s|@@PYTHON_INCLUDE_DIR@@|$(python_get_includedir)|" \ + -e "s|@@PYTHON_LIBS@@|$(python_get_LIBS)|" \ + -e "s|@@PYTHON_SITEDIR@@|$(python_get_sitedir)|" >> \ + scripts/CMakeLists.txt || die +} + +src_prepare() { + cmake_src_prepare + + # Prevent bundled inchi as fallback + rm -r include/inchi || die + + use python && python_foreach_impl gen_python_bindings +} + +src_configure() { + if use json; then + # -DOPTIMIZE_NATIVE=ON also forces -march=native so use + # cpu_flags to set defines instead + use cpu_flags_x86_sse2 && append-cppflags -DRAPIDJSON_SSE2 + use cpu_flags_x86_sse4_2 && append-cppflags -DRAPIDJSON_SSE42 + use cpu_flags_arm_neon && append-cppflags -DRAPIDJSON_NEON + fi + + use wxwidgets && setup-wxwidgets + + use_bindings() { + (use perl || use python) && (echo 'yes' || die) || (echo 'no' || die) + } + + local mycmakeargs=( + $(cmake_use_find_package png Cairo) + -DCMAKE_SKIP_RPATH=ON + -DBUILD_DOCS=$(usex doc) + -DBUILD_EXAMPLES=$(usex examples) + -DBUILD_GUI=$(usex wxwidgets) + -DENABLE_OPENMP=$(usex openmp) + -DENABLE_TESTS=$(usex test) + -DMINIMAL_BUILD=$(usex minimal) + # All three required to comply w/ useflag and prevent bundled lib + -DOPENBABEL_USE_SYSTEM_INCHI=$(usex inchi) + -DADD_INCHI_FORMAT=$(usex inchi) + -DWITH_INCHI=$(usex inchi) + -DOPTIMIZE_NATIVE=OFF + -DPERL_BINDINGS=$(usex perl) + -DPYTHON_BINDINGS=OFF + -DRUN_SWIG=$(use_bindings) + -DWITH_COORDGEN=false + -DWITH_JSON=$(usex json) + # MEAPARSER + -DCMAKE_DISABLE_FIND_PACKAGE_Boost=ON + -DWITH_MAEPARSER=false + ) + + if use perl; then + perl_set_version + mycmakeargs+=( + -DPERL_INSTDIR="${VENDOR_ARCH}" + ) + fi + + if use python; then + mycmakeargs+=( + -DPYTHON_GENTOO_BINDINGS=ON + ) + fi + + if use test; then + # used for unittest + python_setup + mycmakeargs+=( + -DPython_EXECUTABLE="${PYTHON}" + ) + fi + + cmake_src_configure +} + +src_compile() { + # Avoid perl-module_src_compile (bug #963096) + cmake_src_compile +} + +src_test() { + local CMAKE_SKIP_TESTS=() + ! use json && CMAKE_SKIP_TESTS+=( + test_ketformat* + ) + ! use wxwidgets && CMAKE_SKIP_TESTS+=( + test_tautomer_{22,27} + ) + + # Weird deadlock causes system_load to keep rising + cmake_src_test -j1 +} + +openbabel-optimize() { + python_optimize "${D}/$(python_get_sitedir)"/openbabel || die +} + +src_install() { + cmake_src_install + + docinto html + for x in doc/*.html; do + [[ ${x} != doc/api*.html ]] && dodoc ${x} + done + + if use doc; then + cmake_src_install docs + docinto html/API + dodoc -r doc/API/html/. + fi + + if use examples; then + # no compression since we want ready-to-run scripts + docompress -x /usr/share/doc/${PF}/examples + + # ${PV} doesn't correspond to the internal BABEL_VERSION for + # live or patch release builds so we grep it + local babel_ver=$( + grep '^#define BABEL_VERSION' < \ + "${BUILD_DIR}"/include/openbabel/babelconfig.h | \ + cut -d \" -f 2 || die + ) + docinto examples/povray + dodoc doc/dioxin.* doc/README*.pov* + # Needed by the povray example + dosym ../../../../${PN}/${babel_ver}/babel_povray3.inc \ + /usr/share/doc/${PF}/examples/povray/babel31.inc + fi + + if use perl; then + docinto / + newdoc scripts/perl/Changes Changes.perl + newdoc scripts/perl/README README.perl + if use examples; then + docinto examples/perl + dodoc -r scripts/perl/examples/. + fi + fi + + if use python; then + python_foreach_impl openbabel-optimize + docinto / + newdoc scripts/python/README.rst README.python.rst + docinto html + dodoc scripts/python/*.html + if use examples; then + docinto examples/python + dodoc -r scripts/python/examples/. + fi + fi + + if use wxwidgets; then + make_desktop_entry --eapi9 obgui -n "Open Babel" -i ${PN} + newicon "${S}"/src/GUI/babel.xpm ${PN}.xpm + fi +}