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

Contents of /eclass/gnustep-base.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (hide annotations) (download)
Wed Mar 10 13:19:06 2010 UTC (4 years, 7 months ago) by voyageur
Branch: MAIN
Changes since 1.14: +2 -2 lines
Allow EAPI=>3 usage (so EXPORT_FONCTIONS works on new gnustep-base)

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

  ViewVC Help
Powered by ViewVC 1.1.20