| 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.1 2005/08/08 02:57:50 spyderous Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.1.1.1 2005/11/30 09:59:28 chriswhite 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 | # |
|
|
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. |
| 9 | |
12 | |
| 10 | EXPORT_FUNCTIONS src_unpack src_compile src_install |
13 | EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst |
| 11 | |
14 | |
| 12 | inherit eutils |
15 | inherit eutils libtool |
| 13 | |
16 | |
| 14 | # Directory prefix to use for everything |
17 | # Directory prefix to use for everything |
| 15 | # Change to /usr/X11R6 once it's standard |
|
|
| 16 | XDIR="/usr" |
18 | XDIR="/usr" |
| 17 | |
19 | |
| 18 | IUSE="" |
20 | IUSE="" |
| 19 | HOMEPAGE="http://xorg.freedesktop.org/" |
21 | HOMEPAGE="http://xorg.freedesktop.org/" |
| 20 | SRC_URI="http://xorg.freedesktop.org/X11R7.0-RC0/everything/${P}.tar.bz2" |
22 | SRC_URI="http://xorg.freedesktop.org/releases/X11R7.0-RC2/everything/${P}.tar.bz2 |
|
|
23 | http://xorg.freedesktop.org/releases/X11R7.0-RC1/everything/${P}.tar.bz2 |
|
|
24 | http://xorg.freedesktop.org/releases/X11R7.0-RC0/everything/${P}.tar.bz2" |
| 21 | LICENSE="X11" |
25 | LICENSE="X11" |
| 22 | SLOT="0" |
26 | SLOT="0" |
| 23 | |
27 | |
| 24 | # Set up shared dependencies |
28 | # Set up shared dependencies |
| 25 | if [ -n "${SNAPSHOT}" ]; then |
29 | if [ -n "${SNAPSHOT}" ]; then |
| … | |
… | |
| 29 | >=sys-devel/automake-1.7 |
33 | >=sys-devel/automake-1.7 |
| 30 | >=sys-devel/libtool-1.5 |
34 | >=sys-devel/libtool-1.5 |
| 31 | >=sys-devel/m4-1.4" |
35 | >=sys-devel/m4-1.4" |
| 32 | fi |
36 | fi |
| 33 | |
37 | |
|
|
38 | # If we're a font package, but not the font.alias one |
|
|
39 | if [[ "${PN/#font-}" != "${PN}" ]] && [[ "${PN}" != "font-alias" ]]; then |
|
|
40 | # Activate font code in the rest of the eclass |
|
|
41 | FONT="yes" |
|
|
42 | |
|
|
43 | RDEPEND="${RDEPEND} |
|
|
44 | media-fonts/encodings" |
|
|
45 | PDEPEND="${PDEPEND} |
|
|
46 | media-fonts/font-alias" |
|
|
47 | fi |
|
|
48 | |
|
|
49 | # If we're a driver package |
|
|
50 | if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then |
|
|
51 | # Don't build static driver modules |
|
|
52 | DRIVER_OPTIONS="--disable-static" |
|
|
53 | fi |
|
|
54 | |
| 34 | DEPEND="${DEPEND} |
55 | DEPEND="${DEPEND} |
| 35 | dev-util/pkgconfig |
56 | >=dev-util/pkgconfig-0.18 |
| 36 | x11-misc/util-macros" |
57 | >=x11-misc/util-macros-0.99.0_p20051007" |
| 37 | |
58 | |
|
|
59 | # >=sys-apps/man-1.6b-r2 required to look in [0-8]x/ directories |
| 38 | RDEPEND="${RDEPEND}" |
60 | RDEPEND="${RDEPEND} |
| 39 | # Shouldn't be necessary once we're in a standard location |
61 | !<=x11-base/xorg-x11-6.9 |
|
|
62 | >=sys-apps/man-1.6b-r2" |
|
|
63 | # Provides virtual/x11 for temporary use until packages are ported |
| 40 | # x11-base/x11-env" |
64 | # x11-base/x11-env" |
| 41 | # FIXME: Uncomment once it's in portage |
|
|
| 42 | # !x11-base/xorg-x11" |
|
|
| 43 | |
65 | |
| 44 | x-modular_unpack_source() { |
66 | x-modular_unpack_source() { |
| 45 | unpack ${A} |
67 | unpack ${A} |
| 46 | cd ${S} |
68 | cd ${S} |
|
|
69 | |
|
|
70 | # Joshua Baergen - October 23, 2005 |
|
|
71 | # Fix shared lib issues on MIPS, FBSD, etc etc |
|
|
72 | elibtoolize |
| 47 | } |
73 | } |
| 48 | |
74 | |
| 49 | x-modular_patch_source() { |
75 | x-modular_patch_source() { |
| 50 | # Use standardized names and locations with bulk patching |
76 | # Use standardized names and locations with bulk patching |
| 51 | # Patch directory is ${WORKDIR}/patch |
77 | # Patch directory is ${WORKDIR}/patch |
| … | |
… | |
| 75 | then |
101 | then |
| 76 | # If possible, generate configure if it doesn't exist |
102 | # If possible, generate configure if it doesn't exist |
| 77 | if [ -f "${S}/configure.ac" ] |
103 | if [ -f "${S}/configure.ac" ] |
| 78 | then |
104 | then |
| 79 | einfo "Running autoreconf..." |
105 | einfo "Running autoreconf..." |
| 80 | autoreconf -v --install |
106 | autoreconf -v --force --install |
| 81 | fi |
107 | fi |
| 82 | fi |
108 | fi |
| 83 | |
109 | |
| 84 | } |
110 | } |
| 85 | |
111 | |
| … | |
… | |
| 87 | x-modular_unpack_source |
113 | x-modular_unpack_source |
| 88 | x-modular_patch_source |
114 | x-modular_patch_source |
| 89 | x-modular_reconf_source |
115 | x-modular_reconf_source |
| 90 | } |
116 | } |
| 91 | |
117 | |
| 92 | x-modular_src_compile() { |
118 | x-modular_src_configure() { |
| 93 | # If prefix isn't set here, .pc files cause problems |
119 | # If prefix isn't set here, .pc files cause problems |
| 94 | if [ -x ./configure ]; then |
120 | if [ -x ./configure ]; then |
| 95 | econf --prefix=${XDIR} \ |
121 | econf --prefix=${XDIR} \ |
| 96 | --datadir=${XDIR}/share \ |
122 | --datadir=${XDIR}/share \ |
|
|
123 | ${DRIVER_OPTIONS} \ |
| 97 | ${CONFIGURE_OPTIONS} |
124 | ${CONFIGURE_OPTIONS} |
| 98 | fi |
125 | fi |
|
|
126 | } |
|
|
127 | |
|
|
128 | x-modular_src_make() { |
| 99 | emake || die "emake failed" |
129 | emake || die "emake failed" |
|
|
130 | } |
|
|
131 | |
|
|
132 | x-modular_src_compile() { |
|
|
133 | x-modular_src_configure |
|
|
134 | x-modular_src_make |
| 100 | } |
135 | } |
| 101 | |
136 | |
| 102 | x-modular_src_install() { |
137 | x-modular_src_install() { |
| 103 | # Install everything to ${XDIR} |
138 | # Install everything to ${XDIR} |
| 104 | make \ |
139 | make \ |
| … | |
… | |
| 106 | install |
141 | install |
| 107 | # Shouldn't be necessary in XDIR=/usr |
142 | # Shouldn't be necessary in XDIR=/usr |
| 108 | # einstall forces datadir, so we need to re-force it |
143 | # einstall forces datadir, so we need to re-force it |
| 109 | # datadir=${XDIR}/share \ |
144 | # datadir=${XDIR}/share \ |
| 110 | # mandir=${XDIR}/share/man \ |
145 | # mandir=${XDIR}/share/man \ |
|
|
146 | |
|
|
147 | # Don't install libtool archives for server modules |
|
|
148 | if [[ -e ${D}/usr/lib/xorg/modules ]]; then |
|
|
149 | find ${D}/usr/lib/xorg/modules -name '*.la' \ |
|
|
150 | | xargs rm -f |
|
|
151 | fi |
| 111 | } |
152 | } |
|
|
153 | |
|
|
154 | x-modular_pkg_preinst() { |
|
|
155 | if [[ -n "${FONT}" ]]; then |
|
|
156 | discover_font_dirs |
|
|
157 | fi |
|
|
158 | } |
|
|
159 | |
|
|
160 | x-modular_pkg_postinst() { |
|
|
161 | if [[ -n "${FONT}" ]]; then |
|
|
162 | setup_fonts |
|
|
163 | fi |
|
|
164 | } |
|
|
165 | |
|
|
166 | setup_fonts() { |
|
|
167 | if [[ ! -n "${FONT_DIRS}" ]]; then |
|
|
168 | msg="FONT_DIRS empty. Set it to at least one subdir of /usr/share/fonts." |
|
|
169 | eerror ${msg} |
|
|
170 | die ${msg} |
|
|
171 | fi |
|
|
172 | |
|
|
173 | create_fonts_scale |
|
|
174 | create_fonts_dir |
|
|
175 | fix_font_permissions |
|
|
176 | create_font_cache |
|
|
177 | } |
|
|
178 | |
|
|
179 | discover_font_dirs() { |
|
|
180 | pushd ${IMAGE}/usr/share/fonts |
|
|
181 | FONT_DIRS="$(find . -maxdepth 1 -mindepth 1 -type d)" |
|
|
182 | FONT_DIRS="$(echo ${FONT_DIRS} | sed -e 's:./::g')" |
|
|
183 | popd |
|
|
184 | } |
|
|
185 | |
|
|
186 | create_fonts_scale() { |
|
|
187 | ebegin "Creating fonts.scale files" |
|
|
188 | local x |
|
|
189 | for FONT_DIR in ${FONT_DIRS}; do |
|
|
190 | x=${ROOT}/usr/share/fonts/${FONT_DIR} |
|
|
191 | [ -z "$(ls ${x}/)" ] && continue |
|
|
192 | [ "$(ls ${x}/)" = "fonts.cache-1" ] && continue |
|
|
193 | |
|
|
194 | # Only generate .scale files if truetype, opentype or type1 |
|
|
195 | # fonts are present ... |
|
|
196 | |
|
|
197 | # First truetype (ttf,ttc) |
|
|
198 | # NOTE: ttmkfdir does NOT work on type1 fonts (#53753) |
|
|
199 | # Also, there is no way to regenerate Speedo/CID fonts.scale |
|
|
200 | # <spyderous@gentoo.org> 2 August 2004 |
|
|
201 | if [ "${x/encodings}" = "${x}" -a \ |
|
|
202 | -n "$(find ${x} -iname '*.tt[cf]' -print)" ]; then |
|
|
203 | if [ -x ${ROOT}/usr/bin/ttmkfdir ]; then |
|
|
204 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
|
|
205 | ${ROOT}/usr/bin/ttmkfdir -x 2 \ |
|
|
206 | -e ${ROOT}/usr/share/fonts/encodings/encodings.dir \ |
|
|
207 | -o ${x}/fonts.scale -d ${x} |
|
|
208 | # ttmkfdir fails on some stuff, so try mkfontscale if it does |
|
|
209 | local ttmkfdir_return=$? |
|
|
210 | else |
|
|
211 | # We didn't use ttmkfdir at all |
|
|
212 | local ttmkfdir_return=2 |
|
|
213 | fi |
|
|
214 | if [ ${ttmkfdir_return} -ne 0 ]; then |
|
|
215 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
|
|
216 | ${ROOT}/usr/bin/mkfontscale \ |
|
|
217 | -a /usr/share/fonts/encodings/encodings.dir \ |
|
|
218 | -- ${x} |
|
|
219 | fi |
|
|
220 | # Next type1 and opentype (pfa,pfb,otf,otc) |
|
|
221 | elif [ "${x/encodings}" = "${x}" -a \ |
|
|
222 | -n "$(find ${x} -iname '*.[po][ft][abcf]' -print)" ]; then |
|
|
223 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
|
|
224 | ${ROOT}/usr/bin/mkfontscale \ |
|
|
225 | -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \ |
|
|
226 | -- ${x} |
|
|
227 | fi |
|
|
228 | done |
|
|
229 | eend 0 |
|
|
230 | } |
|
|
231 | |
|
|
232 | create_fonts_dir() { |
|
|
233 | ebegin "Generating fonts.dir files" |
|
|
234 | for FONT_DIR in ${FONT_DIRS}; do |
|
|
235 | x=${ROOT}/usr/share/fonts/${FONT_DIR} |
|
|
236 | [ -z "$(ls ${x}/)" ] && continue |
|
|
237 | [ "$(ls ${x}/)" = "fonts.cache-1" ] && continue |
|
|
238 | |
|
|
239 | if [ "${x/encodings}" = "${x}" ]; then |
|
|
240 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
|
|
241 | ${ROOT}/usr/bin/mkfontdir \ |
|
|
242 | -e ${ROOT}/usr/share/fonts/encodings \ |
|
|
243 | -e ${ROOT}/usr/share/fonts/encodings/large \ |
|
|
244 | -- ${x} |
|
|
245 | fi |
|
|
246 | done |
|
|
247 | eend 0 |
|
|
248 | } |
|
|
249 | |
|
|
250 | fix_font_permissions() { |
|
|
251 | ebegin "Fixing permissions" |
|
|
252 | for FONT_DIR in ${FONT_DIRS}; do |
|
|
253 | find ${ROOT}/usr/share/fonts/${FONT_DIR} -type f -name 'font.*' \ |
|
|
254 | -exec chmod 0644 {} \; |
|
|
255 | done |
|
|
256 | eend 0 |
|
|
257 | } |
|
|
258 | |
|
|
259 | create_font_cache() { |
|
|
260 | # danarmak found out that fc-cache should be run AFTER all the above |
|
|
261 | # stuff, as otherwise the cache is invalid, and has to be run again |
|
|
262 | # as root anyway |
|
|
263 | if [ -x ${ROOT}/usr/bin/fc-cache ]; then |
|
|
264 | ebegin "Creating FC font cache" |
|
|
265 | HOME="/root" ${ROOT}/usr/bin/fc-cache |
|
|
266 | eend 0 |
|
|
267 | fi |
|
|
268 | } |