| 1 | # Copyright 1999-2005 Gentoo Foundation |
1 | # Copyright 1999-2005 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/x-modular.eclass,v 1.3 2005/08/14 23:04:02 spyderous Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.13 2005/09/12 21:44:16 spyderous Exp $ |
| 4 | # |
4 | # |
| 5 | # Author: Donnie Berkholz <spyderous@gentoo.org> |
5 | # Author: Donnie Berkholz <spyderous@gentoo.org> |
| 6 | # |
6 | # |
| 7 | # This eclass is designed to reduce code duplication in the modularized X11 |
7 | # This eclass is designed to reduce code duplication in the modularized X11 |
| 8 | # ebuilds. |
8 | # ebuilds. |
| 9 | # |
9 | # |
| 10 | # If the ebuild installs fonts, set FONT="yes" at the top and set FONT_DIRS to |
10 | # If the ebuild installs fonts, set FONT="yes" at the top and set FONT_DIRS to |
| 11 | # the subdirectories within /usr/share/fonts to which it installs fonts. |
11 | # the subdirectories within /usr/share/fonts to which it installs fonts. |
| 12 | |
12 | |
| 13 | EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst |
13 | EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst |
| 14 | |
14 | |
| 15 | inherit eutils |
15 | inherit eutils |
| 16 | |
16 | |
| 17 | # Directory prefix to use for everything |
17 | # Directory prefix to use for everything |
| 18 | # Change to /usr/X11R6 once it's standard |
|
|
| 19 | XDIR="/usr" |
18 | XDIR="/usr" |
| 20 | |
19 | |
| 21 | IUSE="" |
20 | IUSE="" |
| 22 | HOMEPAGE="http://xorg.freedesktop.org/" |
21 | HOMEPAGE="http://xorg.freedesktop.org/" |
| 23 | SRC_URI="http://xorg.freedesktop.org/X11R7.0-RC0/everything/${P}.tar.bz2" |
22 | SRC_URI="http://xorg.freedesktop.org/X11R7.0-RC0/everything/${P}.tar.bz2" |
| … | |
… | |
| 34 | >=sys-devel/m4-1.4" |
33 | >=sys-devel/m4-1.4" |
| 35 | fi |
34 | fi |
| 36 | |
35 | |
| 37 | # If we're a font package, but not the font.alias one |
36 | # If we're a font package, but not the font.alias one |
| 38 | if [[ "${PN/#font}" != "${PN}" ]] && [[ "${PN}" != "font-alias" ]]; then |
37 | if [[ "${PN/#font}" != "${PN}" ]] && [[ "${PN}" != "font-alias" ]]; then |
|
|
38 | # Activate font code in the rest of the eclass |
|
|
39 | FONT="yes" |
|
|
40 | |
| 39 | RDEPEND="${RDEPEND} |
41 | RDEPEND="${RDEPEND} |
| 40 | media-fonts/encodings" |
42 | media-fonts/encodings" |
| 41 | PDEPEND="${PDEPEND} |
43 | PDEPEND="${PDEPEND} |
| 42 | media-fonts/font-alias" |
44 | media-fonts/font-alias" |
| 43 | fi |
45 | fi |
| 44 | |
46 | |
|
|
47 | # If we're a driver package |
|
|
48 | if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then |
|
|
49 | # Don't build static driver modules |
|
|
50 | DRIVER_OPTIONS="--disable-static" |
|
|
51 | fi |
|
|
52 | |
| 45 | DEPEND="${DEPEND} |
53 | DEPEND="${DEPEND} |
| 46 | dev-util/pkgconfig |
54 | >=dev-util/pkgconfig-0.18 |
| 47 | x11-misc/util-macros" |
55 | x11-misc/util-macros" |
| 48 | |
56 | |
| 49 | RDEPEND="${RDEPEND}" |
57 | RDEPEND="${RDEPEND} |
| 50 | # Shouldn't be necessary once we're in a standard location |
58 | !<x11-base/xorg-x11-7" |
|
|
59 | # Provides virtual/x11 for temporary use until packages are ported |
| 51 | # x11-base/x11-env" |
60 | # x11-base/x11-env" |
| 52 | # FIXME: Uncomment once it's in portage |
|
|
| 53 | # !x11-base/xorg-x11" |
|
|
| 54 | |
61 | |
| 55 | x-modular_unpack_source() { |
62 | x-modular_unpack_source() { |
| 56 | unpack ${A} |
63 | unpack ${A} |
| 57 | cd ${S} |
64 | cd ${S} |
| 58 | } |
65 | } |
| … | |
… | |
| 86 | then |
93 | then |
| 87 | # If possible, generate configure if it doesn't exist |
94 | # If possible, generate configure if it doesn't exist |
| 88 | if [ -f "${S}/configure.ac" ] |
95 | if [ -f "${S}/configure.ac" ] |
| 89 | then |
96 | then |
| 90 | einfo "Running autoreconf..." |
97 | einfo "Running autoreconf..." |
| 91 | autoreconf -v --install |
98 | autoreconf -v --force --install |
| 92 | fi |
99 | fi |
| 93 | fi |
100 | fi |
| 94 | |
101 | |
| 95 | } |
102 | } |
| 96 | |
103 | |
| … | |
… | |
| 98 | x-modular_unpack_source |
105 | x-modular_unpack_source |
| 99 | x-modular_patch_source |
106 | x-modular_patch_source |
| 100 | x-modular_reconf_source |
107 | x-modular_reconf_source |
| 101 | } |
108 | } |
| 102 | |
109 | |
| 103 | x-modular_src_compile() { |
110 | x-modular_src_configure() { |
| 104 | # If prefix isn't set here, .pc files cause problems |
111 | # If prefix isn't set here, .pc files cause problems |
| 105 | if [ -x ./configure ]; then |
112 | if [ -x ./configure ]; then |
| 106 | econf --prefix=${XDIR} \ |
113 | econf --prefix=${XDIR} \ |
| 107 | --datadir=${XDIR}/share \ |
114 | --datadir=${XDIR}/share \ |
|
|
115 | ${DRIVER_OPTIONS} \ |
| 108 | ${CONFIGURE_OPTIONS} |
116 | ${CONFIGURE_OPTIONS} |
| 109 | fi |
117 | fi |
|
|
118 | } |
|
|
119 | |
|
|
120 | x-modular_src_make() { |
| 110 | emake || die "emake failed" |
121 | emake || die "emake failed" |
|
|
122 | } |
|
|
123 | |
|
|
124 | x-modular_src_compile() { |
|
|
125 | x-modular_src_configure |
|
|
126 | x-modular_src_make |
| 111 | } |
127 | } |
| 112 | |
128 | |
| 113 | x-modular_src_install() { |
129 | x-modular_src_install() { |
| 114 | # Install everything to ${XDIR} |
130 | # Install everything to ${XDIR} |
| 115 | make \ |
131 | make \ |
| … | |
… | |
| 117 | install |
133 | install |
| 118 | # Shouldn't be necessary in XDIR=/usr |
134 | # Shouldn't be necessary in XDIR=/usr |
| 119 | # einstall forces datadir, so we need to re-force it |
135 | # einstall forces datadir, so we need to re-force it |
| 120 | # datadir=${XDIR}/share \ |
136 | # datadir=${XDIR}/share \ |
| 121 | # mandir=${XDIR}/share/man \ |
137 | # mandir=${XDIR}/share/man \ |
|
|
138 | |
|
|
139 | # Don't install libtool archives for server modules |
|
|
140 | if [[ -e ${D}/usr/lib/xorg/modules ]]; then |
|
|
141 | find ${D}/usr/lib/xorg/modules -name '*.la' \ |
|
|
142 | | xargs rm -f |
|
|
143 | fi |
|
|
144 | } |
|
|
145 | |
|
|
146 | x-modular_pkg_preinst() { |
|
|
147 | if [[ -n "${FONT}" ]]; then |
|
|
148 | discover_font_dirs |
|
|
149 | fi |
| 122 | } |
150 | } |
| 123 | |
151 | |
| 124 | x-modular_pkg_postinst() { |
152 | x-modular_pkg_postinst() { |
| 125 | if [[ -n "${FONT}" ]]; then |
153 | if [[ -n "${FONT}" ]]; then |
| 126 | setup_fonts |
154 | setup_fonts |
| … | |
… | |
| 136 | |
164 | |
| 137 | create_fonts_scale |
165 | create_fonts_scale |
| 138 | create_fonts_dir |
166 | create_fonts_dir |
| 139 | fix_font_permissions |
167 | fix_font_permissions |
| 140 | create_font_cache |
168 | create_font_cache |
|
|
169 | } |
|
|
170 | |
|
|
171 | discover_font_dirs() { |
|
|
172 | pushd ${IMAGE}/usr/share/fonts |
|
|
173 | FONT_DIRS="$(find . -maxdepth 1 -mindepth 1 -type d)" |
|
|
174 | FONT_DIRS="$(echo ${FONT_DIRS} | sed -e 's:./::g')" |
|
|
175 | popd |
| 141 | } |
176 | } |
| 142 | |
177 | |
| 143 | create_fonts_scale() { |
178 | create_fonts_scale() { |
| 144 | ebegin "Creating fonts.scale files" |
179 | ebegin "Creating fonts.scale files" |
| 145 | local x |
180 | local x |