| 1 |
# Copyright 1999-2007 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/gnustep-base.eclass,v 1.1 2007/08/18 13:12:57 grobian Exp $
|
| 4 |
|
| 5 |
inherit eutils flag-o-matic
|
| 6 |
|
| 7 |
# Inner gnustep eclass, should only be inherited directly by gnustep-base
|
| 8 |
# packages
|
| 9 |
#
|
| 10 |
# maintainer: GNUstep Herd <gnustep@gentoo.org>
|
| 11 |
|
| 12 |
# IUSE variables across all GNUstep packages
|
| 13 |
# "debug": enable code for debugging
|
| 14 |
# "doc": build and install documentation, if available
|
| 15 |
IUSE="debug doc"
|
| 16 |
|
| 17 |
# packages needed to build any base gnustep package
|
| 18 |
GNUSTEP_CORE_DEPEND="virtual/libc
|
| 19 |
doc? ( virtual/tetex =dev-tex/latex2html-2002* >=app-text/texi2html-1.64 )"
|
| 20 |
|
| 21 |
# Where to install GNUstep
|
| 22 |
GNUSTEP_PREFIX="/usr/GNUstep"
|
| 23 |
|
| 24 |
# GNUstep environment array
|
| 25 |
typeset -a GS_ENV
|
| 26 |
|
| 27 |
# Ebuild function overrides
|
| 28 |
gnustep-base_pkg_setup() {
|
| 29 |
if test_version_info 3.3 ; then
|
| 30 |
strip-unsupported-flags
|
| 31 |
elif test_version_info 3.4 ; then
|
| 32 |
# strict-aliasing is known to break obj-c stuff in gcc-3.4*
|
| 33 |
filter-flags -fstrict-aliasing
|
| 34 |
fi
|
| 35 |
|
| 36 |
# known to break ObjC (bug 86089)
|
| 37 |
filter-flags -fomit-frame-pointer
|
| 38 |
}
|
| 39 |
|
| 40 |
gnustep-base_src_unpack() {
|
| 41 |
unpack ${A}
|
| 42 |
cd "${S}"
|
| 43 |
|
| 44 |
if [[ -f ./GNUmakefile ]] ; then
|
| 45 |
# Kill stupid includes that are simply overdone or useless on normal
|
| 46 |
# Gentoo, but (may) cause major headaches on Prefixed Gentoo. If this
|
| 47 |
# only removes a part of a path it's good that it bails out, as we want
|
| 48 |
# to know when they use some direct include.
|
| 49 |
ebegin "Cleaning paths from GNUmakefile"
|
| 50 |
sed -i \
|
| 51 |
-e 's|-I/usr/X11R6/include||g' \
|
| 52 |
-e 's|-I/usr/include||g' \
|
| 53 |
-e 's|-L/usr/X11R6/lib||g' \
|
| 54 |
-e 's|-L/usr/lib||g' \
|
| 55 |
GNUmakefile
|
| 56 |
eend $?
|
| 57 |
fi
|
| 58 |
}
|
| 59 |
|
| 60 |
gnustep-base_src_compile() {
|
| 61 |
egnustep_env
|
| 62 |
if [[ -x ./configure ]] ; then
|
| 63 |
econf || die "configure failed"
|
| 64 |
fi
|
| 65 |
egnustep_make
|
| 66 |
}
|
| 67 |
|
| 68 |
gnustep-base_src_install() {
|
| 69 |
egnustep_env
|
| 70 |
egnustep_install
|
| 71 |
if use doc ; then
|
| 72 |
egnustep_env
|
| 73 |
egnustep_doc
|
| 74 |
fi
|
| 75 |
egnustep_install_config
|
| 76 |
}
|
| 77 |
|
| 78 |
gnustep-base_pkg_postinst() {
|
| 79 |
[[ $(type -t gnustep_config_script) != "function" ]] && return 0
|
| 80 |
|
| 81 |
elog "To use this package, as *user* you should run:"
|
| 82 |
elog " ${GNUSTEP_SYSTEM_TOOLS}/Gentoo/config-${PN}.sh"
|
| 83 |
}
|
| 84 |
|
| 85 |
# Clean/reset an ebuild to the installed GNUstep environment
|
| 86 |
egnustep_env() {
|
| 87 |
# Get additional variables
|
| 88 |
GNUSTEP_SH_EXPORT_ALL_VARIABLES="true"
|
| 89 |
|
| 90 |
if [[ -f ${GNUSTEP_PREFIX}/System/Library/Makefiles/GNUstep.sh ]] ; then
|
| 91 |
# Reset GNUstep variables
|
| 92 |
source "${GNUSTEP_PREFIX}"/System/Library/Makefiles/GNUstep-reset.sh
|
| 93 |
source "${GNUSTEP_PREFIX}"/System/Library/Makefiles/GNUstep.sh
|
| 94 |
|
| 95 |
# Needed to run installed GNUstep apps in sandbox
|
| 96 |
addpredict "/root/GNUstep"
|
| 97 |
|
| 98 |
# Set rpath in ldflags when available
|
| 99 |
case ${CHOST} in
|
| 100 |
*-linux-gnu|*-solaris*)
|
| 101 |
append-ldflags \
|
| 102 |
-Wl,-rpath="${GNUSTEP_SYSTEM_LIBRARIES}" \
|
| 103 |
-L"${GNUSTEP_SYSTEM_LIBRARIES}"
|
| 104 |
;;
|
| 105 |
*)
|
| 106 |
append-ldflags \
|
| 107 |
-L"${GNUSTEP_SYSTEM_LIBRARIES}"
|
| 108 |
;;
|
| 109 |
esac
|
| 110 |
|
| 111 |
# Set up env vars for make operations
|
| 112 |
GS_ENV=( AUXILIARY_LDFLAGS="${LDFLAGS}" \
|
| 113 |
DESTDIR="${D}" \
|
| 114 |
HOME="${T}" \
|
| 115 |
GNUSTEP_USER_DIR="${T}" \
|
| 116 |
GNUSTEP_USER_DEFAULTS_DIR="${T}"/Defaults \
|
| 117 |
GNUSTEP_INSTALLATION_DOMAIN=SYSTEM \
|
| 118 |
TAR_OPTIONS="${TAR_OPTIONS} --no-same-owner" \
|
| 119 |
messages=yes \
|
| 120 |
-j1 )
|
| 121 |
# -j1 is needed as gnustep-make is not parallel-safe
|
| 122 |
|
| 123 |
use debug \
|
| 124 |
&& GS_ENV=( "${GS_ENV[@]}" "debug=yes" ) \
|
| 125 |
|| GS_ENV=( "${GS_ENV[@]}" "debug=no" )
|
| 126 |
|
| 127 |
return 0
|
| 128 |
fi
|
| 129 |
die "gnustep-make not installed!"
|
| 130 |
}
|
| 131 |
|
| 132 |
# Make utilizing GNUstep Makefiles
|
| 133 |
egnustep_make() {
|
| 134 |
if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then
|
| 135 |
emake ${*} "${GS_ENV[@]}" all || die "package make failed"
|
| 136 |
return 0
|
| 137 |
fi
|
| 138 |
die "no Makefile found"
|
| 139 |
}
|
| 140 |
|
| 141 |
# Make-install utilizing GNUstep Makefiles
|
| 142 |
egnustep_install() {
|
| 143 |
# avoid problems due to our "weird" prefix, make sure it exists
|
| 144 |
mkdir -p "${D}"${GNUSTEP_SYSTEM_TOOLS}
|
| 145 |
if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then
|
| 146 |
emake ${*} "${GS_ENV[@]}" install || die "package install failed"
|
| 147 |
return 0
|
| 148 |
fi
|
| 149 |
die "no Makefile found"
|
| 150 |
}
|
| 151 |
|
| 152 |
# Make and install docs using GNUstep Makefiles
|
| 153 |
egnustep_doc() {
|
| 154 |
if [[ -d ./Documentation ]] ; then
|
| 155 |
# Check documentation presence
|
| 156 |
cd "${S}"/Documentation
|
| 157 |
if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then
|
| 158 |
emake "${GS_ENV[@]}" all || die "doc make failed"
|
| 159 |
emake "${GS_ENV[@]}" install || die "doc install failed"
|
| 160 |
fi
|
| 161 |
cd ..
|
| 162 |
fi
|
| 163 |
}
|
| 164 |
|
| 165 |
egnustep_install_config() {
|
| 166 |
[[ $(type -t gnustep_config_script) != "function" ]] && return 0
|
| 167 |
|
| 168 |
local cfile=config-${PN}.sh
|
| 169 |
|
| 170 |
echo '#!/usr/bin/env bash' > "${T}"/${cfile}
|
| 171 |
echo "echo Applying ${P} default configuration ..." >> "${T}"/${cfile}
|
| 172 |
gnustep_config_script | \
|
| 173 |
while read line ; do
|
| 174 |
echo "${line}" >> "${T}"/${cfile}
|
| 175 |
done
|
| 176 |
echo 'echo "done"' >> "${T}"/${cfile}
|
| 177 |
|
| 178 |
exeinto ${GNUSTEP_SYSTEM_TOOLS}/Gentoo
|
| 179 |
doexe "${T}"/${cfile}
|
| 180 |
}
|
| 181 |
|
| 182 |
EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst
|