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

Diff of /eclass/gnome2.eclass

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

Revision 1.76 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.76 2006/12/07 03:13:25 compnerd 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
29if [[ ${GCONF_DEBUG} != "no" ]]; then 39if [[ ${GCONF_DEBUG} != "no" ]]; then
30 IUSE="debug" 40 IUSE="debug"
31fi 41fi
32 42
54 fi 64 fi
55 65
56 # Run libtoolize 66 # Run libtoolize
57 elibtoolize ${ELTCONF} 67 elibtoolize ${ELTCONF}
58 68
59 # Do not remove the addwrite. bug #128289 69 # Avoid sandbox violations caused by misbehaving packages (bug #128289)
60 addwrite "${ROOT}/root/.gnome2" 70 addwrite "${ROOT}root/.gnome2"
61 71
62 # 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
63 GST_REGISTRY="${S}/registry.xml" econf "$@" ${G2CONF} || die "configure failed" 73 GST_REGISTRY="${S}/registry.xml" econf "$@" ${G2CONF} || die "configure failed"
64} 74}
65 75
69} 79}
70 80
71gnome2_src_install() { 81gnome2_src_install() {
72 # if this is not present, scrollkeeper-update may segfault and 82 # if this is not present, scrollkeeper-update may segfault and
73 # create bogus directories in /var/lib/ 83 # create bogus directories in /var/lib/
74 dodir "${SCROLLKEEPER_DIR}" 84 local sk_tmp_dir="/var/lib/scrollkeeper"
85 dodir "${sk_tmp_dir}"
75 86
76 # we must delay gconf schema installation due to sandbox 87 # we must delay gconf schema installation due to sandbox
77 export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL="1" 88 export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL="1"
78 89
79 debug-print "You are testing with DESTDIR by default - AllanonJL"
80 if [[ -z "${USE_EINSTALL}" || "${USE_EINSTALL}" = "0" ]]; then 90 if [[ -z "${USE_EINSTALL}" || "${USE_EINSTALL}" = "0" ]]; then
91 debug-print "Installing with 'make install'"
81 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"
82 else 93 else
94 debug-print "Installing with 'einstall'"
83 einstall "scrollkeeper_localstate_dir=${D}${SCROLLKEEPER_DIR} " "$@" || die "einstall failed" 95 einstall "scrollkeeper_localstate_dir=${D}${sk_tmp_dir} " "$@" || die "einstall failed"
84 fi 96 fi
85 97
86 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL 98 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
87 99
88 # Manual document installation 100 # Manual document installation
89 [[ -n "${DOCS}" ]] && dodoc ${DOCS} 101 [[ -n "${DOCS}" ]] && dodoc ${DOCS}
90 102
91 # Do not keep /var/lib/scrollkeeper because: 103 # Do not keep /var/lib/scrollkeeper because:
92 # 1. scrollkeeper will get regenerated at pkg_postinst() 104 # 1. The scrollkeeper database is regenerated at pkg_postinst()
93 # 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
94 # 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.
95
96 if [[ -z "$(find ${D} -name '*.omf')" ]]; then 107 if [[ -z "$(find ${D} -name '*.omf')" ]]; then
97 export SCROLLKEEPER_UPDATE="0" 108 export SCROLLKEEPER_UPDATE="0"
98 fi 109 fi
99 110 rm -rf "${D}${sk_tmp_dir}"
100 # Regenerate these in pkg_postinst()
101 rm -rf "${D}${SCROLLKEEPER_DIR}"
102 111
103 # Make sure this one doesn't get in the portage db 112 # Make sure this one doesn't get in the portage db
104 rm -fr "${D}/usr/share/applications/mimeinfo.cache" 113 rm -fr "${D}/usr/share/applications/mimeinfo.cache"
105} 114}
106 115
107 116
117
118# Applies any schema files installed by the current ebuild to Gconf's database
119# using gconftool-2
108gnome2_gconf_install() { 120gnome2_gconf_install() {
109
110 if [[ -x ${GCONFTOOL_BIN} ]]; then 121 if [[ ! -x ${GCONFTOOL_BIN} ]]; then
122 return
123 fi
124
111 # We are ready to install the GCONF Scheme now 125 # We are ready to install the GCONF Scheme now
112 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL 126 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
113 export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source) 127 export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source)
114 128
115 einfo "Installing GNOME 2 GConf schemas" 129 einfo "Installing GNOME 2 GConf schemas"
116 130
117 local contents="${ROOT}/var/db/pkg/*/${PN}-${PVR}/CONTENTS" 131 local contents="${ROOT}/var/db/pkg/*/${PN}-${PVR}/CONTENTS"
132 local F
118 133
119 for F in $(grep "^obj /etc/gconf/schemas/.\+\.schemas\b" ${contents} | gawk '{print $2}' ); do 134 for F in $(grep "^obj /etc/gconf/schemas/.\+\.schemas\b" ${contents} | gawk '{print $2}' ); do
120 if [[ -e "${F}" ]]; then 135 if [[ -e "${F}" ]]; then
121 # echo "DEBUG::gconf install ${F}" 136 # echo "DEBUG::gconf install ${F}"
122 ${GCONFTOOL_BIN} --makefile-install-rule ${F} 1>/dev/null 137 ${GCONFTOOL_BIN} --makefile-install-rule ${F} 1>/dev/null
123 fi 138 fi
124 done 139 done
125 140
126 # have gconf reload the new schemas 141 # have gconf reload the new schemas
127 ebegin "Reloading GConf schemas" 142 ebegin "Reloading GConf schemas"
128 killall -HUP gconfd-2 143 killall -HUP gconfd-2
129 eend $? 144 eend $?
130 fi
131
132} 145}
133 146
147# Removes schema files previously installed by the current ebuild from Gconf's
148# database.
134gnome2_gconf_uninstall() { 149gnome2_gconf_uninstall() {
135 if [[ -x ${GCONFTOOL_BIN} ]]; then 150 if [[ ! -x ${GCONFTOOL_BIN} ]]; then
151 return
152 fi
153
136 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL 154 unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
137 export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source) 155 export GCONF_CONFIG_SOURCE=$(${GCONFTOOL_BIN} --get-default-source)
138 156
139 einfo "Uninstalling GNOME 2 GConf schemas" 157 einfo "Uninstalling GNOME 2 GConf schemas"
140 158
141 local contents="${ROOT}/var/db/pkg/*/${PN}-${PVR}/CONTENTS" 159 local contents="${ROOT}/var/db/pkg/*/${PN}-${PVR}/CONTENTS"
160 local F
142 161
143 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
144 # echo "DEBUG::gconf install ${F}" 163 # echo "DEBUG::gconf install ${F}"
145 ${GCONFTOOL_BIN} --makefile-uninstall-rule ${F} 1>/dev/null 164 ${GCONFTOOL_BIN} --makefile-uninstall-rule ${F} 1>/dev/null
146 done 165 done
147 fi
148} 166}
149 167
168# Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild
169# have installed anything under that location.
150gnome2_icon_cache_update() { 170gnome2_icon_cache_update() {
151 local updater=$(type -p gtk-update-icon-cache 2> /dev/null) 171 local updater=$(type -p gtk-update-icon-cache 2> /dev/null)
152 172
153 ebegin "Updating icons cache"
154
155 if [[ ! -x ${updater} ]] ; then 173 if [[ ! -x ${updater} ]] ; then
156 debug-print "${updater} is not executable" 174 debug-print "${updater} is not executable"
157
158 # We failed to run
159 eend 1
160 175
161 return 176 return
162 fi 177 fi
163 178
164 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
165 then 180 then
166 debug-print "No items to update" 181 debug-print "No items to update"
167 182
168 # We are done successfully
169 eend 0
170
171 return 183 return
172 fi 184 fi
185
186 ebegin "Updating icons cache"
173 187
174 local retval=0 188 local retval=0
175 local fails=( ) 189 local fails=( )
176 190
177 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)
206 eerror "Failed to update cache with icon ${fails[i]}" 220 eerror "Failed to update cache with icon ${fails[i]}"
207 fi 221 fi
208 done 222 done
209} 223}
210 224
225# Workaround applied to Makefile rules in order to remove redundant
226# calls to scrollkeeper-update and sandbox violations.
211gnome2_omf_fix() { 227gnome2_omf_fix() {
212 # workaround/patch against omf.make or omf-install/Makefile.in
213 # in order to remove redundant scrollkeeper-updates.
214 # - <liquidx@gentoo.org>
215
216 local omf_makefiles filename 228 local omf_makefiles filename
217 229
218 omf_makefiles="$@" 230 omf_makefiles="$@"
219
220 if [[ -f ${S}/omf-install/Makefile.in ]] ; then
221 omf_makefiles="${omf_makefiles} ${S}/omf-install/Makefile.in"
222 fi
223
224 # FIXME: does this really work? because omf.make only gets included
225 # when autoconf/automake is run. You should directly patch
226 # the Makefile.in's
227 231
228 if [[ -f ${S}/omf.make ]] ; then 232 if [[ -f ${S}/omf.make ]] ; then
229 omf_makefiles="${omf_makefiles} ${S}/omf.make" 233 omf_makefiles="${omf_makefiles} ${S}/omf.make"
230 fi 234 fi
231 235
268 eerror "Failed to update OMF Makefile ${fails[i]}" 272 eerror "Failed to update OMF Makefile ${fails[i]}"
269 fi 273 fi
270 done 274 done
271} 275}
272 276
277# Updates the scrollkeeper database if necessary. To force this action, make
278# sure to set SCROLLKEPER_UPDATE to 1.
273gnome2_scrollkeeper_update() { 279gnome2_scrollkeeper_update() {
274 if [[ -x ${SCROLLKEEPER_UPDATE_BIN} && "${SCROLLKEEPER_UPDATE}" = "1" ]] 280 if [[ -x ${SCROLLKEEPER_UPDATE_BIN} && "${SCROLLKEEPER_UPDATE}" = "1" ]]
275 then 281 then
276 einfo "Updating scrollkeeper database ..." 282 einfo "Updating scrollkeeper database ..."
277 ${SCROLLKEEPER_UPDATE_BIN} -q -p ${ROOT}${SCROLLKEEPER_DIR} 283 ${SCROLLKEEPER_UPDATE_BIN} -q -p ${SCROLLKEEPER_DIR}
278 fi 284 fi
279} 285}
280 286
281gnome2_pkg_postinst() { 287gnome2_pkg_postinst() {
282 gnome2_gconf_install 288 gnome2_gconf_install

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

  ViewVC Help
Powered by ViewVC 1.1.20