/[gentoo-x86]/eclass/gnome2.eclass
Gentoo

Diff of /eclass/gnome2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.68 Revision 1.77
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.68 2006/03/29 13:02:27 allanonjl Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.77 2006/12/12 02:58:22 leonardop Exp $
4 4
5# GNOME 2 ECLASS 5#
6# gnome2.eclass
7#
8# Exports portage base functions used by ebuilds written for packages using the
9# GNOME framework.
10#
11# Maintained by Gentoo's GNOME herd <gnome@gentoo.org>
12#
13
14
6inherit libtool gnome.org debug fdo-mime eutils 15inherit libtool gnome.org debug fdo-mime eutils
16
7 17
8# Extra configure opts passed to econf 18# Extra configure opts passed to econf
9G2CONF=${G2CONF:=""} 19G2CONF=${G2CONF:=""}
10 20
11# Extra options passed to elibtoolize 21# Extra options passed to elibtoolize
15USE_EINSTALL=${USE_EINSTALL:=""} 25USE_EINSTALL=${USE_EINSTALL:=""}
16 26
17# Run scrollkeeper for this package? 27# Run scrollkeeper for this package?
18SCROLLKEEPER_UPDATE=${SCROLLKEEPER_UPDATE:="1"} 28SCROLLKEEPER_UPDATE=${SCROLLKEEPER_UPDATE:="1"}
19 29
20# Where to put scrollkeeper data lives 30# Directory where scrollkeeper-update should do its work
21SCROLLKEEPER_DIR=${SCROLLKEEPER_DIR:="/var/lib/scrollkeeper"} 31SCROLLKEEPER_DIR=${SCROLLKEEPER_DIR:="${ROOT}var/lib/scrollkeeper"}
22 32
23# Path to scrollkeeper-update 33# Path to scrollkeeper-update
24SCROLLKEEPER_UPDATE_BIN=${SCROLLKEEPER_UPDATE_BIN:="${ROOT}/usr/bin/scrollkeeper-update"} 34SCROLLKEEPER_UPDATE_BIN=${SCROLLKEEPER_UPDATE_BIN:="${ROOT}usr/bin/scrollkeeper-update"}
25 35
26# Path to gconftool-2 36# Path to gconftool-2
27GCONFTOOL_BIN=${GCONFTOOL_BIN:="${ROOT}/usr/bin/gconftool-2"} 37GCONFTOOL_BIN=${GCONFTOOL_BIN:="${ROOT}usr/bin/gconftool-2"}
28 38
39if [[ ${GCONF_DEBUG} != "no" ]]; then
29IUSE="debug" 40 IUSE="debug"
41fi
30 42
31DEPEND=">=sys-apps/sed-4 43DEPEND=">=sys-apps/sed-4"
32 sys-apps/findutils"
33 44
34gnome2_src_unpack() { 45gnome2_src_unpack() {
35 unpack ${A} 46 unpack ${A}
36 cd ${S} 47 cd ${S}
37 48
39 gnome2_omf_fix 50 gnome2_omf_fix
40} 51}
41 52
42gnome2_src_configure() { 53gnome2_src_configure() {
43 # Update the GNOME configuration options 54 # Update the GNOME configuration options
55 if [[ ${GCONF_DEBUG} != 'no' ]] ; then
56 if use debug ; then
44 use debug && G2CONF="${G2CONF} --enable-debug=yes" 57 G2CONF="${G2CONF} --enable-debug=yes"
58 fi
59 fi
60
61 # Prevent a QA warning
62 if hasq doc ${IUSE} ; then
45 G2CONF="${G2CONF} $(use_enable doc gtk-doc)" 63 G2CONF="${G2CONF} $(use_enable doc gtk-doc)"
64 fi
46 65
47 # Run libtoolize 66 # Run libtoolize
48 elibtoolize ${ELTCONF} 67 elibtoolize ${ELTCONF}
68
69 # Avoid sandbox violations caused by misbehaving packages (bug #128289)
70 addwrite "${ROOT}root/.gnome2"
49 71
50 # GST_REGISTRY is to work around gst-inspect trying to read/write /root 72 # GST_REGISTRY is to work around gst-inspect trying to read/write /root
51 GST_REGISTRY="${S}/registry.xml" econf "$@" ${G2CONF} || die "configure failed" 73 GST_REGISTRY="${S}/registry.xml" econf "$@" ${G2CONF} || die "configure failed"
52} 74}
53 75
57} 79}
58 80
59gnome2_src_install() { 81gnome2_src_install() {
60 # if this is not present, scrollkeeper-update may segfault and 82 # if this is not present, scrollkeeper-update may segfault and
61 # create bogus directories in /var/lib/ 83 # create bogus directories in /var/lib/
62 dodir "${SCROLLKEEPER_DIR}" 84 local sk_tmp_dir="/var/lib/scrollkeeper"
85 dodir "${sk_tmp_dir}"
63 86
64 # we must delay gconf schema installation due to sandbox 87 # we must delay gconf schema installation due to sandbox
65 export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL="1" 88 export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL="1"
66 89
67 debug-print "You are testing with DESTDIR by default - AllanonJL"
68 if [[ -z "${USE_EINSTALL}" || "${USE_EINSTALL}" = "0" ]]; then 90 if [[ -z "${USE_EINSTALL}" || "${USE_EINSTALL}" = "0" ]]; then
91 debug-print "Installing with 'make install'"
69 make DESTDIR=${D} "scrollkeeper_localstate_dir=${D}${SCROLLKEEPER_DIR} " "$@" install || die "install failed" 92 make DESTDIR=${D} "scrollkeeper_localstate_dir=${D}${sk_tmp_dir} " "$@" install || die "install failed"
70 else 93 else
94 debug-print "Installing with 'einstall'"
71 einstall "scrollkeeper_localstate_dir=${D}${SCROLLKEEPER_DIR} " "$@" || die "einstall failed" 95 einstall "scrollkeeper_localstate_dir=${D}${sk_tmp_dir} " "$@" || die "einstall failed"
72 fi 96 fi
73 97
74 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL 98 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
75 99
76 # Manual document installation 100 # Manual document installation
77 [[ -n "${DOCS}" ]] && dodoc ${DOCS} 101 [[ -n "${DOCS}" ]] && dodoc ${DOCS}
78 102
79 # Do not keep /var/lib/scrollkeeper because: 103 # Do not keep /var/lib/scrollkeeper because:
80 # 1. scrollkeeper will get regenerated at pkg_postinst() 104 # 1. The scrollkeeper database is regenerated at pkg_postinst()
81 # 2. ${D}/var/lib/scrollkeeper contains only indexes for the current pkg 105 # 2. ${D}/var/lib/scrollkeeper contains only indexes for the current pkg
82 # thus it makes no sense if pkg_postinst ISN'T run for some reason. 106 # thus it makes no sense if pkg_postinst ISN'T run for some reason.
83
84 if [[ -z "$(find ${D} -name '*.omf')" ]]; then 107 if [[ -z "$(find ${D} -name '*.omf')" ]]; then
85 export SCROLLKEEPER_UPDATE="0" 108 export SCROLLKEEPER_UPDATE="0"
86 fi 109 fi
87 110 rm -rf "${D}${sk_tmp_dir}"
88 # Regenerate these in pkg_postinst()
89 rm -rf "${D}${SCROLLKEEPER_DIR}"
90 111
91 # Make sure this one doesn't get in the portage db 112 # Make sure this one doesn't get in the portage db
92 rm -fr "${D}/usr/share/applications/mimeinfo.cache" 113 rm -fr "${D}/usr/share/applications/mimeinfo.cache"
93} 114}
94 115
95 116
117
118# Applies any schema files installed by the current ebuild to Gconf's database
119# using gconftool-2
96gnome2_gconf_install() { 120gnome2_gconf_install() {
97 if [[ -x ${GCONFTOOL_BIN} ]]; then 121 if [[ ! -x ${GCONFTOOL_BIN} ]]; then
122 return
123 fi
124
98 # We are ready to install the GCONF Scheme now 125 # We are ready to install the GCONF Scheme now
99 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL 126 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
100 export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source) 127 export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source)
101 128
102 einfo "Installing GNOME 2 GConf schemas" 129 einfo "Installing GNOME 2 GConf schemas"
103 130
104 local contents="${ROOT}/var/db/pkg/*/${PN}-${PVR}/CONTENTS" 131 local contents="${ROOT}/var/db/pkg/*/${PN}-${PVR}/CONTENTS"
132 local F
105 133
106 for F in $(grep "obj /etc/gconf/schemas" ${contents} | sed 's:obj \([^ ]*\) .*:\1:' ); do 134 for F in $(grep "^obj /etc/gconf/schemas/.\+\.schemas\b" ${contents} | gawk '{print $2}' ); do
107 if [[ -e "${F}" ]]; then 135 if [[ -e "${F}" ]]; then
108 # echo "DEBUG::gconf install ${F}" 136 # echo "DEBUG::gconf install ${F}"
109 ${GCONFTOOL_BIN} --makefile-install-rule ${F} 1>/dev/null 137 ${GCONFTOOL_BIN} --makefile-install-rule ${F} 1>/dev/null
110 fi 138 fi
111 done 139 done
112 fi
113}
114 140
141 # have gconf reload the new schemas
142 ebegin "Reloading GConf schemas"
143 killall -HUP gconfd-2
144 eend $?
145}
146
147# Removes schema files previously installed by the current ebuild from Gconf's
148# database.
115gnome2_gconf_uninstall() { 149gnome2_gconf_uninstall() {
116 if [[ -x ${GCONFTOOL_BIN} ]]; then 150 if [[ ! -x ${GCONFTOOL_BIN} ]]; then
151 return
152 fi
153
117 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL 154 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
118 export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source) 155 export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source)
119 156
120 einfo "Uninstalling GNOME 2 GConf schemas" 157 einfo "Uninstalling GNOME 2 GConf schemas"
121 158
122 local contents="${ROOT}/var/db/pkg/*/${PN}-${PVR}/CONTENTS" 159 local contents="${ROOT}/var/db/pkg/*/${PN}-${PVR}/CONTENTS"
160 local F
123 161
124 for F in $(grep "obj /etc/gconf/schemas" ${contents} | sed 's:obj \([^ ]*\) .*:\1:' ); do 162 for F in $(grep "obj /etc/gconf/schemas" ${contents} | sed 's:obj \([^ ]*\) .*:\1:' ); do
125 # echo "DEBUG::gconf install ${F}" 163 # echo "DEBUG::gconf install ${F}"
126 ${GCONFTOOL_BIN} --makefile-uninstall-rule ${F} 1>/dev/null 164 ${GCONFTOOL_BIN} --makefile-uninstall-rule ${F} 1>/dev/null
127 done 165 done
128 fi
129} 166}
130 167
168# Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild
169# have installed anything under that location.
131gnome2_icon_cache_update() { 170gnome2_icon_cache_update() {
132 local updater=$(type -p gtk-update-icon-cache 2> /dev/null) 171 local updater=$(type -p gtk-update-icon-cache 2> /dev/null)
133 172
134 ebegin "Updating icons cache"
135
136 if [[ ! -x ${updater} ]] ; then 173 if [[ ! -x ${updater} ]] ; then
137 debug-print "${updater} is not executable" 174 debug-print "${updater} is not executable"
138
139 # We failed to run
140 eend 1
141 175
142 return 176 return
143 fi 177 fi
144 178
145 if ! grep -q "obj /usr/share/icons" ${ROOT}/var/db/pkg/*/${PF}/CONTENTS 179 if ! grep -q "obj /usr/share/icons" ${ROOT}/var/db/pkg/*/${PF}/CONTENTS
146 then 180 then
147 debug-print "No items to update" 181 debug-print "No items to update"
148 182
149 # We are done successfully
150 eend 0
151
152 return 183 return
153 fi 184 fi
185
186 ebegin "Updating icons cache"
154 187
155 local retval=0 188 local retval=0
156 local fails=( ) 189 local fails=( )
157 190
158 for dir in $(find ${ROOT}/usr/share/icons -maxdepth 1 -mindepth 1 -type d) 191 for dir in $(find ${ROOT}/usr/share/icons -maxdepth 1 -mindepth 1 -type d)
187 eerror "Failed to update cache with icon ${fails[i]}" 220 eerror "Failed to update cache with icon ${fails[i]}"
188 fi 221 fi
189 done 222 done
190} 223}
191 224
225# Workaround applied to Makefile rules in order to remove redundant
226# calls to scrollkeeper-update and sandbox violations.
192gnome2_omf_fix() { 227gnome2_omf_fix() {
193 # workaround/patch against omf.make or omf-install/Makefile.in
194 # in order to remove redundant scrollkeeper-updates.
195 # - <liquidx@gentoo.org>
196
197 local omf_makefiles filename 228 local omf_makefiles filename
198 229
199 omf_makefiles="$@" 230 omf_makefiles="$@"
200
201 if [[ -f ${S}/omf-install/Makefile.in ]] ; then
202 omf_makefiles="${omf_makefiles} ${S}/omf-install/Makefile.in"
203 fi
204
205 # FIXME: does this really work? because omf.make only gets included
206 # when autoconf/automake is run. You should directly patch
207 # the Makefile.in's
208 231
209 if [[ -f ${S}/omf.make ]] ; then 232 if [[ -f ${S}/omf.make ]] ; then
210 omf_makefiles="${omf_makefiles} ${S}/omf.make" 233 omf_makefiles="${omf_makefiles} ${S}/omf.make"
211 fi 234 fi
212 235
249 eerror "Failed to update OMF Makefile ${fails[i]}" 272 eerror "Failed to update OMF Makefile ${fails[i]}"
250 fi 273 fi
251 done 274 done
252} 275}
253 276
277# Updates the scrollkeeper database if necessary. To force this action, make
278# sure to set SCROLLKEPER_UPDATE to 1.
254gnome2_scrollkeeper_update() { 279gnome2_scrollkeeper_update() {
255 if [[ -x ${SCROLLKEEPER_UPDATE_BIN} && "${SCROLLKEEPER_UPDATE}" = "1" ]] 280 if [[ -x ${SCROLLKEEPER_UPDATE_BIN} && "${SCROLLKEEPER_UPDATE}" = "1" ]]
256 then 281 then
257 einfo "Updating scrollkeeper database ..." 282 einfo "Updating scrollkeeper database ..."
258 ${SCROLLKEEPER_UPDATE_BIN} -q -p ${ROOT}${SCROLLKEEPER_DIR} 283 ${SCROLLKEEPER_UPDATE_BIN} -q -p ${SCROLLKEEPER_DIR}
259 fi 284 fi
260} 285}
261 286
262gnome2_pkg_postinst() { 287gnome2_pkg_postinst() {
263 gnome2_gconf_install 288 gnome2_gconf_install

Legend:
Removed from v.1.68  
changed lines
  Added in v.1.77

  ViewVC Help
Powered by ViewVC 1.1.20