build pthread-stubs before libxcb
[xorg-util-modular.git] / build-from-tarballs.sh
blobdd86021528973ac956451066487158dc3052d22d
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
6 # CONFFLAGS: flags to pass to all configure scripts
8 failed() {
9 if test x"$NOQUIT" = x1; then
10 echo "***** $1 failed on $2/$3"
11 else
12 exit 1
16 build() {
17 test "$USEMODULEDIRS" = "yes" && cd $1
19 TARBALL=`ls -1rt $2-*.tar.$COMPRESSION 2> /dev/null | tail -1`
21 if test x"$TARBALL" = x; then
22 echo "WARNING: $2 does not exist -- skipping"
23 test "$USEMODULEDIRS" = "yes" && cd ..
24 return
26 TARDIR=`echo $TARBALL | sed "s,.tar.$COMPRESSION,,"`
28 echo "Building $1 module component $TARDIR..."
30 case $COMPRESSION in
31 bz2)
32 tar xjf $TARBALL
33 break;;
34 gz)
35 tar xvf $TARBALL
36 break;;
37 esac
39 cd $TARDIR
41 if test "$1" = "xserver" && test "$2" = "xorg-server" && test -n "$MESAPATH"; then
42 MESA=-"-with-mesa-source=${MESAPATH}"
43 else
44 MESA=
47 eval sh configure --prefix=${PREFIX} ${MESA} ${QUIET:+--quiet} \
48 ${CACHE:+--cache-file=}${CACHE} ${CONFFLAGS} || failed configure $1 $2
49 make || failed make $1 $2
50 if test x"$CLEAN" = x1; then
51 make clean || failed clean $1 $2
53 if test x"$DIST" = x1; then
54 make dist || failed dist $1 $2
56 if test x"$DISTCHECK" = x1; then
57 make distcheck || failed distcheck $1 $2
59 $SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH make install || \
60 failed install $1 $2
62 cd ..
63 test "$USEMODULEDIRS" = "yes" && cd ..
66 # protocol headers have no build order dependencies
67 build_proto() {
68 build proto applewmproto
69 build proto bigreqsproto
70 build proto compositeproto
71 build proto damageproto
72 build proto dmxproto
73 build proto evieext
74 build proto fixesproto
75 build proto fontcacheproto
76 build proto fontsproto
77 build proto glproto
78 build proto inputproto
79 build proto kbproto
80 build proto printproto
81 build proto randrproto
82 build proto recordproto
83 build proto renderproto
84 build proto resourceproto
85 build proto scrnsaverproto
86 build proto trapproto
87 build proto videoproto
88 build proto windowswmproto
89 build proto xcmiscproto
90 build proto xextproto
91 build proto xf86bigfontproto
92 build proto xf86dgaproto
93 build proto xf86driproto
94 build proto xf86miscproto
95 build proto xf86rushproto
96 build proto xf86vidmodeproto
97 build proto xineramaproto
98 build proto xproto
99 build proto xproxymanagementprotocol
102 # bitmaps is needed for building apps, so has to be done separately first
103 # cursors depends on apps/xcursorgen
104 # xkbdata depends on apps/xkbcomp
105 build_data() {
106 # build data xbitmaps
107 build data xcursor-themes
108 build data xkbdata
111 # All protocol modules must be installed before the libs (okay, that's an
112 # overstatement, but all protocol modules should be installed anyway)
114 # the libraries have a dependency order:
115 # xtrans, Xau, Xdmcp before anything else
116 # fontenc before Xfont
117 # ICE before SM
118 # X11 before Xext
119 # (X11 and SM) before Xt
120 # Xt before Xmu and Xpm
121 # Xext before any other extension library
122 # Xfixes before Xcomposite
123 # Xp before XprintUtil before XprintAppUtil
124 build_lib() {
125 build lib xtrans
126 build lib libXau
127 build lib libXdmcp
128 build lib libX11
129 build lib libXext
130 build lib libAppleWM
131 build lib libWindowsWM
132 build lib libdmx
133 build lib libfontenc
134 build lib libFS
135 build lib libICE
136 build lib liblbxutil
137 build lib liboldX
138 build lib libSM
139 build lib libXt
140 build lib libXmu
141 build lib libXpm
142 build lib libXp
143 build lib libXaw
144 build lib libXfixes
145 build lib libXcomposite
146 build lib libXrender
147 build lib libXdamage
148 build lib libXcursor
149 build lib libXevie
150 build lib libXfont
151 build lib libXfontcache
152 build lib libXft
153 build lib libXi
154 build lib libXinerama
155 build lib libxkbfile
156 build lib libxkbui
157 build lib libXprintUtil
158 build lib libXprintAppUtil
159 build lib libXrandr
160 build lib libXres
161 build lib libXScrnSaver
162 build lib libXTrap
163 build lib libXtst
164 build lib libXv
165 build lib libXvMC
166 build lib libXxf86dga
167 build lib libXxf86misc
168 build lib libXxf86vm
171 # Most apps depend at least on libX11.
173 # bdftopcf depends on libXfont
174 # mkfontscale depends on libfontenc and libfreetype
175 # mkfontdir depends on mkfontscale
177 # TODO: detailed breakdown of which apps require which libs
178 build_app() {
179 build app appres
180 build app bdftopcf
181 build app beforelight
182 build app bitmap
183 build app editres
184 build app fonttosfnt
185 build app fslsfonts
186 build app fstobdf
187 build app iceauth
188 build app ico
189 build app lbxproxy
190 build app listres
191 build app luit
192 build app mkcfm
193 build app mkfontdir
194 build app mkfontscale
195 build app oclock
196 # build app pclcomp
197 build app proxymngr
198 build app rgb
199 build app rstart
200 build app scripts
201 build app sessreg
202 build app setxkbmap
203 build app showfont
204 build app smproxy
205 build app twm
206 build app viewres
207 build app x11perf
208 build app xauth
209 build app xbiff
210 build app xcalc
211 build app xclipboard
212 build app xclock
213 build app xcmsdb
214 build app xconsole
215 build app xcursorgen
216 build app xdbedizzy
217 build app xditview
218 build app xdm
219 build app xdpyinfo
220 build app xdriinfo
221 build app xedit
222 build app xev
223 build app xeyes
224 build app xf86dga
225 build app xfd
226 build app xfindproxy
227 build app xfontsel
228 build app xfs
229 build app xfsinfo
230 build app xfwp
231 build app xgamma
232 build app xgc
233 build app xhost
234 build app xinit
235 build app xkbcomp
236 build app xkbevd
237 build app xkbprint
238 build app xkbutils
239 build app xkill
240 build app xload
241 build app xlogo
242 build app xlsatoms
243 build app xlsclients
244 build app xlsfonts
245 build app xmag
246 build app xman
247 build app xmessage
248 build app xmh
249 build app xmodmap
250 build app xmore
251 build app xphelloworld
252 build app xplsprinters
253 build app xpr
254 build app xprehashprinterlist
255 build app xprop
256 build app xrandr
257 build app xrdb
258 build app xrefresh
259 build app xrx
260 build app xset
261 build app xsetmode
262 build app xsetpointer
263 build app xsetroot
264 build app xsm
265 build app xstdcmap
266 build app xtrap
267 build app xvidtune
268 build app xvinfo
269 build app xwd
270 build app xwininfo
271 build app xwud
274 # The server requires at least the following libraries:
275 # Xfont, Xau, Xdmcp
276 build_xserver() {
277 build xserver xorg-server
280 build_driver_input() {
282 HOST_OS=`uname -s`
283 HOST_CPU=`uname -m`
285 # Some drivers are only buildable on some OS'es
286 case $HOST_OS in
287 Linux)
288 build driver xf86-input-aiptek
289 build driver xf86-input-evdev
290 build driver xf86-input-ur98
294 esac
296 # And some drivers are only buildable on some CPUs.
297 case $HOST_CPU in
298 i*86* | amd64* | x86*64*)
299 build driver xf86-input-vmmouse
303 esac
305 build driver xf86-input-acecad
306 build driver xf86-input-calcomp
307 build driver xf86-input-citron
308 build driver xf86-input-digitaledge
309 build driver xf86-input-dmc
310 build driver xf86-input-dynapro
311 build driver xf86-input-elo2300
312 build driver xf86-input-elographics
313 build driver xf86-input-fpit
314 build driver xf86-input-hyperpen
315 build driver xf86-input-jamstudio
316 build driver xf86-input-joystick
317 build driver xf86-input-keyboard
318 build driver xf86-input-magellan
319 build driver xf86-input-magictouch
320 build driver xf86-input-microtouch
321 build driver xf86-input-mouse
322 build driver xf86-input-mutouch
323 build driver xf86-input-palmax
324 build driver xf86-input-penmount
325 build driver xf86-input-spaceorb
326 build driver xf86-input-summa
327 build driver xf86-input-tek4957
328 build driver xf86-input-void
331 build_driver_video() {
333 HOST_OS=`uname -s`
335 # Some drivers are only buildable on some OS'es
336 case $HOST_OS in
337 *BSD* | *bsd*)
338 build driver xf86-video-wsfb
339 build driver xf86-video-sunffb
341 *Linux*)
342 build driver xf86-video-sisusb
343 build driver xf86-video-sunffb
344 build driver xf86-video-v4l
348 esac
350 build driver xf86-video-apm
351 build driver xf86-video-ark
352 build driver xf86-video-ati
353 build driver xf86-video-chips
354 build driver xf86-video-cirrus
355 build driver xf86-video-cyrix
356 build driver xf86-video-dummy
357 build driver xf86-video-fbdev
358 build driver xf86-video-glide
359 build driver xf86-video-glint
360 build driver xf86-video-i128
361 build driver xf86-video-i740
362 build driver xf86-video-i810
363 build driver xf86-video-imstt
364 build driver xf86-video-mga
365 build driver xf86-video-neomagic
366 build driver xf86-video-newport
367 build driver xf86-video-nsc
368 build driver xf86-video-nv
369 build driver xf86-video-rendition
370 build driver xf86-video-s3
371 build driver xf86-video-s3virge
372 build driver xf86-video-savage
373 build driver xf86-video-siliconmotion
374 build driver xf86-video-sis
375 build driver xf86-video-sunbw2
376 build driver xf86-video-suncg14
377 build driver xf86-video-suncg3
378 build driver xf86-video-suncg6
379 build driver xf86-video-sunleo
380 build driver xf86-video-suntcx
381 build driver xf86-video-tdfx
382 build driver xf86-video-tga
383 build driver xf86-video-trident
384 build driver xf86-video-tseng
385 build driver xf86-video-vesa
386 build driver xf86-video-vga
387 build driver xf86-video-via
388 build driver xf86-video-vmware
389 build driver xf86-video-voodoo
392 # The server must be built before the drivers
393 build_driver() {
394 build_driver_input
395 build_driver_video
398 # All fonts require mkfontscale and mkfontdir to be available
400 # The following fonts require bdftopcf to be available:
401 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
402 # arabic-misc, bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi,
403 # bh-lucidatypewriter-75dpi, bitstream-100dpi, bitstream-75dpi,
404 # cronyx-cyrillic, cursor-misc, daewoo-misc, dec-misc, isas-misc,
405 # jis-misc, micro-misc, misc-cyrillic, misc-misc, mutt-misc,
406 # schumacher-misc, screen-cyrillic, sony-misc, sun-misc and
407 # winitzki-cyrillic
409 # Within the font module, the util component must be built before the
410 # following fonts:
411 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
412 # bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi, bh-lucidatypewriter-75dpi,
413 # misc-misc and schumacher-misc
415 # The alias component is recommended to be installed after the other fonts
416 # since the fonts.alias files reference specific fonts installed from the
417 # other font components
418 build_font() {
419 build font font-util
420 build font encodings
421 build font font-adobe-100dpi
422 build font font-adobe-75dpi
423 build font font-adobe-utopia-100dpi
424 build font font-adobe-utopia-75dpi
425 build font font-adobe-utopia-type1
426 build font font-arabic-misc
427 build font font-bh-100dpi
428 build font font-bh-75dpi
429 build font font-bh-lucidatypewriter-100dpi
430 build font font-bh-lucidatypewriter-75dpi
431 build font font-bh-ttf
432 build font font-bh-type1
433 build font font-bitstream-100dpi
434 build font font-bitstream-75dpi
435 build font font-bitstream-speedo
436 build font font-bitstream-type1
437 build font font-cronyx-cyrillic
438 build font font-cursor-misc
439 build font font-daewoo-misc
440 build font font-dec-misc
441 build font font-ibm-type1
442 build font font-isas-misc
443 build font font-jis-misc
444 build font font-micro-misc
445 build font font-misc-cyrillic
446 build font font-misc-ethiopic
447 build font font-misc-meltho
448 build font font-misc-misc
449 build font font-mutt-misc
450 build font font-schumacher-misc
451 build font font-screen-cyrillic
452 build font font-sony-misc
453 build font font-sun-misc
454 build font font-winitzki-cyrillic
455 build font font-xfree86-type1
456 build font font-alias
459 # makedepend requires xproto
460 build_util() {
461 build util xorg-cf-files
462 build util imake
463 build util makedepend
464 build util gccmakedep
465 build util lndir
468 # xorg-docs requires xorg-sgml-doctools
469 build_doc() {
470 build doc xorg-sgml-doctools
471 build doc xorg-docs
474 usage() {
475 echo "Usage: $0 [options] prefix"
476 echo " where options are:"
477 echo " -d : run make distcheck in addition to others"
478 echo " -D : run make dist in addition to others"
479 echo " -c : run make clean in addition to others"
480 echo " -m path-to-mesa-sources-for-xserver : full path to Mesa sources"
481 echo " -n : do not quit after error; just print error message"
482 echo " -s sudo-command : sudo command to use"
483 echo " -bz2 : use tarballs with bzip2 compression (default)"
484 echo " -gz : use tarballs with gzip compression"
485 echo " -e : build from witin the 'everything' dir instead of module dirs"
488 # Initialize defaults
489 COMPRESSION=bz2
490 USEMODULEDIRS=yes
492 # Process command line args
493 while test $# != 0
495 case $1 in
497 shift
498 SUDO=$1
501 shift
502 MESAPATH=$1
505 NOQUIT=1
508 DISTCHECK=1
511 DIST=1
514 CLEAN=1
516 -bz2)
517 COMPRESSION=bz2
519 -gz)
520 COMPRESSION=gz
523 USEMODULEDIRS=no
526 PREFIX=$1
528 esac
530 shift
531 done
533 if test x"${PREFIX}" = x ; then
534 usage
535 exit
538 # Must create local aclocal dir or aclocal fails
539 ACLOCAL_LOCALDIR="${DESTDIR}${PREFIX}/share/aclocal"
540 $SUDO mkdir -p ${ACLOCAL_LOCALDIR}
542 # The following is required to make aclocal find our .m4 macros
543 if test x"$ACLOCAL" = x; then
544 ACLOCAL="aclocal -I ${ACLOCAL_LOCALDIR}"
545 else
546 ACLOCAL="${ACLOCAL} -I ${ACLOCAL_LOCALDIR}"
548 export ACLOCAL
550 # The following is required to make pkg-config find our .pc metadata files
551 if test x"$PKG_CONFIG_PATH" = x; then
552 PKG_CONFIG_PATH=${DESTDIR}${PREFIX}/lib/pkgconfig
553 else
554 PKG_CONFIG_PATH=${DESTDIR}${PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}
556 export PKG_CONFIG_PATH
558 # Set the library path so that locally built libs will be found by apps
559 if test x"$LD_LIBRARY_PATH" = x; then
560 LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/lib
561 else
562 LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/lib:${LD_LIBRARY_PATH}
564 export LD_LIBRARY_PATH
566 # Set the path so that locally built apps will be found and used
567 if test x"$PATH" = x; then
568 PATH=${DESTDIR}${PREFIX}/bin
569 else
570 PATH=${DESTDIR}${PREFIX}/bin:${PATH}
572 export PATH
574 # Set the default font path for xserver/xorg unless it's already set
575 if test x"$FONTPATH" = x; then
576 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/"
577 export FONTPATH
580 # Create the log file directory
581 $SUDO mkdir -p ${DESTDIR}${PREFIX}/var/log
583 date
585 # We must install the global macros before anything else
586 build util util-macros
588 build_doc
589 build_proto
590 build_lib
591 build data xbitmaps
592 build_app
593 build_xserver
594 build_driver
595 build_data
596 build_font
597 build_util
599 date