From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 646211382C5 for ; Sun, 14 Mar 2021 22:49:39 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B1929E083D; Sun, 14 Mar 2021 22:49:38 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 87F19E083D for ; Sun, 14 Mar 2021 22:49:38 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5A99F340D8A for ; Sun, 14 Mar 2021 22:49:37 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id CAE8D583 for ; Sun, 14 Mar 2021 22:49:35 +0000 (UTC) From: "Alessandro Barbieri" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Alessandro Barbieri" Message-ID: <1615762128.2f3797d95a55a13ae749f9050d17438a460f0049.Alessandro-Barbieri@gentoo> Subject: [gentoo-commits] repo/proj/guru:dev commit in: eclass/ X-VCS-Repository: repo/proj/guru X-VCS-Files: eclass/octaveforge.eclass X-VCS-Directories: eclass/ X-VCS-Committer: Alessandro-Barbieri X-VCS-Committer-Name: Alessandro Barbieri X-VCS-Revision: 2f3797d95a55a13ae749f9050d17438a460f0049 X-VCS-Branch: dev Date: Sun, 14 Mar 2021 22:49:35 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 7106f013-698d-463b-b984-0f8b31653d44 X-Archives-Hash: b347430ddf641b9311d4b57298c64c78 commit: 2f3797d95a55a13ae749f9050d17438a460f0049 Author: Alessandro Barbieri gmail com> AuthorDate: Sun Mar 14 22:48:48 2021 +0000 Commit: Alessandro Barbieri gmail com> CommitDate: Sun Mar 14 22:48:48 2021 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=2f3797d9 eclass: old g-octave eclass Signed-off-by: Alessandro Barbieri gmail.com> eclass/octaveforge.eclass | 105 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/eclass/octaveforge.eclass b/eclass/octaveforge.eclass new file mode 100644 index 00000000..d5492e89 --- /dev/null +++ b/eclass/octaveforge.eclass @@ -0,0 +1,105 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# +# Original Author: Rafael G. Martins +# Purpose: octaveforge helper eclass. +# + +# @ECLASS-VARIABLE: OCTAVEFORGE_CAT +# @DESCRIPTION: +# the octave-forge category of the package. +OCTAVEFORGE_CAT="${OCTAVEFORGE_CAT:-main}" + + +REPO_URI="http://svn.code.sf.net/p/octave/code/trunk/octave-forge" +if [[ "${PV}" = 9999* ]]; then + inherit subversion autotools + ESVN_REPO_URI="${REPO_URI}/${OCTAVEFORGE_CAT}/${PN}" +else + inherit autotools + SRC_URI="mirror://sourceforge/octave/${P}.tar.gz" +fi + +SRC_URI=" + ${SRC_URI} + ${REPO_URI}/packages/package_Makefile.in -> octaveforge_Makefile + ${REPO_URI}/packages/package_configure.in -> octaveforge_configure +" +SLOT="0" + +# defining some paths +OCT_ROOT="/usr/share/octave" +OCT_PKGDIR="${OCT_ROOT}/packages" +OCT_BIN="$(type -p octave)" + +EXPORT_FUNCTIONS src_unpack src_prepare src_install pkg_postinst pkg_prerm pkg_postrm + +octaveforge_src_unpack() { + default + if [ ! -d "${WORKDIR}/${P}" ]; then + S="${WORKDIR}/${PN}" + cd "${S}" + fi +} + +octaveforge_src_prepare() { + [[ "${PV}" = 9999* ]] && subversion_src_prepare + for filename in Makefile configure; do + cp "${DISTDIR}/octaveforge_${filename}" "${S}/${filename}" + done + + #octave_config_info is deprecated in octave5 + sed -i 's|octave_config_info|__octave_config_info__|g' Makefile || die + + chmod 0755 "${S}/configure" + if [ -e "${S}"/src/autogen.sh ]; then + cd "${S}"/src && ./autogen.sh || die 'failed to run autogen.sh' + fi + if [ -e "${S}/src/Makefile" ]; then + sed -i 's/ -s / /g' "${S}/src/Makefile" || die 'sed failed.' + fi + eapply_user +} + +octaveforge_src_install() { + emake DESTDIR="${D}" DISTPKG='Gentoo' install + if [ -d doc/ ]; then + insinto "/usr/share/doc/${PF}" + doins -r doc/* || die 'failed to install the docs' + fi +} + +octaveforge_pkg_postinst() { + einfo "Registering ${CATEGORY}/${PF} on the Octave package database." + [ -d "${OCT_PKGDIR}" ] || mkdir -p "${OCT_PKGDIR}" + "${OCT_BIN}" -H -q --no-site-file --eval "pkg('rebuild');" \ + &> /dev/null || die 'failed to register the package.' +} + +octaveforge_pkg_prerm() { + einfo 'Running on_uninstall routines to prepare the package to remove.' + local pkgdir=$( + "${OCT_BIN}" -H -q --no-site-file --eval " + pkg('rebuild'); + l = pkg('list'); + disp(l{cellfun(@(x)strcmp(x.name,'${PN}'),l)}.dir); + " + ) + rm -f "${pkgdir}"/packinfo/on_uninstall.m + if [ -e "${pkgdir}"/packinfo/on_uninstall.m.orig ]; then + mv "$pkgdir"/packinfo/on_uninstall.m{.orig,} + cd "$pkgdir"/packinfo + "${OCT_BIN}" -H -q --no-site-file --eval " + l = pkg('list'); + on_uninstall(l{cellfun(@(x)strcmp(x.name,'${PN}'), l)}); + " &> /dev/null || die 'failed to remove the package' + fi +} + +octaveforge_pkg_postrm() { + einfo 'Rebuilding the Octave package database.' + [ -d "${OCT_PKGDIR}" ] || mkdir -p "${OCT_PKGDIR}" + "${OCT_BIN}" -H --silent --eval 'pkg rebuild' \ + &> /dev/null || die 'failed to rebuild the package database' +}