| 1 |
grobian |
1.1 |
# Copyright 1999-2007 Gentoo Foundation |
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
voyageur |
1.17 |
# $Header: /var/cvsroot/gentoo-x86/eclass/gnustep-base.eclass,v 1.16 2011/04/20 20:48:47 voyageur Exp $ |
| 4 |
grobian |
1.1 |
|
| 5 |
voyageur |
1.16 |
# @ECLASS: gnustep-base.eclass |
| 6 |
|
|
# @MAINTAINER: |
| 7 |
|
|
# GNUstep Herd <gnustep@gentoo.org> |
| 8 |
|
|
# @BLURB: Internal handling of GNUstep pacakges |
| 9 |
|
|
# @DESCRIPTION: |
| 10 |
grobian |
1.1 |
# Inner gnustep eclass, should only be inherited directly by gnustep-base |
| 11 |
|
|
# packages |
| 12 |
voyageur |
1.16 |
|
| 13 |
|
|
inherit eutils flag-o-matic |
| 14 |
grobian |
1.1 |
|
| 15 |
|
|
# IUSE variables across all GNUstep packages |
| 16 |
|
|
# "debug": enable code for debugging |
| 17 |
|
|
# "doc": build and install documentation, if available |
| 18 |
|
|
IUSE="debug doc" |
| 19 |
|
|
|
| 20 |
|
|
# packages needed to build any base gnustep package |
| 21 |
patrick |
1.12 |
GNUSTEP_CORE_DEPEND="doc? ( virtual/texi2dvi dev-tex/latex2html app-text/texi2html )" |
| 22 |
grobian |
1.1 |
|
| 23 |
voyageur |
1.16 |
# New layout is used when ${EPREFIX}/usr/share/GNUstep/Makefiles exists |
| 24 |
|
|
# Where to install GNUstep (with old layout) |
| 25 |
grobian |
1.14 |
GNUSTEP_PREFIX="${EPREFIX}/usr/GNUstep" |
| 26 |
grobian |
1.1 |
|
| 27 |
|
|
# GNUstep environment array |
| 28 |
|
|
typeset -a GS_ENV |
| 29 |
|
|
|
| 30 |
|
|
# Ebuild function overrides |
| 31 |
|
|
gnustep-base_pkg_setup() { |
| 32 |
|
|
if test_version_info 3.3 ; then |
| 33 |
|
|
strip-unsupported-flags |
| 34 |
|
|
elif test_version_info 3.4 ; then |
| 35 |
|
|
# strict-aliasing is known to break obj-c stuff in gcc-3.4* |
| 36 |
|
|
filter-flags -fstrict-aliasing |
| 37 |
|
|
fi |
| 38 |
|
|
|
| 39 |
|
|
# known to break ObjC (bug 86089) |
| 40 |
|
|
filter-flags -fomit-frame-pointer |
| 41 |
|
|
} |
| 42 |
|
|
|
| 43 |
|
|
gnustep-base_src_unpack() { |
| 44 |
|
|
unpack ${A} |
| 45 |
|
|
cd "${S}" |
| 46 |
|
|
|
| 47 |
voyageur |
1.13 |
gnustep-base_src_prepare |
| 48 |
|
|
} |
| 49 |
|
|
|
| 50 |
|
|
gnustep-base_src_prepare() { |
| 51 |
grobian |
1.1 |
if [[ -f ./GNUmakefile ]] ; then |
| 52 |
|
|
# Kill stupid includes that are simply overdone or useless on normal |
| 53 |
|
|
# Gentoo, but (may) cause major headaches on Prefixed Gentoo. If this |
| 54 |
|
|
# only removes a part of a path it's good that it bails out, as we want |
| 55 |
|
|
# to know when they use some direct include. |
| 56 |
|
|
ebegin "Cleaning paths from GNUmakefile" |
| 57 |
|
|
sed -i \ |
| 58 |
|
|
-e 's|-I/usr/X11R6/include||g' \ |
| 59 |
|
|
-e 's|-I/usr/include||g' \ |
| 60 |
|
|
-e 's|-L/usr/X11R6/lib||g' \ |
| 61 |
|
|
-e 's|-L/usr/lib||g' \ |
| 62 |
|
|
GNUmakefile |
| 63 |
|
|
eend $? |
| 64 |
|
|
fi |
| 65 |
|
|
} |
| 66 |
|
|
|
| 67 |
voyageur |
1.8 |
gnustep-base_src_configure() { |
| 68 |
grobian |
1.1 |
egnustep_env |
| 69 |
|
|
if [[ -x ./configure ]] ; then |
| 70 |
|
|
econf || die "configure failed" |
| 71 |
|
|
fi |
| 72 |
voyageur |
1.8 |
} |
| 73 |
|
|
|
| 74 |
|
|
gnustep-base_src_compile() { |
| 75 |
|
|
egnustep_env |
| 76 |
|
|
case ${EAPI:-0} in |
| 77 |
|
|
0|1) gnustep-base_src_configure ;; |
| 78 |
|
|
esac |
| 79 |
|
|
|
| 80 |
grobian |
1.1 |
egnustep_make |
| 81 |
|
|
} |
| 82 |
|
|
|
| 83 |
|
|
gnustep-base_src_install() { |
| 84 |
|
|
egnustep_env |
| 85 |
|
|
egnustep_install |
| 86 |
|
|
if use doc ; then |
| 87 |
|
|
egnustep_env |
| 88 |
|
|
egnustep_doc |
| 89 |
|
|
fi |
| 90 |
|
|
egnustep_install_config |
| 91 |
|
|
} |
| 92 |
|
|
|
| 93 |
|
|
gnustep-base_pkg_postinst() { |
| 94 |
|
|
[[ $(type -t gnustep_config_script) != "function" ]] && return 0 |
| 95 |
|
|
|
| 96 |
voyageur |
1.16 |
local SCRIPT_PATH |
| 97 |
|
|
if [[ -d ${EPREFIX}/usr/share/GNUstep/Makefiles ]]; then |
| 98 |
|
|
SCRIPT_PATH="/usr/bin" |
| 99 |
|
|
else |
| 100 |
|
|
SCRIPT_PATH=${GNUSTEP_SYSTEM_TOOLS}/Gentoo |
| 101 |
|
|
fi |
| 102 |
grobian |
1.1 |
elog "To use this package, as *user* you should run:" |
| 103 |
voyageur |
1.16 |
elog " ${SCRIPT_PATH}/config-${PN}.sh" |
| 104 |
grobian |
1.1 |
} |
| 105 |
|
|
|
| 106 |
|
|
# Clean/reset an ebuild to the installed GNUstep environment |
| 107 |
|
|
egnustep_env() { |
| 108 |
|
|
# Get additional variables |
| 109 |
|
|
GNUSTEP_SH_EXPORT_ALL_VARIABLES="true" |
| 110 |
|
|
|
| 111 |
voyageur |
1.16 |
# Makefiles path |
| 112 |
|
|
local GS_MAKEFILES |
| 113 |
|
|
if [[ -d ${EPREFIX}/usr/share/GNUstep/Makefiles ]]; then |
| 114 |
|
|
GS_MAKEFILES=${EPREFIX}/usr/share/GNUstep/Makefiles |
| 115 |
|
|
else |
| 116 |
|
|
GS_MAKEFILES=${GNUSTEP_PREFIX}/System/Library/Makefiles |
| 117 |
|
|
fi |
| 118 |
|
|
if [[ -f ${GS_MAKEFILES}/GNUstep.sh ]] ; then |
| 119 |
grobian |
1.1 |
# Reset GNUstep variables |
| 120 |
voyageur |
1.16 |
source "${GS_MAKEFILES}"/GNUstep-reset.sh |
| 121 |
|
|
source "${GS_MAKEFILES}"/GNUstep.sh |
| 122 |
grobian |
1.1 |
|
| 123 |
voyageur |
1.17 |
# Create compilation GNUstep.conf if it does not exist yet |
| 124 |
|
|
if [[ ! -f ${T}/GNUstep.conf ]]; then |
| 125 |
|
|
cp "${EPREFIX}"/etc/GNUstep/GNUstep.conf "${T}" \ |
| 126 |
|
|
|| die "GNUstep.conf copy failed" |
| 127 |
|
|
sed -e "s#\(GNUSTEP_USER_DIR=\).*#\1${T}#" \ |
| 128 |
|
|
-e "s#\(GNUSTEP_USER_DEFAULTS_DIR=\).*#\1${T}/Defaults#" \ |
| 129 |
|
|
-i "${T}"/GNUstep.conf || die "GNUstep.conf sed failed" |
| 130 |
|
|
fi |
| 131 |
|
|
|
| 132 |
grobian |
1.1 |
|
| 133 |
voyageur |
1.16 |
if [[ ! -d ${EPREFIX}/usr/share/GNUstep/Makefiles ]]; then |
| 134 |
|
|
# Set rpath in ldflags when available |
| 135 |
|
|
case ${CHOST} in |
| 136 |
|
|
*-linux-gnu|*-solaris*) |
| 137 |
|
|
is-ldflagq -Wl,-rpath="${GNUSTEP_SYSTEM_LIBRARIES}" \ |
| 138 |
|
|
|| append-ldflags \ |
| 139 |
|
|
-Wl,-rpath="${GNUSTEP_SYSTEM_LIBRARIES}" |
| 140 |
|
|
;; |
| 141 |
|
|
esac |
| 142 |
|
|
fi |
| 143 |
grobian |
1.1 |
|
| 144 |
|
|
# Set up env vars for make operations |
| 145 |
|
|
GS_ENV=( AUXILIARY_LDFLAGS="${LDFLAGS}" \ |
| 146 |
voyageur |
1.6 |
ADDITIONAL_NATIVE_LIB_DIRS="${GNUSTEP_SYSTEM_LIBRARIES}" \ |
| 147 |
grobian |
1.1 |
DESTDIR="${D}" \ |
| 148 |
|
|
HOME="${T}" \ |
| 149 |
voyageur |
1.17 |
GNUSTEP_CONFIG_FILE="${T}"/GNUstep.conf \ |
| 150 |
grobian |
1.1 |
GNUSTEP_USER_DIR="${T}" \ |
| 151 |
|
|
GNUSTEP_USER_DEFAULTS_DIR="${T}"/Defaults \ |
| 152 |
|
|
GNUSTEP_INSTALLATION_DOMAIN=SYSTEM \ |
| 153 |
|
|
TAR_OPTIONS="${TAR_OPTIONS} --no-same-owner" \ |
| 154 |
voyageur |
1.16 |
messages=yes \ |
| 155 |
|
|
-j1 ) |
| 156 |
grobian |
1.1 |
|
| 157 |
|
|
use debug \ |
| 158 |
|
|
&& GS_ENV=( "${GS_ENV[@]}" "debug=yes" ) \ |
| 159 |
|
|
|| GS_ENV=( "${GS_ENV[@]}" "debug=no" ) |
| 160 |
|
|
|
| 161 |
|
|
return 0 |
| 162 |
|
|
fi |
| 163 |
|
|
die "gnustep-make not installed!" |
| 164 |
|
|
} |
| 165 |
|
|
|
| 166 |
|
|
# Make utilizing GNUstep Makefiles |
| 167 |
|
|
egnustep_make() { |
| 168 |
grobian |
1.11 |
if [[ -f ./Makefile || -f ./makefile || -f ./GNUmakefile ]] ; then |
| 169 |
grobian |
1.1 |
emake ${*} "${GS_ENV[@]}" all || die "package make failed" |
| 170 |
|
|
return 0 |
| 171 |
|
|
fi |
| 172 |
|
|
die "no Makefile found" |
| 173 |
|
|
} |
| 174 |
|
|
|
| 175 |
|
|
# Make-install utilizing GNUstep Makefiles |
| 176 |
|
|
egnustep_install() { |
| 177 |
voyageur |
1.16 |
if [[ ! -d ${EPREFIX}/usr/share/GNUstep/Makefiles ]]; then |
| 178 |
|
|
# avoid problems due to our "weird" prefix, make sure it exists |
| 179 |
|
|
mkdir -p "${D}"${GNUSTEP_SYSTEM_TOOLS} |
| 180 |
|
|
fi |
| 181 |
grobian |
1.1 |
if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then |
| 182 |
|
|
emake ${*} "${GS_ENV[@]}" install || die "package install failed" |
| 183 |
|
|
return 0 |
| 184 |
|
|
fi |
| 185 |
|
|
die "no Makefile found" |
| 186 |
|
|
} |
| 187 |
|
|
|
| 188 |
|
|
# Make and install docs using GNUstep Makefiles |
| 189 |
|
|
egnustep_doc() { |
| 190 |
|
|
if [[ -d ./Documentation ]] ; then |
| 191 |
|
|
# Check documentation presence |
| 192 |
|
|
cd "${S}"/Documentation |
| 193 |
|
|
if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then |
| 194 |
|
|
emake "${GS_ENV[@]}" all || die "doc make failed" |
| 195 |
|
|
emake "${GS_ENV[@]}" install || die "doc install failed" |
| 196 |
|
|
fi |
| 197 |
|
|
cd .. |
| 198 |
|
|
fi |
| 199 |
|
|
} |
| 200 |
|
|
|
| 201 |
|
|
egnustep_install_config() { |
| 202 |
|
|
[[ $(type -t gnustep_config_script) != "function" ]] && return 0 |
| 203 |
|
|
|
| 204 |
|
|
local cfile=config-${PN}.sh |
| 205 |
|
|
|
| 206 |
voyageur |
1.5 |
cat << 'EOF' > "${T}"/${cfile} |
| 207 |
voyageur |
1.4 |
#!/usr/bin/env bash |
| 208 |
|
|
gnustep_append_default() { |
| 209 |
voyageur |
1.5 |
if [[ -z $1 || -z $2 || -z $3 ]]; then |
| 210 |
voyageur |
1.4 |
echo "warning: invalid script invocation" |
| 211 |
|
|
return |
| 212 |
|
|
fi |
| 213 |
voyageur |
1.5 |
dom=$1 |
| 214 |
|
|
key=$2 |
| 215 |
|
|
val=$3 |
| 216 |
|
|
cur=$(defaults read ${dom} ${key}) 2> /dev/null |
| 217 |
|
|
if [[ -z $cur ]] ; then |
| 218 |
|
|
echo " * setting ${dom} ${key}" |
| 219 |
|
|
defaults write ${dom} ${key} "( ${val} )" |
| 220 |
|
|
elif [[ ${cur} != *${val}* ]] ; then |
| 221 |
|
|
echo " * adding ${val} to ${dom} ${key}" |
| 222 |
|
|
echo "${cur%)\'}, \"${val}\" )'" | defaults write |
| 223 |
voyageur |
1.4 |
else |
| 224 |
voyageur |
1.5 |
echo " * ${val} already present in ${dom} ${key}" |
| 225 |
voyageur |
1.4 |
fi |
| 226 |
|
|
} |
| 227 |
|
|
|
| 228 |
|
|
gnustep_set_default() { |
| 229 |
opfer |
1.7 |
if [[ -z $1 || -z $2 || -z $3 ]]; then |
| 230 |
|
|
echo "warning: invalid script invocation" |
| 231 |
|
|
return |
| 232 |
|
|
fi |
| 233 |
|
|
dom=$1 |
| 234 |
|
|
key=$2 |
| 235 |
|
|
val=$3 |
| 236 |
|
|
echo " * setting ${dom} ${key}" |
| 237 |
voyageur |
1.5 |
defaults write ${dom} ${key} ${val} |
| 238 |
voyageur |
1.4 |
} |
| 239 |
|
|
|
| 240 |
|
|
EOF |
| 241 |
|
|
|
| 242 |
voyageur |
1.5 |
echo "echo \"Applying ${P} default configuration ...\"" >> "${T}"/${cfile} |
| 243 |
|
|
|
| 244 |
grobian |
1.1 |
gnustep_config_script | \ |
| 245 |
|
|
while read line ; do |
| 246 |
|
|
echo "${line}" >> "${T}"/${cfile} |
| 247 |
|
|
done |
| 248 |
grobian |
1.2 |
echo 'echo "done"' >> "${T}"/${cfile} |
| 249 |
grobian |
1.1 |
|
| 250 |
voyageur |
1.16 |
if [[ -d ${EPREFIX}/usr/share/GNUstep/Makefiles ]]; then |
| 251 |
|
|
exeinto /usr/bin |
| 252 |
|
|
else |
| 253 |
|
|
exeinto ${GNUSTEP_SYSTEM_TOOLS#${EPREFIX}}/Gentoo |
| 254 |
|
|
fi |
| 255 |
grobian |
1.1 |
doexe "${T}"/${cfile} |
| 256 |
|
|
} |
| 257 |
|
|
|
| 258 |
voyageur |
1.8 |
case ${EAPI:-0} in |
| 259 |
|
|
0|1) EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst ;; |
| 260 |
voyageur |
1.15 |
*) EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_install pkg_postinst ;; |
| 261 |
voyageur |
1.8 |
esac |