diff options
author | Dan Armak <danarmak@gentoo.org> | 2001-09-28 19:25:33 +0000 |
---|---|---|
committer | Dan Armak <danarmak@gentoo.org> | 2001-09-28 19:25:33 +0000 |
commit | f7fae54fe7b937b7a482622f2d39d7e6b503e14d (patch) | |
tree | 7c6ad6805e30defc41419891b2e8a0fe0ded7f8a /eclass | |
parent | Just updated my email. (diff) | |
download | historical-f7fae54fe7b937b7a482622f2d39d7e6b503e14d.tar.gz historical-f7fae54fe7b937b7a482622f2d39d7e6b503e14d.tar.bz2 historical-f7fae54fe7b937b7a482622f2d39d7e6b503e14d.zip |
Initial version of eclasses. :-)
If you're gong to play wih it:
1) wait for tomorrow, by then i'll have much more commited, including a README.
2) don't commit changes unless you know what you're doing
3) don't criticise unless you know what you're thinking
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/autoconf.eclass | 13 | ||||
-rw-r--r-- | eclass/base.eclass | 72 | ||||
-rw-r--r-- | eclass/c.eclass | 14 | ||||
-rw-r--r-- | eclass/inherit.eclass | 15 | ||||
-rw-r--r-- | eclass/kde-base.eclass | 67 | ||||
-rw-r--r-- | eclass/kde.eclass | 68 | ||||
-rw-r--r-- | eclass/notes.txt | 32 | ||||
-rw-r--r-- | eclass/virtual.eclass | 61 |
8 files changed, 342 insertions, 0 deletions
diff --git a/eclass/autoconf.eclass b/eclass/autoconf.eclass new file mode 100644 index 000000000000..a0c4545116bd --- /dev/null +++ b/eclass/autoconf.eclass @@ -0,0 +1,13 @@ +# Copyright 1999-2000 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# Author Dan Armak <danarmak@gentoo.org> +# $Header: /var/cvsroot/gentoo-x86/eclass/autoconf.eclass,v 1.1 2001/09/28 19:25:33 danarmak Exp $ +# The autoconf eclass merely adds autconf/automake deps. +. /usr/portage/inherit.eclass || die +inherit virtual || die +ECLASS=autoconf + +S=${WORKDIR}/${P} +DESCRIPTION="Based on the $ECLASS eclass" +DEPEND="${DEPEND} sys-devel/autoconf sys-devel/automake" + diff --git a/eclass/base.eclass b/eclass/base.eclass new file mode 100644 index 000000000000..6a7e200276cb --- /dev/null +++ b/eclass/base.eclass @@ -0,0 +1,72 @@ +# Copyright 1999-2000 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# Author Dan Armak <danarmak@gentoo.org> +# $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.1 2001/09/28 19:25:33 danarmak Exp $ +# The base eclass defines some default functions and variables. Nearly everything +# else inherits from here. +. /usr/portage/inherit.eclass || die +inherit virtual || die +ECLASS=base + +S=${WORKDIR}/${P} +DESCRIPTION="Based on the $ECLASS eclass" + +base_src_unpack() { + + while [ "$1" ]; do + + case $1 in + unpack) + unpack ${A} + ;; + all) + base_src_unpack unpack + ;; + esac + + shift + done + +} + +base_src_compile() { + + while [ "$1" ]; do + + case $1 in + configure) + configure || die + ;; + make) + make || die + ;; + all) + base_src_compile configure make + ;; + esac + + shift + done + +} + +base_src_install() { + + while [ "$1" ]; do + + case $1 in + make) + make DESTDIR=${D} install || die + ;; + all) + base_src_install make + ;; + esac + + shift + done + +} + +EXPORT_FUNCTIONS + diff --git a/eclass/c.eclass b/eclass/c.eclass new file mode 100644 index 000000000000..77e188999dea --- /dev/null +++ b/eclass/c.eclass @@ -0,0 +1,14 @@ +# Copyright 1999-2000 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# Author Dan Armak <danarmak@gentoo.org> +# $Header: /var/cvsroot/gentoo-x86/eclass/c.eclass,v 1.1 2001/09/28 19:25:33 danarmak Exp $ +# The "c" eclass merely adds gcc, glibc and ld.so to DEPEND/RDEPEND for comfort. +. /usr/portage/inherit.eclass || die +inherit virtual || die +ECLASS=c + +S=${WORKDIR}/${P} +DESCRIPTION="Based on the $ECLASS eclass" +DEPEND="${DEPEND} sys-devel/gcc virtual/glibc sys-devel/ld.so" +RDEPEND="${RDEPEND} sys-devel/gcc virtual/glibc sys-devel/ld.so" + diff --git a/eclass/inherit.eclass b/eclass/inherit.eclass new file mode 100644 index 000000000000..5f323b8a40fd --- /dev/null +++ b/eclass/inherit.eclass @@ -0,0 +1,15 @@ +# $Header: /var/cvsroot/gentoo-x86/eclass/inherit.eclass,v 1.1 2001/09/28 19:25:33 danarmak Exp $ +# This eclass provides the inherit() function. In the future it will be placed in ebuild.sh, but for now drobbins +# doesn't want to make a new portage just for my testing, so every eclass/ebuild will source this file manually and +# then inherit(). This way whn the tmie comes for this to move into stable ebuild.sh, we can just delete the source lines. + +ECLASSDIR=${PORTDIR}/eclass + +inherit() { + + while [ "$1" ]; do + source ${ECLASSDIR}/${1}.eclass + shift + done + +}
\ No newline at end of file diff --git a/eclass/kde-base.eclass b/eclass/kde-base.eclass new file mode 100644 index 000000000000..618c5cea0a41 --- /dev/null +++ b/eclass/kde-base.eclass @@ -0,0 +1,67 @@ +# Copyright 1999-2000 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# Author Dan Armak <danarmak@gentoo.org> +# $Header: /var/cvsroot/gentoo-x86/eclass/kde-base.eclass,v 1.1 2001/09/28 19:25:33 danarmak Exp $ +# This is the kde ebuild for >=2.2.1 kde base packages. Don't use for kdelibs though :-) +. /usr/portage/inherit.eclass || die +inherit base c autoconf || die +ECLASS=kde + +DESCRIPTION="Based on the $ECLASS eclass" +HOMEPAGE="http://www.kde.org/" + +DEPEND="${DEPEND} ( kde-base/kdelibs-${PV} ) dev-util/objprelink >=x11-libs/qt-x11-2.3.0" +#RDEPEND="${RDEPEND} kde-base/kdelibs-${PV} >=x11-libs/qt-x11-2.3.0" + +kde_src_compile() { + + while [ "$1" ]; do + + case $1 in + myconf) + use qtmt && myconf="$myconf --enable-mt" + use mitshm && myconf="$myconf --enable-mitshm" + use objprelink && myconf="$myconf --enable-objprelink" + ;; + configure) + ./configure --host=${CHOST} --with-x \ + ${myconf} --with-xinerama || die + ;; + make) + make || die + ;; + all) + kde_src_compile myconf configure make + ;; + esac + + shift + done + +} + +kde_src_install() { + + while [ "$1" ]; do + + case $1 in + make) + make install DESTDIR=${D} || die + ;; + dodoc) + dodoc AUTHORS ChangeLog README* + ;; + all) + kde_src_install make dodoc + ;; + esac + + shift + done + +} + + +EXPORT_FUNCTIONS + + diff --git a/eclass/kde.eclass b/eclass/kde.eclass new file mode 100644 index 000000000000..38d7caaaba4a --- /dev/null +++ b/eclass/kde.eclass @@ -0,0 +1,68 @@ +# Copyright 1999-2000 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# Author Dan Armak <danarmak@gentoo.org> +# $Header: /var/cvsroot/gentoo-x86/eclass/kde.eclass,v 1.1 2001/09/28 19:25:33 danarmak Exp $ +# This is the kde ebuild for std. kde-dependant apps which follow configure/make/make install +# procedures and have std. configure options. +. /usr/portage/inherit.eclass || die +inherit c autoconf base || die +ECLASS=kde + +DESCRIPTION="Based on the $ECLASS eclass" +HOMEPAGE="http://www.kde.org/" + +DEPEND="${DEPEND} kde-base/kdelibs dev-util/objprelink x11-libs/qt-x11" +RDEPEND="${RDEPEND} kde-base/kdelibs x11-libs/qt-x11" + +kde_src_compile() { + + while [ "$1" ]; do + + case $1 in + myconf) + use qtmt && myconf="$myconf --enable-mt" + use mitshm && myconf="$myconf --enable-mitshm" + use objprelink && myconf="$myconf --enable-objprelink" + ;; + configure) + ./configure --host=${CHOST} --with-x \ + ${myconf} --with-xinerama || die + ;; + make) + make || die + ;; + all) + kde_src_compile myconf configure make + ;; + esac + + shift + done + +} + +kde_src_install() { + + while [ "$1" ]; do + + case $1 in + make) + make install DESTDIR=${D} || die + ;; + dodoc) + dodoc AUTHORS ChangeLog README* + ;; + all) + kde_src_install make dodoc + ;; + esac + + shift + done + +} + + +EXPORT_FUNCTIONS + + diff --git a/eclass/notes.txt b/eclass/notes.txt new file mode 100644 index 000000000000..3d02ac14479c --- /dev/null +++ b/eclass/notes.txt @@ -0,0 +1,32 @@ +Notes about moving deps from ebuilds into eclasses +-------------------------------------------------- + +1. eclasses may define depends, but they sually do so without mentioning specific versions. The kde eclass depends on +x11-libs/qt-x11. howevr kde 2.2.1 depends on >=qt-x11-2.3.0, whih will have to be specified in the kdelibs ebuild. +The same applies to dependnig on kdelibs. the kde eclass includes a kdelibs dep, yet nearly all kde apps inheriting from +it are forced to specify it again with a minimal version. Expect a kde-base eclass in the near future which will inherit from +kde and be better suited for kde-base/* ebuilds of a specific kde version. + +2. More about depends of eclasses. Since kdelibs depends on qt and kde app foo depends on kdelibs, there is no need for foo +to explicitly require qt, just kdelibs. However we now move the qt depend from the kdelibs ebuild to the kde eclass, which is +inherited by both kdelibs and foo. So that they both depend on qt explicitly. This shouldn't be a problem, but it is a +change from the current situation. + +3. Most euilds don't define deps which they need such as gcc, glibc, ld.so, autoconf/make, gzip/bzip2/unzip/tar for extracting +the source archives. It'd be nice to have eclasses defnie all these common deps, but it will make some unneeded deps show up +in some cases. For now I have the c eclass and the autoonf eclass, but these are more for testing of multiple inheritance +than for any real use. + + +Notes for writig inheritig eclasses +----------------------------------- +1. Make sure to extend your variables and functions, not relpace them. In particular always use DEPEND=$DEPEND"..." +and the same for RDEPEND. +2. Remember to inherit virtual first, to EXPORT_FUNCTIONS and then to extend your functions. +3. Problem: +kde originally inherited base,c,autoconf. Of these three only base defines any functions, so you'd think the base functions +are the ones kde gets by default. However, because base, c and autoconf all inherit from virtual, they do, in fact, +implement empty funcions. So, if kde inherits base,c,autoconf in that order, it gets the virtual functions. This isn't +what we want, so kde should inherit base last. +In fact, kde should also inheit virtual first, like all eclasses, but that's a formality. +BEWARE OF MULTIPLE INHERITANCE, ESPECIALLY IN EBUILDS! diff --git a/eclass/virtual.eclass b/eclass/virtual.eclass new file mode 100644 index 000000000000..4834ef646274 --- /dev/null +++ b/eclass/virtual.eclass @@ -0,0 +1,61 @@ +# Copyright 1999-2000 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# Author Dan Armak <danarmak@gentoo.org> +# $Header: /var/cvsroot/gentoo-x86/eclass/virtual.eclass,v 1.1 2001/09/28 19:25:33 danarmak Exp $ +# All other eclasses, and thus ebuilds, inherit from this. It defines the EXPORT_FUNCTIONS +# string, which (should) be eval'd by all other eclasses. + +# Used by the EXPORT_FUNCTIONS code, and placed at the beginning of the eclass +# for elegancy's sake. +# Someday the code that processes an ebuild's name and extracts $PN from it +# can be adapted to automatically calculate $ECLASS from the filename. +# Note that this must come after any inherit lines. +ECLASS=virtual + +DESCRIPTION="Based on the $ECLASS eclass." + +virtual_src_unpack() { +return +} +virtual_src_compile() { +return +} +virtual_src_install() { +return +} +virtual_pkg_preinst() { +return +} +virtual_pkg_postinst() { +return +} +virtual_pkg_prerm() { +return +} +virtual_pkg_postrm() { +return +} + +# EXPORT_FUNCTIONS trick +# This is the global part, defined here only. + +EXPORT_FUNCTIONS() { + +LOCAL_FUNCTIONS=" +src_unpack() { ${ECLASS}_src_unpack; } +src_compile() { ${ECLASS}_src_compile; } +src_install() { ${ECLASS}_src_install; } +pkg_preinst() { ${ECLASS}_pkg_preinst; } +pkg_postinst() { ${ECLASS}_pkg_postinst; } +pkg_prerm() { ${ECLASS}_pkg_prerm; } +pkg_postrm() { ${ECLASS}_pkg_postrm; } +" + +eval "$LOCAL_FUNCTIONS" + +} + + +# This part should be repeated for every eclass inheriting from here. +EXPORT_FUNCTIONS + |