1997-10-02 23:05:46 +00:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
|
|
|
# ld_lib_path.sh
|
|
|
|
#
|
2001-07-06 09:37:11 +00:00
|
|
|
# Set up the LD_LIBRARY_PATH (or similar env variable for your system)
|
1997-10-02 23:05:46 +00:00
|
|
|
#
|
2002-04-04 14:26:03 +00:00
|
|
|
# Copyright (C) 1997-2002 Free Software Foundation, Inc.
|
1997-10-02 23:05:46 +00:00
|
|
|
#
|
|
|
|
# Author: Scott Christley <scottc@net-community.com>
|
1997-10-13 23:30:17 +00:00
|
|
|
# Author: Ovidiu Predescu <ovidiu@net-community.com>
|
2002-04-04 15:55:07 +00:00
|
|
|
# Rewrite: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
|
|
|
# Author: Nicola Pero <n.pero@mi.flashnet.it>
|
2002-04-04 14:26:03 +00:00
|
|
|
#
|
1997-10-02 23:05:46 +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-11-07 18:56:37 +00:00
|
|
|
# as published by the Free Software Foundation; either version 3
|
1997-10-02 23:05:46 +00:00
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public
|
2007-11-07 18:56:37 +00:00
|
|
|
# License along with this library; see the file COPYING.
|
1997-10-02 23:05:46 +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.
|
1997-10-02 23:05:46 +00:00
|
|
|
#
|
|
|
|
|
2007-02-14 13:46:52 +00:00
|
|
|
# The modern version of this file basically expects you to execute it
|
|
|
|
# inside GNUstep.sh. If not, you need to have at least the
|
|
|
|
# GNUSTEP_MAKEFILES, GNUSTEP_HOST_*, GNUSTEP_SYSTEM_LIBRARIES,
|
|
|
|
# GNUSTEP_LOCAL_LIBRARIES, etc. GNUSTEP_SYSTEM_LIBRARY,
|
|
|
|
# GNUSTEP_LOCAL_LIBRARY, etc. variables defined.
|
|
|
|
|
|
|
|
# FIXME/TODO: Update all callers to source GNUstep.sh and not this file.
|
2007-02-14 05:42:31 +00:00
|
|
|
|
2002-04-04 14:26:03 +00:00
|
|
|
# This file is sourced. This means extra care is needed when changing
|
|
|
|
# it. Please read the comments on GNUstep.sh.in before touching it.
|
|
|
|
|
2002-04-04 15:38:21 +00:00
|
|
|
lib_paths=
|
2004-04-02 07:28:02 +00:00
|
|
|
fw_paths=
|
2002-04-04 15:38:21 +00:00
|
|
|
|
2007-02-14 13:46:52 +00:00
|
|
|
# Determine the library paths
|
|
|
|
GNUSTEP_LIBRARIES_PATHLIST=`$GNUSTEP_MAKEFILES/print_unique_pathlist.sh "$GNUSTEP_USER_LIBRARIES" "$GNUSTEP_LOCAL_LIBRARIES" "$GNUSTEP_NETWORK_LIBRARIES" "$GNUSTEP_SYSTEM_LIBRARIES" $fixup_paths`
|
2002-04-04 15:38:21 +00:00
|
|
|
|
2007-02-14 13:46:52 +00:00
|
|
|
if [ "$GNUSTEP_IS_FLATTENED" = "yes" ]; then
|
|
|
|
lib_paths="$GNUSTEP_LIBRARIES_PATHLIST"
|
|
|
|
else
|
|
|
|
old_IFS="$IFS"
|
|
|
|
IFS=:
|
|
|
|
for dir in $GNUSTEP_LIBRARIES_PATHLIST; do
|
2002-04-04 15:38:21 +00:00
|
|
|
|
2007-02-14 13:46:52 +00:00
|
|
|
# prepare the path_fragment for libraries and this dir
|
|
|
|
path_fragment="$dir/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO:$dir/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS"
|
2004-04-02 07:28:02 +00:00
|
|
|
|
2007-02-14 13:46:52 +00:00
|
|
|
# Append the path_fragment to lib_paths
|
|
|
|
if [ -z "$lib_paths" ]; then
|
|
|
|
lib_paths="$path_fragment"
|
|
|
|
else
|
|
|
|
lib_paths="$lib_paths:$path_fragment"
|
|
|
|
fi
|
|
|
|
|
|
|
|
unset path_fragment
|
|
|
|
done
|
|
|
|
IFS="$old_IFS"
|
|
|
|
unset old_IFS
|
|
|
|
unset dir
|
|
|
|
fi
|
2004-04-02 07:28:02 +00:00
|
|
|
|
2007-02-14 13:46:52 +00:00
|
|
|
unset GNUSTEP_LIBRARIES_PATHLIST
|
2002-04-04 15:38:21 +00:00
|
|
|
|
2007-02-14 13:46:52 +00:00
|
|
|
# Determine the framework paths
|
|
|
|
fw_paths=`$GNUSTEP_MAKEFILES/print_unique_pathlist.sh "$GNUSTEP_USER_LIBRARY/Frameworks" "$GNUSTEP_LOCAL_LIBRARY/Frameworks" "$GNUSTEP_NETWORK_LIBRARY/Frameworks" "$GNUSTEP_SYSTEM_LIBRARY/Frameworks" $fixup_paths`
|
2002-04-04 15:38:21 +00:00
|
|
|
|
1999-09-24 19:15:22 +00:00
|
|
|
|
2007-02-14 13:46:52 +00:00
|
|
|
case "$GNUSTEP_HOST_OS" in
|
1997-10-02 23:05:46 +00:00
|
|
|
|
1997-10-13 23:30:17 +00:00
|
|
|
*nextstep4*)
|
1998-09-14 14:54:23 +00:00
|
|
|
if [ -z "$DYLD_LIBRARY_PATH" ]; then
|
2002-12-31 04:16:16 +00:00
|
|
|
DYLD_LIBRARY_PATH="$lib_paths"
|
|
|
|
else
|
|
|
|
if ( echo ${DYLD_LIBRARY_PATH}|fgrep -v "${lib_paths}" >/dev/null ); then
|
|
|
|
DYLD_LIBRARY_PATH="$lib_paths:$DYLD_LIBRARY_PATH"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
export DYLD_LIBRARY_PATH
|
|
|
|
;;
|
|
|
|
|
|
|
|
*darwin*)
|
|
|
|
if [ -z "$DYLD_LIBRARY_PATH" ]; then
|
1999-09-24 19:15:22 +00:00
|
|
|
DYLD_LIBRARY_PATH="$lib_paths"
|
1998-08-20 17:48:46 +00:00
|
|
|
else
|
1999-09-24 19:15:22 +00:00
|
|
|
if ( echo ${DYLD_LIBRARY_PATH}|fgrep -v "${lib_paths}" >/dev/null ); then
|
|
|
|
DYLD_LIBRARY_PATH="$lib_paths:$DYLD_LIBRARY_PATH"
|
|
|
|
fi
|
1998-08-20 17:48:46 +00:00
|
|
|
fi
|
1997-12-05 02:09:12 +00:00
|
|
|
export DYLD_LIBRARY_PATH
|
2004-08-24 16:46:08 +00:00
|
|
|
|
|
|
|
# The code below has been temporarily removed, because...
|
2005-04-15 22:48:30 +00:00
|
|
|
# Frameworks in GNUstep-make are supported by creating a link like
|
|
|
|
#
|
|
|
|
# Libraries/libMyFramework.dylib ->
|
|
|
|
# Frameworks/MyFramework.framework/Versions/Current/libMyFramework.dylib,
|
|
|
|
#
|
|
|
|
# to mitigate the fact that FSF GCC does not support a -framework flag.
|
|
|
|
#
|
|
|
|
# On Darwin, however, we partially emulate -framework by setting the
|
|
|
|
# "install_name" to the framework name during linking. The dynamic
|
|
|
|
# linker (dyld) is smart enough to find the framework under this name,
|
|
|
|
# but only if DYLD_FRAMEWORK_PATH is set (unless we set the
|
|
|
|
# "install_name" to an absolute path, which we don't). We'd really like
|
|
|
|
# to fully support -framework, though.
|
|
|
|
#
|
|
|
|
# Use otool -L MyApplication.app/MyApplication, for instance, to see
|
|
|
|
# how the shared libraries/frameworks are linked.
|
2004-08-24 16:46:08 +00:00
|
|
|
#
|
|
|
|
# if [ "$LIBRARY_COMBO" = "apple-apple-apple" -o \
|
2005-04-15 22:48:30 +00:00
|
|
|
# "$LIBRARY_COMBO" = "apple" ]; then
|
2004-08-24 16:46:08 +00:00
|
|
|
|
2004-06-07 14:54:18 +00:00
|
|
|
if [ -z "$DYLD_FRAMEWORK_PATH" ]; then
|
|
|
|
DYLD_FRAMEWORK_PATH="$fw_paths"
|
|
|
|
else
|
|
|
|
if ( echo ${DYLD_FRAMEWORK_PATH}|
|
|
|
|
fgrep -v "${fw_paths}" >/dev/null ); then
|
|
|
|
DYLD_FRAMEWORK_PATH="$fw_paths:$DYLD_FRAMEWORK_PATH"
|
2004-04-02 07:28:02 +00:00
|
|
|
fi
|
|
|
|
fi
|
2004-06-07 14:54:18 +00:00
|
|
|
export DYLD_FRAMEWORK_PATH;;
|
1997-10-02 23:05:46 +00:00
|
|
|
|
2000-04-06 15:01:12 +00:00
|
|
|
*hpux*)
|
|
|
|
if [ -z "$SHLIB_PATH" ]; then
|
|
|
|
SHLIB_PATH="$lib_paths"
|
|
|
|
else
|
|
|
|
if ( echo ${SHLIB_PATH}|fgrep -v "${lib_paths}" >/dev/null ); then
|
|
|
|
SHLIB_PATH="$lib_paths:$SHLIB_PATH"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
export SHLIB_PATH;
|
|
|
|
if [ -z "$LD_LIBRARY_PATH" ]; then
|
|
|
|
LD_LIBRARY_PATH="$lib_paths"
|
|
|
|
else
|
2000-11-15 05:03:14 +00:00
|
|
|
if ( echo ${LD_LIBRARY_PATH}| grep -v "${lib_paths}" >/dev/null ); then
|
2000-04-06 15:01:12 +00:00
|
|
|
LD_LIBRARY_PATH="$lib_paths:$LD_LIBRARY_PATH"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
export LD_LIBRARY_PATH;;
|
|
|
|
|
1997-10-13 23:30:17 +00:00
|
|
|
*)
|
1998-09-14 14:54:23 +00:00
|
|
|
if [ -z "$LD_LIBRARY_PATH" ]; then
|
1999-09-24 19:15:22 +00:00
|
|
|
LD_LIBRARY_PATH="$lib_paths"
|
1998-08-20 17:48:46 +00:00
|
|
|
else
|
2000-11-15 05:03:14 +00:00
|
|
|
if ( echo ${LD_LIBRARY_PATH}| grep -v "${lib_paths}" >/dev/null ); then
|
1999-09-24 19:15:22 +00:00
|
|
|
LD_LIBRARY_PATH="$lib_paths:$LD_LIBRARY_PATH"
|
|
|
|
fi
|
1997-10-15 22:45:58 +00:00
|
|
|
fi
|
1997-10-13 23:30:17 +00:00
|
|
|
export LD_LIBRARY_PATH;;
|
1997-10-02 23:05:46 +00:00
|
|
|
|
1997-10-13 23:30:17 +00:00
|
|
|
esac
|
1997-10-02 23:05:46 +00:00
|
|
|
|
2002-01-11 12:35:05 +00:00
|
|
|
unset lib_paths
|
2004-04-02 07:28:02 +00:00
|
|
|
unset fw_paths
|
2002-01-11 12:35:05 +00:00
|
|
|
|