Update the build.sh script with simple command-line options for the common
[xorg-util-modular.git] / build.sh
blob78eec36339d45ca589c8aba7a4ea5262e661c4ca
1 #!/bin/sh
3 # global environment variables you may set:
4 # CACHE: absolute path to a global autoconf cache
5 # QUIET: hush the configure script noise
7 failed() {
8 if test x"$NOQUIT" = x1; then
9 echo "***** $1 failed on $2/$3"
10 else
11 exit 1
15 build() {
16 echo "Building $1 module component $2..."
17 cd $1/$2
19 if test "$1" = "xserver" && test "$2" = "xorg" && test -n $MESAPATH; then
20 MESA=-"-with-mesa-source=${MESAPATH}"
21 else
22 MESA=
25 # Use "sh autogen.sh" since some scripts are not executable in CVS
26 sh autogen.sh --prefix=${PREFIX} ${MESA} ${QUIET:+--quiet} \
27 ${CACHE:+--cache-file=}${CACHE} || failed autogen $1 $2
28 make || failed make $1 $2
29 $SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH make install || \
30 failed install $1 $2
31 # make clean || failed clean $1 $2
32 # make dist || failed dist $1 $2
33 if test x"$DISTCHECK" = x1; then
34 make distcheck || failed distcheck $1 $2
37 cd ../..
40 # protocol headers have no build order dependencies
41 build_proto() {
42 build proto BigReqs
43 build proto Composite
44 build proto Damage
45 build proto DMX
46 build proto EvIE
47 build proto Fixes
48 build proto Fontcache
49 build proto Fonts
50 build proto GL
51 build proto Input
52 build proto KB
53 build proto PM
54 build proto Print
55 build proto Randr
56 build proto Record
57 build proto Render
58 build proto Resource
59 build proto ScrnSaver
60 build proto Trap
61 build proto Video
62 build proto X11
63 build proto XCMisc
64 build proto XExt
65 build proto XF86BigFont
66 build proto XF86DGA
67 build proto XF86DRI
68 build proto XF86Misc
69 build proto XF86Rush
70 build proto XF86VidMode
71 build proto Xinerama
74 # bitmaps is needed for building apps, so has to be done separately first
75 # cursors depends on apps/xcursorgen
76 # xkbdata depends on apps/xkbcomp
77 build_data() {
78 # build data bitmaps
79 build data cursors
80 build data xkbdata
83 # All protocol modules must be installed before the libs (okay, that's an
84 # overstatement, but all protocol modules should be installed anyway)
86 # the libraries have a dependency order:
87 # xtrans, Xau, Xdmcp before anything else
88 # fontenc before Xfont
89 # ICE before SM
90 # X11 before Xext
91 # (X11 and SM) before Xt
92 # Xt before Xmu and Xpm
93 # Xext before any other extension library
94 # Xfixes before Xcomposite
95 # Xp before XprintUtil before XprintAppUtil
96 build_lib() {
97 build lib xtrans
98 build lib Xau
99 build lib Xdmcp
100 build lib X11
101 build lib Xext
102 build lib dmx
103 build lib fontenc
104 build lib FS
105 build lib ICE
106 build lib lbxutil
107 build lib oldX
108 build lib SM
109 build lib Xt
110 build lib Xmu
111 build lib Xpm
112 build lib Xp
113 build lib Xaw
114 build lib Xfixes
115 build lib Xcomposite
116 build lib Xrender
117 build lib Xdamage
118 build lib Xcursor
119 build lib Xevie
120 build lib Xfont
121 build lib Xfontcache
122 build lib Xft
123 build lib Xi
124 build lib Xinerama
125 build lib xkbfile
126 build lib xkbui
127 build lib XprintUtil
128 build lib XprintAppUtil
129 build lib Xrandr
130 build lib XRes
131 build lib XScrnSaver
132 build lib XTrap
133 build lib Xtst
134 build lib Xv
135 build lib XvMC
136 build lib Xxf86dga
137 build lib Xxf86misc
138 build lib Xxf86vm
141 # Most apps depend at least on libX11.
143 # bdftopcf depends on libXfont
144 # mkfontscale depends on libfontenc and libfreetype
145 # mkfontdir depends on mkfontscale
147 # TODO: detailed breakdown of which apps require which libs
148 build_app() {
149 build app appres
150 build app bdftopcf
151 build app beforelight
152 build app bitmap
153 build app editres
154 build app fonttosfnt
155 build app fslsfonts
156 build app fstobdf
157 build app iceauth
158 build app ico
159 build app lbxproxy
160 build app listres
161 build app luit
162 build app mkfontdir
163 build app mkfontscale
164 build app oclock
165 build app pclcomp
166 build app proxymngr
167 build app rgb
168 build app rstart
169 build app scripts
170 build app setxkbmap
171 build app showfont
172 build app smproxy
173 build app twm
174 build app viewres
175 build app x11perf
176 build app xauth
177 build app xbiff
178 build app xcalc
179 build app xclipboard
180 build app xclock
181 build app xcmsdb
182 build app xconsole
183 build app xcursorgen
184 build app xdbedizzy
185 build app xditview
186 build app xdm
187 build app xdpyinfo
188 build app xedit
189 build app xev
190 build app xeyes
191 build app xf86dga
192 build app xfd
193 build app xfontsel
194 build app xfs
195 build app xfsinfo
196 build app xfwp
197 build app xgamma
198 build app xgc
199 build app xhost
200 build app xinit
201 build app xkbcomp
202 build app xkbevd
203 build app xkbprint
204 build app xkbutils
205 build app xkill
206 build app xload
207 build app xlogo
208 build app xlsatoms
209 build app xlsclients
210 build app xlsfonts
211 build app xmag
212 build app xman
213 build app xmessage
214 build app xmh
215 build app xmodmap
216 build app xmore
217 build app xphelloworld
218 build app xplsprinters
219 build app xpr
220 build app xprehashprinterlist
221 build app xprop
222 build app xrandr
223 build app xrdb
224 build app xrefresh
225 build app xset
226 build app xsetmode
227 build app xsetpointer
228 build app xsetroot
229 build app xsm
230 build app xstdcmap
231 build app xtrap
232 build app xvidtune
233 build app xvinfo
234 build app xwd
235 build app xwininfo
236 build app xwud
239 # The server requires at least the following libraries:
240 # Xfont, Xau, Xdmcp
241 build_xserver() {
242 build xserver xorg
245 build_driver_input() {
247 HOST_OS=`uname -s`
249 # Some drivers are only buildable on some OS'es
250 case $HOST_OS in
251 Linux)
252 build driver xf86-input-aiptek
253 build driver xf86-input-evdev
254 # not built in monolith, doesn't build for lots of systems
255 # build driver xf86-input-ur98
259 esac
261 build driver xf86-input-acecad
262 build driver xf86-input-calcomp
263 build driver xf86-input-citron
264 build driver xf86-input-digitaledge
265 build driver xf86-input-dmc
266 build driver xf86-input-dynapro
267 build driver xf86-input-elo2300
268 build driver xf86-input-elographics
269 build driver xf86-input-fpit
270 build driver xf86-input-hyperpen
271 build driver xf86-input-jamstudio
272 build driver xf86-input-joystick
273 build driver xf86-input-keyboard
274 build driver xf86-input-magellan
275 build driver xf86-input-magictouch
276 build driver xf86-input-microtouch
277 build driver xf86-input-mouse
278 build driver xf86-input-mutouch
279 build driver xf86-input-palmax
280 build driver xf86-input-penmount
281 build driver xf86-input-sample
282 build driver xf86-input-spaceorb
283 build driver xf86-input-summa
284 build driver xf86-input-tek4957
285 build driver xf86-input-void
288 build_driver_video() {
290 HOST_OS=`uname -s`
292 # Some drivers are only buildable on some OS'es
293 case $HOST_OS in
294 *BSD* | *bsd*)
295 build driver xf86-video-wsfb
296 build driver xf86-video-sunffb
298 *Linux*)
299 build driver xf86-video-sisusb
300 build driver xf86-video-sunffb
304 esac
306 build driver xf86-video-apm
307 build driver xf86-video-ark
308 build driver xf86-video-ati
309 build driver xf86-video-chips
310 build driver xf86-video-cirrus
311 build driver xf86-video-cyrix
312 build driver xf86-video-dummy
313 build driver xf86-video-fbdev
314 # build driver xf86-video-glide
315 build driver xf86-video-glint
316 build driver xf86-video-i128
317 build driver xf86-video-i740
318 build driver xf86-video-i810
319 build driver xf86-video-imstt
320 build driver xf86-video-mga
321 build driver xf86-video-neomagic
322 build driver xf86-video-newport
323 build driver xf86-video-nsc
324 build driver xf86-video-nv
325 build driver xf86-video-rendition
326 build driver xf86-video-s3
327 build driver xf86-video-s3virge
328 build driver xf86-video-savage
329 build driver xf86-video-siliconmotion
330 build driver xf86-video-sis
331 build driver xf86-video-sunbw2
332 build driver xf86-video-suncg14
333 build driver xf86-video-suncg3
334 build driver xf86-video-suncg6
335 build driver xf86-video-sunleo
336 build driver xf86-video-suntcx
337 build driver xf86-video-tdfx
338 build driver xf86-video-tga
339 build driver xf86-video-trident
340 build driver xf86-video-tseng
341 build driver xf86-video-vesa
342 build driver xf86-video-vga
343 build driver xf86-video-via
344 build driver xf86-video-vmware
345 build driver xf86-video-voodoo
348 # The server must be built before the drivers
349 build_driver() {
350 build_driver_input
351 build_driver_video
354 # All fonts require mkfontscale and mkfontdir to be available
356 # The following fonts require bdftopcf to be available:
357 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
358 # arabic-misc, bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi,
359 # bh-lucidatypewriter-75dpi, bitstream-100dpi, bitstream-75dpi,
360 # cronyx-cyrillic, cursor-misc, daewoo-misc, dec-misc, isas-misc,
361 # jis-misc, micro-misc, misc-cyrillic, misc-misc, mutt-misc,
362 # schumacher-misc, screen-cyrillic, sony-misc, sun-misc and
363 # winitzki-cyrillic
365 # Within the font module, the util component must be built before the
366 # following fonts:
367 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
368 # bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi, bh-lucidatypewriter-75dpi,
369 # misc-misc and schumacher-misc
371 # The alias component is recommended to be installed after the other fonts
372 # since the fonts.alias files reference specific fonts installed from the
373 # other font components
374 build_font() {
375 build font util
376 build font adobe-100dpi
377 build font adobe-75dpi
378 build font adobe-utopia-100dpi
379 build font adobe-utopia-75dpi
380 build font adobe-utopia-type1
381 build font arabic-misc
382 build font bh-100dpi
383 build font bh-75dpi
384 build font bh-lucidatypewriter-100dpi
385 build font bh-lucidatypewriter-75dpi
386 build font bh-ttf
387 build font bh-type1
388 build font bitstream-100dpi
389 build font bitstream-75dpi
390 build font bitstream-type1
391 build font cronyx-cyrillic
392 build font cursor-misc
393 build font daewoo-misc
394 build font dec-misc
395 build font ibm-type1
396 build font isas-misc
397 build font jis-misc
398 build font micro-misc
399 build font misc-cyrillic
400 build font misc-misc
401 build font mutt-misc
402 build font schumacher-misc
403 build font screen-cyrillic
404 build font sony-misc
405 build font sun-misc
406 build font winitzki-cyrillic
407 build font xfree86-type1
408 build font alias
411 # TODO
412 build_doc() {
413 build
416 usage() {
417 echo "Usage: $0 [options] prefix"
418 echo " where options are:"
419 echo " -d : run make distcheck in addition to others"
420 echo " -m path-to-mesa-sources-for-xserver : full path to Mesa sources"
421 echo " -n : do not quit after error; just print error message"
422 echo " -s sudo-command : sudo command to use"
425 # Process command line args
426 while test $# != 0
428 case $1 in
430 shift
431 SUDO=$1
434 shift
435 MESAPATH=$1
438 NOQUIT=1
441 DISTCHECK=1
444 PREFIX=$1
446 esac
448 shift
449 done
451 if test x"${PREFIX}" = x ; then
452 usage
453 exit
456 # Must create local aclocal dir or aclocal fails
457 ACLOCAL_LOCALDIR="${PREFIX}/share/aclocal"
458 $SUDO mkdir -p ${ACLOCAL_LOCALDIR}
460 # The following is required to make aclocal find our .m4 macros
461 if test x"$ACLOCAL" = x; then
462 ACLOCAL="aclocal -I ${ACLOCAL_LOCALDIR}"
463 else
464 ACLOCAL="${ACLOCAL} -I ${ACLOCAL_LOCALDIR}"
466 export ACLOCAL
468 # The following is required to make pkg-config find our .pc metadata files
469 if test x"$PKG_CONFIG_PATH" = x; then
470 PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
471 else
472 PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}
474 export PKG_CONFIG_PATH
476 # Set the library path so that locally built libs will be found by apps
477 if test x"$LD_LIBRARY_PATH" = x; then
478 LD_LIBRARY_PATH=${PREFIX}/lib
479 else
480 LD_LIBRARY_PATH=${PREFIX}/lib:${LD_LIBRARY_PATH}
482 export LD_LIBRARY_PATH
484 # Set the path so that locally built apps will be found and used
485 if test x"$PATH" = x; then
486 PATH=${PREFIX}/bin
487 else
488 PATH=${PREFIX}/bin:${PATH}
490 export PATH
492 # Set the default font path for xserver/xorg unless it's already set
493 if test x"$FONTPATH" = x; then
494 FONTPATH="${PREFIX}/lib/X11/fonts/misc/,${PREFIX}/lib/X11/fonts/Type1/,${PREFIX}/lib/X11/fonts/75dpi/,${PREFIX}/lib/X11/fonts/100dpi/,${PREFIX}/lib/X11/fonts/cyrillic/,${PREFIX}/lib/X11/fonts/TTF/"
495 export FONTPATH
498 # Create the log file directory
499 $SUDO mkdir -p ${PREFIX}/var/log
501 date
503 # We must install the global macros before anything else
504 build util macros
506 build_proto
507 build_lib
508 build data bitmaps
509 build_app
510 build_xserver
511 build_driver
512 build_data
513 build_font
514 # build_doc
516 date