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

Contents of /eclass/gnustep-base.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations) (download)
Wed Dec 3 14:29:05 2008 UTC (5 years, 7 months ago) by voyageur
Branch: MAIN
Changes since 1.8: +2 -2 lines
Update doc DEPEND

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.8 2008/10/03 14:59:42 voyageur 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/texi2dvi dev-tex/latex2html app-text/texi2html )"
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_configure() {
61 egnustep_env
62 if [[ -x ./configure ]] ; then
63 econf || die "configure failed"
64 fi
65 }
66
67 gnustep-base_src_compile() {
68 egnustep_env
69 case ${EAPI:-0} in
70 0|1) gnustep-base_src_configure ;;
71 esac
72
73 egnustep_make
74 }
75
76 gnustep-base_src_install() {
77 egnustep_env
78 egnustep_install
79 if use doc ; then
80 egnustep_env
81 egnustep_doc
82 fi
83 egnustep_install_config
84 }
85
86 gnustep-base_pkg_postinst() {
87 [[ $(type -t gnustep_config_script) != "function" ]] && return 0
88
89 elog "To use this package, as *user* you should run:"
90 elog " ${GNUSTEP_SYSTEM_TOOLS}/Gentoo/config-${PN}.sh"
91 }
92
93 # Clean/reset an ebuild to the installed GNUstep environment
94 egnustep_env() {
95 # Get additional variables
96 GNUSTEP_SH_EXPORT_ALL_VARIABLES="true"
97
98 if [[ -f ${GNUSTEP_PREFIX}/System/Library/Makefiles/GNUstep.sh ]] ; then
99 # Reset GNUstep variables
100 source "${GNUSTEP_PREFIX}"/System/Library/Makefiles/GNUstep-reset.sh
101 source "${GNUSTEP_PREFIX}"/System/Library/Makefiles/GNUstep.sh
102
103 # Needed to run installed GNUstep apps in sandbox
104 addpredict "/root/GNUstep"
105
106 # Set rpath in ldflags when available
107 case ${CHOST} in
108 *-linux-gnu|*-solaris*)
109 is-ldflagq -Wl,-rpath="${GNUSTEP_SYSTEM_LIBRARIES}" \
110 || append-ldflags \
111 -Wl,-rpath="${GNUSTEP_SYSTEM_LIBRARIES}"
112 ;;
113 esac
114
115 # Set up env vars for make operations
116 GS_ENV=( AUXILIARY_LDFLAGS="${LDFLAGS}" \
117 ADDITIONAL_NATIVE_LIB_DIRS="${GNUSTEP_SYSTEM_LIBRARIES}" \
118 DESTDIR="${D}" \
119 HOME="${T}" \
120 GNUSTEP_USER_DIR="${T}" \
121 GNUSTEP_USER_DEFAULTS_DIR="${T}"/Defaults \
122 GNUSTEP_INSTALLATION_DOMAIN=SYSTEM \
123 TAR_OPTIONS="${TAR_OPTIONS} --no-same-owner" \
124 messages=yes \
125 -j1 )
126 # -j1 is needed as gnustep-make is not parallel-safe
127
128 use debug \
129 && GS_ENV=( "${GS_ENV[@]}" "debug=yes" ) \
130 || GS_ENV=( "${GS_ENV[@]}" "debug=no" )
131
132 return 0
133 fi
134 die "gnustep-make not installed!"
135 }
136
137 # Make utilizing GNUstep Makefiles
138 egnustep_make() {
139 if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then
140 emake ${*} "${GS_ENV[@]}" all || die "package make failed"
141 return 0
142 fi
143 die "no Makefile found"
144 }
145
146 # Make-install utilizing GNUstep Makefiles
147 egnustep_install() {
148 # avoid problems due to our "weird" prefix, make sure it exists
149 mkdir -p "${D}"${GNUSTEP_SYSTEM_TOOLS}
150 if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then
151 emake ${*} "${GS_ENV[@]}" install || die "package install failed"
152 return 0
153 fi
154 die "no Makefile found"
155 }
156
157 # Make and install docs using GNUstep Makefiles
158 egnustep_doc() {
159 if [[ -d ./Documentation ]] ; then
160 # Check documentation presence
161 cd "${S}"/Documentation
162 if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then
163 emake "${GS_ENV[@]}" all || die "doc make failed"
164 emake "${GS_ENV[@]}" install || die "doc install failed"
165 fi
166 cd ..
167 fi
168 }
169
170 egnustep_install_config() {
171 [[ $(type -t gnustep_config_script) != "function" ]] && return 0
172
173 local cfile=config-${PN}.sh
174
175 cat << 'EOF' > "${T}"/${cfile}
176 #!/usr/bin/env bash
177 gnustep_append_default() {
178 if [[ -z $1 || -z $2 || -z $3 ]]; then
179 echo "warning: invalid script invocation"
180 return
181 fi
182 dom=$1
183 key=$2
184 val=$3
185 cur=$(defaults read ${dom} ${key}) 2> /dev/null
186 if [[ -z $cur ]] ; then
187 echo " * setting ${dom} ${key}"
188 defaults write ${dom} ${key} "( ${val} )"
189 elif [[ ${cur} != *${val}* ]] ; then
190 echo " * adding ${val} to ${dom} ${key}"
191 echo "${cur%)\'}, \"${val}\" )'" | defaults write
192 else
193 echo " * ${val} already present in ${dom} ${key}"
194 fi
195 }
196
197 gnustep_set_default() {
198 if [[ -z $1 || -z $2 || -z $3 ]]; then
199 echo "warning: invalid script invocation"
200 return
201 fi
202 dom=$1
203 key=$2
204 val=$3
205 echo " * setting ${dom} ${key}"
206 defaults write ${dom} ${key} ${val}
207 }
208
209 EOF
210
211 echo "echo \"Applying ${P} default configuration ...\"" >> "${T}"/${cfile}
212
213 gnustep_config_script | \
214 while read line ; do
215 echo "${line}" >> "${T}"/${cfile}
216 done
217 echo 'echo "done"' >> "${T}"/${cfile}
218
219 exeinto ${GNUSTEP_SYSTEM_TOOLS}/Gentoo
220 doexe "${T}"/${cfile}
221 }
222
223 case ${EAPI:-0} in
224 0|1) EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst ;;
225 2) EXPORT_FUNCTIONS pkg_setup src_unpack src_configure src_compile src_install pkg_postinst ;;
226 esac

  ViewVC Help
Powered by ViewVC 1.1.20