1999-02-18 06:22:33 +00:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
2002-05-02 15:07:49 +00:00
|
|
|
# @configure_input@
|
|
|
|
#
|
1999-02-18 06:22:33 +00:00
|
|
|
# Copyright (C) 1997, 1999 Free Software Foundation, Inc.
|
|
|
|
#
|
|
|
|
# Author: Scott Predescu <ovidiu@net-community.com>
|
|
|
|
# Author: Ovidiu Predescu <ovidiu@net-community.com>
|
|
|
|
# Date: February 1999
|
|
|
|
#
|
|
|
|
# This file is part of the GNUstep Makefile Package.
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public
|
|
|
|
# License along with this library; see the file COPYING.LIB.
|
|
|
|
# If not, write to the Free Software Foundation,
|
2005-05-22 03:20:14 +00:00
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
1999-02-18 06:22:33 +00:00
|
|
|
|
|
|
|
# Try to execute the GNUstep tool passed as argument. The tool is
|
|
|
|
# searched through the GNUstep directories if a complete or relative path name
|
|
|
|
# is not specified. The arguments passed after the tool name are passed
|
|
|
|
# unmodified to the tool.
|
|
|
|
|
2002-06-19 03:46:08 +00:00
|
|
|
if [ -z "$GNUSTEP_PATHLIST" ]; then
|
|
|
|
echo "The GNUSTEP_PATHLIST environment variable is missing."
|
2002-02-04 16:21:08 +00:00
|
|
|
echo "Did you forget to set up your environment using GNUstep.sh ?"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
1999-02-18 06:22:33 +00:00
|
|
|
if [ -z "$1" ]; then
|
2003-05-14 15:10:22 +00:00
|
|
|
echo usage: `basename "$0"` [--library-combo=...] tool [arguments...]
|
|
|
|
echo `basename "$0"` --help for help
|
1999-02-18 06:22:33 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$EXEEXT" ]; then
|
|
|
|
EXEEXT=@EXEEXT@
|
|
|
|
fi
|
|
|
|
|
|
|
|
# traps the parameters
|
2002-06-25 18:01:46 +00:00
|
|
|
while true
|
|
|
|
do
|
2003-05-14 15:10:22 +00:00
|
|
|
case "$1" in
|
2002-06-25 18:01:46 +00:00
|
|
|
--library-combo=*)
|
|
|
|
tmp_root="$GNUSTEP_SYSTEM_ROOT"
|
2003-04-28 02:29:49 +00:00
|
|
|
. "$tmp_root/@MAKEFILES_SUFFIX@/GNUstep-reset.sh"
|
2003-05-14 15:10:22 +00:00
|
|
|
LIBRARY_COMBO=`echo "$1" | sed 's/--library-combo=//'`
|
2003-04-28 02:29:49 +00:00
|
|
|
. "$tmp_root/@MAKEFILES_SUFFIX@/GNUstep.sh"
|
2002-06-25 18:01:46 +00:00
|
|
|
echo "Switched to library combo $LIBRARY_COMBO"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--help)
|
2003-05-14 15:10:22 +00:00
|
|
|
echo usage: `basename "$0"` [--library-combo=...] tool [arguments...]
|
2002-06-25 18:01:46 +00:00
|
|
|
echo
|
|
|
|
echo tool is the complete or relative name of the tool executable
|
|
|
|
echo without any extension, like defaults
|
|
|
|
echo
|
|
|
|
echo [arguments...] are the arguments to the tool.
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
break;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2003-05-14 15:10:22 +00:00
|
|
|
tool="$1";
|
2002-06-25 18:01:46 +00:00
|
|
|
shift;
|
1999-02-18 06:22:33 +00:00
|
|
|
|
2001-05-17 23:45:29 +00:00
|
|
|
if [ -n "$EXEEXT" ]; then
|
2003-05-14 15:10:22 +00:00
|
|
|
tool="$tool$EXEEXT"
|
1999-02-18 06:22:33 +00:00
|
|
|
fi
|
|
|
|
|
2003-05-14 15:10:22 +00:00
|
|
|
case "$tool" in
|
1999-02-18 06:22:33 +00:00
|
|
|
/*) # An absolute path.
|
2003-05-14 15:10:22 +00:00
|
|
|
full_toolname="$tool";;
|
1999-02-18 06:22:33 +00:00
|
|
|
*/*) # A relative path
|
2003-05-14 15:10:22 +00:00
|
|
|
tool_dir="`dirname \"$tool\"`";
|
|
|
|
tool_dir="`(cd \"$tool_dir\"; pwd)`";
|
|
|
|
tool_name="`basename \"$tool\"`";
|
|
|
|
full_toolname="${tool_dir}/${tool_name}";;
|
1999-02-18 06:22:33 +00:00
|
|
|
*) # A path that should be searched into GNUstep tool paths
|
2000-12-06 06:48:04 +00:00
|
|
|
|
2001-11-09 13:39:58 +00:00
|
|
|
# Search for a local tool
|
1999-02-18 06:59:33 +00:00
|
|
|
|
2001-11-09 13:39:58 +00:00
|
|
|
# We used to scan all ./*/$(GNUSTEP_HOST_LDIR)/ directories,
|
|
|
|
# but this facility was removed (GNUSTEP_HOST_LDIR is no
|
|
|
|
# longer even defined in this file), now we perform a much
|
|
|
|
# simpler search.
|
|
|
|
|
|
|
|
# The really important one is looking into ./obj, anyway here
|
|
|
|
# is the order in which we search local directories -
|
|
|
|
# First, we search in ./
|
|
|
|
# Second, we search in ./obj
|
|
|
|
# Third, we search in ./Tools/
|
|
|
|
# Fourth, we search in ./Tools/obj
|
|
|
|
for dir in . obj Tools Tools/obj; do
|
|
|
|
# echo "$dir/$tool";
|
|
|
|
if [ -x "$dir/$tool" ]; then
|
2003-05-14 15:10:22 +00:00
|
|
|
full_toolname="$dir/$tool"
|
2001-11-09 13:39:58 +00:00
|
|
|
# echo "Found: $dir/$tool";
|
2001-04-13 19:49:16 +00:00
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done
|
2001-11-09 13:39:58 +00:00
|
|
|
|
|
|
|
if [ -z "$full_toolname" ]; then
|
|
|
|
|
|
|
|
# Local tool not found - Search for an installed one
|
2002-06-19 03:46:08 +00:00
|
|
|
# we search in GNUSTEP_PATHLIST, which means we
|
2001-11-09 13:39:58 +00:00
|
|
|
# search in the order in:
|
|
|
|
# GNUSTEP_USER_ROOT
|
|
|
|
# GNUSTEP_LOCAL_ROOT
|
|
|
|
# GNUSTEP_NETWORK_ROOT
|
|
|
|
# GNUSTEP_SYSTEM_ROOT
|
2002-02-04 16:05:41 +00:00
|
|
|
#
|
|
|
|
# We look in the GNUSTEP_HOST_CPU/GNUSTEP_HOST_OS/LIBRARY_COMBO
|
|
|
|
# subdirectory first, then the GNUSTEP_HOST_CPU/GNUSTEP_HOST_OS
|
|
|
|
# subdirectory, then the top-level directory.
|
|
|
|
# (For flattened systems we skip the first two options.
|
|
|
|
#
|
2002-06-19 03:46:08 +00:00
|
|
|
if [ -n "$GNUSTEP_PATHLIST" ]; then
|
2003-05-14 15:10:22 +00:00
|
|
|
SPATH="$GNUSTEP_PATHLIST"
|
2002-02-04 16:05:41 +00:00
|
|
|
IFS=:
|
|
|
|
for dir in $SPATH; do
|
2003-05-14 15:10:22 +00:00
|
|
|
tmpdir="$dir/Tools"
|
2002-02-04 16:05:41 +00:00
|
|
|
if [ -z "$GNUSTEP_FLATTENED" ]; then
|
2003-05-14 15:10:22 +00:00
|
|
|
tmpgnudir="$dir/Tools/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS"
|
|
|
|
tmplibdir="$tmpgnudir/$LIBRARY_COMBO"
|
2002-06-25 18:01:46 +00:00
|
|
|
# echo "$tmplibdir/$tool";
|
2002-02-04 16:05:41 +00:00
|
|
|
if [ -x "$tmplibdir/$tool" ]; then
|
2002-06-25 18:01:46 +00:00
|
|
|
# echo "Found: $tmplibdir/$tool";
|
2003-05-14 15:10:22 +00:00
|
|
|
full_toolname="$tmplibdir/$tool"
|
2002-02-04 16:05:41 +00:00
|
|
|
break;
|
|
|
|
fi
|
|
|
|
if [ -x "$tmpgnudir/$tool" ]; then
|
2002-06-25 18:01:46 +00:00
|
|
|
# echo "Found: $tmpgnudir/$tool";
|
2003-05-14 15:10:22 +00:00
|
|
|
full_toolname="$tmpgnudir/$tool"
|
2002-02-04 16:05:41 +00:00
|
|
|
break;
|
|
|
|
fi
|
|
|
|
fi
|
2002-06-25 18:01:46 +00:00
|
|
|
# echo "$tmpdir/$tool";
|
2002-02-04 16:05:41 +00:00
|
|
|
if [ -x "$tmpdir/$tool" ]; then
|
2002-06-25 18:01:46 +00:00
|
|
|
# echo "Found: $tmpdir/$tool";
|
2003-05-14 15:10:22 +00:00
|
|
|
full_toolname="$tmpdir/$tool"
|
2002-02-04 16:05:41 +00:00
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
unset tmpdir
|
|
|
|
unset tmpgnudir
|
|
|
|
unset tmplibdir
|
|
|
|
IFS=" "
|
2001-11-09 13:39:58 +00:00
|
|
|
fi
|
|
|
|
fi
|
2001-04-13 19:49:16 +00:00
|
|
|
;;
|
1999-02-18 06:22:33 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
if [ -z "$full_toolname" ]; then
|
|
|
|
echo "Can't find the required tool: $tool!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
IFS=" "
|
2002-03-26 17:37:24 +00:00
|
|
|
exec "$full_toolname" "$@"
|