public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] New eclass: autotools-multilib-minimal
@ 2013-02-24  0:34 hasufell
  2013-02-24  4:22 ` hasufell
                   ` (2 more replies)
  0 siblings, 3 replies; 30+ messages in thread
From: hasufell @ 2013-02-24  0:34 UTC (permalink / raw
  To: gentoo-dev; +Cc: Samuli Suominen, mgorny

[-- Attachment #1: Type: text/plain, Size: 443 bytes --]

Some people seem to feel uncomfortable with autotools-multilib, because
it depends on autotools-utils.

Instead of arguing whether it makes sense or not I'd propose a similar
autotools related eclass.

I also attach an example conversion of media-libs/libexif (the
maintainer wants to keep the changes minimal).
Effectively I am only (almost) changing the function names and not the
ebuild code.

Feel free to propose a different eclass name.

[-- Attachment #2: autotools-multilib-minimal.eclass --]
[-- Type: text/plain, Size: 3010 bytes --]

# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: autotools-multilib-minimal.eclass
# @MAINTAINER:
# Julian Ospald <hasufell@gentoo.org>
# @BLURB: wrapper for multilib builds providing convenient multilib_src_* functions
# @DESCRIPTION:
#
# src_configure, src_compile, src_test and src_install are exported
# use multilib_src_* instead of src_* which runs this phase for
# all enabled ABIs
#
# if you need generic install rules, use multilib_src_install_all function

# @ECLASS-VARIABLE: AUTOTOOLS_IN_SOURCE_BUILD
# @DEFAULT_UNSET
# @DESCRIPTION:
# Set to enable in-source build.
# If you enable this, ensure that prepabisources is called
# at the END of src_prepare!


# EAPI=5 is required for meaningful MULTILIB_USEDEP.
case ${EAPI:-0} in
	5) ;;
	*) die "EAPI=${EAPI} is not supported" ;;
esac

inherit multilib-build

EXPORT_FUNCTIONS src_configure src_compile src_test src_install

prepabisources() {
	if [[ $AUTOTOOLS_IN_SOURCE_BUILD ]] ; then
		einfo "Copying sources to abi-specific dirs"

		prepabisources() {
			cp -pR "${S}" "${BUILD_DIR}" || die "failed to copy sources"
		}
		multilib_foreach_abi prepabisources
	fi
}

autotools-multilib-minimal_src_configure() {
	local myeconfsource
	if [[ $AUTOTOOLS_IN_SOURCE_BUILD ]] ; then
		myeconfsource=.
	else
		myeconfsource="${S}"
	fi

	_autotools-multilib-minimal_src_configure() {
		einfo "Configuring for ${ABI}"

		mkdir -p "${BUILD_DIR}" || die
		pushd "${BUILD_DIR}" >/dev/null || die
		if declare -f multilib_src_configure >/dev/null ; then
			ECONF_SOURCE="${myeconfsource}" multilib_src_configure
		else
			ECONF_SOURCE="${myeconfsource}" default_src_configure
		fi
		popd >/dev/null || die
	}
	multilib_foreach_abi _autotools-multilib-minimal_src_configure
}

autotools-multilib-minimal_src_compile() {
	_autotools-multilib-minimal_src_compile() {
		einfo "Compiling for ${ABI}"

		pushd "${BUILD_DIR}" >/dev/null || die
		if declare -f multilib_src_compile >/dev/null ; then
			multilib_src_compile
		else
			default_src_compile
		fi
		popd >/dev/null || die
	}
	multilib_foreach_abi _autotools-multilib-minimal_src_compile
}

autotools-multilib-minimal_src_test() {
	_autotools-multilib-minimal_src_test() {
		einfo "Testing for ${ABI}"

		pushd "${BUILD_DIR}" >/dev/null || die
		if declare -f multilib_src_test >/dev/null ; then
			multilib_src_test
		else
			default_src_test
		fi
		popd >/dev/null || die
	}
	multilib_foreach_abi _autotools-multilib-minimal_src_test
}

autotools-multilib-minimal_src_install() {
	_autotools-multilib-minimal_src_install() {
		einfo "Installing for ${ABI}"

		pushd "${BUILD_DIR}" >/dev/null || die
		if declare -f multilib_src_install >/dev/null ; then
			multilib_src_install
		else
			default_src_install	
		fi
		multilib_check_headers
		popd >/dev/null || die
	}
	multilib_foreach_abi _autotools-multilib-minimal_src_install

	if declare -f multilib_src_install_all >/dev/null ; then
		multilib_src_install_all
	fi
}

[-- Attachment #3: libexif-0.6.21.ebuild.diff --]
[-- Type: text/plain, Size: 1438 bytes --]

--- media-libs/libexif/libexif-0.6.21.ebuild
+++ media-libs/libexif/libexif-0.6.21-r1.ebuild
@@ -2,8 +2,8 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-x86/media-libs/libexif/libexif-0.6.21.ebuild,v 1.8 2012/11/07 19:03:58 grobian Exp $
 
-EAPI=4
-inherit eutils libtool
+EAPI=5
+inherit autotools-multilib-minimal eutils libtool
 
 DESCRIPTION="Library for parsing, editing, and saving EXIF data"
 HOMEPAGE="http://libexif.sourceforge.net/"
@@ -11,7 +11,7 @@
 
 LICENSE="LGPL-2.1"
 SLOT="0"
-KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
 IUSE="doc nls static-libs"
 
 RDEPEND="nls? ( virtual/libintl )"
@@ -26,7 +26,7 @@
 	elibtoolize # For *-bsd
 }
 
-src_configure() {
+multilib_src_configure() {
 	econf \
 		$(use_enable static-libs static) \
 		$(use_enable nls) \
@@ -34,8 +34,11 @@
 		--with-doc-dir="${EPREFIX}"/usr/share/doc/${PF}
 }
 
-src_install() {
+multilib_src_install() {
 	emake DESTDIR="${D}" install
+}
+
+multilib_src_install_all() {
 	prune_libtool_files
 	rm -f "${ED}"/usr/share/doc/${PF}/{ABOUT-NLS,COPYING}
 }

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2013-03-02 15:14 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-24  0:34 [gentoo-dev] New eclass: autotools-multilib-minimal hasufell
2013-02-24  4:22 ` hasufell
2013-02-24 10:06   ` Michał Górny
2013-02-24 10:11     ` Diego Elio Pettenò
2013-02-24 14:17       ` hasufell
2013-02-24 14:33         ` Pacho Ramos
2013-02-27 13:01         ` Samuli Suominen
2013-02-27 20:13           ` Michał Górny
2013-02-27 20:15           ` Pacho Ramos
2013-02-24 14:57   ` Michał Górny
2013-02-24 15:12     ` hasufell
2013-02-24 15:12     ` Pacho Ramos
2013-02-24 15:53       ` Michał Górny
2013-02-24 16:21         ` Pacho Ramos
2013-02-24 16:28         ` Alexis Ballier
2013-02-24 16:58         ` Samuli Suominen
2013-02-24 18:56           ` Michał Górny
2013-02-24 19:40             ` hasufell
2013-02-24 18:05         ` [gentoo-dev] " Jonathan Callen
2013-02-24 18:18           ` Michał Górny
2013-02-24 16:22 ` [gentoo-dev] " Alexis Ballier
2013-02-24 16:42   ` hasufell
2013-02-24 18:46     ` Alexis Ballier
2013-02-24 22:39 ` Samuli Suominen
2013-02-28  1:06   ` hasufell
2013-02-28  8:30     ` Michał Górny
2013-02-28 15:16       ` hasufell
2013-03-02  2:50       ` hasufell
2013-03-02 15:07         ` Michał Górny
2013-03-02 15:13           ` hasufell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox