| 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.18 2005/11/02 05:51:38 joshuabaergen 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 libtool |
| 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/releases/X11R7.0-RC1/everything/${P}.tar.bz2 |
|
|
23 | http://xorg.freedesktop.org/releases/X11R7.0-RC0/everything/${P}.tar.bz2" |
| 24 | LICENSE="X11" |
24 | LICENSE="X11" |
| 25 | SLOT="0" |
25 | SLOT="0" |
| 26 | |
26 | |
| 27 | # Set up shared dependencies |
27 | # Set up shared dependencies |
| 28 | if [ -n "${SNAPSHOT}" ]; then |
28 | if [ -n "${SNAPSHOT}" ]; then |
| … | |
… | |
| 33 | >=sys-devel/libtool-1.5 |
33 | >=sys-devel/libtool-1.5 |
| 34 | >=sys-devel/m4-1.4" |
34 | >=sys-devel/m4-1.4" |
| 35 | fi |
35 | fi |
| 36 | |
36 | |
| 37 | # If we're a font package, but not the font.alias one |
37 | # If we're a font package, but not the font.alias one |
| 38 | if [[ "${PN/#font}" != "${PN}" ]] && [[ "${PN}" != "font-alias" ]]; then |
38 | if [[ "${PN/#font-}" != "${PN}" ]] && [[ "${PN}" != "font-alias" ]]; then |
|
|
39 | # Activate font code in the rest of the eclass |
|
|
40 | FONT="yes" |
|
|
41 | |
| 39 | RDEPEND="${RDEPEND} |
42 | RDEPEND="${RDEPEND} |
| 40 | media-fonts/encodings" |
43 | media-fonts/encodings" |
| 41 | PDEPEND="${PDEPEND} |
44 | PDEPEND="${PDEPEND} |
| 42 | media-fonts/font-alias" |
45 | media-fonts/font-alias" |
| 43 | fi |
46 | fi |
| 44 | |
47 | |
|
|
48 | # If we're a driver package |
|
|
49 | if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then |
|
|
50 | # Don't build static driver modules |
|
|
51 | DRIVER_OPTIONS="--disable-static" |
|
|
52 | fi |
|
|
53 | |
| 45 | DEPEND="${DEPEND} |
54 | DEPEND="${DEPEND} |
| 46 | dev-util/pkgconfig |
55 | >=dev-util/pkgconfig-0.18 |
| 47 | x11-misc/util-macros" |
56 | >=x11-misc/util-macros-0.99.0_p20051007" |
| 48 | |
57 | |
| 49 | RDEPEND="${RDEPEND}" |
58 | RDEPEND="${RDEPEND} |
| 50 | # Shouldn't be necessary once we're in a standard location |
59 | !<x11-base/xorg-x11-7.0.0_rc0" |
|
|
60 | # Provides virtual/x11 for temporary use until packages are ported |
| 51 | # x11-base/x11-env" |
61 | # x11-base/x11-env" |
| 52 | # FIXME: Uncomment once it's in portage |
62 | |
| 53 | # !x11-base/xorg-x11" |
63 | x-modular_pkg_setup() { |
|
|
64 | # Collision protect will scream bloody murder if we install over old versions |
|
|
65 | if $(has_version "<x11-base/xorg-x11-7.0.0_rc0"); then |
|
|
66 | if has collision-protect ${FEATURES}; then |
|
|
67 | eerror "Having collision-protect in FEATURES will disrupt upgrades" |
|
|
68 | eerror "from non-modular versions of xorg-x11." |
|
|
69 | eerror "Please remove collision-protect from FEATURES while upgrading." |
|
|
70 | die "" |
|
|
71 | fi |
|
|
72 | fi |
|
|
73 | } |
| 54 | |
74 | |
| 55 | x-modular_unpack_source() { |
75 | x-modular_unpack_source() { |
| 56 | unpack ${A} |
76 | unpack ${A} |
| 57 | cd ${S} |
77 | cd ${S} |
|
|
78 | |
|
|
79 | # Joshua Baergen - October 23, 2005 |
|
|
80 | # Fix shared lib issues on MIPS, FBSD, etc etc |
|
|
81 | elibtoolize |
| 58 | } |
82 | } |
| 59 | |
83 | |
| 60 | x-modular_patch_source() { |
84 | x-modular_patch_source() { |
| 61 | # Use standardized names and locations with bulk patching |
85 | # Use standardized names and locations with bulk patching |
| 62 | # Patch directory is ${WORKDIR}/patch |
86 | # Patch directory is ${WORKDIR}/patch |
| … | |
… | |
| 86 | then |
110 | then |
| 87 | # If possible, generate configure if it doesn't exist |
111 | # If possible, generate configure if it doesn't exist |
| 88 | if [ -f "${S}/configure.ac" ] |
112 | if [ -f "${S}/configure.ac" ] |
| 89 | then |
113 | then |
| 90 | einfo "Running autoreconf..." |
114 | einfo "Running autoreconf..." |
| 91 | autoreconf -v --install |
115 | autoreconf -v --force --install |
| 92 | fi |
116 | fi |
| 93 | fi |
117 | fi |
| 94 | |
118 | |
| 95 | } |
119 | } |
| 96 | |
120 | |
| … | |
… | |
| 98 | x-modular_unpack_source |
122 | x-modular_unpack_source |
| 99 | x-modular_patch_source |
123 | x-modular_patch_source |
| 100 | x-modular_reconf_source |
124 | x-modular_reconf_source |
| 101 | } |
125 | } |
| 102 | |
126 | |
| 103 | x-modular_src_compile() { |
127 | x-modular_src_configure() { |
| 104 | # If prefix isn't set here, .pc files cause problems |
128 | # If prefix isn't set here, .pc files cause problems |
| 105 | if [ -x ./configure ]; then |
129 | if [ -x ./configure ]; then |
| 106 | econf --prefix=${XDIR} \ |
130 | econf --prefix=${XDIR} \ |
| 107 | --datadir=${XDIR}/share \ |
131 | --datadir=${XDIR}/share \ |
|
|
132 | ${DRIVER_OPTIONS} \ |
| 108 | ${CONFIGURE_OPTIONS} |
133 | ${CONFIGURE_OPTIONS} |
| 109 | fi |
134 | fi |
|
|
135 | } |
|
|
136 | |
|
|
137 | x-modular_src_make() { |
| 110 | emake || die "emake failed" |
138 | emake || die "emake failed" |
|
|
139 | } |
|
|
140 | |
|
|
141 | x-modular_src_compile() { |
|
|
142 | x-modular_src_configure |
|
|
143 | x-modular_src_make |
| 111 | } |
144 | } |
| 112 | |
145 | |
| 113 | x-modular_src_install() { |
146 | x-modular_src_install() { |
| 114 | # Install everything to ${XDIR} |
147 | # Install everything to ${XDIR} |
| 115 | make \ |
148 | make \ |
| … | |
… | |
| 117 | install |
150 | install |
| 118 | # Shouldn't be necessary in XDIR=/usr |
151 | # Shouldn't be necessary in XDIR=/usr |
| 119 | # einstall forces datadir, so we need to re-force it |
152 | # einstall forces datadir, so we need to re-force it |
| 120 | # datadir=${XDIR}/share \ |
153 | # datadir=${XDIR}/share \ |
| 121 | # mandir=${XDIR}/share/man \ |
154 | # mandir=${XDIR}/share/man \ |
|
|
155 | |
|
|
156 | # Don't install libtool archives for server modules |
|
|
157 | if [[ -e ${D}/usr/lib/xorg/modules ]]; then |
|
|
158 | find ${D}/usr/lib/xorg/modules -name '*.la' \ |
|
|
159 | | xargs rm -f |
|
|
160 | fi |
|
|
161 | } |
|
|
162 | |
|
|
163 | x-modular_pkg_preinst() { |
|
|
164 | if [[ -n "${FONT}" ]]; then |
|
|
165 | discover_font_dirs |
|
|
166 | fi |
| 122 | } |
167 | } |
| 123 | |
168 | |
| 124 | x-modular_pkg_postinst() { |
169 | x-modular_pkg_postinst() { |
| 125 | if [[ -n "${FONT}" ]]; then |
170 | if [[ -n "${FONT}" ]]; then |
| 126 | setup_fonts |
171 | setup_fonts |
| … | |
… | |
| 136 | |
181 | |
| 137 | create_fonts_scale |
182 | create_fonts_scale |
| 138 | create_fonts_dir |
183 | create_fonts_dir |
| 139 | fix_font_permissions |
184 | fix_font_permissions |
| 140 | create_font_cache |
185 | create_font_cache |
|
|
186 | } |
|
|
187 | |
|
|
188 | discover_font_dirs() { |
|
|
189 | pushd ${IMAGE}/usr/share/fonts |
|
|
190 | FONT_DIRS="$(find . -maxdepth 1 -mindepth 1 -type d)" |
|
|
191 | FONT_DIRS="$(echo ${FONT_DIRS} | sed -e 's:./::g')" |
|
|
192 | popd |
| 141 | } |
193 | } |
| 142 | |
194 | |
| 143 | create_fonts_scale() { |
195 | create_fonts_scale() { |
| 144 | ebegin "Creating fonts.scale files" |
196 | ebegin "Creating fonts.scale files" |
| 145 | local x |
197 | local x |