aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Barbieri <lssndrbarbieri@gmail.com>2021-03-14 23:48:48 +0100
committerAlessandro Barbieri <lssndrbarbieri@gmail.com>2021-03-14 23:48:48 +0100
commit2f3797d95a55a13ae749f9050d17438a460f0049 (patch)
treecc2655fe4b34e06d0efcd2a4b9fd8a700b12af55 /eclass/octaveforge.eclass
parentdev-R/dplyr: new version (untested) (diff)
downloadguru-2f3797d95a55a13ae749f9050d17438a460f0049.tar.gz
guru-2f3797d95a55a13ae749f9050d17438a460f0049.tar.bz2
guru-2f3797d95a55a13ae749f9050d17438a460f0049.zip
eclass: old g-octave eclass
Signed-off-by: Alessandro Barbieri <lssndrbarbieri@gmail.com>
Diffstat (limited to 'eclass/octaveforge.eclass')
-rw-r--r--eclass/octaveforge.eclass105
1 files changed, 105 insertions, 0 deletions
diff --git a/eclass/octaveforge.eclass b/eclass/octaveforge.eclass
new file mode 100644
index 000000000..d5492e891
--- /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 <rafael@rafaelmartins.eng.br>
+# 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'
+}