Skip to content

Commit

Permalink
Makefile: enable symbol versioning by default
Browse files Browse the repository at this point in the history
This enables symbol versioning by default, with the version string
`JL_LIBJULIA_1.10` (the version suffix is the SOMAJOR in general).

As part of this change, the SOMAJOR has also been changed to be
MAJOR.MINOR instead of just MAJOR. This is required to allow multiple
minor releases of libjulia to live side-by-side in the same process.

`SYMBOL_VERSION_SUFFIX` is provided to allow appending an additional
unique "salt" to SOMAJOR, which can be helpful for creating template
binaries that will be "version-stamped" after distribution.
  • Loading branch information
topolarity committed Jun 1, 2023
1 parent a799cc0 commit f1c041a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
18 changes: 7 additions & 11 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -188,21 +188,17 @@ JULIA_MINOR_VERSION := $(shell echo $(JULIA_VERSION) | cut -d'-' -f 1 | cut -d'.
JULIA_PATCH_VERSION := $(shell echo $(JULIA_VERSION) | cut -d'-' -f 1 | cut -d'+' -f 1 | cut -d'.' -f 3)

# libjulia's SONAME will follow the format libjulia.so.$(SOMAJOR). Before v1.0.0,
# SOMAJOR will be a two-decimal value, e.g. libjulia.so.0.5, whereas at and beyond
# v1.0.0, SOMAJOR will be simply the major version number, e.g. libjulia.so.1
# somajor was a two-decimal value (e.g. libjulia.so.0.5). During v1.0.x - v1.9.x,
# somajor was simply the major version number (e.g. libjulia.so.1). Starting in
# v1.10.0, somajor is major.minor again (e.g. libjulia.so.1.10)
# The file itself will ultimately symlink to libjulia.so.$(SOMAJOR).$(SOMINOR)
ifeq ($(JULIA_MAJOR_VERSION),0)
SOMAJOR := $(JULIA_MAJOR_VERSION).$(JULIA_MINOR_VERSION)
SOMINOR := $(JULIA_PATCH_VERSION)
else
SOMAJOR := $(JULIA_MAJOR_VERSION)
SOMINOR := $(JULIA_MINOR_VERSION)
endif

# In order to load multiple libjulia's with different DEFAULT_SYMBOL_VERSION
# each must have a unique SONAME
ifdef DEFAULT_SYMBOL_VERSION
SOMAJOR := "$(SOMAJOR)-$(DEFAULT_SYMBOL_VERSION)"
# This suffix affects libjulia's SONAME and the symbol version associated with
# all of its exported symbols.
ifdef SYMBOL_VERSION_SUFFIX
SOMAJOR := $(SOMAJOR)_$(SYMBOL_VERSION_SUFFIX)
endif

ifneq ($(NO_GIT), 1)
Expand Down
2 changes: 1 addition & 1 deletion cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ $(build_bindir)/julia-debug$(EXE): $(EXE_DOBJS) $(build_shlibdir)/libjulia-debug
@$(call PRINT_LINK, $(CC) $(LOADER_CFLAGS) $(DEBUGFLAGS) $(EXE_DOBJS) -o $@ $(LOADER_LDFLAGS) $(RPATH) -ljulia-debug)

$(BUILDDIR)/julia.expmap: $(SRCDIR)/julia.expmap.in
sed <'$<' >'$@' -e 's/@JULIA_SHLIB_SYMBOL_VERSION@/$(DEFAULT_SYMBOL_VERSION)/'
sed <'$<' >'$@' -e 's/@JULIA_SHLIB_SYMBOL_VERSION@/JL_LIBJULIA_$(SOMAJOR)/'

clean: | $(CLEAN_TARGETS)
rm -f $(BUILDDIR)/*.o $(BUILDDIR)/*.dbg.obj
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ $(BUILDDIR)/julia_version.h: $(JULIAHOME)/VERSION
CXXLD = $(CXX) -shared

$(BUILDDIR)/julia.expmap: $(SRCDIR)/julia.expmap.in
sed <'$<' >'$@' -e 's/@JULIA_SHLIB_SYMBOL_VERSION@/$(DEFAULT_SYMBOL_VERSION)/'
sed <'$<' >'$@' -e 's/@JULIA_SHLIB_SYMBOL_VERSION@/JL_LIBJULIA_$(SOMAJOR)/'

$(build_shlibdir)/libjulia-internal.$(JL_MAJOR_MINOR_SHLIB_EXT): $(BUILDDIR)/julia.expmap $(OBJS) $(BUILDDIR)/flisp/libflisp.a $(BUILDDIR)/support/libsupport.a $(LIBUV)
@$(call PRINT_LINK, $(CXXLD) $(call IMPLIB_FLAGS,$@) $(JCXXFLAGS) $(JL_CXXFLAGS) $(CXXLDFLAGS) $(SHIPFLAGS) $(OBJS) $(RPATH_LIB) -o $@ \
Expand Down

0 comments on commit f1c041a

Please sign in to comment.