Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make shared libraries load from runtime ACT_HOME by relative search path #41

Merged
merged 3 commits into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ baseos=`$full_pathname/scripts/getbaseos`;

installdir=/usr/local/cad

if [ $# -eq 1 ]
if [ $# -gt 0 ]
then
installdir=$1
fi
Expand Down Expand Up @@ -92,6 +92,16 @@ then
mkdir $installdir/act
fi

# get additional CFLAGS and pass them through
if [ $# -gt 1 ]
then
case $2 in
"CFLAGS="*) addon_cflags=${2#CFLAGS=}
addon_cflags=${addon_cflags#\"}
addon_cflags=${addon_cflags#\'}
echo "CFLAGS: $addon_cflags"
esac
fi

#
# shared linking on macos
Expand All @@ -101,6 +111,13 @@ then
sh_build=-fPIC
sh_link=-dynamiclib
sh_exe_options=
elif [ "x$baseos" = "xlinux" ] || [ "x$baseos" = "xsolaris" ]
then
sh_build="\"-shared -DPIC -fPIC\""
# the RUNPATH shared object search parameter are relative the location of the binary during runtime, and as backup the compile time $ACT_HOME path is used
# libraries and executables are parsed differently by the build system hand have therefor different escape patterns
sh_link="\"-shared -Wl,-x,-rpath=\\\$ORIGIN/../lib,-rpath=$ACT_HOME/lib\""
sh_exe_options="\"-Wl,-rpath=\\$\$ORIGIN/../lib,-rpath=$ACT_HOME/lib\""
else
sh_build="\"-shared -DPIC -fPIC\""
sh_link="\"-shared -Wl,-x,-rpath=$ACT_HOME/lib\""
Expand All @@ -110,7 +127,8 @@ fi

c_compiler_name=gcc
cxx_compiler_name=g++
c_compiler_flags=-O2
# the double parentesis are needed beause of double parcing in the check script and are removed in the makefile to have the intended behaviour
c_compiler_flags="\"-O2 ${addon_cflags}\""
make_program=gmake
myranlib=ranlib

Expand Down
2 changes: 1 addition & 1 deletion scripts/Makefile.std
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ DFLAGS=-DARCH_$(ARCH) -DOS_$(OS) -DBASEOS_$(BASEOS) -I$(INSTALLINC) # -D_FORTIFY
ifndef DEPEND_FLAGS
DEPEND_FLAGS=-I.
endif
CFLAGS=$(C_COMPILER_FLAGS)
CFLAGS=$(subst ",,$(C_COMPILER_FLAGS))


all: installincsub dependsub allsub move-in $(TARGETLIBS) install_lib install_inc $(TARGETS) $(EXTRA) move-out postsub
Expand Down
6 changes: 3 additions & 3 deletions scripts/check
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ int main (void)

EOM


# the $C_COMPILER_FLAGS enable to load so files form a custom path
echo " ... looking for editline"
if ! $C_COMPILER_NAME -c __tst1.c >/dev/null 2>&1
if ! $C_COMPILER_NAME $C_COMPILER_FLAGS -c __tst1.c >/dev/null 2>&1
then
rm -f __tst1.c
echo "Did not find libeditline on the system"
exit 1
fi

echo " ... looking for zlib"
if ! $C_COMPILER_NAME __tst1.o -lz >/dev/null 2>&1
if ! $C_COMPILER_NAME $C_COMPILER_FLAGS __tst1.o -lz >/dev/null 2>&1
then
rm -f __tst1.c
echo "Did not find zlib on the system"
Expand Down
2 changes: 1 addition & 1 deletion simulation/prsim/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ SRCS=$(OBJS:.o=.c)
include $(VLSI_TOOLS_SRC)/scripts/Makefile.std

$(BIN1): $(LIB) $(OBJS1) $(LIBDEPEND) $(SCMCLIDEPEND)
$(CXX) $(CFLAGS) $(OBJS1) -o $(BIN1) $(LIBCOMMON) $(LIBACTSCMCLI) -ledit -ldl
$(CXX) $(CFLAGS) $(OBJS1) -o $(BIN1) $(LIBCOMMON) $(LIBACTSCMCLI) -ledit $(SH_EXE_OPTIONS) -ldl

$(BIN2): $(LIB) $(OBJS2) $(LIBDEPEND)
$(CXX) $(CFLAGS) $(OBJS2) -o $(BIN2) $(LIBCOMMON)
Expand Down