From 6b967b1285704db13188895d86e7b3b34c3d2ff4 Mon Sep 17 00:00:00 2001 From: Ben C Date: Wed, 25 Oct 2023 22:17:35 -0400 Subject: [PATCH] Fix macOS .dylib build when VERSION contains letters. macOS builds with --disable-static fail to link if the version number contains letters because of the -current_version and -compatibility_version arguments (current version is 0.9.28rc). This commit adds a new MACOS_DYLIB_VERSION variable to config.mak for builds that target macOS. It has no impact on other targets. --- Makefile | 4 ++-- configure | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ba6ec08f..11cc9a88 100644 --- a/Makefile +++ b/Makefile @@ -55,8 +55,8 @@ else # `make test' when libtcc.dylib is used (configure --disable-static), so # we bake a relative path into the binary. $libdir is used after install. LINK_LIBTCC += -Wl,-rpath,"@executable_path/$(TOP)" -Wl,-rpath,"$(libdir)" - DYLIBVER += -current_version $(VERSION) - DYLIBVER += -compatibility_version $(VERSION) + DYLIBVER += -current_version $(MACOS_DYLIB_VERSION) + DYLIBVER += -compatibility_version $(MACOS_DYLIB_VERSION) endif endif endif diff --git a/configure b/configure index a407200b..27005fe3 100755 --- a/configure +++ b/configure @@ -602,6 +602,12 @@ echo "VERSION = $version" >> config.mak echo "#define TCC_VERSION \"$version\"" >> $TMPH echo "@set VERSION $version" > config.texi +if test "$targetos" = "Darwin"; then + # On macOS, -current_version and -compatibility_version must not contain letters. + macos_dylib_version=`echo $version | sed 's/[^0-9.]//g'` + echo "MACOS_DYLIB_VERSION = $macos_dylib_version" >> config.mak +fi + if test "$source_path_used" = "yes" ; then case $source_path in /*) echo "TOPSRC=$source_path";;