/[gentoo-x86]/eclass/xorg-2.eclass
Gentoo

Diff of /eclass/xorg-2.eclass

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

Revision 1.8 Revision 1.19
1# Copyright 1999-2010 Gentoo Foundation 1# Copyright 1999-2010 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/xorg-2.eclass,v 1.8 2010/08/06 20:46:08 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.19 2010/11/05 12:11:55 scarabeus Exp $
4# 4#
5# @ECLASS: xorg-2.eclass 5# @ECLASS: xorg-2.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# x11@gentoo.org 7# x11@gentoo.org
8# @BLURB: Reduces code duplication in the modularized X11 ebuilds. 8# @BLURB: Reduces code duplication in the modularized X11 ebuilds.
42 ${FONT_ECLASS} ${GIT_ECLASS} 42 ${FONT_ECLASS} ${GIT_ECLASS}
43 43
44EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm" 44EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm"
45case "${EAPI:-0}" in 45case "${EAPI:-0}" in
46 3) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;; 46 3) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;;
47 *) DEPEND="EAPI-UNSUPPORTED" ;; 47 *) die "EAPI-UNSUPPORTED" ;;
48esac 48esac
49 49
50# exports must be ALWAYS after inherit 50# exports must be ALWAYS after inherit
51EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS} 51EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
52 52
91# Set the license for the package. This can be overridden by setting 91# Set the license for the package. This can be overridden by setting
92# LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages 92# LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages
93# are under the MIT license. (This is what Red Hat does in their rpms) 93# are under the MIT license. (This is what Red Hat does in their rpms)
94: ${LICENSE:=MIT} 94: ${LICENSE:=MIT}
95 95
96# Set up shared dependencies 96# Set up autotools shared dependencies
97if [[ ${XORG_EAUTORECONF} != no ]]; then 97# Remember that all versions here MUST be stable
98 DEPEND+=" 98XORG_EAUTORECONF_ARCHES="x86-interix ppc-aix x86-winnt"
99EAUTORECONF_DEPEND+="
99 >=sys-devel/libtool-2.2.6a 100 >=sys-devel/libtool-2.2.6a
100 sys-devel/m4" 101 sys-devel/m4"
101 # This MUST BE STABLE
102 if [[ ${PN} != util-macros ]] ; then 102if [[ ${PN} != util-macros ]] ; then
103 DEPEND+=" >=x11-misc/util-macros-1.8.0" 103 EAUTORECONF_DEPEND+=" >=x11-misc/util-macros-1.11.0"
104 # Required even by xorg-server 104 # Required even by xorg-server
105 [[ ${PN} == "font-util" ]] || DEPEND+=" >=media-fonts/font-util-1.1.1-r1" 105 [[ ${PN} == "font-util" ]] || EAUTORECONF_DEPEND+=" >=media-fonts/font-util-1.1.1-r1"
106 fi 106fi
107 WANT_AUTOCONF="latest" 107WANT_AUTOCONF="latest"
108 WANT_AUTOMAKE="latest" 108WANT_AUTOMAKE="latest"
109fi 109for arch in ${XORG_EAUTORECONF_ARCHES}; do
110 EAUTORECONF_DEPENDS+=" ${arch}? ( ${EAUTORECONF_DEPEND} )"
111done
112DEPEND+=" ${EAUTORECONF_DEPENDS}"
113[[ ${XORG_EAUTORECONF} != no ]] && DEPEND+=" ${EAUTORECONF_DEPEND}"
114unset EAUTORECONF_DEPENDS
115unset EAUTORECONF_DEPEND
110 116
111if [[ ${FONT} == yes ]]; then 117if [[ ${FONT} == yes ]]; then
112 RDEPEND+=" media-fonts/encodings 118 RDEPEND+=" media-fonts/encodings
113 x11-apps/mkfontscale 119 x11-apps/mkfontscale
114 x11-apps/mkfontdir" 120 x11-apps/mkfontdir"
115 PDEPEND+=" media-fonts/font-alias" 121 PDEPEND+=" media-fonts/font-alias"
122 DEPEND+=" >=media-fonts/font-util-1.1.1-r1"
116 123
117 # @ECLASS-VARIABLE: FONT_DIR 124 # @ECLASS-VARIABLE: FONT_DIR
118 # @DESCRIPTION: 125 # @DESCRIPTION:
119 # If you're creating a font package and the suffix of PN is not equal to 126 # If you're creating a font package and the suffix of PN is not equal to
120 # the subdirectory of /usr/share/fonts/ it should install into, set 127 # the subdirectory of /usr/share/fonts/ it should install into, set
146 153
147# Add static-libs useflag where usefull. 154# Add static-libs useflag where usefull.
148if [[ ${XORG_STATIC} == yes \ 155if [[ ${XORG_STATIC} == yes \
149 && ${FONT} != yes \ 156 && ${FONT} != yes \
150 && ${CATEGORY} != app-doc \ 157 && ${CATEGORY} != app-doc \
158 && ${CATEGORY} != x11-apps \
151 && ${CATEGORY} != x11-proto \ 159 && ${CATEGORY} != x11-proto \
152 && ${CATEGORY} != x11-drivers \ 160 && ${CATEGORY} != x11-drivers \
153 && ${CATEGORY} != media-fonts \ 161 && ${CATEGORY} != media-fonts \
154 && ${PN} != util-macros \ 162 && ${PN} != util-macros \
155 && ${PN} != xbitmaps \ 163 && ${PN} != xbitmaps \
163# Check deps on xorg-server 171# Check deps on xorg-server
164has dri ${IUSE//+} && DEPEND+=" dri? ( >=x11-base/xorg-server-1.6.3.901-r2[-minimal] )" 172has dri ${IUSE//+} && DEPEND+=" dri? ( >=x11-base/xorg-server-1.6.3.901-r2[-minimal] )"
165[[ -n "${DRIVER}" ]] && DEPEND+=" x11-base/xorg-server[xorg]" 173[[ -n "${DRIVER}" ]] && DEPEND+=" x11-base/xorg-server[xorg]"
166 174
167# @FUNCTION: xorg-2_pkg_setup 175# @FUNCTION: xorg-2_pkg_setup
168# @USAGE:
169# @DESCRIPTION: 176# @DESCRIPTION:
170# Setup prefix compat 177# Setup prefix compat
171xorg-2_pkg_setup() { 178xorg-2_pkg_setup() {
172 [[ ${FONT} == yes ]] && font_pkg_setup 179 [[ ${FONT} == yes ]] && font_pkg_setup
173} 180}
174 181
175# @FUNCTION: xorg-2_src_unpack 182# @FUNCTION: xorg-2_src_unpack
176# @USAGE:
177# @DESCRIPTION: 183# @DESCRIPTION:
178# Simply unpack source code. 184# Simply unpack source code.
179xorg-2_src_unpack() { 185xorg-2_src_unpack() {
180 if [[ -n ${GIT_ECLASS} ]]; then 186 if [[ -n ${GIT_ECLASS} ]]; then
181 git_src_unpack 187 git_src_unpack
185 191
186 [[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}" 192 [[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}"
187} 193}
188 194
189# @FUNCTION: xorg-2_patch_source 195# @FUNCTION: xorg-2_patch_source
190# @USAGE:
191# @DESCRIPTION: 196# @DESCRIPTION:
192# Apply all patches 197# Apply all patches
193xorg-2_patch_source() { 198xorg-2_patch_source() {
194 # Use standardized names and locations with bulk patching 199 # Use standardized names and locations with bulk patching
195 # Patch directory is ${WORKDIR}/patch 200 # Patch directory is ${WORKDIR}/patch
199 [[ -d "${EPATCH_SOURCE}" ]] && epatch 204 [[ -d "${EPATCH_SOURCE}" ]] && epatch
200 base_src_prepare 205 base_src_prepare
201} 206}
202 207
203# @FUNCTION: xorg-2_reconf_source 208# @FUNCTION: xorg-2_reconf_source
204# @USAGE:
205# @DESCRIPTION: 209# @DESCRIPTION:
206# Run eautoreconf if necessary, and run elibtoolize. 210# Run eautoreconf if necessary, and run elibtoolize.
207xorg-2_reconf_source() { 211xorg-2_reconf_source() {
208 case ${CHOST} in 212 case ${CHOST} in
209 *-interix* | *-aix* | *-winnt*) 213 *-interix* | *-aix* | *-winnt*)
216 ;; 220 ;;
217 esac 221 esac
218} 222}
219 223
220# @FUNCTION: xorg-2_src_prepare 224# @FUNCTION: xorg-2_src_prepare
221# @USAGE:
222# @DESCRIPTION: 225# @DESCRIPTION:
223# Prepare a package after unpacking, performing all X-related tasks. 226# Prepare a package after unpacking, performing all X-related tasks.
224xorg-2_src_prepare() { 227xorg-2_src_prepare() {
225 [[ -n ${GIT_ECLASS} ]] && git_src_prepare 228 [[ -n ${GIT_ECLASS} ]] && git_src_prepare
226 xorg-2_patch_source 229 xorg-2_patch_source
227 xorg-2_reconf_source 230 xorg-2_reconf_source
228} 231}
229 232
230# @FUNCTION: xorg-2_font_configure 233# @FUNCTION: xorg-2_font_configure
231# @USAGE:
232# @DESCRIPTION: 234# @DESCRIPTION:
233# If a font package, perform any necessary configuration steps 235# If a font package, perform any necessary configuration steps
234xorg-2_font_configure() { 236xorg-2_font_configure() {
235 if has nls ${IUSE//+} && ! use nls; then 237 if has nls ${IUSE//+} && ! use nls; then
236 FONT_OPTIONS+=" 238 FONT_OPTIONS+="
252 --disable-jisx0201 254 --disable-jisx0201
253 --disable-koi8-r" 255 --disable-koi8-r"
254 fi 256 fi
255} 257}
256 258
257# @FUNCTION: x-modular_flags_setup 259# @FUNCTION: xorg-2_flags_setup
258# @USAGE:
259# @DESCRIPTION: 260# @DESCRIPTION:
260# Set up CFLAGS for a debug build 261# Set up CFLAGS for a debug build
261xorg-2_flags_setup() { 262xorg-2_flags_setup() {
262 # Win32 require special define 263 # Win32 require special define
263 [[ ${CHOST} == *-winnt* ]] && append-cppflags -DWIN32 -D__STDC__ 264 [[ ${CHOST} == *-winnt* ]] && append-cppflags -DWIN32 -D__STDC__
264 # hardened ldflags 265 # hardened ldflags
265 [[ ${PN} = xorg-server || -n ${DRIVER} ]] && append-ldflags -Wl,-z,lazy 266 [[ ${PN} = xorg-server || -n ${DRIVER} ]] && append-ldflags -Wl,-z,lazy
267
268 # Quite few libraries fail on runtime without these:
269 if has static-libs ${IUSE//+}; then
270 filter-flags -Wl,-Bdirect
271 filter-ldflags -Bdirect
272 filter-ldflags -Wl,-Bdirect
273 fi
266} 274}
267 275
268# @FUNCTION: xorg-2_src_configure 276# @FUNCTION: xorg-2_src_configure
269# @USAGE:
270# @DESCRIPTION: 277# @DESCRIPTION:
271# Perform any necessary pre-configuration steps, then run configure 278# Perform any necessary pre-configuration steps, then run configure
272xorg-2_src_configure() { 279xorg-2_src_configure() {
273 local myopts="" 280 local myopts=""
274 281
275 xorg-2_flags_setup 282 xorg-2_flags_setup
276 [[ -n "${FONT}" ]] && xorg-2_font_configure 283 [[ -n "${FONT}" ]] && xorg-2_font_configure
277 284
278# @VARIABLE: CONFIGURE_OPTIONS 285 # @VARIABLE: CONFIGURE_OPTIONS
279# @DESCRIPTION: 286 # @DESCRIPTION:
280# Any options to pass to configure 287 # Any options to pass to configure
288 # @DEFAULT_UNSET
281 CONFIGURE_OPTIONS=${CONFIGURE_OPTIONS:=""} 289 CONFIGURE_OPTIONS=${CONFIGURE_OPTIONS:=""}
282 if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then 290 if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
283 if has static-libs ${IUSE//+}; then 291 if has static-libs ${IUSE//+}; then
284 myopts+=" $(use_enable static-libs static)" 292 myopts+=" $(use_enable static-libs static)"
285 fi 293 fi
289 ${myopts} 297 ${myopts}
290 fi 298 fi
291} 299}
292 300
293# @FUNCTION: xorg-2_src_compile 301# @FUNCTION: xorg-2_src_compile
294# @USAGE:
295# @DESCRIPTION: 302# @DESCRIPTION:
296# Compile a package, performing all X-related tasks. 303# Compile a package, performing all X-related tasks.
297xorg-2_src_compile() { 304xorg-2_src_compile() {
298 base_src_compile 305 base_src_compile
299} 306}
300 307
301# @FUNCTION: xorg-2_src_install 308# @FUNCTION: xorg-2_src_install
302# @USAGE:
303# @DESCRIPTION: 309# @DESCRIPTION:
304# Install a built package to ${D}, performing any necessary steps. 310# Install a built package to ${D}, performing any necessary steps.
305# Creates a ChangeLog from git if using live ebuilds. 311# Creates a ChangeLog from git if using live ebuilds.
306xorg-2_src_install() { 312xorg-2_src_install() {
307 if [[ ${CATEGORY} == x11-proto ]]; then 313 if [[ ${CATEGORY} == x11-proto ]]; then
308 emake \ 314 emake \
309 ${PN/proto/}docdir=${EPREFIX}/usr/share/doc/${PF} \ 315 ${PN/proto/}docdir=${EPREFIX}/usr/share/doc/${PF} \
316 docdir=${EPREFIX}/usr/share/doc/${PF} \
310 DESTDIR="${D}" \ 317 DESTDIR="${D}" \
311 install || die "emake install failed" 318 install || die "emake install failed"
312 else 319 else
313 emake \ 320 emake \
314 docdir=${EPREFIX}/usr/share/doc/${PF} \ 321 docdir=${EPREFIX}/usr/share/doc/${PF} \
316 install || die "emake install failed" 323 install || die "emake install failed"
317 fi 324 fi
318 325
319 if [[ -n ${GIT_ECLASS} ]]; then 326 if [[ -n ${GIT_ECLASS} ]]; then
320 pushd "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" > /dev/null 327 pushd "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" > /dev/null
321 git log ${GIT_TREE} > "${S}"/ChangeLog 328 git log ${EGIT_COMMIT} > "${S}"/ChangeLog
322 popd > /dev/null 329 popd > /dev/null
323 fi 330 fi
324 331
325 if [[ -e "${S}"/ChangeLog ]]; then 332 if [[ -e "${S}"/ChangeLog ]]; then
326 dodoc "${S}"/ChangeLog 333 dodoc "${S}"/ChangeLog
327 fi 334 fi
328# @VARIABLE: DOCS 335 # @VARIABLE: DOCS
329# @DESCRIPTION: 336 # @DESCRIPTION:
330# Any documentation to install 337 # Any documentation to install
338 # @DEFAULT_UNSET
331 if [[ -n ${DOCS} ]]; then 339 if [[ -n ${DOCS} ]]; then
332 dodoc ${DOCS} || die "dodoc failed" 340 dodoc ${DOCS} || die "dodoc failed"
333 fi 341 fi
334 342
335 # Don't install libtool archives for server modules 343 # Don't install libtool archives for server modules
340 348
341 [[ -n ${FONT} ]] && remove_font_metadata 349 [[ -n ${FONT} ]] && remove_font_metadata
342} 350}
343 351
344# @FUNCTION: xorg-2_pkg_postinst 352# @FUNCTION: xorg-2_pkg_postinst
345# @USAGE:
346# @DESCRIPTION: 353# @DESCRIPTION:
347# Run X-specific post-installation tasks on the live filesystem. The 354# Run X-specific post-installation tasks on the live filesystem. The
348# only task right now is some setup for font packages. 355# only task right now is some setup for font packages.
349xorg-2_pkg_postinst() { 356xorg-2_pkg_postinst() {
350 [[ -n ${FONT} ]] && setup_fonts 357 [[ -n ${FONT} ]] && setup_fonts
351} 358}
352 359
353# @FUNCTION: xorg-2_pkg_postrm 360# @FUNCTION: xorg-2_pkg_postrm
354# @USAGE:
355# @DESCRIPTION: 361# @DESCRIPTION:
356# Run X-specific post-removal tasks on the live filesystem. The only 362# Run X-specific post-removal tasks on the live filesystem. The only
357# task right now is some cleanup for font packages. 363# task right now is some cleanup for font packages.
358xorg-2_pkg_postrm() { 364xorg-2_pkg_postrm() {
359 if [[ -n ${FONT} ]]; then 365 if [[ -n ${FONT} ]]; then
360 font_pkg_postrm 366 font_pkg_postrm
361 fi 367 fi
362} 368}
363 369
364# @FUNCTION: setup_fonts 370# @FUNCTION: setup_fonts
365# @USAGE:
366# @DESCRIPTION: 371# @DESCRIPTION:
367# Generates needed files for fonts and fixes font permissions 372# Generates needed files for fonts and fixes font permissions
368setup_fonts() { 373setup_fonts() {
369 create_fonts_scale 374 create_fonts_scale
370 create_fonts_dir 375 create_fonts_dir
371 font_pkg_postinst 376 font_pkg_postinst
372} 377}
373 378
374# @FUNCTION: remove_font_metadata 379# @FUNCTION: remove_font_metadata
375# @USAGE:
376# @DESCRIPTION: 380# @DESCRIPTION:
377# Don't let the package install generated font files that may overlap 381# Don't let the package install generated font files that may overlap
378# with other packages. Instead, they're generated in pkg_postinst(). 382# with other packages. Instead, they're generated in pkg_postinst().
379remove_font_metadata() { 383remove_font_metadata() {
380 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then 384 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
382 rm -rf "${ED}"/usr/share/fonts/${FONT_DIR}/fonts.{scale,dir,cache-1} 386 rm -rf "${ED}"/usr/share/fonts/${FONT_DIR}/fonts.{scale,dir,cache-1}
383 fi 387 fi
384} 388}
385 389
386# @FUNCTION: create_fonts_scale 390# @FUNCTION: create_fonts_scale
387# @USAGE:
388# @DESCRIPTION: 391# @DESCRIPTION:
389# Create fonts.scale file, used by the old server-side fonts subsystem. 392# Create fonts.scale file, used by the old server-side fonts subsystem.
390create_fonts_scale() { 393create_fonts_scale() {
391 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then 394 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
392 ebegin "Generating font.scale" 395 ebegin "Generating font.scale"
396 eend $? 399 eend $?
397 fi 400 fi
398} 401}
399 402
400# @FUNCTION: create_fonts_dir 403# @FUNCTION: create_fonts_dir
401# @USAGE:
402# @DESCRIPTION: 404# @DESCRIPTION:
403# Create fonts.dir file, used by the old server-side fonts subsystem. 405# Create fonts.dir file, used by the old server-side fonts subsystem.
404create_fonts_dir() { 406create_fonts_dir() {
405 ebegin "Generating fonts.dir" 407 ebegin "Generating fonts.dir"
406 mkfontdir \ 408 mkfontdir \

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.20