1 #! /bin/echo This file must be sourced inside csh using: source
5 # Shell initialization for the GNUstep environment.
7 # Copyright (C) 1998-2005 Free Software Foundation, Inc.
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>
14 # This file is part of the GNUstep Makefile Package.
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.
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.
28 # Set the GNUstep system root and local root
32 # Read our configuration files
35 # Determine the location of the system configuration file
36 if ( ! ${?GNUSTEP_CONFIG_FILE} ) then
37 setenv GNUSTEP_CONFIG_FILE "@GNUSTEP_CONFIG_FILE@"
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@"
45 # Read the system configuration file
46 if ( -e "${GNUSTEP_CONFIG_FILE}" ) then
48 # Convert the config file from sh syntax to csh syntax, and execute it.
50 # We want to convert every line of the type ^xxx=yyy$ into setenv xxx yyy;
51 # and ignore any other line.
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'.
62 # The result of all this is ... something that we want to execute!
63 # We use eval to execute the results of `...`.
65 # Please note that ! must always be escaped in csh, which is why we
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.
71 eval `sed -e '/^[^#=][^#=]*=.*$/\\!d' -e 's/^\([^#=][^#=]*\)=\(.*\)$/setenv \1 \2;/' "${GNUSTEP_CONFIG_FILE}"`
74 # FIXME: determining GNUSTEP_HOME
77 # Read the user configuration file ... unless it is disabled (ie, set
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}"``
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}"`
95 # Now, set any essential variable (that is not already set) to the
97 if ( ! ${?GNUSTEP_SYSTEM_ROOT} ) then
98 setenv GNUSTEP_SYSTEM_ROOT "@GNUSTEP_SYSTEM_ROOT@"
101 if ( ! ${?GNUSTEP_LOCAL_ROOT} ) then
102 setenv GNUSTEP_LOCAL_ROOT "@GNUSTEP_LOCAL_ROOT@"
105 if ( ! ${?GNUSTEP_NETWORK_ROOT} ) then
106 setenv GNUSTEP_NETWORK_ROOT "@GNUSTEP_NETWORK_ROOT@"
110 setenv GNUSTEP_FLATTENED "@GNUSTEP_FLATTENED@"
111 if ( ! ${?LIBRARY_COMBO} ) then
112 setenv LIBRARY_COMBO "@ac_cv_library_combo@"
115 if ( ! ${?GNUSTEP_MAKEFILES} ) then
116 setenv GNUSTEP_MAKEFILES "${GNUSTEP_SYSTEM_ROOT}/Library/Makefiles"
119 if ( ! ${?GNUSTEP_USER_DIR} ) then
120 setenv GNUSTEP_USER_DIR "@GNUSTEP_USER_DIR@"
124 # Set GNUSTEP_USER_ROOT which is the variable used in practice
126 switch ("${GNUSTEP_USER_DIR}")
127 case /*: # An absolute path
128 setenv GNUSTEP_USER_ROOT "${GNUSTEP_USER_DIR}"
130 default: # Something else
131 setenv GNUSTEP_USER_ROOT "${GNUSTEP_HOME}/${GNUSTEP_USER_DIR}"
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@"
146 # Determine the host information
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}`
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}`
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}`
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}`
171 # Add the GNUstep tools directories to the path
173 if ( ! ${?GNUSTEP_PATHLIST} ) then
174 setenv GNUSTEP_PATHLIST \
175 "${GNUSTEP_USER_ROOT}:${GNUSTEP_LOCAL_ROOT}:${GNUSTEP_NETWORK_ROOT}:${GNUSTEP_SYSTEM_ROOT}"
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}:"
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}"
194 source "${GNUSTEP_MAKEFILES}/ld_lib_path.csh"
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"
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}"
205 unset gnustep_class_path
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"
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}"
215 unset gnustep_guile_path
218 # Perform any user initialization
220 if ( -e "$GNUSTEP_USER_ROOT/GNUstep.csh" ) then
221 source "$GNUSTEP_USER_ROOT/GNUstep.csh"