Magellan Linux

Contents of /smage/trunk/include/xorg.sminc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3 - (show annotations) (download)
Sat Jan 2 16:59:51 2010 UTC (14 years, 4 months ago) by niro
File size: 5466 byte(s)
-initial smage includes
1 # $Header: /magellan-cvs/smage/include/xorg.sminc,v 1.18 2008/02/16 11:26:47 niro Exp $
2 # xorg global smage2 functions
3
4 # must: X11_dir (defaults to /usr in sminc)
5 # optional:
6 # X11_FONT_DIR
7 # SRCFILE
8 # SRCDIR
9 # SRC_URI
10 # DEPEND
11 # SDEPEND
12
13 # global xorg functions needed in the sminc
14
15 # checks if ${PNAME} is a font package
16 is_xorg_font()
17 {
18 if [[ ${PNAME/#font-/} != ${PNAME} ]] &&
19 [[ ${PNAME} != font-alias ]] &&
20 [[ ${PNAME} != font-util ]]
21 then
22 return 0
23 fi
24
25 return 1
26 }
27
28 # checks if ${PNAME} is a video driver package
29 is_xorg_video_driver()
30 {
31 [[ ${PNAME/#xf86-video/} != ${PNAME} ]] && return 0
32 return 1
33
34 }
35
36 # checks if ${PNAME} is a input driver package
37 is_xorg_input_driver()
38 {
39 [[ ${PNAME/#xf86-input/} != ${PNAME} ]] && return 0
40 return 1
41 }
42
43 # checks for general driver packages
44 is_xorg_driver()
45 {
46 if is_xorg_video_driver ||
47 is_xorg_input_driver
48 then
49 return 0
50 fi
51
52 return 1
53 }
54
55 # check if old <=Xorg-6.9 is installed; aborts installation
56 is_old_xorg_installed()
57 {
58 local RED="\033[1;6m\033[31m"
59 local DEF="\033[0m"
60
61 if [ -e /usr/X11R6 ] && [[ $(readlink /usr/X11R6) != ../usr ]]
62 then
63 echo
64 echo -e ${RED}" !!! Remove all old <=xorg-6.9 installations first."${DEF}
65 echo -e ${RED}" !!! You also need to check all packages which are installed to /usr/X11R6"${DEF}
66 echo
67
68 # print a pkg list if magequery supports this
69 if [[ -n $(/sbin/magequery -h | grep -- -f) ]]
70 then
71 echo "Please check following packages:"
72 /sbin/magequery -f /usr/X11R6 | while read pkg
73 do
74 echo -e " ${RED}*${DEF} ${pkg}"
75 done
76 echo
77 fi
78
79 die "/usr/X11R6 directory exists ..."
80 fi
81 }
82
83 # default vars
84 X11_DIR="/usr"
85
86 # satisfy mage with preinstall
87 INHERITS="${INHERITS} xorg"
88
89 # pkg setup
90 SRCFILE="${PNAME}-${PVER}.tar.bz2"
91 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
92
93 #XORG_MIRROR="http://ftp.x.org/pub"
94 XORG_MIRROR="http://xorg.freedesktop.org/archive"
95
96 # get the right subdir
97 case ${PCATEGORIE} in
98 app-doc) URISUBDIR="doc" ;;
99 media-fonts) URISUBDIR="font" ;;
100 x11-apps) URISUBDIR="app" ;;
101 x11-base) URISUBDIR="xserver" ;;
102 x11-drivers) URISUBDIR="driver" ;;
103 x11-libs) URISUBDIR="lib" ;;
104 x11-misc) case ${PNAME} in
105 xbitmaps|xkbdata|xkeyboard-config) URISUBDIR="data" ;;
106 *) URISUBDIR="util" ;;
107 esac
108 ;;
109 x11-proto) URISUBDIR="proto" ;;
110 x11-themes) URISUBDIR="data" ;;
111 x11-wm) URISUBDIR="app" ;;
112 esac
113
114 SRC_URI=(
115 # ${XORG_MIRROR}/individual/app/${SRCFILE}
116 # ${XORG_MIRROR}/individual/data/${SRCFILE}
117 # ${XORG_MIRROR}/individual/doc/${SRCFILE}
118 # ${XORG_MIRROR}/individual/driver/${SRCFILE}
119 # ${XORG_MIRROR}/individual/font/${SRCFILE}
120 # ${XORG_MIRROR}/individual/lib/${SRCFILE}
121 # ${XORG_MIRROR}/individual/proto/${SRCFILE}
122 # ${XORG_MIRROR}/individual/testdir/${SRCFILE}
123 # ${XORG_MIRROR}/individual/util/${SRCFILE}
124 # ${XORG_MIRROR}/individual/xserver/${SRCFILE}
125 ${XORG_MIRROR}/individual/${URISUBDIR}/${SRCFILE}
126 mirror://${PNAME}/${SRCFILE}
127 )
128
129 # add default deps
130 # DEPEND="${DEPEND}
131 # >= sys-apps/man-1.6"
132
133 SDEPEND="${SDEPEND}
134 >= dev-util/pkgconfig-0.20
135 >= x11-misc/util-macros-1"
136
137 # font dependencies
138 if is_xorg_font
139 then
140 DEPEND="${DEPEND}
141 >= x11-apps/mkfontscale-1
142 >= x11-apps/mkfontdir-1
143 >= media-fonts/font-alias-1"
144
145 # encodings are run-time needed to rebuild the font.dirs files !!
146 # so don't use SDEPEND but DEPEND here!
147 DEPEND="${DEPEND}
148 >= media-fonts/encodings-1"
149
150 XORG_FONT_PKG=yes
151 SPECIAL_VARS="${SPECIAL_VARS} XORG_FONT_PKG"
152 #INHERITS="${INHERITS} xorg"
153 fi
154
155 # default input driver dependencies
156 if is_xorg_input_driver
157 then
158 DEPEND="${DEPEND}
159 >= x11-base/xorg-server-1"
160
161 SDEPEND="${SDEPEND}
162 >= x11-proto/inputproto-1
163 >= x11-proto/randrproto-1
164 >= x11-proto/xproto-7"
165 fi
166
167 # default video driver dependencies
168 if is_xorg_video_driver
169 then
170 DEPEND="${DEPEND}
171 >= x11-base/xorg-server-1"
172
173 SDEPEND="${SDEPEND}
174 >= x11-proto/fontsproto-2
175 >= x11-proto/randrproto-1
176 >= x11-proto/renderproto-0.9
177 >= x11-proto/xextproto-7
178 >= x11-proto/xproto-7
179 >= x11-proto/videoproto-2"
180 fi
181
182 xorg_src_prepare()
183 {
184 # check for old xorg installations
185 is_old_xorg_installed
186
187 munpack ${SRCFILE} || die
188 }
189
190 xorg_src_configure()
191 {
192 cd ${SRCDIR}
193
194 # abort if configure script is not found
195 [ ! -x ./configure ] && return
196
197 local conf_opts="$@"
198
199 # setup fonts
200 if is_xorg_font
201 then
202 # setup default font dir
203 : ${XORG_FONT_DIR=${PNAME##*-}}
204
205 # fix case of font directories
206 XORG_FONT_DIR=${XORG_FONT_DIR/ttf/TTF}
207 XORG_FONT_DIR=${XORG_FONT_DIR/otf/OTF}
208 XORG_FONT_DIR=${XORG_FONT_DIR/type1/Type1}
209 XORG_FONT_DIR=${XORG_FONT_DIR/speedo/Speedo}
210
211 conf_opts="${conf_opts} --with-fontdir=/usr/share/fonts/${XORG_FONT_DIR}"
212 fi
213
214 # setup drivers
215 if is_xorg_driver
216 then
217 # don't build static driver modules
218 conf_opts="${conf_opts} --disable-static"
219 fi
220
221 mconfigure \
222 --prefix=${X11_DIR} \
223 ${conf_opts} \
224 || die
225 }
226
227 xorg_src_compile()
228 {
229 cd ${SRCDIR}
230 xorg_src_configure || die
231 mmake || die
232 }
233
234 xorg_src_install()
235 {
236 cd ${SRCDIR}
237 make DESTDIR=${BINDIR} install || die
238
239 # remove libtool files for server modules
240 if [ -e ${BINDIR}/usr/$(mlibdir)/xorg/modules ]
241 then
242 find ${BINDIR}/usr/$(mlibdir)/xorg/modules -name '*.la' | xargs rm -f
243 fi
244 }
245
246 xorg_preinstall()
247 {
248 # check for old xorg installations
249 is_old_xorg_installed
250
251 # run this in postinstall to cover --src-install builds
252 # ( the is now package-dir at this moment, cause its not already builded :)
253 # if [[ -n ${XORG_FONT_PKG} ]]
254 # then
255 # xorg_discover_font_dirs
256 # fi
257 }
258
259 export_inherits xorg src_prepare src_compile src_install preinstall