Skip to content

Commit

Permalink
Enable GPC's "WITH_SHARED" as a GCC configure arg --with-gpc-shared o…
Browse files Browse the repository at this point in the history
…r --without-gpc-shared
  • Loading branch information
mesheets committed Sep 24, 2024
1 parent 7730bbf commit 03fe39f
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 28 deletions.
1 change: 1 addition & 0 deletions src-projects/gcc-3.4.6/Makefile.def
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ flags_to_pass = { flag= gxx_include_dir ; };
flags_to_pass = { flag= gcc_version ; };
flags_to_pass = { flag= gcc_version_trigger ; };
flags_to_pass = { flag= target_alias ; };
flags_to_pass = { flag= with_gpc_shared ; };

// Build tools
flags_to_pass = { flag= BISON ; };
Expand Down
4 changes: 4 additions & 0 deletions src-projects/gcc-3.4.6/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ TARGET_SUBDIR = @target_subdir@
# directories built for the target.
TARGET_CONFIGARGS = @target_configargs@

# This is whether to also build shared RTS library when building GPC
WITH_GPC_SHARED = @with_gpc_shared@

# ----------------------------------------------
# Programs producing files for the BUILD machine
# ----------------------------------------------
Expand Down Expand Up @@ -412,6 +415,7 @@ BASE_FLAGS_TO_PASS = \
"gcc_version=$(gcc_version)" \
"gcc_version_trigger=$(gcc_version_trigger)" \
"target_alias=$(target_alias)" \
"WITH_GPC_SHARED=$(WITH_GPC_SHARED)" \
"BISON=$(BISON)" \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
Expand Down
3 changes: 3 additions & 0 deletions src-projects/gcc-3.4.6/Makefile.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ TARGET_SUBDIR = @target_subdir@
# directories built for the target.
TARGET_CONFIGARGS = @target_configargs@

# This is whether to also build shared RTS library when building GPC
WITH_GPC_SHARED = @with_gpc_shared@

# ----------------------------------------------
# Programs producing files for the BUILD machine
# ----------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src-projects/gcc-3.4.6/configure
Original file line number Diff line number Diff line change
Expand Up @@ -4292,6 +4292,7 @@ s%@host_configargs@%$host_configargs%g
s%@configdirs@%$configdirs%g
s%@target_configargs@%$target_configargs%g
s%@target_configdirs@%$target_configdirs%g
s%@with_gpc_shared@%$with_gpc_shared%g
s%@BISON@%$BISON%g
s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
s%@LEX@%$LEX%g
Expand Down
3 changes: 1 addition & 2 deletions src-projects/gpc-2.1-20070904/libgpc/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

SHELL = @SHELL@
srcdir = @srcdir@
WITH_SHARED = @with_shared@
target_alias = undef_var
gcc_version := $(shell cat $(srcdir)/../gcc/BASE-VER)

RTS_SHARED_FLAG = `if [ x$(WITH_SHARED) = xyes ]; then echo '--with-shared'; fi`
RTS_SHARED_FLAG = `if [ x$(WITH_GPC_SHARED) = xyes ]; then echo '--with-gpc-shared'; fi`

MPREFIX = .

Expand Down
33 changes: 23 additions & 10 deletions src-projects/gpc-2.1-20070904/p/Make-lang.in
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,36 @@ LIBEXECSUBDIR_34=$(libexecsubdir)
LIBEXECSUBDIR_=$(libsubdir)
LIBEXECSUBDIR=$(LIBEXECSUBDIR_$(GPC_GCC_34_))

# PC is the GPC for the host!
PC="`if [ x"$(GPC_HOST)" = x"$(target)" ]; then echo $(GPC_FOR_TARGET) -L../..' '; else echo $(CC) | $(GCC2GPC); fi | $(ADD_RTS_PARENT_DIR)` -I../rts"

# TREE_GIMPLE_H is defined only for 4.0 and up, so we use it to
# distinguish backed versions. For 4.x we build libgpc in
# toplevel directory.
ifdef TREE_GIMPLE_H
__skip_gpc_shared=yes
endif
ifneq ("$(WITH_SHARED)","yes")
ifeq ("$(WITH_GPC_SHARED)","no")
__skip_gpc_shared=yes
endif

ifdef __skip_gpc_shared
pascal.maybe_rts:
pascal.maybe_install-utils:
pascal.install_rts-config.inc:
pascal.maybe_utils:
pascal.maybe_install-utils:
else
pascal.install_rts-config.inc: pascal.do_install_rts-config.inc
pascal.maybe_rts: pascal.rts pascal.maybe_utils
ifneq (,$(shell $(PC) --version 2>/dev/null))
pascal.maybe_utils: pascal.utils
pascal.maybe_install-utils: pascal.install-utils
pascal.maybe_rts: pascal.rts pascal.utils
else
pascal.maybe_utils:
$(warning WARNING: Pascal Compiler $(PC) not found; skipping build of GPC utils)
pascal.maybe_install-utils:
$(warning WARNING: Pascal Compiler "$(PC)" not found; skipping install of GPC utils)
endif
endif

# gcc<3 doesn't set $(STAMP) and $(man1ext).
Expand All @@ -158,7 +170,6 @@ rts_version=`cat $(RTS_VERSION_FILENAME)`
GPCSOLIBSHORTNAME=libgpc.so
GPCSOLIBNAME=$(GPCSOLIBSHORTNAME).$(gpc_major).$(gpc_minor).$(rts_version)
GPCSOLIBDIR=lib
WITH_SHARED=@with_shared@

BISON=bison
BISONFLAGS=
Expand Down Expand Up @@ -226,22 +237,23 @@ GPC_INSTALL_FLAGS_TO_PASS=\
"GPCSOLIBSHORTNAME=$(GPCSOLIBSHORTNAME)" \
"GPCSOLIBDIR=$(GPCSOLIBDIR)" \
"GPC_EXTRA_INSTALL_LIBS=$(GPC_EXTRA_INSTALL_LIBS)" \
"WITH_SHARED=$(WITH_SHARED)" \
"WITH_GPC_SHARED=$(WITH_GPC_SHARED)" \
"FLOAT_H=$(FLOAT_H)" \
"EXTRA_PARTS=$(EXTRA_PARTS)" \
$(GPC_EXTRA_INSTALL_FLAGS_TO_PASS)

# Flags to pass when building the utilities. (PC is the GPC for the host!)
UTILS_FLAGS_TO_PASS=\
SHELL="$(SHELL)" \
PC="`if [ x"$(GPC_HOST)" = x"$(target)" ]; then echo $(GPC_FOR_TARGET) -L../..' '; else echo $(CC) | $(GCC2GPC); fi | $(ADD_RTS_PARENT_DIR)` -I../rts" \
PC="$(PC)" \
CFLAGS="$(CFLAGS)" \
PFLAGS="$(PFLAGS)" \
exeext="$(exeext)" \
INSTALL_PROGRAM="$(INSTALL_PROGRAM)" \
INSTALL_DATA="$(INSTALL_DATA)" \
BUILD="$(GPC_BUILD)" \
HOST="$(GPC_HOST)"
HOST="$(GPC_HOST)" \
WITH_GPC_SHARED="$(WITH_GPC_SHARED)"

# Flags to pass when building the RTS.
RTS_FLAGS_TO_PASS_ALL=\
Expand All @@ -251,7 +263,8 @@ RTS_FLAGS_TO_PASS_ALL=\
PFLAGS="$(PFLAGS)" \
AR_FLAGS="$(AR_FLAGS)" \
RTSFLAGS="$(RTSFLAGS)" \
GPC_DESTDIR="../.."
GPC_DESTDIR="../.." \
WITH_GPC_SHARED="$(WITH_GPC_SHARED)"

RTS_FLAGS_TO_PASS_28=\
AR="$(AR)" \
Expand Down Expand Up @@ -813,7 +826,7 @@ p/rts/Makefile: $(GCC_PARTS) \
cd ./p/rts && \
$(RTS_COMPILERS) CONFIG_SITE=nonexisting-file \
$$src/p/rts/configure --silent > /dev/null --srcdir=$$src/p/rts \
`if [ x$(WITH_SHARED) = xyes ]; then echo '--with-shared'; fi`
`if [ x$(WITH_GPC_SHARED) = xyes ]; then echo '--with-gpc-shared'; fi`

pascal.rts: p/rts/Makefile xgpc$(exeext) gpc1$(exeext)
cd ./p/rts && $(MAKE) $(RTS_COMPILERS) $(RTS_FLAGS_TO_PASS) all
Expand Down Expand Up @@ -1012,7 +1025,7 @@ pascal.install-lib: pascal.install-dir pascal.maybe_rts
$(INSTALL_DATA) "$$f" "$(DESTDIR)$(libsubdir)/`echo "$$f" | sed -e 's,.*/,,'`" || exit 1; \
fi; \
done
if [ x$(WITH_SHARED) = xyes ] && [ -f $(GPCSOLIBNAME) ]; then \
if [ x$(WITH_GPC_SHARED) = xyes ] && [ -f $(GPCSOLIBNAME) ]; then \
$(srcdir)/p/script/mkdir-p -m a+rx $(DESTDIR)$(prefix)/$(GPCSOLIBDIR) && \
rm -f $(DESTDIR)$(libsubdir)/$(GPCSOLIBSHORTNAME) $(DESTDIR)$(prefix)/$(GPCSOLIBDIR)/$(GPCSOLIBNAME); \
$(INSTALL_DATA) $(GPCSOLIBNAME) $(DESTDIR)$(prefix)/$(GPCSOLIBDIR)/$(GPCSOLIBNAME) && \
Expand Down
15 changes: 7 additions & 8 deletions src-projects/gpc-2.1-20070904/p/rts/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ RTSFLAGS=
GPC_DESTDIR=.
GCC_VERSION=unknown

WITH_SHARED=@with_shared@
VERSION_FILENAME=$(srcdir)/rts-version
gpc_major=2
gpc_minor=1
Expand Down Expand Up @@ -84,7 +83,7 @@ GENERATED_FILES=\
$(srcdir)/rtsc.pas \
$(srcdir)/gpc.pas

all: $(GPCLIB) sharedlib.$(WITH_SHARED)
all: $(GPCLIB) sharedlib.$(WITH_GPC_SHARED)

generated-files: $(GENERATED_FILES)

Expand Down Expand Up @@ -113,12 +112,12 @@ rts-config.inc: rts-config.h
echo '{ rts-config.inc. Generated automatically from rts-config.h. }' > rts-config.inc
sed -e 's,/\*,{,g;s,\*/,},g;s,^[ \t]*#\(.*\),{$$\1},' rts-config.h >> rts-config.inc

# @@ `with_shared' is currently not substituted in the parent Makefile, so
# it arrives here via the setting of $(WITH_SHARED) on the command line
DUMMY=# Don't let configure substitute `@with_shared$(DUMMY)@' below
# @@ `with_gpc_shared' is currently not substituted in the parent Makefile, so
# it arrives here via the setting of $(WITH_GPC_SHARED) on the command line
DUMMY=# Don't let configure substitute `@with_gpc_shared$(DUMMY)@' below

.PHONY: all install check generated-files rts.update-release \
sharedlib. sharedlib.no sharedlib.@with_shared$(DUMMY)@ sharedlib.yes \
sharedlib. sharedlib.no sharedlib.@with_gpc_shared$(DUMMY)@ sharedlib.yes \
mostlyclean clean distclean extraclean maintainer-clean

install:
Expand All @@ -128,7 +127,7 @@ install:
@echo "if know what you are doing and have a current GPC version installed," >&2
@echo "but you will have to install the resulting file(s) (libgpc.*) manually" >&2
@echo "into the right directories, and create a symlink for the shared library" >&2
@echo "if configured \`--with-shared'." >&2
@echo "if configured \`--with-gpc-shared'." >&2

check:
@echo "Checks for the GPC RTS are contained in the GPC Test Suite."
Expand Down Expand Up @@ -197,7 +196,7 @@ $(GPCLIB): $(OBJS)
-$(RANLIB) $(GPCLIB) 2> /dev/null

# That's a way to do an `if' that even a stupid make understands ...
sharedlib. sharedlib.no sharedlib.@with_shared$(DUMMY)@:
sharedlib. sharedlib.no sharedlib.@with_gpc_shared$(DUMMY)@:
@echo "Skipping making of Pascal shared library"

sharedlib.yes: $(GPCSOLIB)
Expand Down
12 changes: 6 additions & 6 deletions src-projects/gpc-2.1-20070904/p/rts/configure
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
--with-shared build shared RTS library"
--with-gpc-shared build shared RTS library"

# Initialize some variables set by options.
# The variables have the same names as the options, with
Expand Down Expand Up @@ -789,10 +789,10 @@ fi
fi


# Check whether --with-shared or --without-shared was given.
if test "${with_shared+set}" = set; then
withval="$with_shared"
with_shared=${withval}
# Check whether --with-gpc-shared or --without-gpc-shared was given.
if test "${with_gpc_shared+set}" = set; then
withval="$with_gpc_shared"
with_gpc_shared=${withval}
fi


Expand Down Expand Up @@ -4025,7 +4025,7 @@ s%@CC@%$CC%g
s%@AR@%$AR%g
s%@RANLIB@%$RANLIB%g
s%@RANLIB_TEST@%$RANLIB_TEST%g
s%@with_shared@%$with_shared%g
s%@with_gpc_shared@%$with_gpc_shared%g
s%@CPP@%$CPP%g
CEOF
Expand Down
4 changes: 2 additions & 2 deletions src-projects/gpc-2.1-20070904/p/rts/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ else
fi
AC_SUBST(RANLIB_TEST)

AC_ARG_WITH(shared, [ --with-shared build shared RTS library], with_shared=${withval})
AC_SUBST(with_shared)
AC_ARG_WITH(gpc-shared, [ --with-gpc-shared build shared RTS library], with_gpc_shared=${withval})
AC_SUBST(with_gpc_shared)

# GPC_DEFINE(NAME)
# Define $1 in upper case
Expand Down

0 comments on commit 03fe39f

Please sign in to comment.