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 # ******************** usage ********************
29 \`configure' configures a GNUstep-make based sourcetree for installation.
33 Note: You do not need to configure this source tree, as another option
34 just ensure that the GNUstep.sh of your GNUstep make installation
35 is properly sourced prior running make.
38 -h, --help display this help and exit
39 -q, --quiet, --silent do not print \`checking...' messages
40 -n, --no-create do not create output files
42 Installation directories:
43 --prefix=PREFIX install files in PREFIX [/usr/local]
44 --gsmake=PATH path to gnustep-make tree
45 --configmake=PATH path to the config file being created
46 --with-gnustep install in GNUstep tree
47 --enable-debug turn on debugging and compile time warnings
54 # ******************** running ********************
56 function printParas() {
58 if test $ARG_BEQUIET = 1; then echo " will be quite."; fi
59 if test $ARG_NOCREATE = 1; then echo " won't create files"; fi
60 if test $DARG_IS_FHS = 1; then
61 echo " FHS: install in FHS root";
63 echo " FHS: install in GNUstep tree";
66 if test $ARG_WITH_DEBUG = 1; then
72 echo " prefix: $ARG_PREFIX"
73 echo " gstep: $ARG_GSMAKE"
74 echo " config: $ARG_CFGMAKE"
75 echo " script: $DARG_GNUSTEP_SH"
79 function warnOnFHSPrefix() {
81 Warning: you are configuring for a non standard FHS style prefix.
84 Some code in SOPE only looks in /usr and /usr/local for resources and is
85 therefore incompatible with arbitary install pathes.
87 If you want to have the flexibility of installation in arbitary pathes just
88 configure GNUstep-make and source the GNUstep.sh script prior executing tools
89 to ensure a proper environment.
90 All SOPE based code is completely relocatable when being used in a GNUstep
96 function validateGNUstepArgs() {
98 if test "x$ARG_GSMAKE" = "x"; then
99 if test -f $HOME/OGoRoot/Library/Makefiles/GNUstep.sh; then
100 ARG_GSMAKE="$HOME/OGoRoot/Library/Makefiles/"
101 elif test -f $HOME/GNUstep/Library/Makefiles/GNUstep.sh; then
102 ARG_GSMAKE="$HOME/GNUstep/Library/Makefiles/"
103 elif test -f /usr/GNUstep/System/Library/Makefiles/GNUstep.sh; then
104 ARG_GSMAKE="/usr/GNUstep/System/Library/Makefiles/"
106 echo "error: please specify a GNUstep make tree!"
109 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
110 elif test -d $ARG_GSMAKE; then
111 if test -f $ARG_GSMAKE/GNUstep.sh; then
112 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
113 elif test -f $ARG_GSMAKE/Library/Makefiles/GNUstep.sh; then
114 ARG_GSMAKE="$ARG_GSMAKE/Library/Makefiles"
115 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
117 echo "error: specified directory contains no GNUstep.sh: $ARG_GSMAKE"
121 echo "error: specified GNUstep make tree does not exist: $ARG_GSMAKE"
126 function validateArgs() {
127 # validate prefix (could be better?)
128 case "x$ARG_PREFIX" in
129 "x/usr/local"|"x/usr/local/")
135 "x$GNUSTEP_USER_ROOT"|"x$GNUSTEP_LOCAL_ROOT"|"x$GNUSTEP_SYSTEM_ROOT")
140 if test $ARG_WITH_GNUSTEP = 1; then
142 ARG_PREFIX="$GNUSTEP_LOCAL_ROOT"
143 if test $ARG_BEQUIET != 1; then
144 echo "Note: will install in GNUSTEP_LOCAL_ROOT: $ARG_PREFIX"
149 ARG_PREFIX="/usr/local/"
150 echo "Note: will install in default location: $ARG_PREFIX"
155 if test $ARG_WITH_GNUSTEP = 1; then
156 echo "error: specified --with-gnustep, but specified prefix is not"
157 echo " a GNUstep root: '$ARG_PREFIX'"
160 if test $ARG_BEQUIET != 1; then
168 if test $ARG_WITH_GNUSTEP = 1; then
169 if test $DARG_IS_FHS = 1; then
170 echo "error: configured for FHS root _and_ GNUstep tree. Choose one!"
176 function printGNUstepSetup() {
177 echo "GNUstep environment:"
178 echo " system: ${GNUSTEP_SYSTEM_ROOT}"
179 echo " local: ${GNUSTEP_LOCAL_ROOT}"
180 echo " user: ${GNUSTEP_USER_ROOT}"
181 echo " path: ${GNUSTEP_PATHLIST}"
182 echo " flat: ${GNUSTEP_FLATTENED}"
183 echo " arch: ${GNUSTEP_HOST}"
184 echo " combo: ${LIBRARY_COMBO}"
188 function cfgwrite() {
189 echo "$1" >> $ARG_CFGMAKE
192 function genConfigMake() {
193 # we ignore the following vars also patches by gstep-make:
199 if test $ARG_BEQUIET != 1; then
200 echo "creating: $ARG_CFGMAKE"
203 echo "# GNUstep environment configuration" > $ARG_CFGMAKE
204 cfgwrite "# created by: '$CFG_ARGS'"
207 cfgwrite "# Note: you can override any option as a 'make' parameter, eg:"
208 cfgwrite "# make debug=yes"
211 cfgwrite "# print on the cmdline that this file is being used"
213 cfgwrite " @echo Local GNUstep config.make is active"
216 # TODO: should be also write a GNUSTEP_INSTALLATION_DIR / BUNDLE_INSTALL_DIR?
218 if test $DARG_IS_FHS = 1; then
219 cfgwrite "# configured for FHS install"
220 cfgwrite "FHS_INSTALL_ROOT:=$ARG_PREFIX"
224 if test $ARG_WITH_DEBUG = 1; then
225 cfgwrite "# configured to produce debugging code";
226 cfgwrite "debug:=yes"
228 cfgwrite "# configured to produce non-debugging code";
233 cfgwrite "# enforce shared libraries";
234 cfgwrite "shared:=yes"
237 cfgwrite "# GNUstep environment variables:";
238 for i in `env | grep GNUSTEP_ | sort`; do
239 MAKE_ASSI="`echo $i | sed s/=/:=/`"
240 cfgwrite "${MAKE_ASSI}";
242 cfgwrite "LIBRARY_COMBO=$LIBRARY_COMBO"
246 if test $ARG_BEQUIET != 1; then
250 if test $ARG_NOCREATE = 1; then
251 if test $ARG_BEQUIET != 1; then
252 echo "not creating the config file ...";
257 if test -f sope-core/NGStreams/configure; then
258 if test $ARG_BEQUIET != 1; then
259 echo -n "configuring NGStreams library .."
260 ./sope-core/NGStreams/configure >config-NGStreams.log
261 echo ".. done (log in config-NGStreams.log)."
267 # ******************** options ********************
269 function extractFuncValue() {
270 VALUE="`echo "$1" | sed "s/[^=]*=//g"`"
273 function processOption() {
278 "x--quiet"|"x--silent"|"x-q") ARG_BEQUIET=1; ;;
279 "x--no-create"|"x-n") ARG_NOCREATE=1; ;;
290 ARG_CFGMAKE="$VALUE";
300 *) echo "error: cannot process argument: $1"; exit 1; ;;
308 # load GNUstep environment
310 # first we load the GNUstep.sh environment
311 source $DARG_GNUSTEP_SH
312 if test $ARG_BEQUIET != 1; then
316 # ensure the parameters make sense