fix macOS use of -dead_strip_dylibs, install major version lib symlinks.

Under macOS, to reduce dependency chains, we remove functions and
data that are unreachable by the entry point or exported symbols.
In particular, the macOS linker is used with "-dead_strip" by default.

While calc on macOS will execute if linker used with "-dead_strip_dylibs"
and CUSTOM is defined, other applications that use libcalc but not
libcustcalc (such as sample_many and sample_rand) will fail to execute
due to missile symbols.  Therefore "-dead_strip_dylibs" is not used
by default when ALLOW_CUSTOM is "-DCUSTOM" under macOS.
Thanks to GitHub user @TurtleWilly for bringing to our attention,
problems related to use of  "-dead_strip_dylibs".

When installing shared libraries, libcalc.x.y.z will be a link
to the libcalc shared library and libcustcalc.x.y.z will be a link
to the libcustcal shared library.
This commit is contained in:
Landon Curt Noll
2023-08-14 17:40:29 -07:00
parent 7d8d4cb5ea
commit faf3a4fab6
3 changed files with 31 additions and 9 deletions

View File

@@ -290,8 +290,8 @@ OBJS= ${LIBOBJS} ${CALCOBJS} ${UTIL_OBJS} ${SAMPLE_OBJ}
#
CALC_STATIC_LIBS= libcalc.a libcustcalc.a
CALC_DYNAMIC_LIBS= libcalc${LIB_EXT_VERSION} libcustcalc${LIB_EXT_VERSION}
SYM_DYNAMIC_LIBS= libcalc${LIB_EXT} \
libcustcalc${LIB_EXT_VERSION} libcustcalc${LIB_EXT}
SYM_DYNAMIC_LIBS= libcalc${LIB_EXT} libcustcalc${LIB_EXT} \
libcalc${LIB_EXT_VER} libcustcalc${LIB_EXT_VER}
EARLY_TARGETS= hsrc .hsrc custom/.all custom/Makefile
# list of sample programs that need to be built to satisfy sample rule
@@ -483,6 +483,10 @@ libcalc${LIB_EXT}: libcalc${LIB_EXT_VERSION}
${Q} ${RM} -f $@
${LN} -s $? $@
libcalc${LIB_EXT_VER}: libcalc${LIB_EXT_VERSION}
${Q} ${RM} -f $@
${LN} -s $? $@
###
#
# calc documentation
@@ -2370,6 +2374,10 @@ libcustcalc${LIB_EXT}: libcustcalc${LIB_EXT_VERSION}
${Q} ${RM} -f $@
${LN} -s $? $@
libcustcalc${LIB_EXT_VER}: libcustcalc${LIB_EXT_VERSION}
${Q} ${RM} -f $@
${LN} -s $? $@
###
#
# building calc-static and static lib*.a libraries
@@ -3392,9 +3400,6 @@ install: ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all custom/Makefile
echo "installed ${T}${LIBDIR}/libcalc.a"; \
fi; \
fi
${Q}# NOTE: The this makefile installs libcustcalc${LIB_EXT_VERSION}
${Q}# because we only want to perform one ${LDCONFIG} for both
${Q}# libcalc${LIB_EXT_VERSION} and libcustcalc${LIB_EXT_VERSION}.
-${Q} if [ -f libcalc${LIB_EXT_VERSION} ]; then \
if ${CMP} -s libcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}; then \
@@ -3418,6 +3423,11 @@ install: ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all custom/Makefile
${LN} -f -s libcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcalc${LIB_EXT}; \
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT}"; \
echo ${LN} -f -s libcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcalc${LIB_EXT_VER}; \
${LN} -f -s libcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcalc${LIB_EXT_VER}; \
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT_VER}"; \
fi; \
fi
-${Q} if [ -f custom/libcustcalc${LIB_EXT_VERSION} ]; then \
@@ -3443,6 +3453,11 @@ install: ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all custom/Makefile
${LN} -f -s libcustcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcustcalc${LIB_EXT}; \
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT}"; \
echo ${LN} -f -s libcustcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcustcalc${LIB_EXT_VER}; \
${LN} -f -s libcustcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcustcalc${LIB_EXT_VER}; \
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT_VER}"; \
if [ -z "${T}" -o "/" = "${T}" ]; then \
if [ ! -z "${LDCONFIG}" ]; then \
echo "running ${LDCONFIG}"; \