I've already written about the possibility of creating an ebuild to
simply _replace_ the entire buildsystem of a package if it's
non-existant (simple .c file thrown around by upstream), too minimal
and/or impossible to get upstream do adapt, or as a temporary measure
until upstream is beaten into common sense.

The whole story can be found at
http://blog.flameeyes.eu/2008/10/15/fixing-cflags-ldflags-handling-with-a-single-boilerplate-makefile

I'm attaching a proof of concept of the eclass, it's certainly not ready
for prime time: it does not support C++ programs, it does not have
pkg-config support, and so on. But in general it should work, I'm also
attaching a reworked ebuild for uif2iso (package I maintain and for
which I had to _rewrite_ the whole Makefile already).

This gets especially interesting to consider if we want to enable
--as-needed by default, since this will allow easy fix for packages that
don't otherwise build with --as-needed, like habak that I had to fix,
and takes care of quite a few different problems at once.

HTH,

# Copyright 2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#
# Author: Diego Pettenò <[EMAIL PROTECTED]>

inherit toolchain-funcs

EXPORT_FUNCTIONS src_compile src_install

simple-build_src_compile() {
        cat - > Makefile <<EOF
OBJS = \$(patsubst %.c,%.o,\$(wildcard \$(SRCS)))
\$(TARGET): \$(OBJS)
        \$(CC) \$(LDFLAGS) \$^ -o \$@ \$(LIBS)
EOF

        emake \
                CC="$(tc-getCC)" \
                SRCS="${SIMPLE_SOURCES}" \
                LIBS="${SIMPLE_LIBRARIES}" \
                TARGET="${SIMPLE_TARGET:-${PN}}" \
                || die "emake failed"
}

simple-build_src_install() {
        dobin ${SIMPLE_TARGET:-${PN}} || die "dobin failed"
}
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit simple-build flag-o-matic

DESCRIPTION="Converts MagicISO CD-images to iso"
HOMEPAGE="http://aluigi.org/mytoolz.htm#uif2iso";
SRC_URI="mirror://gentoo/${P}.zip"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

RDEPEND="sys-libs/zlib"
DEPEND="${RDEPEND}
        app-arch/unzip"

SIMPLE_SOURCES='src/*.c'
SIMPLE_LIBRARIES='-lz'

src_compile() {
        append-flags -DMAGICISO_IS_SHIT

        simple-build_src_compile
}

src_install() {
        simple-build_src_install

        dodoc "${WORKDIR}"/${PN}.txt "${WORKDIR}"/README || die "dodoc failed"
}

-- 
Diego "Flameeyes" Pettenò
http://blog.flameeyes.eu/

Attachment: pgp7HRsrICOry.pgp
Description: PGP signature

Reply via email to