]> err.no Git - sope/blob - gnustep-make/GNUstep.csh.in
Drop apache 1 build-dependency
[sope] / gnustep-make / GNUstep.csh.in
1 #! /bin/echo This file must be sourced inside csh using: source
2 #
3 #   @configure_input@
4 #
5 #   Shell initialization for the GNUstep environment.
6 #
7 #   Copyright (C) 1998-2005 Free Software Foundation, Inc.
8 #
9 #   Author:  Scott Christley <scottc@net-community.com>
10 #   Author:  Adam Fedor <fedor@gnu.org>
11 #   Author:  Richard Frith-Macdonald <rfm@gnu.org>
12 #   Author:  Nicola Pero <n.pero@mi.flashnet.it>
13 #
14 #   This file is part of the GNUstep Makefile Package.
15 #
16 #   This library is free software; you can redistribute it and/or
17 #   modify it under the terms of the GNU General Public License
18 #   as published by the Free Software Foundation; either version 2
19 #   of the License, or (at your option) any later version.
20 #   
21 #   You should have received a copy of the GNU General Public
22 #   License along with this library; see the file COPYING.LIB.
23 #   If not, write to the Free Software Foundation,
24 #   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #
26
27 #
28 # Set the GNUstep system root and local root
29 #
30
31 #
32 # Read our configuration files
33 #
34
35 # Determine the location of the system configuration file
36 if ( ! ${?GNUSTEP_CONFIG_FILE} ) then
37   setenv GNUSTEP_CONFIG_FILE "@GNUSTEP_CONFIG_FILE@"
38 endif
39
40 # Determine the location of the user configuration file
41 if ( ! ${?GNUSTEP_USER_CONFIG_FILE} ) then
42   setenv GNUSTEP_USER_CONFIG_FILE "@GNUSTEP_USER_CONFIG_FILE@"
43 endif
44
45 # Read the system configuration file
46 if ( -e "${GNUSTEP_CONFIG_FILE}" ) then
47   #
48   # Convert the config file from sh syntax to csh syntax, and execute it.
49   #
50   # We want to convert every line of the type ^xxx=yyy$ into setenv xxx yyy;
51   # and ignore any other line.
52   #
53   # This sed expression will first delete all lines that don't match
54   # the pattern ^[^#=][^#=]*=.*$ -- which means "start of line (^),
55   # followed by a character that is not # and not = ([^#=]), followed
56   # by 0 or more characters that are not # and not = ([^#=]*),
57   # followed by a = (=), followed by some characters until end of the
58   # line (.*$).  It will then replace each occurrence of the same
59   # pattern (where the first and second relevant parts are now tagged
60   # -- that's what the additional \(...\) do) with 'setenv \1 \2'.
61   #
62   # The result of all this is ... something that we want to execute!
63   # We use eval to execute the results of `...`.
64   #
65   # Please note that ! must always be escaped in csh, which is why we
66   # write \\!
67   #
68   # Also note that we add a ';' at the end of each setenv command so
69   # that we can pipe all the commands through a single eval.
70   #
71   eval `sed -e '/^[^#=][^#=]*=.*$/\\!d' -e 's/^\([^#=][^#=]*\)=\(.*\)$/setenv \1 \2;/' "${GNUSTEP_CONFIG_FILE}"`
72 endif
73
74 # FIXME: determining GNUSTEP_HOME
75 set GNUSTEP_HOME = ~
76
77 # Read the user configuration file ... unless it is disabled (ie, set
78 # to an empty string)
79 if ( ${?GNUSTEP_USER_CONFIG_FILE} ) then
80   switch ("${GNUSTEP_USER_CONFIG_FILE}")
81    case /*: # An absolute path
82      if ( -e "${GNUSTEP_USER_CONFIG_FILE}" ) then
83       # See above for an explanation of the sed expression
84       eval `sed -e '/^[^#=][^#=]*=.*$/\\!d' -e 's/^\([^#=][^#=]*\)=\(.*\)$/setenv \1 \2;/' "${GNUSTEP_USER_CONFIG_FILE}"``
85      endif
86      breaksw
87    default: # Something else
88      if ( -e "${GNUSTEP_HOME}/${GNUSTEP_USER_CONFIG_FILE}" ) then
89        eval `sed -e '/^[^#=][^#=]*=.*$/\\!d' -e 's/^\([^#=][^#=]*\)=\(.*\)$/setenv \1 \2;/' "${GNUSTEP_HOME}/${GNUSTEP_USER_CONFIG_FILE}"`
90      endif
91      breaksw
92    endsw
93 endif
94
95 # Now, set any essential variable (that is not already set) to the
96 # built-in values.
97 if ( ! ${?GNUSTEP_SYSTEM_ROOT} ) then
98   setenv GNUSTEP_SYSTEM_ROOT "@GNUSTEP_SYSTEM_ROOT@"
99 endif
100
101 if ( ! ${?GNUSTEP_LOCAL_ROOT} ) then
102   setenv GNUSTEP_LOCAL_ROOT "@GNUSTEP_LOCAL_ROOT@"
103 endif
104
105 if ( ! ${?GNUSTEP_NETWORK_ROOT} ) then
106   setenv GNUSTEP_NETWORK_ROOT "@GNUSTEP_NETWORK_ROOT@"
107 endif
108
109
110 setenv GNUSTEP_FLATTENED "@GNUSTEP_FLATTENED@"
111 if ( ! ${?LIBRARY_COMBO} ) then
112   setenv LIBRARY_COMBO "@ac_cv_library_combo@"
113 endif
114
115 if ( ! ${?GNUSTEP_MAKEFILES} ) then
116   setenv GNUSTEP_MAKEFILES "${GNUSTEP_SYSTEM_ROOT}/Library/Makefiles"
117 endif
118
119 if ( ! ${?GNUSTEP_USER_DIR} ) then
120   setenv GNUSTEP_USER_DIR "@GNUSTEP_USER_DIR@"
121 endif
122
123 #
124 # Set GNUSTEP_USER_ROOT which is the variable used in practice
125 #
126 switch ("${GNUSTEP_USER_DIR}")
127  case /*: # An absolute path
128    setenv GNUSTEP_USER_ROOT "${GNUSTEP_USER_DIR}"
129    breaksw
130  default: # Something else
131    setenv GNUSTEP_USER_ROOT "${GNUSTEP_HOME}/${GNUSTEP_USER_DIR}"
132    breaksw
133 endsw
134
135 # No longer needed
136 unset GNUSTEP_HOME
137
138 if ( "@GNUSTEP_MULTI_PLATFORM@" == "" ) then
139   setenv GNUSTEP_HOST "@target@"
140   setenv GNUSTEP_HOST_CPU "@clean_target_cpu@"
141   setenv GNUSTEP_HOST_VENDOR "@clean_target_vendor@"
142   setenv GNUSTEP_HOST_OS "@clean_target_os@"
143 endif
144
145 #
146 # Determine the host information
147 #
148 if ( ! ${?GNUSTEP_HOST} ) then
149   pushd /tmp > /dev/null
150   setenv GNUSTEP_HOST `${GNUSTEP_MAKEFILES}/config.guess`
151   setenv GNUSTEP_HOST `${GNUSTEP_MAKEFILES}/config.sub ${GNUSTEP_HOST}`
152   popd > /dev/null
153 endif
154
155 if ( ! ${?GNUSTEP_HOST_CPU} ) then
156   setenv GNUSTEP_HOST_CPU `${GNUSTEP_MAKEFILES}/cpu.sh ${GNUSTEP_HOST}`
157   setenv GNUSTEP_HOST_CPU `${GNUSTEP_MAKEFILES}/clean_cpu.sh ${GNUSTEP_HOST_CPU}`
158 endif
159
160 if ( ! ${?GNUSTEP_HOST_VENDOR} ) then
161   setenv GNUSTEP_HOST_VENDOR `${GNUSTEP_MAKEFILES}/vendor.sh ${GNUSTEP_HOST}`
162   setenv GNUSTEP_HOST_VENDOR `${GNUSTEP_MAKEFILES}/clean_vendor.sh ${GNUSTEP_HOST_VENDOR}`
163 endif
164
165 if ( ! ${?GNUSTEP_HOST_OS} ) then
166   setenv GNUSTEP_HOST_OS `${GNUSTEP_MAKEFILES}/os.sh ${GNUSTEP_HOST}`
167   setenv GNUSTEP_HOST_OS `${GNUSTEP_MAKEFILES}/clean_os.sh ${GNUSTEP_HOST_OS}`
168 endif
169
170 #
171 # Add the GNUstep tools directories to the path
172 #
173 if ( ! ${?GNUSTEP_PATHLIST} ) then
174   setenv GNUSTEP_PATHLIST \
175          "${GNUSTEP_USER_ROOT}:${GNUSTEP_LOCAL_ROOT}:${GNUSTEP_NETWORK_ROOT}:${GNUSTEP_SYSTEM_ROOT}"
176 endif
177
178 set temp_path = ""
179 foreach dir ( `/bin/sh -c 'IFS=:; for i in ${GNUSTEP_PATHLIST}; do echo $i; done'` )
180   set temp_path="${temp_path}${dir}/Tools:"
181   if ( "${GNUSTEP_FLATTENED}" == "" ) then
182     set temp_path="${temp_path}${dir}/Tools/${GNUSTEP_HOST_CPU}/${GNUSTEP_HOST_OS}/${LIBRARY_COMBO}:"
183     set temp_path="${temp_path}${dir}/Tools/${GNUSTEP_HOST_CPU}/${GNUSTEP_HOST_OS}:"
184   endif
185 end
186
187 if ( ! ${?PATH} ) then
188   setenv PATH "${temp_path}"
189 else if ( { (echo "$PATH" | fgrep -v "$temp_path" >/dev/null) } ) then
190   setenv PATH "${temp_path}${PATH}"
191 endif
192 unset temp_path dir
193
194 source "${GNUSTEP_MAKEFILES}/ld_lib_path.csh"
195
196 # FIXME/TODO - use GNUSTEP_PATHLIST here
197 set gnustep_class_path="${GNUSTEP_USER_ROOT}/Library/Libraries/Java:${GNUSTEP_LOCAL_ROOT}/Library/Libraries/Java:${GNUSTEP_NETWORK_ROOT}/Library/Libraries/Java:${GNUSTEP_SYSTEM_ROOT}/Library/Libraries/Java"
198
199 if ( ! ${?CLASSPATH} ) then
200   setenv CLASSPATH "${gnustep_class_path}"
201 else if ( { (echo "${CLASSPATH}" | fgrep -v "${gnustep_class_path}" >/dev/null) } ) then
202   setenv CLASSPATH "${CLASSPATH}:${gnustep_class_path}"
203 endif
204
205 unset gnustep_class_path
206
207 set gnustep_guile_path="${GNUSTEP_USER_ROOT}/Libraries/Guile:${GNUSTEP_LOCAL_ROOT}/Libraries/Guile:${GNUSTEP_NETWORK_ROOT}/Libraries/Guile:${GNUSTEP_SYSTEM_ROOT}/Libraries/Guile"
208
209 if ( $?GUILE_LOAD_PATH == 0 ) then
210     setenv GUILE_LOAD_PATH "${gnustep_guile_path}"
211 else if ( { (echo "${GUILE_LOAD_PATH}" | fgrep -v "${gnustep_guile_path}" >/dev/null) } ) then
212     setenv GUILE_LOAD_PATH "${gnustep_guile_path}:${GUILE_LOAD_PATH}"
213 endif
214
215 unset gnustep_guile_path
216
217 #
218 # Perform any user initialization
219 #
220 if ( -e "$GNUSTEP_USER_ROOT/GNUstep.csh" ) then
221   source "$GNUSTEP_USER_ROOT/GNUstep.csh"
222 endif
223