From a9f6bd028af5e91efbba59dd1cb542c5f40aee91 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 5 Jul 2024 15:02:42 -0400 Subject: [PATCH] Add make target shared-gc Allows building shared GC using `make shared-gc SHARED_GC=gc_impl` --- .github/workflows/compilers.yml | 8 ++------ common.mk | 12 ++++++++++++ template/Makefile.in | 2 ++ tool/m4/ruby_shared_gc.m4 | 2 ++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/compilers.yml b/.github/workflows/compilers.yml index a4f6bcdf80..5e9abde523 100644 --- a/.github/workflows/compilers.yml +++ b/.github/workflows/compilers.yml @@ -263,13 +263,9 @@ jobs: - name: Build shared GC run: > - make probes.h && - export RUBY_GC_LIBRARY=librubygc.so && - echo "RUBY_GC_LIBRARY=$RUBY_GC_LIBRARY" >> $GITHUB_ENV && + echo "RUBY_GC_LIBRARY=librubygc.gc_impl.so" >> $GITHUB_ENV && mkdir ${{ matrix.entry.shared_gc_dir }} && - gcc -I../src -I../src/include -I. -I.ext/include/x86_64-linux - -Wl,-undefined,dynamic_lookup -fPIC -g -O3 -shared - -o ${{ matrix.entry.shared_gc_dir }}/$RUBY_GC_LIBRARY ../src/gc_impl.c + make shared-gc SHARED_GC=gc_impl if: ${{ matrix.entry.shared_gc }} - name: Add to ext/Setup diff --git a/common.mk b/common.mk index 05145313c6..eb1ccbcdeb 100644 --- a/common.mk +++ b/common.mk @@ -1906,6 +1906,18 @@ rewindable: HELP_EXTRA_TASKS = "" +shared-gc: probes.h + $(Q) if test -z $(shared_gc_dir); then \ + echo "You must configure with --with-shared-gc to use shared GC"; \ + exit 1; \ + elif test -z $(SHARED_GC); then \ + echo "You must specify SHARED_GC with the GC to build"; \ + exit 1; \ + else \ + echo generating $(shared_gc_dir)librubygc.$(SHARED_GC).$(SOEXT); \ + $(LDSHARED) -I$(srcdir)/include -I$(srcdir) -I$(arch_hdrdir) -I. $(XDLDFLAGS) $(cflags) -fPIC -o $(shared_gc_dir)librubygc.$(SHARED_GC).$(SOEXT) $(srcdir)/$(SHARED_GC).c; \ + fi + help: PHONY $(MESSAGE_BEGIN) \ " Makefile of Ruby" \ diff --git a/template/Makefile.in b/template/Makefile.in index c679c9f96b..79a23fcdeb 100644 --- a/template/Makefile.in +++ b/template/Makefile.in @@ -67,6 +67,8 @@ RUBY_VERSION_NAME = @RUBY_VERSION_NAME@ UNIVERSAL_ARCHNAMES = @UNIVERSAL_ARCHNAMES@ BUILTIN_BINARY = @X_BUILTIN_BINARY@ +shared_gc_dir = @shared_gc_dir@ + TESTUI = console TESTS = INSTALLDOC = @INSTALLDOC@ diff --git a/tool/m4/ruby_shared_gc.m4 b/tool/m4/ruby_shared_gc.m4 index a65c26b876..78f4a386cc 100644 --- a/tool/m4/ruby_shared_gc.m4 +++ b/tool/m4/ruby_shared_gc.m4 @@ -33,4 +33,6 @@ AS_IF([test x"$shared_gc_dir" != x], [ shared_gc_summary="no" ]) + +AC_SUBST(shared_gc_dir, "${shared_gc_dir}") ])dnl