Skip to content

Commit

Permalink
buildsys: always link gap against libgap
Browse files Browse the repository at this point in the history
... even the copy we don't install system wide.

On macOS this allows us an annoying issue with the linker flags used by e.g.
gac for building kernel extensions: by always linking them against libgap we
don't need to use a flat namespace, nor rely on a bundle loader (which breaks
if you try to load the kernel extension in another binary using libgap).
  • Loading branch information
fingolfin committed Sep 5, 2024
1 parent 0cd14ac commit 98f8479
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,12 @@ ifneq (,$(findstring cygwin,$(host_os)))
else
ifneq (,$(findstring darwin,$(host_os)))
GAC_CFLAGS = -fno-common
GAC_LDFLAGS = -bundle -undefined dynamic_lookup -Wl,-no_fixup_chains
GAC_LDFLAGS = -bundle -L$(abs_builddir) -lgap
GAC_LDFLAGS_FOR_INSTALL = -bundle -L$(libdir) -lgap
else
GAC_CFLAGS = -fPIC
GAC_LDFLAGS = -shared -fPIC
GAC_LDFLAGS = -shared -fPIC -L$(abs_builddir) -lgap
GAC_LDFLAGS_FOR_INSTALL = -shared -fPIC -L$(libdir) -lgap
endif
endif

Expand Down Expand Up @@ -509,8 +511,8 @@ libgap$(SHLIB_EXT): $(LIBGAP_FULL)
ln -sf $< $@

# build rule for the main gap executable
gap$(EXEEXT): build/obj/src/main.c.o $(OBJS) cnf/GAP-LDFLAGS cnf/GAP-LIBS cnf/GAP-OBJS
$(QUIET_LINK)$(LINK) $(GAP_LDFLAGS) $< $(OBJS) $(GAP_LIBS) -o $@
gap$(EXEEXT): build/obj/src/main.c.o libgap$(SHLIB_EXT) cnf/GAP-LDFLAGS cnf/GAP-LIBS cnf/GAP-OBJS
$(QUIET_LINK)$(LINK) $(GAP_LDFLAGS) $< $(GAP_LIBS) -L${abs_builddir} -lgap -o $@

# generate a modified copy of main.c for use by the `gap-install` binary
build/main.c: src/main.c config.status
Expand Down Expand Up @@ -673,6 +675,7 @@ install-sysinfo: SYSINFO_CPPFLAGS = -I${includedir}/gap -I${includedir} $(GAP_DE
install-sysinfo: SYSINFO_LDFLAGS = $(ABI_CFLAGS)
install-sysinfo: SYSINFO_GAP = $(bindir)/gap
install-sysinfo: SYSINFO_GAC = $(bindir)/gac
install-sysinfo: GAC_LDFLAGS = $(GAC_LDFLAGS_FOR_INSTALL)
install-sysinfo: GMP_PREFIX =
install-sysinfo:
$(INSTALL) -d -m 0755 $(DESTDIR)$(libdir)/gap
Expand Down

0 comments on commit 98f8479

Please sign in to comment.