585302e0b2606229c485ed2ce15d7cc80f3823b4
[oweals/cde.git] / cde / admin / BuildTools / tog / build_id
1 #!/bin/ksh
2 #
3 # build_id
4 #
5 ########################################################################
6 # set -x
7
8 ##########################################################################
9 #
10 # Script setup:  THIS NEEDS TO BE FIRST
11 #
12 SCRIPTS_DIR="`dirname $0`"
13 if [ "" = "$SCRIPTS_DIR" ]; then
14         SCRIPTS_DIR=/project/dt/scripts
15 fi
16
17 ##########################################################################
18 ##########################################################################
19 #
20 # Script specific global variables
21 #
22 ##########################################################################
23 ##########################################################################
24 PROG_NAME="$0"
25 LOG_DIR="/project/dt/admin/mkid"
26 LOG_FILE="cdeID"
27 LOG_PATH=""
28
29 DO_X_BUILD="False"
30 DO_MOTIF_BUILD="False"
31 DO_CDE_BUILD="False"
32 DO_CDEDOC_BUILD="False"
33 DO_CDETEST_BUILD="False"
34
35 DO_DEBUG="False"
36
37 ##########################################################################
38
39 usage ()
40 {
41         cat <<eof
42 USAGE: $1
43         [-e | -dev]     # Default: build x11, motif and cde
44         [-x | -x11]     # Build x11 only
45         [-m | -motif]   # Build motif only
46         [-c | -cde]     # Build cde only
47         [-t | -cdetest] # Build cde tests only
48         [-a | -all]     # Build x11, motif, cde, cdedoc and cdetest
49         [-debug]        # Debugging output
50         [{-ld | -log_dir} <dirpath>]
51                 # Specify an alternate log directory.
52                 # Default: $LOG_DIR
53         [{-lf | -log_file} <filename>]
54                 # Specify an alternate log file relative to $LOG_DIR.
55                 # Default: $LOG_FILE
56         [{-lp | -log_path} <path>]
57                 # Specify an alternate log directory.
58                 # Default: $LOG_DIR/$LOG_FILE
59         [-h | -? | -help]  # Print usage and exit
60 eof
61 }
62
63
64 ##########################################################################
65
66 while [ $# -gt 0 ]; do
67         case $1 in
68                 -e | -dev)              DO_X_BUILD="True"
69                                         DO_MOTIF_BUILD="True"
70                                         DO_CDE_BUILD="True"
71                                         shift 1 ;;
72
73                 -x | -x11)              DO_X_BUILD="True"
74                                         shift 1 ;;
75
76                 -m | -motif)            DO_MOTIF_BUILD="True"
77                                         shift 1 ;;
78
79                 -c | -cde)              DO_CDE_BUILD="True"
80                                         shift 1 ;;
81
82                 -t | -cdetest)          DO_CDETEST_BUILD="True";        
83                                         shift 1 ;;
84
85                 -a | -all)              DO_X_BUILD="True"
86                                         DO_MOTIF_BUILD="True"
87                                         DO_CDE_BUILD="True"
88                                         DO_CDEDOC_BUILD="True"
89                                         DO_CDETEST_BUILD="True"
90                                         shift 1 ;;
91
92                 -debug)                 DO_DEBUG="True"
93                                         shift 1 ;;
94
95                 -ld | -log_dir)         LOG_DIR=$2;             shift 2 ;;
96
97                 -lf | -log_file)        LOG_FILE=$2;            shift 2 ;;
98
99                 -lp | -log_path)        LOG_PATH=$2;            shift 2 ;;
100
101                 -h | "-?" | -help | *)  usage $PROG_NAME;
102                                         exit 1;
103         esac
104 done
105
106
107 ##########################################################################
108 #
109 # Script setup:  Do this after the command line parsing to pick up
110 #   an alternate setting of SCRIPTS_DIR
111 #
112 if [ ! -f $SCRIPTS_DIR/script_setup.ksh ]; then
113     print -u2 "$PRG:  File '$SCRIPTS_DIR/script_setup.ksh' NOT found!"
114     print -u2 "$PRG:  Exiting ..."
115     exit 1
116 fi
117 . $SCRIPTS_DIR/script_setup.ksh
118
119
120 ##########################################################################
121 #
122 # If no project was selected, then build the 'dev' projects
123 #
124 PROJECTS=""
125 if [ "True" = $DO_X_BUILD ]; then
126     PROJECTS="$PROJECTS $X_TOP"
127 fi
128
129 if [ "True" = $DO_MOTIF_BUILD ]; then
130     PROJECTS="$PROJECTS $MOTIF_TOP"
131 fi
132
133 if [ "True" = $DO_CDE_BUILD ]; then
134     PROJECTS="$PROJECTS $CDE_TOP"
135 fi
136
137 if [ "True" = $DO_CDETEST_BUILD ]; then
138     PROJECTS="$PROJECTS $CDETEST_TOP"
139 fi
140
141 if [ -z "$PROJECTS" ]; then
142     PROJECTS="$X_TOP $MOTIF_TOP $CDE_TOP"
143 fi
144
145 ##########################################################################
146 #
147 # Set the log path
148 #
149 if [ -z "$LOG_PATH" ]; then
150     LOG_PATH=$LOG_DIR/$LOG_PATH
151 fi
152
153 /usr/local/bin/mkid -o$LOG_PATH $PROJECTS
154
155 #
156 # Clean up temporary files and exit
157 #
158 do_exit 0