Am Donnerstag 06 November 2008 15:53:53 schrieb Sergiu Ivanov:
> > And since ebuilds are very easy to maintain, it's far easier to keep a
> > system current with them.
>
> Is there any advantage over Debian binary packages when using ebuilds?

Yes. As example I attached the ebuild for "nano". 

And the following is the diff between the ebuild for nano 2.1.4 and nano 2.1.5 
(reduced: only changed lines): 
------ ------ ------ ------ ------ ------ ------ ------ ------ 
--- nano-2.1.4.ebuild   2008-08-18 06:07:36.000000000 +0200
+++ nano-2.1.5.ebuild   2008-10-09 21:35:24.000000000 +0200
-# $Header: /var/cvsroot/gentoo-x86/app-editors/nano/nano-2.1.4.ebuild,v 1.2 
2008/08/18 03:43:38 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-editors/nano/nano-2.1.5.ebuild,v 1.8 
2008/10/09 19:34:18 vapier Exp $

-KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh 
~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc 
~sparc-fbsd x86 ~x86-fbsd"

-       epatch "${FILESDIR}"/${P}-debug.patch #234959
-       epatch "${FILESDIR}"/${P}-open-mode.patch #232079

------ ------ ------ ------ ------ ------ ------ ------ ------ 

In cleartext: 2.1.5 is deemed stable on alpha, amd64, arm, hppa, ia64, m68k, 
ppc, ppc64, s390, sh, sparc, and x86 while 2.1.4 was "testing" for them. 

Also two patches were no longer necessary. 

Generally, updating an application is only a matter of renaming the ebuild 
file to the version of the application. 

But that also means, every user has to compile the applications himself (I 
like that, but it takes some processing time). 

> Note that I have no special preferences with debs and I'm not sitting
> on a Debian system. What I pursue with this question is whether a
> Gentoo GNU/Hurd would be easier to maintain up-to-date with usual
> Gentoo repositories and whether it would be possible to avoid
> situations like we are in at the moment: some packages are broken and
> a lot of stuff does not work (emacs, for example).

If we get maintainers for the Hurd stuff, then yes. 

But for that we'd still need people who maintain them, and thought it's far 
less work than doing a deb package (just rename the file), the update still 
has to be tested, so someone has to build it which takes about the same time 
as making the deb package. 

So I assume the main advantage is the high geek concentration in the Gentoo 
community :) 

> BTW, I once tried to build emacs from source on Hurd and the attempt
> failed. I used to think that if I have the source code of a program
> for Linux, not using some kernel interfaces, I could easily build it
> on the Hurd, but it proved to be false...

The emacs ebuild is quite complex, so I can well imagine that building it 
isn't that simple... (I attached the ebuild, maybe it can give you a look on 
the difficulty inherent to emacs - the ebuild is one with useflags ("I want 
that feature, but don't want this one") and custom patches). 

Best wishes, 
Arne
-- 
-- My stuff: http://draketo.de - stories, songs, poems, programs and stuff :)
-- Infinite Hands: http://infinite-hands.draketo.de - singing a part of the 
history of free software.
-- Ein Würfel System: http://1w6.org - einfach saubere (Rollenspiel-) Regeln.

-- PGP/GnuPG: http://draketo.de/inhalt/ich/pubkey.txt

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-editors/nano/nano-2.1.5.ebuild,v 1.8 
2008/10/09 19:34:18 vapier Exp $

inherit eutils
if [[ ${PV} == "9999" ]] ; then
        ECVS_SERVER="savannah.gnu.org:/cvsroot/nano"
        ECVS_MODULE="nano"
        ECVS_AUTH="pserver"
        ECVS_USER="anonymous"
        inherit cvs
else
        MY_P=${PN}-${PV/_}
        SRC_URI="http://www.nano-editor.org/dist/v${PV:0:3}/${MY_P}.tar.gz";
fi

DESCRIPTION="GNU GPL'd Pico clone with more functionality"
HOMEPAGE="http://www.nano-editor.org/";

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc 
~sparc-fbsd x86 ~x86-fbsd"
IUSE="debug justify minimal ncurses nls slang spell unicode"

DEPEND=">=sys-libs/ncurses-5.2
        nls? ( sys-devel/gettext )
        !ncurses? ( slang? ( sys-libs/slang ) )"

src_unpack() {
        unpack ${A}
        cd "${S}"
        if [[ ! -e configure ]] ; then
                ./autogen.sh || die "autogen failed"
        fi
}

src_compile() {
        local myconf=""
        use ncurses \
                && myconf="--without-slang" \
                || myconf="${myconf} $(use_with slang)"

        econf \
                --bindir=/bin \
                $(use_enable !minimal color) \
                $(use_enable !minimal multibuffer) \
                $(use_enable !minimal nanorc) \
                --disable-wrapping-as-root \
                $(use_enable spell speller) \
                $(use_enable justify) \
                $(use_enable debug) \
                $(use_enable nls) \
                $(use_enable unicode utf8) \
                $(use_enable minimal tiny) \
                ${myconf} \
                || die "configure failed"
        emake || die
}

src_install() {
        emake DESTDIR="${D}" install || die

        dodoc ChangeLog README doc/nanorc.sample AUTHORS BUGS NEWS TODO
        dohtml *.html
        insinto /etc
        newins doc/nanorc.sample nanorc

        dodir /usr/bin
        dosym /bin/nano /usr/bin/nano

        insinto /usr/share/nano
        local f
        for f in "${FILESDIR}"/*.nanorc ; do
                [[ -e ${D}/usr/share/nano/${f##*/} ]] && continue
                doins "${f}" || die
                echo "# include \"/usr/share/nano/${f##*/}\"" >> 
"${D}"/etc/nanorc
        done
}

pkg_postinst() {
        elog "More helpful info about nano, visit the GDP page:"
        elog "http://www.gentoo.org/doc/en/nano-basics-guide.xml";
}
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-editors/emacs/emacs-22.3.ebuild,v 1.10 
2008/10/21 15:54:59 ulm Exp $

inherit autotools elisp-common eutils flag-o-matic

DESCRIPTION="The extensible, customizable, self-documenting real-time display 
editor"
HOMEPAGE="http://www.gnu.org/software/emacs/";
SRC_URI="mirror://gnu/emacs/${P}.tar.gz"

LICENSE="GPL-3 FDL-1.2 BSD"
SLOT="22"
KEYWORDS="alpha amd64 arm hppa ia64 ppc ~ppc64 ~s390 sh sparc ~sparc-fbsd x86 
~x86-fbsd"
IUSE="alsa gif gtk gzip-el hesiod jpeg kerberos motif png spell sound source 
tiff toolkit-scroll-bars X Xaw3d xpm"
RESTRICT="strip"

RDEPEND="!<app-editors/emacs-cvs-22.1
        sys-libs/ncurses
        >=app-admin/eselect-emacs-1.2
        net-libs/liblockfile
        hesiod? ( net-dns/hesiod )
        kerberos? ( virtual/krb5 )
        spell? ( || ( app-text/ispell app-text/aspell ) )
        alsa? ( media-libs/alsa-lib )
        X? (
                x11-libs/libXmu
                x11-libs/libXt
                x11-misc/xbitmaps
                x11-misc/emacs-desktop
                gif? ( media-libs/giflib )
                jpeg? ( media-libs/jpeg )
                tiff? ( media-libs/tiff )
                png? ( media-libs/libpng )
                xpm? ( x11-libs/libXpm )
                gtk? ( =x11-libs/gtk+-2* )
                !gtk? (
                        Xaw3d? ( x11-libs/Xaw3d )
                        !Xaw3d? ( motif? ( x11-libs/openmotif ) )
                )
        )"

DEPEND="${RDEPEND}
        alsa? ( dev-util/pkgconfig )
        X? ( gtk? ( dev-util/pkgconfig ) )
        gzip-el? ( app-arch/gzip )"

# FULL_VERSION keeps the full version number, which is needed in order to
# determine some path information correctly for copy/move operations later on
FULL_VERSION="${PV}"

src_unpack() {
        unpack ${A}
        cd "${S}"

        epatch "${FILESDIR}/emacs-22.1-Xaw3d-headers.patch"
        epatch "${FILESDIR}/emacs-22.3-freebsd-sparc.patch"
        # SuperH support (bug 238210)
        epatch "${FILESDIR}/emacs-22.2-sh.patch"
        # Fix sporadic segmentation faults in unexec (bug 236579)
        epatch "${FILESDIR}/emacs-22.3-linux-random-heap.patch"

        sed -i -e "s:/usr/lib/crtbegin.o:$(`tc-getCC` 
-print-file-name=crtbegin.o):g" \
                -e "s:/usr/lib/crtend.o:$(`tc-getCC` 
-print-file-name=crtend.o):g" \
                "${S}"/src/s/freebsd.h || die "unable to sed freebsd.h settings"

        if ! use alsa; then
                # ALSA is detected even if not requested by its USE flag.
                # Suppress it by supplying pkg-config with a wrong library name.
                sed -i -e "/ALSA_MODULES=/s/alsa/DiSaBlEaLsA/" configure.in \
                        || die "unable to sed configure.in"
        fi
        if ! use gzip-el; then
                # Emacs' build system automatically detects the gzip binary and
                # compresses el files. We don't want that so confuse it with a
                # wrong binary name
                sed -i -e "s/ gzip/ PrEvEnTcOmPrEsSiOn/" configure.in \
                        || die "unable to sed configure.in"
        fi

        eautoreconf
}

src_compile() {
        export SANDBOX_ON=0                     # for the unbelievers, see Bug 
#131505
        ALLOWED_FLAGS=""
        strip-flags
        #unset LDFLAGS
        if use hppa; then # bug #193703
                replace-flags -O[2-9] -O
        else
                replace-flags -O[3-9] -O2
        fi
        sed -i -e "s/-lungif/-lgif/g" configure* src/Makefile* || die

        local myconf

        if use alsa && ! use sound; then
                echo
                einfo "Although sound USE flag is disabled you chose to have 
alsa,"
                einfo "so sound is switched on anyway."
                echo
                myconf="${myconf} --with-sound"
        else
                myconf="${myconf} $(use_with sound)"
        fi

        if use X; then
                myconf="${myconf} --with-x"
                myconf="${myconf} $(use_with toolkit-scroll-bars)"
                myconf="${myconf} $(use_with jpeg) $(use_with tiff)"
                myconf="${myconf} $(use_with gif) $(use_with png)"
                myconf="${myconf} $(use_with xpm)"

                # GTK+ is the default toolkit if USE=gtk is chosen with other
                # possibilities. Emacs upstream thinks this should be standard
                # policy on all distributions
                if use gtk; then
                        einfo "Configuring to build with GIMP Toolkit (GTK+)"
                        myconf="${myconf} --with-x-toolkit=gtk"
                elif use Xaw3d; then
                        einfo "Configuring to build with Xaw3d (Athena) toolkit"
                        myconf="${myconf} --with-x-toolkit=athena"
                        myconf="${myconf} --without-gtk"
                elif use motif; then
                        einfo "Configuring to build with Motif toolkit"
                        myconf="${myconf} --with-x-toolkit=motif"
                        myconf="${myconf} --without-gtk"
                else
                        einfo "Configuring to build with no toolkit"
                        myconf="${myconf} --with-x-toolkit=no"
                        myconf="${myconf} --without-gtk"
                fi

                local f tk=
                for f in gtk Xaw3d motif; do
                        use ${f} || continue
                        [ "${tk}" ] \
                                && ewarn "USE flag \"${f}\" ignored (superseded 
by \"${tk}\")"
                        tk="${tk}${tk:+ }${f}"
                done
        else
                myconf="${myconf} --without-x"
        fi

        myconf="${myconf} $(use_with hesiod)"
        myconf="${myconf} $(use_with kerberos) $(use_with kerberos kerberos5)"

        econf \
                --program-suffix=-emacs-${SLOT} \
                --infodir=/usr/share/info/emacs-${SLOT} \
                --without-carbon \
                ${myconf} || die "econf emacs failed"

        emake CC="$(tc-getCC)" || die "emake failed"
}

src_install () {
        local i m

        emake install DESTDIR="${D}" || die "make install failed"

        rm "${D}"/usr/bin/emacs-${FULL_VERSION}-emacs-${SLOT} \
                || die "removing duplicate emacs executable failed"
        mv "${D}"/usr/bin/emacs-emacs-${SLOT} "${D}"/usr/bin/emacs-${SLOT} \
                || die "moving Emacs executable failed"

        # move info documentation to the correct place
        for i in "${D}"/usr/share/info/emacs-${SLOT}/*; do
                mv "${i}" "${i}.info" || die "mv info failed"
        done

        # move man pages to the correct place
        for m in "${D}"/usr/share/man/man1/* ; do
                mv "${m}" "${m%.1}-emacs-${SLOT}.1" || die "mv man failed"
        done

        # avoid collision between slots, see bug #169033 e.g.
        rm "${D}"/usr/share/emacs/site-lisp/subdirs.el
        rm "${D}"/var/lib/games/emacs/{snake,tetris}-scores
        keepdir /usr/share/emacs/site-lisp
        keepdir /var/lib/games/emacs

        if use source; then
                insinto /usr/share/emacs/${FULL_VERSION}/src
                # This is not meant to install all the source -- just the
                # C source you might find via find-function
                doins src/*.[ch]
                sed 's/^X//' >10${PN}-${SLOT}-gentoo.el <<-EOF

                ;;; ${PN}-${SLOT} site-lisp configuration

                (if (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" 
emacs-version)
                X    (setq find-function-C-source-directory
                X         "/usr/share/emacs/${FULL_VERSION}/src"))
                EOF
                elisp-site-file-install 10${PN}-${SLOT}-gentoo.el
        fi

        dodoc AUTHORS BUGS CONTRIBUTE README || die "dodoc failed"
}

emacs-infodir-rebuild() {
        # Depending on the Portage version, the Info dir file is compressed
        # or removed. It is only rebuilt by Portage if our directory is in
        # INFOPATH, which is not guaranteed. So we rebuild it ourselves.

        local infodir=/usr/share/info/emacs-${SLOT} f
        einfo "Regenerating Info directory index in ${infodir} ..."
        rm -f "${ROOT}"${infodir}/dir{,.*}
        for f in "${ROOT}"${infodir}/*.info*; do
                [[ ${f##*/} == *[0-9].info* ]] \
                        || install-info --info-dir="${ROOT}"${infodir} "${f}" 
&>/dev/null
        done
        rmdir "${ROOT}"${infodir} 2>/dev/null # remove dir if it is empty
        echo
}

pkg_postinst() {
        [ -f "${ROOT}"/usr/share/emacs/site-lisp/subdirs.el ] \
                || cp 
"${ROOT}"/usr/share/emacs{/${FULL_VERSION},}/site-lisp/subdirs.el

        local f
        for f in "${ROOT}"/var/lib/games/emacs/{snake,tetris}-scores; do
                [ -e "${f}" ] || touch "${f}"
        done

        elisp-site-regen
        emacs-infodir-rebuild

        if [[ $(readlink "${ROOT}"/usr/bin/emacs) == emacs.emacs-${SLOT}* ]]; 
then
                # transition from pre-eselect revision
                eselect emacs set emacs-${SLOT}
        else
                eselect emacs update ifunset
        fi

        echo
        elog "You can set the version to be started by /usr/bin/emacs through"
        elog "the Emacs eselect module, which also redirects man and info 
pages."
        elog "Therefore, several Emacs versions can be installed at the same 
time."
        elog "\"man emacs.eselect\" for details."
}

pkg_postrm() {
        elisp-site-regen
        emacs-infodir-rebuild
        eselect emacs update ifunset
}

Reply via email to