1999-02-18 06:22:33 +00:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
2002-05-02 15:07:49 +00:00
|
|
|
# @configure_input@
|
|
|
|
#
|
2007-02-14 03:40:30 +00:00
|
|
|
# Copyright (C) 1997 - 2007 Free Software Foundation, Inc.
|
1999-02-18 06:22:33 +00:00
|
|
|
#
|
|
|
|
# Author: Scott Predescu <ovidiu@net-community.com>
|
|
|
|
# Author: Ovidiu Predescu <ovidiu@net-community.com>
|
2007-02-14 03:40:30 +00:00
|
|
|
# Author: Nicola Pero <nicola.pero@meta-innovation.com>
|
|
|
|
# Date: 1997 - 2007
|
1999-02-18 06:22:33 +00:00
|
|
|
#
|
|
|
|
# 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
|
2007-10-30 14:18:41 +00:00
|
|
|
# as published by the Free Software Foundation; either version 3
|
1999-02-18 06:22:33 +00:00
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public
|
2007-07-13 10:11:48 +00:00
|
|
|
# License along with this library; see the file COPYING.
|
1999-02-18 06:22:33 +00:00
|
|
|
# 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
|
|
|
|
2006-10-02 15:54:56 +00:00
|
|
|
# 'opentool' is obsolete. You can invoke your tools directly, just
|
|
|
|
# put them in your PATH :-)
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2007-02-14 03:40:30 +00:00
|
|
|
# Try to determine GNUSTEP_MAKEFILES to source GNUstep.sh
|
2005-12-02 09:09:00 +00:00
|
|
|
if [ -z "$GNUSTEP_CONFIG_FILE" ]; then
|
|
|
|
GNUSTEP_CONFIG_FILE=@GNUSTEP_CONFIG_FILE@
|
|
|
|
fi
|
|
|
|
|
2007-02-14 03:40:30 +00:00
|
|
|
if [ -z "$GNUSTEP_USER_CONFIG_FILE" ]; then
|
|
|
|
GNUSTEP_USER_CONFIG_FILE=@GNUSTEP_USER_CONFIG_FILE@
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f "$GNUSTEP_CONFIG_FILE" ]; then
|
|
|
|
. "$GNUSTEP_CONFIG_FILE"
|
|
|
|
fi
|
|
|
|
|
|
|
|
GNUSTEP_HOME=~
|
|
|
|
|
|
|
|
if [ -n "$GNUSTEP_USER_CONFIG_FILE" ]; then
|
|
|
|
case "$GNUSTEP_USER_CONFIG_FILE" in
|
|
|
|
/*) # An absolute path
|
|
|
|
if [ -f "$GNUSTEP_USER_CONFIG_FILE" ]; then
|
|
|
|
. "$GNUSTEP_USER_CONFIG_FILE"
|
|
|
|
fi;;
|
|
|
|
*) # Something else
|
|
|
|
if [ -f "$GNUSTEP_HOME/$GNUSTEP_USER_CONFIG_FILE" ]; then
|
|
|
|
. "$GNUSTEP_HOME/$GNUSTEP_USER_CONFIG_FILE"
|
|
|
|
fi;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$GNUSTEP_MAKEFILES" ]; then
|
|
|
|
GNUSTEP_MAKEFILES=@GNUSTEP_MAKEFILES@
|
|
|
|
fi
|
|
|
|
# OK, we now have GNUSTEP_MAKEFILES, source GNUstep.sh.
|
|
|
|
|
|
|
|
# Also, we'd like to get the GNUSTEP_*_TOOLS directories so we can
|
|
|
|
# search them, so tell GNUstep.sh to export all variabes.
|
|
|
|
GNUSTEP_SH_EXPORT_ALL_VARIABLES=yes
|
|
|
|
. $GNUSTEP_MAKEFILES/GNUstep.sh
|
|
|
|
unset GNUSTEP_SH_EXPORT_ALL_VARIABLES
|
|
|
|
|
2005-11-21 06:47:48 +00:00
|
|
|
|
1999-02-18 06:22:33 +00:00
|
|
|
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=*)
|
2005-10-12 20:45:14 +00:00
|
|
|
tmp_makefiles="$GNUSTEP_MAKEFILES"
|
|
|
|
. "$tmp_makefiles/GNUstep-reset.sh"
|
2003-05-14 15:10:22 +00:00
|
|
|
LIBRARY_COMBO=`echo "$1" | sed 's/--library-combo=//'`
|
2005-10-12 20:45:14 +00:00
|
|
|
. "$tmp_makefiles/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
|
2007-12-20 04:02:20 +00:00
|
|
|
tool_dir=`dirname "$tool"`;
|
|
|
|
tool_dir=`(cd "$tool_dir"; pwd)`;
|
|
|
|
tool_name=`basename "$tool"`;
|
2003-05-14 15:10:22 +00:00
|
|
|
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
|
2005-11-21 06:47:48 +00:00
|
|
|
# we search in the order in:
|
2007-02-14 03:40:30 +00:00
|
|
|
# GNUSTEP_USER_TOOLS
|
|
|
|
# GNUSTEP_LOCAL_TOOLS
|
|
|
|
# GNUSTEP_NETWORK_TOOLS
|
|
|
|
# GNUSTEP_SYSTEM_TOOLS
|
2002-02-04 16:05:41 +00:00
|
|
|
#
|
2016-06-25 07:12: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
|
2002-02-04 16:05:41 +00:00
|
|
|
# subdirectory, then the top-level directory.
|
|
|
|
# (For flattened systems we skip the first two options.
|
|
|
|
#
|
2007-02-16 20:14:44 +00:00
|
|
|
# TODO: Also search Admin Tools directories if appropriate
|
2007-02-14 03:40:30 +00:00
|
|
|
for dir in "$GNUSTEP_USER_TOOLS" "$GNUSTEP_LOCAL_TOOLS" "$GNUSTEP_NETWORK_TOOLS" "$GNUSTEP_SYSTEM_TOOLS" ; do
|
2006-10-02 15:54:56 +00:00
|
|
|
if [ "$GNUSTEP_IS_FLATTENED" = "no" ]; then
|
2016-06-25 07:12:41 +00:00
|
|
|
tmpgnudir="$dir/$GNUSTEP_HOST_CPU-$GNUSTEP_HOST_OS"
|
|
|
|
tmplibdir="$dir/$GNUSTEP_HOST_CPU-$GNUSTEP_HOST_OS/$LIBRARY_COMBO"
|
2005-11-21 06:47:48 +00:00
|
|
|
# echo "$tmplibdir/$tool";
|
|
|
|
if [ -x "$tmplibdir/$tool" ]; then
|
|
|
|
# echo "Found: $tmplibdir/$tool";
|
|
|
|
full_toolname="$tmplibdir/$tool"
|
|
|
|
break;
|
2002-02-04 16:05:41 +00:00
|
|
|
fi
|
2005-11-21 06:47:48 +00:00
|
|
|
if [ -x "$tmpgnudir/$tool" ]; then
|
|
|
|
# echo "Found: $tmpgnudir/$tool";
|
|
|
|
full_toolname="$tmpgnudir/$tool"
|
2002-02-04 16:05:41 +00:00
|
|
|
break;
|
|
|
|
fi
|
2005-11-21 06:47:48 +00:00
|
|
|
fi
|
2007-02-14 03:40:30 +00:00
|
|
|
# echo "$dir/$tool";
|
|
|
|
if [ -x "$dir/$tool" ]; then
|
|
|
|
# echo "Found: $dir/$tool";
|
|
|
|
full_toolname="$dir/$tool"
|
2005-11-21 06:47:48 +00:00
|
|
|
break;
|
|
|
|
fi
|
2002-02-04 16:05:41 +00:00
|
|
|
done
|
|
|
|
unset tmpgnudir
|
|
|
|
unset tmplibdir
|
2005-11-21 06:47:48 +00:00
|
|
|
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
|
|
|
|
|
2005-11-21 06:47:48 +00:00
|
|
|
"$full_toolname" "$@"
|
|
|
|
|