|
| 1 | +# Copyright 2021-2024 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=8 |
| 5 | + |
| 6 | +PYTHON_COMPAT=( python3_{10..12} ) |
| 7 | +BOINC_APP_OPTIONAL=1 |
| 8 | +inherit boinc-app flag-o-matic meson optfeature python-any-r1 |
| 9 | + |
| 10 | +DESCRIPTION="Program for docking ligands to proteins and nucleic acids" |
| 11 | +HOMEPAGE="https://gitlab.com/Jukic/cmdock" |
| 12 | +SRC_URI="https://gitlab.com/Jukic/${PN}/-/archive/v${PV}/${PN}-v${PV}.tar.bz2" |
| 13 | +S="${WORKDIR}/${PN}-v${PV}" |
| 14 | + |
| 15 | +LICENSE="LGPL-3 ZLIB" |
| 16 | +SLOT="0/${PV}" |
| 17 | +KEYWORDS="~amd64" |
| 18 | +IUSE="apidoc cpu_flags_x86_sse2 doc test" |
| 19 | + |
| 20 | +# Flaky tests |
| 21 | +RESTRICT="test" |
| 22 | + |
| 23 | +DEPEND=" |
| 24 | + dev-cpp/eigen:3 |
| 25 | + >=dev-cpp/indicators-2.3-r1 |
| 26 | + >=dev-cpp/pcg-cpp-0.98.1_p20210406-r1 |
| 27 | + >=dev-libs/cxxopts-3 |
| 28 | +" |
| 29 | +BDEPEND=" |
| 30 | + apidoc? ( |
| 31 | + app-text/doxygen |
| 32 | + dev-texlive/texlive-fontutils |
| 33 | + ) |
| 34 | + doc? ( |
| 35 | + $(python_gen_any_dep ' |
| 36 | + dev-python/insipid-sphinx-theme[${PYTHON_USEDEP}] |
| 37 | + dev-python/sphinx[${PYTHON_USEDEP}] |
| 38 | + ') |
| 39 | + ) |
| 40 | + test? ( ${PYTHON_DEPS} ) |
| 41 | +" |
| 42 | + |
| 43 | +PATCHES=( |
| 44 | + "${FILESDIR}"/${P}-include.patch |
| 45 | + "${FILESDIR}"/${P}-cxxopts.patch |
| 46 | +) |
| 47 | + |
| 48 | +DOCS=( README.md changelog.md ) |
| 49 | + |
| 50 | +BOINC_MASTER_URL="https://www.sidock.si/sidock/" |
| 51 | +BOINC_INVITATION_CODE="Crunch_4Science" |
| 52 | +BOINC_APP_HELPTEXT=\ |
| 53 | +"The easiest way to do something useful with this application |
| 54 | +is to attach it to SiDock@home BOINC project." |
| 55 | + |
| 56 | +INSTALL_PREFIX="${EPREFIX}/opt/${P}" |
| 57 | + |
| 58 | +boinc-app_add_deps --wrapper |
| 59 | + |
| 60 | +python_check_deps() { |
| 61 | + use doc || return 0 |
| 62 | + |
| 63 | + python_has_version "dev-python/sphinx[${PYTHON_USEDEP}]" && |
| 64 | + python_has_version "dev-python/insipid-sphinx-theme[${PYTHON_USEDEP}]" |
| 65 | +} |
| 66 | + |
| 67 | +foreach_wrapper_job() { |
| 68 | + sed -e "s:@PREFIX@:${INSTALL_PREFIX}:g" -i "${1}" || die |
| 69 | +} |
| 70 | + |
| 71 | +src_prepare() { |
| 72 | + default |
| 73 | + python_fix_shebang "${S}"/bin |
| 74 | +} |
| 75 | + |
| 76 | +src_configure() { |
| 77 | + # very weird directory layout |
| 78 | + local emesonargs=( |
| 79 | + --prefix="${INSTALL_PREFIX:?}" |
| 80 | + $(meson_use apidoc) |
| 81 | + $(meson_use doc) |
| 82 | + $(meson_use test tests) |
| 83 | + -Ddocdir="${EPREFIX}"/usr/share/doc/${PF} |
| 84 | + ) |
| 85 | + meson_src_configure |
| 86 | + |
| 87 | + use cpu_flags_x86_sse2 || append-cppflags "-DBUNDLE_NO_SSE" |
| 88 | +} |
| 89 | + |
| 90 | +src_install() { |
| 91 | + meson_src_install |
| 92 | + python_optimize "${D}${INSTALL_PREFIX:?}"/bin |
| 93 | + |
| 94 | + if use boinc; then |
| 95 | + boinc_install_appinfo "${FILESDIR}"/app_info_0.2.0-r1.xml |
| 96 | + boinc_install_wrapper cmdock-l_wrapper \ |
| 97 | + "${FILESDIR}"/cmdock-l_job_0.2.0-r1.xml cmdock-l_job.xml |
| 98 | + |
| 99 | + # install cmdock executable |
| 100 | + exeinto "$(get_project_root)" |
| 101 | + exeopts --owner root --group boinc |
| 102 | + doexe "${D}${INSTALL_PREFIX:?}"/bin/cmdock |
| 103 | + |
| 104 | + # install a blank file |
| 105 | + insinto "$(get_project_root)" |
| 106 | + insopts -m 0644 --owner root --group boinc |
| 107 | + newins - docking_out |
| 108 | + fi |
| 109 | +} |
| 110 | + |
| 111 | +pkg_postinst() { |
| 112 | + optfeature "sdtether.py and sdrmsd.py scripts" "dev-python/numpy sci-chemistry/openbabel[python]" |
| 113 | + use boinc && boinc-app_pkg_postinst |
| 114 | +} |
| 115 | + |
| 116 | +pkg_postrm() { |
| 117 | + use boinc && boinc-app_pkg_postrm |
| 118 | +} |
0 commit comments