public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev]  [RFC] simple-build eclass
@ 2008-11-14  0:15 Diego 'Flameeyes' Pettenò
  0 siblings, 0 replies; only message in thread
From: Diego 'Flameeyes' Pettenò @ 2008-11-14  0:15 UTC (permalink / raw)
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 1057 bytes --]


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,


[-- Attachment #1.2: simple-build.eclass --]
[-- Type: text/plain, Size: 668 bytes --]

# Copyright 2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#
# Author: Diego Pettenò <flameeyes@gentoo.org>

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"
}

[-- Attachment #1.3: uif2iso-0.1.7.ebuild --]
[-- Type: text/plain, Size: 653 bytes --]

# 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"
}

[-- Attachment #1.4: Type: text/plain, Size: 66 bytes --]



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


[-- Attachment #2: Type: application/pgp-signature, Size: 196 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-14 14:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-14  0:15 [gentoo-dev] [RFC] simple-build eclass Diego 'Flameeyes' Pettenò

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