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

Contents of /eclass/gnustep-base.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (hide annotations) (download)
Mon May 11 10:58:42 2009 UTC (5 years, 4 months ago) by voyageur
Branch: MAIN
Changes since 1.9: +6 -4 lines
Parallel-make support was added in gnustep-make 2.2.0

1 grobian 1.1 # Copyright 1999-2007 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 voyageur 1.10 # $Header: /var/cvsroot/gentoo-x86/eclass/gnustep-base.eclass,v 1.9 2008/12/03 14:29:05 voyageur Exp $
4 grobian 1.1
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 voyageur 1.9 doc? ( virtual/texi2dvi dev-tex/latex2html app-text/texi2html )"
20 grobian 1.1
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 voyageur 1.8 gnustep-base_src_configure() {
61 grobian 1.1 egnustep_env
62     if [[ -x ./configure ]] ; then
63     econf || die "configure failed"
64     fi
65 voyageur 1.8 }
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 grobian 1.1 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 grobian 1.3 is-ldflagq -Wl,-rpath="${GNUSTEP_SYSTEM_LIBRARIES}" \
110     || append-ldflags \
111     -Wl,-rpath="${GNUSTEP_SYSTEM_LIBRARIES}"
112 grobian 1.1 ;;
113     esac
114    
115     # Set up env vars for make operations
116     GS_ENV=( AUXILIARY_LDFLAGS="${LDFLAGS}" \
117 voyageur 1.6 ADDITIONAL_NATIVE_LIB_DIRS="${GNUSTEP_SYSTEM_LIBRARIES}" \
118 grobian 1.1 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 voyageur 1.10 messages=yes )
125    
126     # Parallel-make support was added in gnustep-make 2.2.0
127     has_version "<gnustep-base/gnustep-make-2.2.0" \
128     && GS_ENV=( "${GS_ENV[@]}" "-j1" )
129 grobian 1.1
130     use debug \
131     && GS_ENV=( "${GS_ENV[@]}" "debug=yes" ) \
132     || GS_ENV=( "${GS_ENV[@]}" "debug=no" )
133    
134     return 0
135     fi
136     die "gnustep-make not installed!"
137     }
138    
139     # Make utilizing GNUstep Makefiles
140     egnustep_make() {
141     if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then
142     emake ${*} "${GS_ENV[@]}" all || die "package make failed"
143     return 0
144     fi
145     die "no Makefile found"
146     }
147    
148     # Make-install utilizing GNUstep Makefiles
149     egnustep_install() {
150     # avoid problems due to our "weird" prefix, make sure it exists
151     mkdir -p "${D}"${GNUSTEP_SYSTEM_TOOLS}
152     if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then
153     emake ${*} "${GS_ENV[@]}" install || die "package install failed"
154     return 0
155     fi
156     die "no Makefile found"
157     }
158    
159     # Make and install docs using GNUstep Makefiles
160     egnustep_doc() {
161     if [[ -d ./Documentation ]] ; then
162     # Check documentation presence
163     cd "${S}"/Documentation
164     if [[ -f ./[mM]akefile || -f ./GNUmakefile ]] ; then
165     emake "${GS_ENV[@]}" all || die "doc make failed"
166     emake "${GS_ENV[@]}" install || die "doc install failed"
167     fi
168     cd ..
169     fi
170     }
171    
172     egnustep_install_config() {
173     [[ $(type -t gnustep_config_script) != "function" ]] && return 0
174    
175     local cfile=config-${PN}.sh
176    
177 voyageur 1.5 cat << 'EOF' > "${T}"/${cfile}
178 voyageur 1.4 #!/usr/bin/env bash
179     gnustep_append_default() {
180 voyageur 1.5 if [[ -z $1 || -z $2 || -z $3 ]]; then
181 voyageur 1.4 echo "warning: invalid script invocation"
182     return
183     fi
184 voyageur 1.5 dom=$1
185     key=$2
186     val=$3
187     cur=$(defaults read ${dom} ${key}) 2> /dev/null
188     if [[ -z $cur ]] ; then
189     echo " * setting ${dom} ${key}"
190     defaults write ${dom} ${key} "( ${val} )"
191     elif [[ ${cur} != *${val}* ]] ; then
192     echo " * adding ${val} to ${dom} ${key}"
193     echo "${cur%)\'}, \"${val}\" )'" | defaults write
194 voyageur 1.4 else
195 voyageur 1.5 echo " * ${val} already present in ${dom} ${key}"
196 voyageur 1.4 fi
197     }
198    
199     gnustep_set_default() {
200 opfer 1.7 if [[ -z $1 || -z $2 || -z $3 ]]; then
201     echo "warning: invalid script invocation"
202     return
203     fi
204     dom=$1
205     key=$2
206     val=$3
207     echo " * setting ${dom} ${key}"
208 voyageur 1.5 defaults write ${dom} ${key} ${val}
209 voyageur 1.4 }
210    
211     EOF
212    
213 voyageur 1.5 echo "echo \"Applying ${P} default configuration ...\"" >> "${T}"/${cfile}
214    
215 grobian 1.1 gnustep_config_script | \
216     while read line ; do
217     echo "${line}" >> "${T}"/${cfile}
218     done
219 grobian 1.2 echo 'echo "done"' >> "${T}"/${cfile}
220 grobian 1.1
221     exeinto ${GNUSTEP_SYSTEM_TOOLS}/Gentoo
222     doexe "${T}"/${cfile}
223     }
224    
225 voyageur 1.8 case ${EAPI:-0} in
226     0|1) EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst ;;
227     2) EXPORT_FUNCTIONS pkg_setup src_unpack src_configure src_compile src_install pkg_postinst ;;
228     esac

  ViewVC Help
Powered by ViewVC 1.1.20