mirror of
https://github.com/gnustep/tools-make.git
synced 2025-05-13 23:10:56 +00:00
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@5107 72102866-910b-0410-8b05-ffd578937521
163 lines
4.8 KiB
Bash
163 lines
4.8 KiB
Bash
#!/bin/sh
|
|
#
|
|
# Copyright (C) 1999 Free Software Foundation, Inc.
|
|
#
|
|
# Author: Lyndon Tremblay <ltremblay@mezzanine.xnot.com>
|
|
# Based on executable.template by Adam Fedor <fedor@gnu.org>
|
|
# Date: Oct 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,
|
|
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
# This is a shell script which runs the java application
|
|
|
|
#--------------------------------------------------------------------------
|
|
# Main body
|
|
#--------------------------------------------------------------------------
|
|
|
|
# Process arguments
|
|
app=$0
|
|
|
|
if [ "$LIBRARY_COMBO" = nx ]; then
|
|
LIBRARY_COMBO=nx-nx-nx-nil
|
|
elif [ "$LIBRARY_COMBO" = gnu-xdps ]; then
|
|
LIBRARY_COMBO=gnu-gnu-gnu-xdps
|
|
elif [ "$LIBRARY_COMBO" = gnu-xgps ]; then
|
|
LIBRARY_COMBO=gnu-gnu-gnu-xgps
|
|
elif [ "$LIBRARY_COMBO" = fd-xgps ]; then
|
|
LIBRARY_COMBO=gnu-fd-gnu-xgps
|
|
elif [ "$LIBRARY_COMBO" = fd-xdps ]; then
|
|
LIBRARY_COMBO=gnu-fd-gnu-xdps
|
|
fi
|
|
export LIBRARY_COMBO
|
|
|
|
# Find path to ourself
|
|
app=`echo $app | sed 's%/*$%%'`
|
|
dir=`dirname $app`
|
|
|
|
case $app in
|
|
/*) # An absolute path.
|
|
full_appname=$dir;;
|
|
*/*) # A relative path
|
|
full_appname=`(cd $dir; pwd)`;;
|
|
*) # A path that needs to be searched
|
|
if [ -n $GNUSTEP_PATHPREFIX_LIST ]; then
|
|
SPATH=$GNUSTEP_PATHPREFIX_LIST
|
|
else
|
|
SPATH=$PATH
|
|
fi
|
|
SPATH=.:$SPATH
|
|
IFS=:
|
|
for path_dir in $SPATH; do
|
|
if [ -d $path_dir/$dir ]; then
|
|
full_appname=`(cd $path_dir/$dir; pwd)`
|
|
break;
|
|
fi
|
|
if [ -d $path_dir/Apps/$dir ]; then
|
|
full_appname=`(cd $path_dir/Apps/$dir; pwd)`
|
|
break;
|
|
fi
|
|
done;;
|
|
esac
|
|
|
|
if [ -z "$full_appname" ]; then
|
|
echo "Can't find absolute path for $app! Please specify full path when"
|
|
echo "invoking executable"
|
|
exit 1
|
|
fi
|
|
|
|
#
|
|
# get base app name
|
|
#
|
|
app=`echo $app | sed 's/\.[a-z]*$//'`
|
|
app=`basename $app`
|
|
appname=
|
|
if [ -f $full_appname/Resources/Info-gnustep.plist ]; then
|
|
appname=`grep NSExecutable $full_appname/Resources/Info-gnustep.plist`
|
|
if [ -n '$appname' ]; then
|
|
appname=`echo '$appname' | sed 's,\", ,g' | awk '{print $3}'`
|
|
fi
|
|
fi
|
|
if [ -z "$appname" ]; then
|
|
appname=$app
|
|
fi
|
|
|
|
if [ $show_available_platforms = 1 ]; then
|
|
cd $full_appname
|
|
#available_platforms
|
|
exit 0
|
|
fi
|
|
|
|
#
|
|
# Determine the host information
|
|
#
|
|
if [ -z "$GNUSTEP_HOST" ]; then
|
|
GNUSTEP_HOST=`(cd /tmp; $GNUSTEP_SYSTEM_ROOT/Makefiles/config.guess)`
|
|
export GNUSTEP_HOST
|
|
fi
|
|
if [ -z "$GNUSTEP_HOST_CPU" ]; then
|
|
GNUSTEP_HOST_CPU=`$GNUSTEP_SYSTEM_ROOT/Makefiles/cpu.sh $GNUSTEP_HOST`
|
|
GNUSTEP_HOST_CPU=`$GNUSTEP_SYSTEM_ROOT/Makefiles/clean_cpu.sh $GNUSTEP_HOST_CPU`
|
|
export GNUSTEP_HOST_CPU
|
|
fi
|
|
if [ -z "$GNUSTEP_HOST_VENDOR" ]; then
|
|
GNUSTEP_HOST_VENDOR=`$GNUSTEP_SYSTEM_ROOT/Makefiles/vendor.sh $GNUSTEP_HOST`
|
|
GNUSTEP_HOST_VENDOR=`$GNUSTEP_SYSTEM_ROOT/Makefiles/clean_vendor.sh $GNUSTEP_HOST_VENDOR`
|
|
export GNUSTEP_HOST_VENDOR
|
|
fi
|
|
if [ -z "$GNUSTEP_HOST_OS" ]; then
|
|
GNUSTEP_HOST_OS=`$GNUSTEP_SYSTEM_ROOT/Makefiles/os.sh $GNUSTEP_HOST`
|
|
GNUSTEP_HOST_OS=`$GNUSTEP_SYSTEM_ROOT/Makefiles/clean_os.sh $GNUSTEP_HOST_OS`
|
|
export GNUSTEP_HOST_OS
|
|
fi
|
|
|
|
#
|
|
# Make sure the executable is there
|
|
#
|
|
if [ -x $full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO/$appname ]; then
|
|
relative_path=$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO/$appname
|
|
elif [ -x $full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$appname ]; then
|
|
relative_path=$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$appname
|
|
elif [ -x $full_appname/$GNUSTEP_HOST_CPU/$appname ]; then
|
|
relative_path=$GNUSTEP_HOST_CPU/$appname
|
|
elif [ $appname != $app -a -x $full_appname/$appname ]; then
|
|
relative_path=$appname
|
|
else
|
|
echo "$full_appname application does not have a binary for this kind of machine/operating system."
|
|
exit 1
|
|
fi
|
|
|
|
if [ $show_relative_path = 1 ]; then
|
|
echo $relative_path
|
|
exit 0
|
|
fi
|
|
if [ $show_full_path = 1 ]; then
|
|
echo $full_appname/$relative_path
|
|
exit 0
|
|
fi
|
|
|
|
if [ "$LIBRARY_COMBO" = nx-nx-nx-nil -a $GNUSTEP_HOST_OS = nextstep4 ]; then
|
|
if [ -f "$full_appname/library_paths.openapp" ]; then
|
|
additional_library_paths="`cat $full_appname/library_paths.openapp`"
|
|
fi
|
|
else
|
|
if [ -f "$full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO/library_paths.openapp" ]; then
|
|
additional_library_paths="`cat $full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO/library_paths.openapp`"
|
|
fi
|
|
fi
|
|
|
|
# Load up LD_LIBRARY_PATH
|
|
# this needs to be PATH on NT
|
|
. $GNUSTEP_SYSTEM_ROOT/Makefiles/ld_lib_path.sh
|
|
|
|
exec $full_appname/$relative_path "$@"
|
|
|