commit: 14617d41adcaac22702439046b5dad6a5979ac94
Author: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
AuthorDate: Thu May 5 07:24:49 2022 +0000
Commit: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
CommitDate: Thu May 5 07:32:17 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=14617d41
octaveforge.eclass: move octaveforge makefile logic into the eclass
Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>
eclass/octaveforge.eclass | 128 +++++++++++++++++++++++++++++++++++-----------
1 file changed, 99 insertions(+), 29 deletions(-)
diff --git a/eclass/octaveforge.eclass b/eclass/octaveforge.eclass
index 590f21a1c..7f5f38dee 100644
--- a/eclass/octaveforge.eclass
+++ b/eclass/octaveforge.eclass
@@ -17,12 +17,7 @@ case ${EAPI} in
*) die "${ECLASS}: EAPI ${EAPI} unsupported."
esac
-EXPORT_FUNCTIONS src_unpack src_prepare src_install pkg_postinst pkg_prerm
pkg_postrm
-
-# @ECLASS-VARIABLE: OCTAVEFORGE_CAT
-# @DESCRIPTION:
-# the octave-forge category of the package.
-OCTAVEFORGE_CAT="${OCTAVEFORGE_CAT:-main}"
+EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install pkg_postinst
pkg_prerm pkg_postrm
# @ECLASS-VARIABLE: REPO_URI
# @DESCRIPTION:
@@ -48,7 +43,6 @@ OCT_BIN="$(type -p octave)"
SRC_URI="
mirror://sourceforge/octave/${P}.tar.gz
- ${REPO_URI}/packages/package_Makefile.in -> octaveforge_Makefile
${REPO_URI}/packages/package_configure.in -> octaveforge_configure
"
SLOT="0"
@@ -68,12 +62,7 @@ octaveforge_src_unpack() {
# @DESCRIPTION:
# function to add octaveforge specific makefile and configure and run
autogen.sh if available
octaveforge_src_prepare() {
- for filename in Makefile configure; do
- cp "${DISTDIR}/octaveforge_${filename}" "${S}/${filename}" ||
die
- done
-
- #octave_config_info is deprecated in octave5
- sed -i 's|octave_config_info|__octave_config_info__|g' Makefile || die
+ cp "${DISTDIR}/octaveforge_configure" "${S}/configure" || die
chmod 0755 "${S}/configure" || die
if [[ -e "${S}/src/autogen.sh" ]]; then
@@ -87,12 +76,87 @@ octaveforge_src_prepare() {
eapply_user
}
+octaveforge_src_compile() {
+ PKGDIR="$(pwd | sed -e 's|^.*/||' || die)"
+ export OCT_PACKAGE="${TMPDIR}/${PKGDIR}.tar.gz"
+ export OCT_PKG=$(echo "${PKGDIR}" | sed -e 's|^\(.*\)-.*|\1|' || die)
+ export MKOCTFILE="mkoctfile -v"
+
+ cmd="disp(__octave_config_info__('octlibdir'));"
+ OCTLIBDIR=$(octavecommand "${cmd}" || die)
+ export LFLAGS="-L${OCTLIBDIR}"
+
+ if [[ -e src/Makefile ]]; then
+ emake -C src all
+ fi
+
+ if [[ -e src/Makefile ]]; then
+ mv src/Makefile src/Makefile.disable || die
+ fi
+ if [[ -e src/configure ]]; then
+ mv src/configure src/configure.disable || die
+ fi
+
+ pushd .. || die
+ tar -czf "${OCT_PACKAGE}" "${PKGDIR}" || die
+}
+
# @FUNCTION: octaveforge_src_install
# @DESCRIPTION:
# function to install the octave package
# documentation to docsdir
octaveforge_src_install() {
- emake DESTDIR="${D}" DISTPKG='Gentoo' install
+ TMPDIR="${T}"
+ DESTDIR="${D}"
+ DISTPKG='Gentoo'
+
+ pushd ../ || die
+ if [[ "X${DISTPKG}X" != "XX" ]]; then
+ stripcmd="
+ unlink(pkg('local_list'));
+ unlink(pkg('global_list'));
+ "
+ fi
+ if [[ "X${DESTDIR}X" = "XX" ]]; then
+ cmd="
+ warning('off','all');
+ pkg('install','${OCT_PACKAGE}');l=pkg('list');
+ disp(l{cellfun(@(x)strcmp(x.name,'${OCT_PKG}'),l)}.dir);
+ "
+ oct_pkgdir=$(octavecommand "${cmd}${stripcmd}" || die)
+ else
+ cmd="disp(fullfile(OCTAVE_HOME(),'share','octave'));"
+ shareprefix=${DESTDIR}/$(octavecommand "${cmd}" || die)
+
cmd="disp(fullfile(__octave_config_info__('libexecdir'),'octave'));"
+ libexecprefix=${DESTDIR}/$(octavecommand "${cmd}" || die)
+ octprefix="${shareprefix}/packages" || die
+ archprefix="${libexecprefix}/packages" || die
+ if [[ ! -e "${octprefix}" ]]; then
+ mkdir -p "${octprefix}" || die
+ fi
+ if [[ ! -e "${archprefix}" ]]; then
+ mkdir -p "${archprefix}" || die
+ fi
+ cmd="
+ warning('off','all');
+ pkg('prefix','${octprefix}','${archprefix}');
+
pkg('global_list',fullfile('${shareprefix}','octave_packages'));
+
pkg('local_list',fullfile('${shareprefix}','octave_packages'));
+ pkg('install','-nodeps','-verbose','${OCT_PACKAGE}');
+ "
+ octavecommand "${cmd}" || die
+ cmd="
+ warning('off','all');
+ pkg('prefix','${octprefix}','${archprefix}');
+
pkg('global_list',fullfile('${shareprefix}','octave_packages'));
+
pkg('local_list',fullfile('${shareprefix}','octave_packages'));
+ l=pkg('list');
+ disp(l{cellfun(@(x)strcmp(x.name,'${OCT_PKG}'),l)}.dir);
+ "
+ oct_pkgdir=$(octavecommand "${cmd}${stripcmd}" || die)
+ fi
+ export oct_pkgdir
+
if [[ -d doc/ ]]; then
dodoc -r doc/*
fi
@@ -106,7 +170,8 @@ octaveforge_pkg_postinst() {
if [[ ! -d "${OCT_PKGDIR}" ]] ; then
mkdir -p "${OCT_PKGDIR}" || die
fi
- "${OCT_BIN}" -H -q --no-site-file --eval "pkg('rebuild');" &> /dev/null
|| die 'failed to register the package.'
+ cmd="pkg('rebuild');"
+ octavecommand "${cmd}" || die 'failed to register the package.'
}
# @FUNCTION: octaveforge_pkg_prerm
@@ -114,21 +179,21 @@ octaveforge_pkg_postinst() {
# function that will run on_uninstall routines to prepare the package to remove
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" || die
- if [[ -e "${pkgdir}/packinfo/on_uninstall.m.orig" ]]; then
- mv "$pkgdir"/packinfo/on_uninstall.m{.orig,} || die
- cd "$pkgdir/packinfo" || die
- "${OCT_BIN}" -H -q --no-site-file --eval "
+ cmd="
+ pkg('rebuild');
+ l = pkg('list');
+ disp(l{cellfun(@(x)strcmp(x.name,'${PN}'),l)}.dir);
+ "
+ oct_pkgdir=$(octavecommand "${cmd}" || die)
+ rm -f "${oct_pkgdir}/packinfo/on_uninstall.m" || die
+ if [[ -e "${oct_pkgdir}/packinfo/on_uninstall.m.orig" ]]; then
+ mv "$oct_pkgdir"/packinfo/on_uninstall.m{.orig,} || die
+ pushd "$oct_pkgdir/packinfo" || die
+ cmd="
l = pkg('list');
on_uninstall(l{cellfun(@(x)strcmp(x.name,'${PN}'), l)});
- " &> /dev/null || die 'failed to remove the package'
+ "
+ octavecommand "${cmd}" || die 'failed to remove the package'
fi
}
@@ -140,5 +205,10 @@ octaveforge_pkg_postrm() {
if [[ ! -d "${OCT_PKGDIR}" ]] ; then
mkdir -p "${OCT_PKGDIR}" || die
fi
- "${OCT_BIN}" -H --silent --eval 'pkg rebuild' &> /dev/null || die
'failed to rebuild the package database'
+ cmd="pkg('rebuild');"
+ "${OCT_BIN}" -H --silent "${cmd}" || die 'failed to rebuild the package
database'
+}
+
+octavecommand() {
+ "${OCT_BIN}" -H -q --no-site-file --eval "$1"
}