/[gentoo-x86]/eclass/x-modular.eclass
Gentoo

Diff of /eclass/x-modular.eclass

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

Revision 1.4 Revision 1.25
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.4 2005/08/14 23:45:52 spyderous Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.25 2005/12/07 11:19:47 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
13EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst 13EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm
14 14
15inherit eutils 15inherit 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
19XDIR="/usr" 18XDIR="/usr"
20 19
21IUSE="" 20IUSE=""
22HOMEPAGE="http://xorg.freedesktop.org/" 21HOMEPAGE="http://xorg.freedesktop.org/"
23SRC_URI="http://xorg.freedesktop.org/X11R7.0-RC0/everything/${P}.tar.bz2" 22SRC_URI="http://xorg.freedesktop.org/releases/X11R7.0-RC3/everything/${P}.tar.bz2
23 http://xorg.freedesktop.org/releases/X11R7.0-RC2/everything/${P}.tar.bz2
24 http://xorg.freedesktop.org/releases/X11R7.0-RC1/everything/${P}.tar.bz2
25 http://xorg.freedesktop.org/releases/X11R7.0-RC0/everything/${P}.tar.bz2"
24LICENSE="X11" 26LICENSE="X11"
25SLOT="0" 27SLOT="0"
26 28
27# Set up shared dependencies 29# Set up shared dependencies
28if [ -n "${SNAPSHOT}" ]; then 30if [ -n "${SNAPSHOT}" ]; then
33 >=sys-devel/libtool-1.5 35 >=sys-devel/libtool-1.5
34 >=sys-devel/m4-1.4" 36 >=sys-devel/m4-1.4"
35fi 37fi
36 38
37# If we're a font package, but not the font.alias one 39# If we're a font package, but not the font.alias one
38if [[ "${PN/#font}" != "${PN}" ]] && [[ "${PN}" != "font-alias" ]]; then 40if [[ "${PN/#font-}" != "${PN}" ]] \
41 && [[ "${PN}" != "font-alias" ]] \
42 && [[ "${PN}" != "font-util" ]]; then
39 # Activate font code in the rest of the eclass 43 # Activate font code in the rest of the eclass
40 FONT="yes" 44 FONT="yes"
41 45
42 RDEPEND="${RDEPEND} 46 RDEPEND="${RDEPEND}
43 media-fonts/encodings" 47 media-fonts/encodings"
44 PDEPEND="${PDEPEND} 48 PDEPEND="${PDEPEND}
45 media-fonts/font-alias" 49 media-fonts/font-alias"
50
51 # Starting with 7.0RC3, we can specify the font directory
52 # But oddly, we can't do the same for encodings or font-alias
53
54 # Wrap in `if` so ebuilds can set it too
55 if [[ -z ${FONT_DIR} ]]; then
56 FONT_DIR=${PN##*-}
57
58 fi
59
60 # Fix case of font directories
61 FONT_DIR=${FONT_DIR/ttf/TTF}
62 FONT_DIR=${FONT_DIR/otf/OTF}
63 FONT_DIR=${FONT_DIR/type1/Type1}
64 FONT_DIR=${FONT_DIR/speedo/Speedo}
65
66 # Set up configure option
67 FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\""
68
69 if [[ -n "${FONT}" ]]; then
70 if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]]; then
71 IUSE="${IUSE} nls"
72 fi
73 fi
46fi 74fi
47 75
76# If we're a driver package
77if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then
78 # Don't build static driver modules
79 DRIVER_OPTIONS="--disable-static"
80fi
81
48DEPEND="${DEPEND} 82DEPEND="${DEPEND}
49 dev-util/pkgconfig 83 >=dev-util/pkgconfig-0.18
50 x11-misc/util-macros" 84 >=x11-misc/util-macros-0.99.2"
51 85
86# >=sys-apps/man-1.6b-r2 required to look in [0-8]x/ directories
52RDEPEND="${RDEPEND}" 87RDEPEND="${RDEPEND}
53# Shouldn't be necessary once we're in a standard location 88 !<=x11-base/xorg-x11-6.9
89 >=sys-apps/man-1.6b-r2"
90# Provides virtual/x11 for temporary use until packages are ported
54# x11-base/x11-env" 91# x11-base/x11-env"
55# FIXME: Uncomment once it's in portage
56# !x11-base/xorg-x11"
57 92
58x-modular_unpack_source() { 93x-modular_unpack_source() {
59 unpack ${A} 94 unpack ${A}
60 cd ${S} 95 cd ${S}
96
97 # Joshua Baergen - October 23, 2005
98 # Fix shared lib issues on MIPS, FBSD, etc etc
99 elibtoolize
100
101 if [[ -n ${FONT_OPTIONS} ]]; then
102 einfo "Detected font directory: ${FONT_DIR}"
103 fi
61} 104}
62 105
63x-modular_patch_source() { 106x-modular_patch_source() {
64 # Use standardized names and locations with bulk patching 107 # Use standardized names and locations with bulk patching
65 # Patch directory is ${WORKDIR}/patch 108 # Patch directory is ${WORKDIR}/patch
89 then 132 then
90 # If possible, generate configure if it doesn't exist 133 # If possible, generate configure if it doesn't exist
91 if [ -f "${S}/configure.ac" ] 134 if [ -f "${S}/configure.ac" ]
92 then 135 then
93 einfo "Running autoreconf..." 136 einfo "Running autoreconf..."
94 autoreconf -v --install 137 autoreconf -v --force --install
95 fi 138 fi
96 fi 139 fi
97 140
98} 141}
99 142
101 x-modular_unpack_source 144 x-modular_unpack_source
102 x-modular_patch_source 145 x-modular_patch_source
103 x-modular_reconf_source 146 x-modular_reconf_source
104} 147}
105 148
149x-modular_font_configure() {
150 if [[ -n "${FONT}" ]]; then
151 # Might be worth adding an option to configure your desired font
152 # and exclude all others. Also, should this USE be nls or minimal?
153 if ! use nls; then
154 FONT_OPTIONS="${FONT_OPTIONS}
155 --disable-iso8859-2
156 --disable-iso8859-3
157 --disable-iso8859-4
158 --disable-iso8859-5
159 --disable-iso8859-6
160 --disable-iso8859-7
161 --disable-iso8859-8
162 --disable-iso8859-9
163 --disable-iso8859-10
164 --disable-iso8859-11
165 --disable-iso8859-12
166 --disable-iso8859-13
167 --disable-iso8859-14
168 --disable-iso8859-15
169 --disable-iso8859-16
170 --disable-jisx0201
171 --disable-koi8-r"
172 fi
173 fi
174}
175
106x-modular_src_compile() { 176x-modular_src_configure() {
177 x-modular_font_configure
178
107 # If prefix isn't set here, .pc files cause problems 179 # If prefix isn't set here, .pc files cause problems
108 if [ -x ./configure ]; then 180 if [ -x ./configure ]; then
109 econf --prefix=${XDIR} \ 181 econf --prefix=${XDIR} \
110 --datadir=${XDIR}/share \ 182 --datadir=${XDIR}/share \
183 ${FONT_OPTIONS} \
184 ${DRIVER_OPTIONS} \
111 ${CONFIGURE_OPTIONS} 185 ${CONFIGURE_OPTIONS}
112 fi 186 fi
187}
188
189x-modular_src_make() {
113 emake || die "emake failed" 190 emake || die "emake failed"
191}
192
193x-modular_src_compile() {
194 x-modular_src_configure
195 x-modular_src_make
114} 196}
115 197
116x-modular_src_install() { 198x-modular_src_install() {
117 # Install everything to ${XDIR} 199 # Install everything to ${XDIR}
118 make \ 200 make \
120 install 202 install
121# Shouldn't be necessary in XDIR=/usr 203# Shouldn't be necessary in XDIR=/usr
122# einstall forces datadir, so we need to re-force it 204# einstall forces datadir, so we need to re-force it
123# datadir=${XDIR}/share \ 205# datadir=${XDIR}/share \
124# mandir=${XDIR}/share/man \ 206# mandir=${XDIR}/share/man \
207
208 # Don't install libtool archives for server modules
209 if [[ -e ${D}/usr/lib/xorg/modules ]]; then
210 find ${D}/usr/lib/xorg/modules -name '*.la' \
211 | xargs rm -f
212 fi
125} 213}
126 214
127x-modular_pkg_preinst() { 215x-modular_pkg_preinst() {
128 if [[ -n "${FONT}" ]]; then 216 if [[ -n "${FONT}" ]]; then
129 discover_font_dirs 217 discover_font_dirs
132 220
133x-modular_pkg_postinst() { 221x-modular_pkg_postinst() {
134 if [[ -n "${FONT}" ]]; then 222 if [[ -n "${FONT}" ]]; then
135 setup_fonts 223 setup_fonts
136 fi 224 fi
225}
226
227x-modular_pkg_postrm() {
228 if [[ -n "${FONT}" ]]; then
229 cleanup_fonts
230 fi
231}
232
233cleanup_fonts() {
234 local ALLOWED_FILES="encodings.dir fonts.cache-1 fonts.dir fonts.scale"
235 for DIR in ${FONT_DIR}; do
236 unset KEEP_FONTDIR
237 REAL_DIR=${ROOT}usr/share/fonts/${DIR}
238
239 ebegin "Checking ${REAL_DIR} for useless files"
240 pushd ${REAL_DIR} &> /dev/null
241 for FILE in *; do
242 unset MATCH
243 for ALLOWED_FILE in ${ALLOWED_FILES}; do
244 if [[ ${FILE} = ${ALLOWED_FILE} ]]; then
245 # If it's allowed, then move on to the next file
246 MATCH="yes"
247 break
248 fi
249 done
250 # If we found a match in allowed files, move on to the next file
251 if [[ -n ${MATCH} ]]; then
252 continue
253 fi
254 # If we get this far, there wasn't a match in the allowed files
255 KEEP_FONTDIR="yes"
256 # We don't need to check more files if we're already keeping it
257 break
258 done
259 popd &> /dev/null
260 # If there are no files worth keeping, then get rid of the dir
261 if [[ -z "${KEEP_FONTDIR}" ]]; then
262 rm -rf ${REAL_DIR}
263 fi
264 eend 0
265 done
137} 266}
138 267
139setup_fonts() { 268setup_fonts() {
140 if [[ ! -n "${FONT_DIRS}" ]]; then 269 if [[ ! -n "${FONT_DIRS}" ]]; then
141 msg="FONT_DIRS empty. Set it to at least one subdir of /usr/share/fonts." 270 msg="FONT_DIRS is empty. The ebuild should set it to at least one subdir of /usr/share/fonts."
142 eerror ${msg} 271 eerror "${msg}"
143 die ${msg} 272 die "${msg}"
144 fi 273 fi
145 274
146 create_fonts_scale 275 create_fonts_scale
147 create_fonts_dir 276 create_fonts_dir
148 fix_font_permissions 277 fix_font_permissions

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.25

  ViewVC Help
Powered by ViewVC 1.1.20