Skip to content

Commit

Permalink
src/Makefile: rough hacks to make a libyajl.dylib for macos
Browse files Browse the repository at this point in the history
- these work with pkgsrc bmake and the bootstrap-mk files, and hopefully
  testing on GitHub will soon show if they work with their bmake-20240108
  (likelyhood low -- last error was failing to make src/.depend)
  • Loading branch information
robohack committed Feb 9, 2024
1 parent c89539c commit 280ac57
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,40 @@ incinstall: .PHONY
LD_shared=-shared -Wl,-h,lib${LIB}.so.${SHLIB_MAJOR}
.endif

# Some hacks to try to get a lib*.dylib file built and installed on macos....
#
# We'll still link our own programs and tests with the static library as that
# makes testing during build possible, but providing a dylib might be useful for
# other uses....
#
.if ((defined(_HOST_OSNAME) && (${_HOST_OSNAME} == "Darwin")) || \
(defined(OS) && (${OS} == "Darwin")) || \
(defined(.FreeBSD) && (${.FreeBSD} == "false")))
OBJECT_FMT = Mach-O # XXX not really of much use....
SHLIB_FULLVERSION ?= ${SHLIB_MAJOR}.${SHLIB_MINOR:U0}.${SHLIB_TEENY:U0}
SHLIB_INSTALL_VERSION ?= ${SHLIB_MAJOR}
# hmmm..... should compat be just SHLIB_MAJOR? (not according to Simon G.)
SHLIB_COMPATABILITY_VERSION ?= ${SHLIB_MAJOR}.${SHLIB_MINOR:U0}
# XXX do we need "-install_name=${PREFIX}/lib/lib${LIB}.dylib" too?
SHLIB_SHFLAGS=-dylib \
-dylib_current_version=${SHLIB_FULLVERSION} \
-dylib_compatibility_version=${SHLIB_COMPATABILITY_VERSION}

lib${LIB}.dylib: lib${LIB}.so.${SHLIB_FULLVERSION}
@echo fixing up shared library name for macos: ${.TARGET}
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} ${.TARGET}

realall all: lib${LIB}.dylib

libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.dylib

${DESTDIR}${LIBDIR}/lib${LIB}.dylib:
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} \
${DESTDIR}${LIBDIR}/lib${LIB}.dylib.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.dylib.tmp \
${DESTDIR}${LIBDIR}/lib${LIB}.dylib
.endif

# note to do a local rebuild you can also do: MAKEOBJDIRPREFIX=../build make
#
# Local Variables:
Expand Down

0 comments on commit 280ac57

Please sign in to comment.