From 23588b47e809ee77b32cf4dd681a2c3e58ca22b8 Mon Sep 17 00:00:00 2001 From: Scott Christley Date: Thu, 2 Oct 1997 23:05:46 +0000 Subject: [PATCH] Add support for the dynamic loader environment variable. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@2475 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 11 +++++++++++ common.make | 18 ++++++++++++++++++ ld_lib_path.sh | 39 +++++++++++++++++++++++++++++++++++++++ rules.make | 6 ++++++ target.make | 5 +++++ test.make | 31 +++++++++++++++++++------------ 6 files changed, 98 insertions(+), 12 deletions(-) create mode 100755 ld_lib_path.sh diff --git a/ChangeLog b/ChangeLog index 51743781..c02dea4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ Thu Oct 2 14:56:08 1997 Scott Christley + * ld_lib_path.sh: New file. + * common.make: Add variables which define explicit paths to the + system, local, and user library directories. + * rules.make (ALL_LD_LIB_DIRS): Variable which specifies the + standard GNUstep and the user's specific directories of where + the dynamic loader can find shared libraries. + * target.make (LD_LIB_PATH): Call shell script which returns the + name of the environment variable used by the dynamic loader. + * test.make: Set the dynamic loader environment variable + when running tests. + * test.make: New file. * rules.make: Add test building and check rules. * Makefile.in: Install test.make. diff --git a/common.make b/common.make index 3b5246cb..51363f75 100644 --- a/common.make +++ b/common.make @@ -36,6 +36,8 @@ CLEAN_CPU_SCRIPT = $(GNUSTEP_SYSTEM_ROOT)/Makefiles/clean_cpu.sh CLEAN_VENDOR_SCRIPT = $(GNUSTEP_SYSTEM_ROOT)/Makefiles/clean_vendor.sh CLEAN_OS_SCRIPT = $(GNUSTEP_SYSTEM_ROOT)/Makefiles/clean_os.sh +LD_LIB_PATH_SCRIPT = $(GNUSTEP_SYSTEM_ROOT)/Makefiles/ld_lib_path.sh + # # Scripts used for installing data and program files # @@ -74,6 +76,20 @@ GNUSTEP_LIBRARIES = $(GNUSTEP_TARGET_LIBRARIES)/$(LIBRARY_COMBO) GNUSTEP_RESOURCES = $(GNUSTEP_LIBRARIES_ROOT)/Resources GNUSTEP_MAKEFILES = $(GNUSTEP_SYSTEM_ROOT)/Makefiles +# In case we need to explicitly reference +# the system, local, and user library directories +GNUSTEP_SYSTEM_LIBRARIES_ROOT = $(GNUSTEP_SYSTEM_ROOT)/Libraries +GNUSTEP_SYSTEM_TARGET_LIBRARIES = $(GNUSTEP_SYSTEM_LIBRARIES_ROOT)/$(GNUSTEP_TARGET_DIR) +GNUSTEP_SYSTEM_LIBRARIES = $(GNUSTEP_SYSTEM_TARGET_LIBRARIES)/$(LIBRARY_COMBO) + +GNUSTEP_LOCAL_LIBRARIES_ROOT = $(GNUSTEP_LOCAL_ROOT)/Libraries +GNUSTEP_LOCAL_TARGET_LIBRARIES = $(GNUSTEP_LOCAL_LIBRARIES_ROOT)/$(GNUSTEP_TARGET_DIR) +GNUSTEP_LOCAL_LIBRARIES = $(GNUSTEP_LOCAL_TARGET_LIBRARIES)/$(LIBRARY_COMBO) + +GNUSTEP_USER_LIBRARIES_ROOT = $(GNUSTEP_USER_ROOT)/Libraries +GNUSTEP_USER_TARGET_LIBRARIES = $(GNUSTEP_USER_LIBRARIES_ROOT)/$(GNUSTEP_TARGET_DIR) +GNUSTEP_USER_LIBRARIES = $(GNUSTEP_USER_TARGET_LIBRARIES)/$(LIBRARY_COMBO) + # # Determine Foundation header subdirectory based upon library combo # @@ -184,3 +200,5 @@ INTERNAL_LDFLAGS += $(LDFLAGS) GNUSTEP_OBJ_PREFIX = $(shell echo $(OBJ_DIR_PREFIX) | sed 's/ //g') GNUSTEP_OBJ_DIR = $(GNUSTEP_OBJ_PREFIX)/$(GNUSTEP_TARGET_DIR)/$(LIBRARY_COMBO) +# The standard GNUstep directories for finding shared libraries +GNUSTEP_LD_LIB_DIRS=$(GNUSTEP_USER_LIBRARIES):$(GNUSTEP_LOCAL_LIBRARIES):$(GNUSTEP_SYSTEM_LIBRARIES) \ No newline at end of file diff --git a/ld_lib_path.sh b/ld_lib_path.sh new file mode 100755 index 00000000..5acc8aa5 --- /dev/null +++ b/ld_lib_path.sh @@ -0,0 +1,39 @@ +#! /bin/sh +# +# ld_lib_path.sh +# +# Return the name of the environment variable for the operating +# system that is used by the dynamic loader. +# +# Copyright (C) 1997 Free Software Foundation, Inc. +# +# Author: Scott Christley +# +# 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. +# + +# The first (and only) parameter to this script is the canonical +# operating system name + +# LD_LIBRARY_PATH is the default name +ld_lib_path="LD_LIBRARY_PATH" + +case "$1" in + + *nextstep4*) + ld_lib_path="DYLD_LIBRARY_PATH" + ;; + +esac + +echo $ld_lib_path diff --git a/rules.make b/rules.make index 2f3dc05f..47fc956e 100644 --- a/rules.make +++ b/rules.make @@ -162,28 +162,34 @@ ALL_TEST_GUI_LIBS = $(ADDITIONAL_GUI_LIBS) $(BACKEND_LIBS) $(GUI_LIBS) \ ADDITIONAL_LIB_DIRS="$($*_LIB_DIRS)" # These are for running the tests +ALL_LD_LIB_DIRS = $(ADDITIONAL_LD_LIB_DIRS)$(GNUSTEP_LD_LIB_DIRS) + %.checklib : FORCE @echo Checking $*... $(MAKE) --no-print-directory internal-check-lib \ TEST_LIBRARY_NAME=$* \ + ADDITIONAL_LD_LIB_DIRS="$($*_LD_LIB_DIRS)" \ CHECK_SCRIPT_DIRS="$($*_SCRIPT_DIRS)" %.checkbundle : FORCE @echo Checking $*... $(MAKE) --no-print-directory internal-check-bundle \ TEST_BUNDLE_NAME=$* \ + ADDITIONAL_LD_LIB_DIRS="$($*_LD_LIB_DIRS)" \ CHECK_SCRIPT_DIRS="$($*_SCRIPT_DIRS)" %.checktool : FORCE @echo Checking $*... $(MAKE) --no-print-directory internal-check-tool \ TEST_TOOL_NAME=$* \ + ADDITIONAL_LD_LIB_DIRS="$($*_LD_LIB_DIRS)" \ CHECK_SCRIPT_DIRS="$($*_SCRIPT_DIRS)" %.checkapp : FORCE @echo Checking $*... $(MAKE) --no-print-directory internal-check-app \ TEST_APP_NAME=$* \ + ADDITIONAL_LD_LIB_DIRS="$($*_LD_LIB_DIRS)" \ CHECK_SCRIPT_DIRS="$($*_SCRIPT_DIRS)" # diff --git a/target.make b/target.make index a113a0e8..298aa424 100644 --- a/target.make +++ b/target.make @@ -58,6 +58,11 @@ endif # include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/clean.make +# +# Determine the environment variable name used by the dynamic loader +# +LD_LIB_PATH := $(shell $(LD_LIB_PATH_SCRIPT) $(GNUSTEP_HOST_OS)) + # # Host and target specific settings # diff --git a/test.make b/test.make index eddc4587..970d2e4c 100644 --- a/test.make +++ b/test.make @@ -65,6 +65,9 @@ include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/rules.make # xxx_LIB_DIRS and xxx_LIBS are additional libraries directories and # libraries to link against, respectively to link the xxx test driver. # +# xxx_LD_LIB_DIRS are additional directories that the dynamic loader +# should check when loading a shared library. +# TEST_LIBRARY_LIST := $(foreach lib,$(TEST_LIBRARY_NAME),$(lib).testlib) CHECK_LIBRARY_LIST := $(foreach lib,$(TEST_LIBRARY_NAME),$(lib).checklib) @@ -140,19 +143,19 @@ internal-test-build:: test-libs test-bundles test-tools test-apps test-libs:: $(TEST_LIBRARY_LIST) -test-bundles:: +test-bundles:: $(TEST_BUNDLE_LIST) test-tools:: $(TEST_TOOL_LIST) -test-apps:: +test-apps:: $(TEST_APP_LIST) internal-testlib-all:: $(GNUSTEP_OBJ_DIR)/stamp-testlib-$(TEST_LIBRARY_NAME) -internal-testbundle-all:: +internal-testbundle-all:: $(GNUSTEP_OBJ_DIR)/stamp-testbundle-$(TEST_BUNDLE_NAME) internal-testtool-all:: $(GNUSTEP_OBJ_DIR)/stamp-testtool-$(TEST_TOOL_NAME) -internal-testapp-all:: +internal-testapp-all:: $(GNUSTEP_OBJ_DIR)/stamp-testapp-$(TEST_APP_NAME) # # Check targets (actually running the tests) @@ -162,28 +165,32 @@ internal-check:: config/unix.exp check-libs check-bundles check-tools check-apps check-libs:: $(CHECK_LIBRARY_LIST) -check-bundles:: +check-bundles:: $(CHECK_BUNDLE_LIST) -check-tools:: +check-tools:: $(CHECK_TOOL_LIST) -check-apps:: +check-apps:: $(CHECK_APP_LIST) internal-check-lib:: for f in $(CHECK_SCRIPT_DIRS); do \ - runtest --tool $$f --srcdir . PROG=./$(TEST_LIBRARY_NAME) ; \ + ($(LD_LIB_PATH)=$(ALL_LD_LIB_DIRS); export $(LD_LIB_PATH); \ + runtest --tool $$f --srcdir . PROG=./$(TEST_LIBRARY_NAME)) ; \ done internal-check-bundle:: for f in $(CHECK_SCRIPT_DIRS); do \ - runtest --tool $$f --srcdir . PROG=./$(TEST_BUNDLE_NAME) ; \ + ($(LD_LIB_PATH)=$(ALL_LD_LIB_DIRS); export $(LD_LIB_PATH); \ + runtest --tool $$f --srcdir . PROG=./$(TEST_BUNDLE_NAME) ; \ done internal-check-tool:: for f in $(CHECK_SCRIPT_DIRS); do \ - runtest --tool $$f --srcdir . PROG=./$(TEST_TOOL_NAME) ; \ + ($(LD_LIB_PATH)=$(ALL_LD_LIB_DIRS); export $(LD_LIB_PATH); \ + runtest --tool $$f --srcdir . PROG=./$(TEST_TOOL_NAME) ; \ done internal-check-app:: - for f in $(CHECK_SCRIPT_DIRS); do \ - runtest --tool $$f --srcdir . PROG=./$(TEST_APP_NAME) ; \ + for f in $(CHECK_SCRIPT_DIRS); do \ + ($(LD_LIB_PATH)=$(ALL_LD_LIB_DIRS); export $(LD_LIB_PATH); \ + runtest --tool $$f --srcdir . PROG=./$(TEST_APP_NAME) ; \ done