summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaetan Nadon <memsize@videotron.ca>2013-10-19 18:05:11 -0400
committerGaetan Nadon <memsize@videotron.ca>2013-12-15 12:40:41 -0500
commitfa9d11ee8f3d299f1ffe4e4c456a948d20ac34a8 (patch)
tree7f644bbae1efa30310cb57487206b383ceede38e
parent1e8e8d950bebfa3c9f5a8195d5a6f940b58226f1 (diff)
build.sh: collapse all build_xxx into one build_all_modules function
There used to be a time where related modules could be built together, for example, all protcols, all libraries, all fonts. Since then, build order has changed so the group order has been broken in several places. This means the reader has to hunt for the function definition just to find the module he is looking for is no longer built with the group and has to look elsewhere. The build_all_modules function is the one stop shopping place to add or remove modules from the build list. There is no functional changes, or no build order changes. Just source code reshuffling. Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
-rwxr-xr-xbuild.sh610
1 files changed, 254 insertions, 356 deletions
diff --git a/build.sh b/build.sh
index 0269ea3..3500a70 100755
--- a/build.sh
+++ b/build.sh
@@ -808,15 +808,180 @@ build() {
fi
}
-# protocol headers have no build order dependencies
-build_proto() {
+
+# just process the sub-projects supplied in the given file ($MODFILE)
+# in the order in which they are found in the list
+# (prerequisites and ordering are the responsibility of the user)
+# globals used:
+# $MODFILE - readable file containing list of modules to process
+# and their optional configuration options
+# arguments:
+# (none)
+# returns:
+# 0 - good
+# 1 - bad
+process_module_file() {
+ # preconds
+ if [ X"$MODFILE" = X ]; then
+ echo "internal process_module_file() error, \$MODFILE is empty"
+ return 1
+ fi
+ if [ ! -r "$MODFILE" ]; then
+ echo "module file '$MODFILE' is not readable or does not exist"
+ return 1
+ fi
+
+ # read from input file, skipping blank and comment lines
+ while read line; do
+ # skip blank lines
+ if [ X"$line" = X ]; then
+ continue
+ fi
+
+ # skip comment lines
+ echo "$line" | grep "^#" > /dev/null
+ if [ $? -eq 0 ]; then
+ continue
+ fi
+
+ # parse each line to extract module, component and options name
+ field1=`echo $line | cut -d' ' -f1`
+ module=`echo $field1 | cut -d'/' -f1`
+ component=`echo $field1 | cut -d'/' -s -f2`
+ confopts=`echo $line | cut -d' ' -s -f2-`
+
+ build $module "$component" "$confopts"
+
+ done <"$MODFILE"
+
+ return 0
+}
+
+usage() {
+ basename="`expr "//$0" : '.*/\([^/]*\)'`"
+ echo "Usage: $basename [options] [prefix]"
+ echo "Options:"
+ echo " -a Do NOT run auto config tools (autogen.sh, configure)"
+ echo " -b Use .build.unknown build directory"
+ echo " -c Run make clean in addition to \"all install\""
+ echo " -D Run make dist in addition to \"all install\""
+ echo " -d Run make distcheck in addition \"all install\""
+ echo " -g Compile and link with debug information"
+ echo " -h, --help Display this help and exit successfully"
+ echo " -n Do not quit after error; just print error message"
+ echo " -o module/component"
+ echo " Build just this module/component"
+ echo " -p Update source code before building (git pull --rebase)"
+ echo " -s sudo The command name providing superuser privilege"
+ echo " --autoresume resumefile"
+ echo " Append module being built to, and autoresume from, <file>"
+ echo " --check Run make check in addition \"all install\""
+ echo " --clone Clone non-existing repositories (uses \$GITROOT if set)"
+ echo " --cmd command"
+ echo " Execute arbitrary git, gmake, or make command"
+ echo " --confflags options"
+ echo " Pass options to autgen.sh/configure of all modules"
+ echo " --modfile modulefile"
+ echo " Only process the module/components specified in modulefile"
+ echo " Any text after, and on the same line as, the module/component"
+ echo " is assumed to be configuration options for the configuration"
+ echo " of each module/component specifically"
+ echo " --retry-v1 Remake 'all' on failure with Automake silent rules disabled"
+ echo ""
+ echo "Usage: $basename -L"
+ echo " -L Just list modules to build"
+ echo ""
+ envoptions
+}
+
+# Ensure the named variable value contains a full path name
+# arguments:
+# $1 - the variable value (the path to examine)
+# $2 - the name of the variable
+# returns:
+# returns nothing or exit on error with message
+check_full_path () {
+ path=$1
+ varname=$2
+ if [ X"`expr $path : "\(.\)"`" != X/ ]; then
+ echo "The path \"$path\" supplied by \"$varname\" must be a full path name"
+ echo ""
+ usage
+ exit 1
+ fi
+}
+
+# Ensure the named variable value contains a writable directory
+# arguments:
+# $1 - the variable value (the path to examine)
+# $2 - the name of the variable
+# returns:
+# returns nothing or exit on error with message
+check_writable_dir () {
+ path=$1
+ varname=$2
+ if [ X"$SUDO" = X ]; then
+ if [ ! -d "$path" ] || [ ! -w "$path" ]; then
+ echo "The path \"$path\" supplied by \"$varname\" must be a writable directory"
+ echo ""
+ usage
+ exit 1
+ fi
+ fi
+}
+
+# perform sanity checks on cmdline args which require arguments
+# arguments:
+# $1 - the option being examined
+# $2 - the argument to the option
+# returns:
+# if it returns, everything is good
+# otherwise it exit's
+required_arg() {
+ option=$1
+ arg=$2
+ # preconds
+ if [ X"$option" = X ]; then
+ echo "internal required_arg() error, missing first argument"
+ exit 1
+ fi
+
+ # check for an argument
+ if [ X"$arg" = X ]; then
+ echo "the '$option' option is missing its required argument"
+ echo ""
+ usage
+ exit 1
+ fi
+
+ # does the argument look like an option?
+ echo $arg | grep "^-" > /dev/null
+ if [ $? -eq 0 ]; then
+ echo "the argument '$arg' of option '$option' looks like an option itself"
+ echo ""
+ usage
+ exit 1
+ fi
+}
+
+#==============================================================================
+# Build All Modules
+# Globals:
+# HOST_OS HOST_CPU
+# Arguments:
+# None
+# Returns:
+# None
+#==============================================================================
+build_all_modules() {
+
+ build util macros
+ build font util
+ build doc xorg-sgml-doctools
+ build doc xorg-docs
case $HOST_OS in
- Darwin)
- build proto applewmproto
- ;;
- CYGWIN*)
- build proto windowswmproto
- ;;
+ Darwin) build proto applewmproto;;
+ CYGWIN*) build proto windowswmproto;;
esac
build proto bigreqsproto
build proto compositeproto
@@ -845,31 +1010,8 @@ build_proto() {
build proto xf86vidmodeproto
build proto xineramaproto
build xcb proto
-}
-
-# bitmaps is needed for building apps, so has to be done separately first
-# cursors depends on apps/xcursorgen
-# xkbdata is obsolete - use xkbdesc from xkeyboard-config instead
-build_data() {
-# build data bitmaps
- build data cursors
-}
-
-# All protocol modules must be installed before the libs (okay, that's an
-# overstatement, but all protocol modules should be installed anyway)
-#
-# the libraries have a dependency order:
-# xtrans, Xau, Xdmcp before anything else
-# fontenc before Xfont
-# ICE before SM
-# X11 before Xext
-# (X11 and SM) before Xt
-# Xt before Xmu and Xpm
-# Xext before any other extension library
-# Xfixes before Xcomposite
-# Xp before XprintUtil before XprintAppUtil
-#
-build_lib() {
+ # Required by mesa and depends on xproto
+ build util makedepend
build lib libxtrans
build lib libXau
build lib libXdmcp
@@ -883,12 +1025,8 @@ build_lib() {
build lib libX11
build lib libXext
case $HOST_OS in
- Darwin)
- build lib libAppleWM
- ;;
- CYGWIN*)
- build lib libWindowsWM
- ;;
+ Darwin) build lib libAppleWM;;
+ CYGWIN*) build lib libWindowsWM;;
esac
build lib libdmx
build lib libfontenc
@@ -925,16 +1063,9 @@ build_lib() {
build lib libXxf86vm
build lib libpciaccess
build pixman ""
-}
-
-# Most apps depend at least on libX11.
-#
-# bdftopcf depends on libXfont
-# mkfontscale depends on libfontenc and libfreetype
-# mkfontdir depends on mkfontscale
-#
-# TODO: detailed breakdown of which apps require which libs
-build_app() {
+ build mesa drm
+ build mesa mesa
+ build data bitmaps
build app appres
build app bdftopcf
build app beforelight
@@ -1005,6 +1136,7 @@ build_app() {
build app xmh
build app xmodmap
build app xmore
+ build app xpr
build app xprop
build app xrandr
build app xrdb
@@ -1020,21 +1152,10 @@ build_app() {
build app xwd
build app xwininfo
build app xwud
-}
-
-build_mesa() {
- build mesa drm
- build mesa mesa
-}
-
-# The server requires at least the following libraries:
-# Xfont, Xau, Xdmcp, pciaccess
-build_xserver() {
build xserver ""
-}
-
-build_driver_input() {
- # Some drivers are only buildable on some OS'es
+ case $HOST_OS in
+ Linux) build libevdev "";;
+ esac
case $HOST_OS in
Linux)
build driver xf86-input-evdev
@@ -1044,131 +1165,89 @@ build_driver_input() {
build driver xf86-input-joystick
;;
esac
-
- # And some drivers are only buildable on some CPUs.
case $HOST_CPU in
i*86 | amd64 | x86_64 | i86pc)
build driver xf86-input-vmmouse
;;
esac
-
- build driver xf86-input-keyboard
- build driver xf86-input-mouse
- build driver xf86-input-synaptics
- build driver xf86-input-void
-}
-
-build_driver_video() {
- # Some drivers are only buildable on some OS'es
case $HOST_OS in
- FreeBSD)
- case $HOST_CPU in
- sparc64)
+ Darwin)
+ ;;
+ *)
+ build driver xf86-input-keyboard
+ build driver xf86-input-mouse
+ build driver xf86-input-synaptics
+ build driver xf86-input-void
+ case $HOST_OS in
+ FreeBSD)
+ case $HOST_CPU in
+ sparc64)
+ build driver xf86-video-sunffb
+ ;;
+ esac
+ ;;
+ NetBSD | OpenBSD)
+ build driver xf86-video-wsfb
build driver xf86-video-sunffb
;;
+ Linux)
+ build driver xf86-video-sisusb
+ build driver xf86-video-sunffb
+ build driver xf86-video-v4l
+ build driver xf86-video-xgixp
+ case $HOST_CPU in
+ i*86)
+ # AMD Geode CPU. Driver contains 32 bit assembler code
+ build driver xf86-video-geode
+ ;;
+ esac
+ ;;
esac
- ;;
- NetBSD | OpenBSD)
- build driver xf86-video-wsfb
- build driver xf86-video-sunffb
- ;;
- Linux)
- build driver xf86-video-sisusb
- build driver xf86-video-sunffb
- build driver xf86-video-v4l
- build driver xf86-video-xgixp
case $HOST_CPU in
- i*86)
- # AMD Geode CPU. Driver contains 32 bit assembler code
- build driver xf86-video-geode
+ sparc | sparc64)
+ build driver xf86-video-suncg14
+ build driver xf86-video-suncg3
+ build driver xf86-video-suncg6
+ build driver xf86-video-sunleo
+ build driver xf86-video-suntcx
+ ;;
+ i*86 | amd64 | x86_64 | i86pc)
+ build driver xf86-video-i740
+ build driver xf86-video-intel
;;
esac
+ build driver xf86-video-apm
+ build driver xf86-video-ark
+ build driver xf86-video-ast
+ build driver xf86-video-ati
+ build driver xf86-video-chips
+ build driver xf86-video-cirrus
+ build driver xf86-video-dummy
+ build driver xf86-video-fbdev
+ build driver xf86-video-glint
+ build driver xf86-video-i128
+ build driver xf86-video-mach64
+ build driver xf86-video-mga
+ build driver xf86-video-modesetting
+ build driver xf86-video-neomagic
+ build driver xf86-video-nv
+ build driver xf86-video-rendition
+ build driver xf86-video-r128
+ build driver xf86-video-s3
+ build driver xf86-video-s3virge
+ build driver xf86-video-savage
+ build driver xf86-video-siliconmotion
+ build driver xf86-video-sis
+ build driver xf86-video-tdfx
+ build driver xf86-video-tga
+ build driver xf86-video-trident
+ build driver xf86-video-tseng
+ build driver xf86-video-vesa
+ build driver xf86-video-vmware
+ build driver xf86-video-voodoo
;;
esac
-
- # Some drivers are only buildable on some architectures
- case $HOST_CPU in
- sparc | sparc64)
- build driver xf86-video-suncg14
- build driver xf86-video-suncg3
- build driver xf86-video-suncg6
- build driver xf86-video-sunleo
- build driver xf86-video-suntcx
- ;;
- i*86 | amd64 | x86_64 | i86pc)
- build driver xf86-video-i740
- build driver xf86-video-intel
- ;;
- esac
-
- build driver xf86-video-apm
- build driver xf86-video-ark
- build driver xf86-video-ast
- build driver xf86-video-ati
- build driver xf86-video-chips
- build driver xf86-video-cirrus
- build driver xf86-video-dummy
- build driver xf86-video-fbdev
-# build driver xf86-video-glide
- build driver xf86-video-glint
- build driver xf86-video-i128
- build driver xf86-video-mach64
- build driver xf86-video-mga
- build driver xf86-video-modesetting
- build driver xf86-video-neomagic
- build driver xf86-video-nv
- build driver xf86-video-rendition
- build driver xf86-video-r128
- build driver xf86-video-s3
- build driver xf86-video-s3virge
- build driver xf86-video-savage
- build driver xf86-video-siliconmotion
- build driver xf86-video-sis
- build driver xf86-video-tdfx
- build driver xf86-video-tga
- build driver xf86-video-trident
- build driver xf86-video-tseng
- build driver xf86-video-vesa
- build driver xf86-video-vmware
- build driver xf86-video-voodoo
-}
-
-# The server must be built before the drivers
-build_driver() {
- # XQuartz doesn't need these...
- case $HOST_OS in
- Darwin) return 0 ;;
- esac
-
-# Build the Wrapper library for evdev devices
- case $HOST_OS in
- Linux)
- build libevdev ""
- ;;
- esac
- build_driver_input
- build_driver_video
-}
-
-# All fonts require mkfontscale and mkfontdir to be available
-#
-# The following fonts require bdftopcf to be available:
-# adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
-# arabic-misc, bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi,
-# bh-lucidatypewriter-75dpi, bitstream-100dpi, bitstream-75dpi,
-# cronyx-cyrillic, cursor-misc, daewoo-misc, dec-misc, isas-misc,
-# jis-misc, micro-misc, misc-cyrillic, misc-misc, mutt-misc,
-# schumacher-misc, screen-cyrillic, sony-misc, sun-misc and
-# winitzki-cyrillic
-#
-# The font util component must be built before any of the fonts, since they
-# use the fontutil.m4 installed by it. (As do several other modules, such
-# as libfontenc and app/xfs, which is why it is moved up to the top.)
-#
-# The alias component is recommended to be installed after the other fonts
-# since the fonts.alias files reference specific fonts installed from the
-# other font components
-build_font() {
+ build data cursors
build font encodings
build font adobe-100dpi
build font adobe-75dpi
@@ -1205,178 +1284,14 @@ build_font() {
build font winitzki-cyrillic
build font xfree86-type1
build font alias
-}
-
-# makedepend requires xproto
-build_util() {
build util cf
build util imake
build util gccmakedep
build util lndir
-
build xkeyboard-config ""
-}
-
-# xorg-docs requires xorg-sgml-doctools
-build_doc() {
- build doc xorg-sgml-doctools
- build doc xorg-docs
-}
-
-# just process the sub-projects supplied in the given file ($MODFILE)
-# in the order in which they are found in the list
-# (prerequisites and ordering are the responsibility of the user)
-# globals used:
-# $MODFILE - readable file containing list of modules to process
-# and their optional configuration options
-# arguments:
-# (none)
-# returns:
-# 0 - good
-# 1 - bad
-process_module_file() {
- # preconds
- if [ X"$MODFILE" = X ]; then
- echo "internal process_module_file() error, \$MODFILE is empty"
- return 1
- fi
- if [ ! -r "$MODFILE" ]; then
- echo "module file '$MODFILE' is not readable or does not exist"
- return 1
- fi
-
- # read from input file, skipping blank and comment lines
- while read line; do
- # skip blank lines
- if [ X"$line" = X ]; then
- continue
- fi
-
- # skip comment lines
- echo "$line" | grep "^#" > /dev/null
- if [ $? -eq 0 ]; then
- continue
- fi
-
- # parse each line to extract module, component and options name
- field1=`echo $line | cut -d' ' -f1`
- module=`echo $field1 | cut -d'/' -f1`
- component=`echo $field1 | cut -d'/' -s -f2`
- confopts=`echo $line | cut -d' ' -s -f2-`
-
- build $module "$component" "$confopts"
-
- done <"$MODFILE"
-
return 0
}
-usage() {
- basename="`expr "//$0" : '.*/\([^/]*\)'`"
- echo "Usage: $basename [options] [prefix]"
- echo "Options:"
- echo " -a Do NOT run auto config tools (autogen.sh, configure)"
- echo " -b Use .build.unknown build directory"
- echo " -c Run make clean in addition to \"all install\""
- echo " -D Run make dist in addition to \"all install\""
- echo " -d Run make distcheck in addition \"all install\""
- echo " -g Compile and link with debug information"
- echo " -h, --help Display this help and exit successfully"
- echo " -n Do not quit after error; just print error message"
- echo " -o module/component"
- echo " Build just this module/component"
- echo " -p Update source code before building (git pull --rebase)"
- echo " -s sudo The command name providing superuser privilege"
- echo " --autoresume resumefile"
- echo " Append module being built to, and autoresume from, <file>"
- echo " --check Run make check in addition \"all install\""
- echo " --clone Clone non-existing repositories (uses \$GITROOT if set)"
- echo " --cmd command"
- echo " Execute arbitrary git, gmake, or make command"
- echo " --confflags options"
- echo " Pass options to autgen.sh/configure of all modules"
- echo " --modfile modulefile"
- echo " Only process the module/components specified in modulefile"
- echo " Any text after, and on the same line as, the module/component"
- echo " is assumed to be configuration options for the configuration"
- echo " of each module/component specifically"
- echo " --retry-v1 Remake 'all' on failure with Automake silent rules disabled"
- echo ""
- echo "Usage: $basename -L"
- echo " -L Just list modules to build"
- echo ""
- envoptions
-}
-
-# Ensure the named variable value contains a full path name
-# arguments:
-# $1 - the variable value (the path to examine)
-# $2 - the name of the variable
-# returns:
-# returns nothing or exit on error with message
-check_full_path () {
- path=$1
- varname=$2
- if [ X"`expr $path : "\(.\)"`" != X/ ]; then
- echo "The path \"$path\" supplied by \"$varname\" must be a full path name"
- echo ""
- usage
- exit 1
- fi
-}
-
-# Ensure the named variable value contains a writable directory
-# arguments:
-# $1 - the variable value (the path to examine)
-# $2 - the name of the variable
-# returns:
-# returns nothing or exit on error with message
-check_writable_dir () {
- path=$1
- varname=$2
- if [ X"$SUDO" = X ]; then
- if [ ! -d "$path" ] || [ ! -w "$path" ]; then
- echo "The path \"$path\" supplied by \"$varname\" must be a writable directory"
- echo ""
- usage
- exit 1
- fi
- fi
-}
-
-# perform sanity checks on cmdline args which require arguments
-# arguments:
-# $1 - the option being examined
-# $2 - the argument to the option
-# returns:
-# if it returns, everything is good
-# otherwise it exit's
-required_arg() {
- option=$1
- arg=$2
- # preconds
- if [ X"$option" = X ]; then
- echo "internal required_arg() error, missing first argument"
- exit 1
- fi
-
- # check for an argument
- if [ X"$arg" = X ]; then
- echo "the '$option' option is missing its required argument"
- echo ""
- usage
- exit 1
- fi
-
- # does the argument look like an option?
- echo $arg | grep "^-" > /dev/null
- if [ $? -eq 0 ]; then
- echo "the argument '$arg' of option '$option' looks like an option itself"
- echo ""
- usage
- exit 1
- fi
-}
#------------------------------------------------------------------------------
# Script main line
@@ -1616,24 +1531,7 @@ if [ X"$BUILT_MODULES_FILE" != X -a -r "$BUILT_MODULES_FILE" ]; then
fi
if [ X"$MODFILE" = X ]; then
- # We must install the global macros before anything else
- build util macros
- build font util
-
- build_doc
- build_proto
- # Required by mesa and depends on xproto
- build util makedepend
- build_lib
- build_mesa
-
- build data bitmaps
- build_app
- build_xserver
- build_driver
- build_data
- build_font
- build_util
+ build_all_modules
else
process_module_file
fi