/[gentoo-x86]/eclass/gnustep-base.eclass
Gentoo

Contents of /eclass/gnustep-base.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download)
Wed Sep 23 21:23:56 2009 UTC (4 years, 11 months ago) by patrick
Branch: MAIN
Changes since 1.11: +2 -3 lines
Remove virtual/libc

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.11 2009/07/06 19:55:55 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="doc? ( virtual/texi2dvi dev-tex/latex2html app-text/texi2html )"
19
20 # Where to install GNUstep
21 GNUSTEP_PREFIX="/usr/GNUstep"
22
23 # GNUstep environment array
24 typeset -a GS_ENV
25
26 # Ebuild function overrides
27 gnustep-base_pkg_setup() {
28 if test_version_info 3.3 ; then
29 strip-unsupported-flags
30 elif test_version_info 3.4 ; then
31 # strict-aliasing is known to break obj-c stuff in gcc-3.4*
32 filter-flags -fstrict-aliasing
33 fi
34
35 # known to break ObjC (bug 86089)
36 filter-flags -fomit-frame-pointer
37 }
38
39 gnustep-base_src_unpack() {
40 unpack ${A}
41 cd "${S}"
42
43 if [[ -f ./GNUmakefile ]] ; then
44 # Kill stupid includes that are simply overdone or useless on normal
45 # Gentoo, but (may) cause major headaches on Prefixed Gentoo. If this
46 # only removes a part of a path it's good that it bails out, as we want
47 # to know when they use some direct include.
48 ebegin "Cleaning paths from GNUmakefile"
49 sed -i \
50 -e 's|-I/usr/X11R6/include||g' \
51 -e 's|-I/usr/include||g' \
52 -e 's|-L/usr/X11R6/lib||g' \
53 -e 's|-L/usr/lib||g' \
54 GNUmakefile
55 eend $?
56 fi
57 }
58
59 gnustep-base_src_configure() {
60 egnustep_env
61 if [[ -x ./configure ]] ; then
62 econf || die "configure failed"
63 fi
64 }
65
66 gnustep-base_src_compile() {
67 egnustep_env
68 case ${EAPI:-0} in
69 0|1) gnustep-base_src_configure ;;
70 esac
71
72 egnustep_make
73 }
74
75 gnustep-base_src_install() {
76 egnustep_env
77 egnustep_install
78 if use doc ; then
79 egnustep_env
80 egnustep_doc
81 fi
82 egnustep_install_config
83 }
84
85 gnustep-base_pkg_postinst() {
86 [[ $(type -t gnustep_config_script) != "function" ]] && return 0
87
88 elog "To use this package, as *user* you should run:"
89 elog " ${GNUSTEP_SYSTEM_TOOLS}/Gentoo/config-${PN}.sh"
90 }
91
92 # Clean/reset an ebuild to the installed GNUstep environment
93 egnustep_env() {
94 # Get additional variables
95 GNUSTEP_SH_EXPORT_ALL_VARIABLES="true"
96
97 if [[ -f ${GNUSTEP_PREFIX}/System/Library/Makefiles/GNUstep.sh ]] ; then
98 # Reset GNUstep variables
99 source "${GNUSTEP_PREFIX}"/System/Library/Makefiles/GNUstep-reset.sh
100 source "${GNUSTEP_PREFIX}"/System/Library/Makefiles/GNUstep.sh
101
102 # Needed to run installed GNUstep apps in sandbox
103 addpredict "/root/GNUstep"
104
105 # Set rpath in ldflags when available
106 case ${CHOST} in
107 *-linux-gnu|*-solaris*)
108 is-ldflagq -Wl,-rpath="${GNUSTEP_SYSTEM_LIBRARIES}" \
109 || append-ldflags \
110 -Wl,-rpath="${GNUSTEP_SYSTEM_LIBRARIES}"
111 ;;
112 esac
113
114 # Set up env vars for make operations
115 GS_ENV=( AUXILIARY_LDFLAGS="${LDFLAGS}" \
116 ADDITIONAL_NATIVE_LIB_DIRS="${GNUSTEP_SYSTEM_LIBRARIES}" \
117 DESTDIR="${D}" \
118 HOME="${T}" \
119 GNUSTEP_USER_DIR="${T}" \
120 GNUSTEP_USER_DEFAULTS_DIR="${T}"/Defaults \
121 GNUSTEP_INSTALLATION_DOMAIN=SYSTEM \
122 TAR_OPTIONS="${TAR_OPTIONS} --no-same-owner" \
123 messages=yes )
124
125 # Parallel-make support was added in gnustep-make 2.2.0
126 has_version "<gnustep-base/gnustep-make-2.2.0" \
127 && GS_ENV=( "${GS_ENV[@]}" "-j1" )
128
129 use debug \
130 && GS_ENV=( "${GS_ENV[@]}" "debug=yes" ) \
131 || GS_ENV=( "${GS_ENV[@]}" "debug=no" )
132
133 return 0
134 fi
135 die "gnustep-make not installed!"
136 }
137
138 # Make utilizing GNUstep Makefiles
139 egnustep_make() {
140 if [[ -f ./Makefile || -f ./makefile || -f ./GNUmakefile ]] ; then
141 emake ${*} "${GS_ENV[@]}" all || die "package make failed"
142 return 0
143 fi
144 die "no Makefile found"
145 }
146
147 # Make-install utilizing GNUstep Makefiles
148 egnustep_install() {
149 # avoid problems due to our "weird" prefix, make sure it exists
150 mkdir -p "${D}"${GNUSTEP_SYSTEM_TOOLS}
151 if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then
152 emake ${*} "${GS_ENV[@]}" install || die "package install failed"
153 return 0
154 fi
155 die "no Makefile found"
156 }
157
158 # Make and install docs using GNUstep Makefiles
159 egnustep_doc() {
160 if [[ -d ./Documentation ]] ; then
161 # Check documentation presence
162 cd "${S}"/Documentation
163 if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then
164 emake "${GS_ENV[@]}" all || die "doc make failed"
165 emake "${GS_ENV[@]}" install || die "doc install failed"
166 fi
167 cd ..
168 fi
169 }
170
171 egnustep_install_config() {
172 [[ $(type -t gnustep_config_script) != "function" ]] && return 0
173
174 local cfile=config-${PN}.sh
175
176 cat << 'EOF' > "${T}"/${cfile}
177 #!/usr/bin/env bash
178 gnustep_append_default() {
179 if [[ -z $1 || -z $2 || -z $3 ]]; then
180 echo "warning: invalid script invocation"
181 return
182 fi
183 dom=$1
184 key=$2
185 val=$3
186 cur=$(defaults read ${dom} ${key}) 2> /dev/null
187 if [[ -z $cur ]] ; then
188 echo " * setting ${dom} ${key}"
189 defaults write ${dom} ${key} "( ${val} )"
190 elif [[ ${cur} != *${val}* ]] ; then
191 echo " * adding ${val} to ${dom} ${key}"
192 echo "${cur%)\'}, \"${val}\" )'" | defaults write
193 else
194 echo " * ${val} already present in ${dom} ${key}"
195 fi
196 }
197
198 gnustep_set_default() {
199 if [[ -z $1 || -z $2 || -z $3 ]]; then
200 echo "warning: invalid script invocation"
201 return
202 fi
203 dom=$1
204 key=$2
205 val=$3
206 echo " * setting ${dom} ${key}"
207 defaults write ${dom} ${key} ${val}
208 }
209
210 EOF
211
212 echo "echo \"Applying ${P} default configuration ...\"" >> "${T}"/${cfile}
213
214 gnustep_config_script | \
215 while read line ; do
216 echo "${line}" >> "${T}"/${cfile}
217 done
218 echo 'echo "done"' >> "${T}"/${cfile}
219
220 exeinto ${GNUSTEP_SYSTEM_TOOLS}/Gentoo
221 doexe "${T}"/${cfile}
222 }
223
224 case ${EAPI:-0} in
225 0|1) EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst ;;
226 2) EXPORT_FUNCTIONS pkg_setup src_unpack src_configure src_compile src_install pkg_postinst ;;
227 esac

  ViewVC Help
Powered by ViewVC 1.1.20