public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] RFC: new gnustep eclasses
@ 2007-08-06 22:04 Bernard Cafarelli
  2007-08-06 22:21 ` Donnie Berkholz
  0 siblings, 1 reply; 2+ messages in thread
From: Bernard Cafarelli @ 2007-08-06 22:04 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 2088 bytes --]

Hello all,

Fabian Groffen (grobian) and myself have been  working on giving
some love to GNUstep support in Gentoo, which you can track progress
from the gnustep overlay:
http://overlays.gentoo.org/proj/gnustep

This has now turned in a massive rewrite of the gnustep eclasses and
base packages, with the following objectives:
* Cleaner and simpler eclasses (easier to read and maintain) and ebuilds
(easier to write). This includes removing the need for most of the
internal Gentoo/GNUstep variables defined in the current eclasses

* Use the new gnustep-make-2 system (needed for new packages)

* Less user environment pollution: no need to source a big script that
tinkered with LD_LIBRARY_PATH and set a bunch of other variables

* Easier user configuration (as in "emerge something and nothing more")

* Lots of cleanups here and there (new virtual for gnustep-back,
removal of useless global init scripts, fix sandbox issues for some
ebuilds...) listed in the overlay web pages

User feedback on the overlay is quite positive, so let's hear from
-dev now!

Latest version of the base eclass (sent with this mail) can be found at:
http://overlays.gentoo.org/proj/gnustep/browser/overlay/eclass/gnustep-base.eclass

This one does most of the hard work, especially in egnustep_env which
sets up an appropriate GNUstep compilation environment from the
installed gnustep-make.

Default functions are provided for:
pkg_setup, src_compile, src_install, pkg_postinst
(pkg_postinst points the users to shell scripts that need to be run
once as user)

Latest version of the gnustep-2 eclass can be found at:
http://overlays.gentoo.org/proj/gnustep/browser/overlay/eclass/gnustep-2.eclass

This one mostly sets dependencies on a full GNUstep base system and is
the one to include in a normal gnustep ebuild

For the interested, many other changes lie in the gnustep-base packages
in the overlay (most of the environment setting is now done by the
gnustep-make ebuild)

Feedback, comments, suggestions, other ideas are welcome!
-- 
Bernard Cafarelli (Voyageur)
NX and GNUstep Gentoo developer

[-- Attachment #2: gnustep-2.eclass --]
[-- Type: application/octet-stream, Size: 496 bytes --]

# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit gnustep-base

# Eclass for GNUstep Apps, Frameworks, and Bundles build

DEPEND=">=gnustep-base/gnustep-make-2.0
	virtual/gnustep-back"
RDEPEND="${DEPEND}
	debug? ( >=sys-devel/gdb-6.0 )"

# The following gnustep-based EXPORT_FUNCTIONS are available:
# * gnustep-base_pkg_setup
# * gnustep-base_src_compile 
# * gnustep-base_src_install 
# * gnustep-base_pkg_postinst

[-- Attachment #3: gnustep-base.eclass --]
[-- Type: application/octet-stream, Size: 3920 bytes --]

# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit eutils flag-o-matic

# Inner gnustep eclass, should only be inherited directly by gnustep-base packages

# IUSE variables across all GNUstep packages
# "debug": enable code for debugging
# "doc": build and install documentation, if available
IUSE="debug doc"

# packages needed to build any base gnustep package
GNUSTEP_CORE_DEPEND="virtual/libc
	doc? ( virtual/tetex
		=dev-tex/latex2html-2002*
		>=app-text/texi2html-1.64 )"

# Where to install GNUstep
GNUSTEP_PREFIX="/usr/GNUstep"

# Ebuild function overrides
gnustep-base_pkg_setup() {
	if test_version_info 3.3
	then
		strip-unsupported-flags
	elif test_version_info 3.4
	then
		# strict-aliasing is known to break obj-c stuff in gcc-3.4*
		filter-flags -fstrict-aliasing
	fi

	# known to break ObjC (bug 86089)
	filter-flags -fomit-frame-pointer
}

gnustep-base_src_compile() {
	egnustep_env
	if [ -x ./configure ]; then
		econf || die
	fi
	egnustep_make || die
}

gnustep-base_src_install() {
	egnustep_env
	egnustep_install || die
	if use doc ; then
		egnustep_env
		egnustep_doc
	fi
	# Copies "convenience scripts"
	if [ -f "${FILESDIR}/config-${PN}.sh" ]; then
		dodir ${GNUSTEP_SYSTEM_TOOLS}/Gentoo
		exeinto ${GNUSTEP_SYSTEM_TOOLS}/Gentoo
		doexe ${FILESDIR}/config-${PN}.sh
	fi
}

gnustep-base_pkg_postinst() {
	# Informs user about existence of "convenience script"	
	if [ -f "${FILESDIR}/config-${PN}.sh" ]; then
		elog "Make sure to set happy defaults for this package by executing:"
		elog "  ${GNUSTEP_SYSTEM_TOOLS}/Gentoo/config-${PN}.sh"
		elog "as the user you will run the package as."
	fi
}

# Clean/reset an ebuild to the installed GNUstep environment
egnustep_env() {
	# Get additional variables
	GNUSTEP_SH_EXPORT_ALL_VARIABLES="true"

	if [ -f "${GNUSTEP_PREFIX}/System/Library/Makefiles/GNUstep.sh" ] ; then
		# Reset GNUstep variables
		. ${GNUSTEP_PREFIX}/System/Library/Makefiles/GNUstep-reset.sh
		. ${GNUSTEP_PREFIX}/System/Library/Makefiles/GNUstep.sh

		# Needed to run installed GNUstep apps in sandbox
		addpredict "/root/GNUstep"

		# Set up common env vars for make operations
		__GS_MAKE_EVAL=" \
			HOME=\"\${T}\" \
			GNUSTEP_USER_DIR=\"\${T}\" \
			GNUSTEP_USER_DEFAULTS_DIR=\"\${T}\"/Defaults \
			DESTDIR=\"\${D}\" \
			GNUSTEP_INSTALLATION_DOMAIN=SYSTEM \
			TAR_OPTIONS=\"\${TAR_OPTIONS} --no-same-owner\" \
			messages=yes \
			-j1"
			# -j1 is needed as gnustep-make is not parallel-safe

		if ! use debug ; then
			__GS_MAKE_EVAL="${__GS_MAKE_EVAL} debug=no"
		fi

		case ${CHOST} in
			*-linux-gnu|*-solaris*)
				append-ldflags \
					-Wl,-rpath="${GNUSTEP_SYSTEM_LIBRARIES}" \
					-L"${GNUSTEP_SYSTEM_LIBRARIES}"
			;;
			*)
				append-ldflags \
					-L"${GNUSTEP_SYSTEM_LIBRARIES}"
			;;
		esac
		__GS_MAKE_EVAL="${__GS_MAKE_EVAL} AUXILIARY_LDFLAGS=\"\${LDFLAGS}\""
	else
		die "gnustep-make not installed!"
	fi
}

# Make utilizing GNUstep Makefiles
egnustep_make() {
	if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
		eval emake ${*} ${__GS_MAKE_EVAL} all || die "package make failed"
	else
		die "no Makefile found"
	fi
}

# Make-install utilizing GNUstep Makefiles
egnustep_install() {
	# avoid problems due to our "weird" prefix, make sure it exists
	mkdir -p "${D}${GNUSTEP_SYSTEM_TOOLS}"
	if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
		eval emake ${*} ${__GS_MAKE_EVAL} install || die "package install failed"
	else
		die "no Makefile found"
	fi
}

# Make and install docs using GNUstep Makefiles
egnustep_doc() {
	if [ -d ./Documentation ]; then
		# Check documentation presence
		cd ${S}/Documentation
		if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
			eval emake ${__GS_MAKE_EVAL} all || die "doc make failed"
			eval emake ${__GS_MAKE_EVAL} install || die "doc install failed"
		fi
		cd ..
	fi
}

EXPORT_FUNCTIONS pkg_setup src_compile src_install pkg_postinst

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gentoo-dev] RFC: new gnustep eclasses
  2007-08-06 22:04 [gentoo-dev] RFC: new gnustep eclasses Bernard Cafarelli
@ 2007-08-06 22:21 ` Donnie Berkholz
  0 siblings, 0 replies; 2+ messages in thread
From: Donnie Berkholz @ 2007-08-06 22:21 UTC (permalink / raw
  To: gentoo-dev

On 00:04 Tue 07 Aug     , Bernard Cafarelli wrote:
> Latest version of the base eclass (sent with this mail) can be found at:
> http://overlays.gentoo.org/proj/gnustep/browser/overlay/eclass/gnustep-base.eclass
> 
> This one does most of the hard work, especially in egnustep_env which
> sets up an appropriate GNUstep compilation environment from the
> installed gnustep-make.

Some suggestions on the eclass ...

Instead of your eval trick, try something like what's in molden-4.6.ebuild:

    typeset -a args
    args=( CC="$(tc-getCC) ${CFLAGS}" \
        FC="${FORTRANC}" LDR="${FORTRANC}" FFLAGS="${FFLAGS}" )

    emake -j1 "${args[@]}" || die "molden emake failed"

Some of your die() calls lack messages. Please add them.

I like a little different setup for this type of function:
117 	egnustep_make() {
118 	        if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
119 	                eval emake ${*} ${__GS_MAKE_EVAL} all || die "package make failed"
120 	        else
121 	                die "no Makefile found"
122 	        fi
123 	}

Instead...
117 	egnustep_make() {
118 	        if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
119 	                eval emake ${*} ${__GS_MAKE_EVAL} all || die "package make failed"
120 	                return 0
121 	        fi
122 	        die "no Makefile found"
123 	}

But that's just a matter of preference. Same kinda deal for egnustep_install().

Thanks,
Donnie
-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-06 22:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-06 22:04 [gentoo-dev] RFC: new gnustep eclasses Bernard Cafarelli
2007-08-06 22:21 ` Donnie Berkholz

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