mutt-j と OpenCV の ebuild

勝手に作って勝手に晒しても良いもんなのかねぇ,と思いながら晒してみる.利用は自己責任で.それと 記述ミスなどが見つかったら教えてほしい.


# /usr/local/portage/mypackages/mail-client/mutt-j/mutt-j-1.5.14-r1.ebuild
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

inherit eutils flag-o-matic autotools

MY_PN="mutt"    # PN=mutt-j
MY_P="${MY_PN}-${PV}"
MY_S="${WORKDIR}/${MY_P}"

DESCRIPTION="Mutt Japanese edition"
HOMEPAGE="http://www.emaillab.org/mutt/"
SRC_URI="ftp://ftp.mutt.org/mutt/devel/${MY_P}.tar.gz
    http://www.emaillab.org/mutt/${PV}/patch-${PV}.mutt-j.ja.1.gz"
IUSE="berkdb buffysize cjk crypt debug gdbm gnutls gpgme idn imap mbox nls nntp
pop qdbm sasl smime ssl"
SLOT="0"
LICENSE="GPL-2"
KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
RDEPEND=">=sys-libs/ncurses-5.2
    qdbm?    ( dev-db/qdbm )
    !qdbm?   (
        gdbm?  ( sys-libs/gdbm )
        !gdbm? ( berkdb? ( >=sys-libs/db-4 ) )
    )
    imap?    (
        gnutls?  ( >=net-libs/gnutls-1.0.17 )
        !gnutls? ( ssl? ( >=dev-libs/openssl-0.9.6 ) )
        sasl?    ( >=dev-libs/cyrus-sasl-2 )
    )
    pop?     (
        gnutls?  ( >=net-libs/gnutls-1.0.17 )
        !gnutls? ( ssl? ( >=dev-libs/openssl-0.9.6 ) )
        sasl?    ( >=dev-libs/cyrus-sasl-2 )
    )
    idn?     ( net-dns/libidn )
    gpgme?   ( >=app-crypt/gpgme-0.9.0 )
    smime?   ( >=dev-libs/openssl-0.9.6 )
    app-misc/mime-types"
DEPEND="${RDEPEND}
    net-mail/mailbase"

src_unpack() {
    unpack ${A} && cd ${MY_S} || die "unpack failed"

    epatch "${WORKDIR}"/patch-${PV}.mutt-j.ja.1

    AT_M4DIR="m4" eautoreconf
}

src_compile() {
    declare myconf="
        $(use_enable nls) \
        $(use_enable gpgme) \
        $(use_enable imap) \
        $(use_enable pop) \
        $(use_enable crypt pgp) \
        $(use_enable smime) \
        $(use_enable cjk default-japanese) \
        $(use_enable debug) \
        $(use_with idn) \
        --with-curses \
        --sysconfdir=/etc/${PN} \
        --with-docdir=/usr/share/doc/${PN}-${PVR} \
        --with-regex \
        --disable-fcntl --enable-flock \
        --enable-nfs-fix --enable-external-dotlock \
        --with-mixmaster"

    # See Bug #22787
    unset WANT_AUTOCONF_2_5 WANT_AUTOCONF

    # mutt prioritizes gdbm over bdb, so we will too.
    # hcache feature requires at least one database is in USE.
    if use qdbm; then
        myconf="${myconf} --enable-hcache \
        --with-qdbm --without-gdbm --without-bdb"
    elif use gdbm ; then
        myconf="${myconf} --enable-hcache \
            --without-qdbm --with-gdbm --without-bdb"
    elif use berkdb; then
        myconf="${myconf} --enable-hcache \
            --without-gdbm --without-qdbm --with-bdb"
    else
        myconf="${myconf} --disable-hcache \
            --without-qdbm --without-gdbm --without-bdb"
    fi

    # there's no need for gnutls, ssl or sasl without either pop or imap.
    # in fact mutt's configure will bail if you do:
    #   --without-pop --without-imap --with-ssl
    if use pop || use imap; then
        if use gnutls; then
            myconf="${myconf} --with-gnutls"
        elif use ssl; then
            myconf="${myconf} --with-ssl"
        fi
        # not sure if this should be mutually exclusive with the other two
        myconf="${myconf} $(use_with sasl)"
    else
        myconf="${myconf} --without-gnutls --without-ssl --without-sasl"
    fi

    # See Bug #11170
    case ${ARCH} in
        alpha|ppc) replace-flags "-O[3-9]" "-O2" ;;
    esac

    if use buffysize; then
        ewarn "USE=buffy-size is just a workaround. Disable it if you don't need it."
        myconf="${myconf} --enable-buffy-size"
    fi

    if use mbox; then
        myconf="${myconf} --with-mailpath=/var/spool/mail"
    else
        myconf="${myconf} --with-homespool=Maildir"
    fi

    # rr.compressed patch
    myconf="${myconf} --enable-compressed"

    # nntp patch
    myconf="${myconf} $(use_enable nntp)"

    cd "${MY_S}"
    econf ${myconf} || die "configure failed"
    emake || die "make failed"
}

src_install() {
    cd "${MY_S}"
    make DESTDIR=${D} install || die "install failed"
    find ${D}/usr/share/doc -type f | grep -v "html\|manual" | xargs gzip
    if use mbox; then
        insinto /etc/mutt
        newins ${FILESDIR}/Muttrc.mbox Muttrc
    else
        insinto /etc/mutt
        doins ${FILESDIR}/Muttrc
    fi

    # A newer file is provided by app-misc/mime-types. So we link it.
    rm ${D}/etc/${PN}/mime.types
    dosym /etc/mime.types /etc/${PN}/mime.types

    dodoc BEWARE COPYRIGHT ChangeLog NEWS OPS* PATCHES README* TODO VERSION
}

pkg_postinst() {
    echo
    elog "If you are new to mutt you may want to take a look at"
    elog "the Gentoo QuickStart Guide to Mutt E-Mail:"
    elog "   http://www.gentoo.org/doc/en/guide-to-mutt.xml"
    echo
}

これは /usr/portage/mail-client/mutt-1.5.14.ebuild をほんの少し書き換えただけで,USE フラグとか依存パッケージとかについての検証はほとんどしていない.


# /usr/local/portage/mypackages/sci-libs/opencv/opencv-1.0.0.ebuild
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

inherit eutils toolchain-funcs

DESCRIPTION="Open Source Computer Vision Library"
HOMEPAGE="http://www.intel.com/technology/computing/opencv/"

SRC_URI="http://downloads.sourceforge.net/opencvlibrary/${P}.tar.gz"

IUSE="debug examples ffmpeg gtk ieee1394 python quicktime swig v4l xine"
LICENSE="Intel"
KEYWORDS="~amd64 ~x86"
SLOT="0"

RDEPEND="dev-util/pkgconfig
    media-libs/libpng
    sys-libs/zlib
    media-libs/jpeg
    media-libs/tiff
    media-libs/jasper
    ffmpeg? ( >=media-video/ffmpeg-0.4.9 )
    gtk? ( >=x11-libs/gtk+-2 )
    ieee1394? ( media-libs/libdc1394
        sys-libs/libraw1394 )
    python? ( >=dev-lang/python-2.3 )
    quicktime? ( media-libs/libquicktime )
    swig? ( dev-lang/swig )
    xine? ( media-libs/xine-lib )"
DEPEND="${RDEPEND}"

src_compile() {
    declare myconf="
        $(use_enable debug) \
        $(use_enable examples apps) \
        $(use_with swig) \
        $(use_with python) \
        $(use_with xine) \
        $(use_with ffmpeg) \
        $(use_with ieee1394 1394libs) \
        $(use_with v4l) \
        $(use_with quicktime) \
        $(use_with gtk)"
    econf ${myconf} || die "econf failed"
    emake || die "emake failed"
}

src_test() {
    if use examples ; then
        emake check || die "emake check failed"
    fi
}

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

これも,./configure のオプションをほぼそのまま USE フラグに反映させただけで,実際に各 USE フラグを有効にして emerge, とかいう検証は行っていない.

さっき気づいたけど,いつの間にか Gentoo 本家の Portage ツリーに acml-3.6.0.ebuild, acml-3.6.1.ebuild が追加されてた.んじゃ以前作った ebuild は用無しになったなぁ.