4 # Note: When adding make options to this script, ensure that the source still
5 # compiles without those options! (and just with GNUstep.sh being
7 # We do not want to force people to run configure.
10 # ******************** variables ****************
12 CFG_ARGS="$0 $1 $2 $3 $4 $5 $6 $7 $8 $9"
17 ARG_GSMAKE="$GNUSTEP_MAKEFILES"
18 ARG_CFGMAKE="$PWD/config.make"
22 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
25 NGSTREAMS_DIR="./sope-core/NGStreams"
27 # ******************** usage ********************
31 \`configure' configures a GNUstep-make based sourcetree for installation.
35 Note: You do not need to configure this source tree, as another option
36 just ensure that the GNUstep.sh of your GNUstep make installation
37 is properly sourced prior running make.
40 -h, --help display this help and exit
41 -q, --quiet, --silent do not print \`checking...' messages
42 -n, --no-create do not create output files
44 Installation directories:
45 --prefix=PREFIX install files in PREFIX [/usr/local]
46 --gsmake=PATH path to gnustep-make tree
47 --configmake=PATH path to the config file being created
48 --with-gnustep install in GNUstep tree
49 --enable-debug turn on debugging and compile time warnings
56 # ******************** running ********************
58 function printParas() {
60 if test $ARG_BEQUIET = 1; then echo " will be quite."; fi
61 if test $ARG_NOCREATE = 1; then echo " won't create files"; fi
62 if test $DARG_IS_FHS = 1; then
63 echo " FHS: install in FHS root";
65 echo " FHS: install in GNUstep tree";
68 if test $ARG_WITH_DEBUG = 1; then
74 echo " prefix: $ARG_PREFIX"
75 echo " gstep: $ARG_GSMAKE"
76 echo " config: $ARG_CFGMAKE"
77 echo " script: $DARG_GNUSTEP_SH"
81 function warnOnFHSPrefix() {
83 Warning: you are configuring for a non standard FHS style prefix.
86 Some code in SOPE only looks in /usr and /usr/local for resources and is
87 therefore incompatible with arbitary install pathes.
89 If you want to have the flexibility of installation in arbitary pathes just
90 configure GNUstep-make and source the GNUstep.sh script prior executing tools
91 to ensure a proper environment.
92 All SOPE based code is completely relocatable when being used in a GNUstep
98 function validateGNUstepArgs() {
100 if test "x$ARG_GSMAKE" = "x"; then
101 if test -f $HOME/OGoRoot/Library/Makefiles/GNUstep.sh; then
102 ARG_GSMAKE="$HOME/OGoRoot/Library/Makefiles/"
103 elif test -f $HOME/GNUstep/Library/Makefiles/GNUstep.sh; then
104 ARG_GSMAKE="$HOME/GNUstep/Library/Makefiles/"
105 elif test -f /usr/GNUstep/System/Library/Makefiles/GNUstep.sh; then
106 ARG_GSMAKE="/usr/GNUstep/System/Library/Makefiles/"
108 echo "error: please specify a GNUstep make tree!"
111 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
112 elif test -d $ARG_GSMAKE; then
113 if test -f $ARG_GSMAKE/GNUstep.sh; then
114 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
115 elif test -f $ARG_GSMAKE/Library/Makefiles/GNUstep.sh; then
116 ARG_GSMAKE="$ARG_GSMAKE/Library/Makefiles"
117 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
119 echo "error: specified directory contains no GNUstep.sh: $ARG_GSMAKE"
123 echo "error: specified GNUstep make tree does not exist: $ARG_GSMAKE"
128 function validateArgs() {
129 # validate prefix (could be better?)
130 case "x$ARG_PREFIX" in
131 "x/usr/local"|"x/usr/local/")
137 "x$GNUSTEP_USER_ROOT"|"x$GNUSTEP_LOCAL_ROOT"|"x$GNUSTEP_SYSTEM_ROOT")
142 if test $ARG_WITH_GNUSTEP = 1; then
144 ARG_PREFIX="$GNUSTEP_LOCAL_ROOT"
145 if test $ARG_BEQUIET != 1; then
146 echo "Note: will install in GNUSTEP_LOCAL_ROOT: $ARG_PREFIX"
151 ARG_PREFIX="/usr/local/"
152 echo "Note: will install in default location: $ARG_PREFIX"
157 if test $ARG_WITH_GNUSTEP = 1; then
158 echo "error: specified --with-gnustep, but specified prefix is not"
159 echo " a GNUstep root: '$ARG_PREFIX'"
162 if test $ARG_BEQUIET != 1; then
170 if test $ARG_WITH_GNUSTEP = 1; then
171 if test $DARG_IS_FHS = 1; then
172 echo "error: configured for FHS root _and_ GNUstep tree. Choose one!"
178 function printGNUstepSetup() {
179 echo "GNUstep environment:"
180 echo " system: ${GNUSTEP_SYSTEM_ROOT}"
181 echo " local: ${GNUSTEP_LOCAL_ROOT}"
182 echo " user: ${GNUSTEP_USER_ROOT}"
183 echo " path: ${GNUSTEP_PATHLIST}"
184 echo " flat: ${GNUSTEP_FLATTENED}"
185 echo " arch: ${GNUSTEP_HOST}"
186 echo " combo: ${LIBRARY_COMBO}"
190 function cfgwrite() {
191 echo "$1" >> $ARG_CFGMAKE
194 function genConfigMake() {
195 # we ignore the following vars also patches by gstep-make:
201 if test $ARG_BEQUIET != 1; then
202 echo "creating: $ARG_CFGMAKE"
205 echo "# GNUstep environment configuration" > $ARG_CFGMAKE
206 cfgwrite "# created by: '$CFG_ARGS'"
209 cfgwrite "# Note: you can override any option as a 'make' parameter, eg:"
210 cfgwrite "# make debug=yes"
213 cfgwrite "# print on the cmdline that this file is being used"
215 cfgwrite " @echo Local GNUstep config.make is active"
218 # TODO: should be also write a GNUSTEP_INSTALLATION_DIR / BUNDLE_INSTALL_DIR?
220 if test $DARG_IS_FHS = 1; then
221 cfgwrite "# configured for FHS install"
222 cfgwrite "FHS_INSTALL_ROOT:=$ARG_PREFIX"
226 if test $ARG_WITH_DEBUG = 1; then
227 cfgwrite "# configured to produce debugging code";
228 cfgwrite "debug:=yes"
230 cfgwrite "# configured to produce non-debugging code";
235 cfgwrite "# enforce shared libraries";
236 cfgwrite "shared:=yes"
239 cfgwrite "# GNUstep environment variables:";
240 for i in `env | grep GNUSTEP_ | sort`; do
241 MAKE_ASSI="`echo $i | sed s/=/:=/`"
242 cfgwrite "${MAKE_ASSI}";
244 cfgwrite "LIBRARY_COMBO=$LIBRARY_COMBO"
248 if test $ARG_BEQUIET != 1; then
252 if test $ARG_NOCREATE = 1; then
253 if test $ARG_BEQUIET != 1; then
254 echo "not creating the config file ...";
259 if test -x $NGSTREAMS_DIR/configure; then
260 if test $ARG_BEQUIET != 1; then
261 echo -n "configuring NGStreams library .."
264 ./configure >$old/config-NGStreams.log
266 echo ".. done (log in config-NGStreams.log)."
272 # ******************** options ********************
274 function extractFuncValue() {
275 VALUE="`echo "$1" | sed "s/[^=]*=//g"`"
278 function processOption() {
283 "x--quiet"|"x--silent"|"x-q") ARG_BEQUIET=1; ;;
284 "x--no-create"|"x-n") ARG_NOCREATE=1; ;;
295 ARG_CFGMAKE="$VALUE";
305 *) echo "error: cannot process argument: $1"; exit 1; ;;
313 # load GNUstep environment
315 # first we load the GNUstep.sh environment
316 source $DARG_GNUSTEP_SH
317 if test $ARG_BEQUIET != 1; then
321 # ensure the parameters make sense