1 #! /bin/echo This file must be sourced inside (ba)sh using: .
5 # Shell script resetting the GNUstep environment variables
7 # Copyright (C) 2002 Free Software Foundation, Inc.
9 # Author: Nicola Pero <n.pero@mi.flashnet.it>
11 # This file is part of the GNUstep Makefile Package.
13 # This library is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License
15 # as published by the Free Software Foundation; either version 2
16 # of the License, or (at your option) any later version.
18 # You should have received a copy of the GNU General Public
19 # License along with this library; see the file COPYING.LIB.
20 # If not, write to the Free Software Foundation,
21 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 # This file is used to reset your environment. This is needed if you
25 # want to change LIBRARY_COMBO. You first reset your environment, then
26 # set a new LIBRARY_COMBO variable, then source GNUstep.sh again.
28 # This file resets variables in reverse order as they are set in the
31 # This function resets a path.
32 # The only argument is the name of the path variable to be reset. All
33 # paths beginning with GNUSTEP_SYSTEM_ROOT, GNUSTEP_LOCAL_ROOT,
34 # GNUSTEP_NETWORK_ROOT and GNUSTEP_USER_ROOT are removed from the path
35 # variable (yes, we are rather crude). All other paths are kept
39 # Declare local variables
40 local original_path tmp_IFS temp_path dir gnustep_dir found
42 # NB: We need to use eval because we want to access a variable
43 # whose name is another variable!
44 original_path=$(eval echo \$$1)
49 for dir in $original_path; do
50 # For each of them, keep it only if it's not beginning with
51 # a path in GNUSTEP_PATHLIST as prefix
53 for gnustep_dir in $GNUSTEP_PATHLIST; do
54 if [ -n "$gnustep_dir" ]; then
56 $gnustep_dir*) found=yes; break;;
61 if [ "$found" = "no" ]; then
62 if [ -z "$temp_path" ]; then
65 temp_path="$temp_path:$dir"
71 # Not set the path variable.
73 # Export it only if non empty, otherwise remove it completely from
74 # the shell environment.
75 temp_path=`eval echo \$"$1"`
76 if [ -z "$temp_path" ]; then
84 reset_path GUILE_LOAD_PATH
85 reset_path LD_LIBRARY_PATH
86 reset_path DYLD_LIBRARY_PATH
87 reset_path DYLD_FRAMEWORK_PATH
90 # Make sure we destroy the reset_path function after using it - we don't
91 # want to pollute the environment with it.
94 unset GNUSTEP_PATHLIST
95 unset GNUSTEP_USER_ROOT
97 unset GNUSTEP_HOST_VENDOR
98 unset GNUSTEP_HOST_CPU
100 unset GNUSTEP_NETWORK_ROOT
101 unset GNUSTEP_LOCAL_ROOT
102 unset GNUSTEP_MAKEFILES
103 unset GNUSTEP_FLATTENED
104 unset GNUSTEP_SYSTEM_ROOT