| 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.2 2005/08/11 06:19:16 spyderous Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.11 2005/09/05 20:36:30 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" |
| … | |
… | |
| 32 | >=sys-devel/automake-1.7 |
31 | >=sys-devel/automake-1.7 |
| 33 | >=sys-devel/libtool-1.5 |
32 | >=sys-devel/libtool-1.5 |
| 34 | >=sys-devel/m4-1.4" |
33 | >=sys-devel/m4-1.4" |
| 35 | fi |
34 | fi |
| 36 | |
35 | |
|
|
36 | # If we're a font package, but not the font.alias one |
|
|
37 | if [[ "${PN/#font}" != "${PN}" ]] && [[ "${PN}" != "font-alias" ]]; then |
|
|
38 | # Activate font code in the rest of the eclass |
|
|
39 | FONT="yes" |
|
|
40 | |
|
|
41 | RDEPEND="${RDEPEND} |
|
|
42 | media-fonts/encodings" |
|
|
43 | PDEPEND="${PDEPEND} |
|
|
44 | media-fonts/font-alias" |
|
|
45 | fi |
|
|
46 | |
|
|
47 | # If we're a driver package |
|
|
48 | if [[ "${PN/#xf86-video}" != "${PN}" || "${PN/#xf86-input}" != "${PN}" ]] |
|
|
49 | then |
|
|
50 | # Don't build static driver modules |
|
|
51 | DRIVER_OPTIONS="--disable-static" |
|
|
52 | fi |
|
|
53 | |
| 37 | DEPEND="${DEPEND} |
54 | DEPEND="${DEPEND} |
| 38 | dev-util/pkgconfig |
55 | >=dev-util/pkgconfig-0.18 |
| 39 | x11-misc/util-macros" |
56 | x11-misc/util-macros" |
| 40 | |
57 | |
| 41 | RDEPEND="${RDEPEND}" |
58 | RDEPEND="${RDEPEND}" |
| 42 | # Shouldn't be necessary once we're in a standard location |
59 | # Shouldn't be necessary once we're in a standard location |
| 43 | # x11-base/x11-env" |
60 | # x11-base/x11-env" |
| … | |
… | |
| 78 | then |
95 | then |
| 79 | # If possible, generate configure if it doesn't exist |
96 | # If possible, generate configure if it doesn't exist |
| 80 | if [ -f "${S}/configure.ac" ] |
97 | if [ -f "${S}/configure.ac" ] |
| 81 | then |
98 | then |
| 82 | einfo "Running autoreconf..." |
99 | einfo "Running autoreconf..." |
| 83 | autoreconf -v --install |
100 | autoreconf -v --force --install |
| 84 | fi |
101 | fi |
| 85 | fi |
102 | fi |
| 86 | |
103 | |
| 87 | } |
104 | } |
| 88 | |
105 | |
| … | |
… | |
| 90 | x-modular_unpack_source |
107 | x-modular_unpack_source |
| 91 | x-modular_patch_source |
108 | x-modular_patch_source |
| 92 | x-modular_reconf_source |
109 | x-modular_reconf_source |
| 93 | } |
110 | } |
| 94 | |
111 | |
| 95 | x-modular_src_compile() { |
112 | x-modular_src_configure() { |
| 96 | # If prefix isn't set here, .pc files cause problems |
113 | # If prefix isn't set here, .pc files cause problems |
| 97 | if [ -x ./configure ]; then |
114 | if [ -x ./configure ]; then |
| 98 | econf --prefix=${XDIR} \ |
115 | econf --prefix=${XDIR} \ |
| 99 | --datadir=${XDIR}/share \ |
116 | --datadir=${XDIR}/share \ |
|
|
117 | ${DRIVER_OPTIONS} \ |
| 100 | ${CONFIGURE_OPTIONS} |
118 | ${CONFIGURE_OPTIONS} |
| 101 | fi |
119 | fi |
|
|
120 | } |
|
|
121 | |
|
|
122 | x-modular_src_make() { |
| 102 | emake || die "emake failed" |
123 | emake || die "emake failed" |
|
|
124 | } |
|
|
125 | |
|
|
126 | x-modular_src_compile() { |
|
|
127 | x-modular_src_configure |
|
|
128 | x-modular_src_make |
| 103 | } |
129 | } |
| 104 | |
130 | |
| 105 | x-modular_src_install() { |
131 | x-modular_src_install() { |
| 106 | # Install everything to ${XDIR} |
132 | # Install everything to ${XDIR} |
| 107 | make \ |
133 | make \ |
| … | |
… | |
| 109 | install |
135 | install |
| 110 | # Shouldn't be necessary in XDIR=/usr |
136 | # Shouldn't be necessary in XDIR=/usr |
| 111 | # einstall forces datadir, so we need to re-force it |
137 | # einstall forces datadir, so we need to re-force it |
| 112 | # datadir=${XDIR}/share \ |
138 | # datadir=${XDIR}/share \ |
| 113 | # mandir=${XDIR}/share/man \ |
139 | # mandir=${XDIR}/share/man \ |
|
|
140 | |
|
|
141 | # Don't install libtool archives for server modules |
|
|
142 | if [[ -e ${D}/usr/lib/xorg/modules ]]; then |
|
|
143 | find ${D}/usr/lib/xorg/modules -name '*.la' \ |
|
|
144 | | xargs rm -f |
|
|
145 | fi |
|
|
146 | } |
|
|
147 | |
|
|
148 | x-modular_pkg_preinst() { |
|
|
149 | if [[ -n "${FONT}" ]]; then |
|
|
150 | discover_font_dirs |
|
|
151 | fi |
| 114 | } |
152 | } |
| 115 | |
153 | |
| 116 | x-modular_pkg_postinst() { |
154 | x-modular_pkg_postinst() { |
| 117 | if [[ -n "${FONT}" ]]; then |
155 | if [[ -n "${FONT}" ]]; then |
| 118 | setup_fonts |
156 | setup_fonts |
| … | |
… | |
| 128 | |
166 | |
| 129 | create_fonts_scale |
167 | create_fonts_scale |
| 130 | create_fonts_dir |
168 | create_fonts_dir |
| 131 | fix_font_permissions |
169 | fix_font_permissions |
| 132 | create_font_cache |
170 | create_font_cache |
|
|
171 | } |
|
|
172 | |
|
|
173 | discover_font_dirs() { |
|
|
174 | pushd ${IMAGE}/usr/share/fonts |
|
|
175 | FONT_DIRS="$(find . -maxdepth 1 -mindepth 1 -type d)" |
|
|
176 | FONT_DIRS="$(echo ${FONT_DIRS} | sed -e 's:./::g')" |
|
|
177 | popd |
| 133 | } |
178 | } |
| 134 | |
179 | |
| 135 | create_fonts_scale() { |
180 | create_fonts_scale() { |
| 136 | ebegin "Creating fonts.scale files" |
181 | ebegin "Creating fonts.scale files" |
| 137 | local x |
182 | local x |