Index: build-aux/m4/buildsys.m4 ================================================================== --- build-aux/m4/buildsys.m4 +++ build-aux/m4/buildsys.m4 @@ -1,8 +1,8 @@ dnl dnl Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017, -dnl 2018, 2020, 2021, 2022, 2023 +dnl 2018, 2020, 2021, 2022, 2023, 2024 dnl Jonathan Schleifer dnl dnl https://fossil.nil.im/buildsys dnl dnl Permission to use, copy, modify, and/or distribute this software for any @@ -342,51 +342,52 @@ case "$host" in *-*-darwin*) AC_MSG_RESULT(Darwin) PLUGIN_CFLAGS='-fPIC -DPIC' - PLUGIN_LDFLAGS='-bundle ${PLUGIN_LDFLAGS_BUNDLE_LOADER}' - PLUGIN_SUFFIX='.bundle' - AS_IF([test x"$host_is_ios" = x"yes"], [ - LINK_PLUGIN='rm -fr $$out && ${MKDIR_P} $$out && if test -f Info.plist; then ${INSTALL} -m 644 Info.plist $$out/Info.plist; fi && ${LD} -o $$out/$${out%${PLUGIN_SUFFIX}} ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS} && ${CODESIGN} -fs ${CODESIGN_IDENTITY} $$out' - ], [ - LINK_PLUGIN='rm -fr $$out && ${MKDIR_P} $$out/Contents/MacOS && if test -f Info.plist; then ${INSTALL} -m 644 Info.plist $$out/Contents/Info.plist; fi && ${LD} -o $$out/Contents/MacOS/$${out%${PLUGIN_SUFFIX}} ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS} && ${CODESIGN} -fs ${CODESIGN_IDENTITY} $$out' - ]) - INSTALL_PLUGIN='&& rm -fr ${DESTDIR}${plugindir}/$$i && cp -R $$i ${DESTDIR}${plugindir}/' - UNINSTALL_PLUGIN='&& rm -fr ${DESTDIR}${plugindir}/$$i' + PLUGIN_LDFLAGS='-bundle' + PLUGIN_SUFFIX='.dylib' ;; *-*-mingw* | *-*-cygwin*) AC_MSG_RESULT(MinGW / Cygwin) PLUGIN_CFLAGS='' PLUGIN_LDFLAGS='-shared -Wl,--export-all-symbols' PLUGIN_SUFFIX='.dll' - LINK_PLUGIN='${LD} -o $$out ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}' - INSTALL_PLUGIN='&& ${INSTALL} -m 755 $$i ${DESTDIR}${plugindir}/$$i' - UNINSTALL_PLUGIN='&& rm -f ${DESTDIR}${plugindir}/$$i' ;; hppa*-*-hpux*) AC_MSG_RESULT([HP-UX (PA-RISC)]) PLUGIN_CFLAGS='-fPIC -DPIC' PLUGIN_LDFLAGS='-shared' PLUGIN_SUFFIX='.sl' - LINK_PLUGIN='${LD} -o $$out ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}' - INSTALL_PLUGIN='&& ${INSTALL} -m 755 $$i ${DESTDIR}${plugindir}/$$i' - UNINSTALL_PLUGIN='&& rm -f ${DESTDIR}${plugindir}/$$i' ;; *) AC_MSG_RESULT(ELF) PLUGIN_CFLAGS='-fPIC -DPIC' PLUGIN_LDFLAGS='-shared' PLUGIN_SUFFIX='.so' - LINK_PLUGIN='${LD} -o $$out ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}' - INSTALL_PLUGIN='&& ${INSTALL} -m 755 $$i ${DESTDIR}${plugindir}/$$i' - UNINSTALL_PLUGIN='&& rm -f ${DESTDIR}${plugindir}/$$i' ;; esac AC_SUBST(PLUGIN_CFLAGS) AC_SUBST(PLUGIN_LDFLAGS) AC_SUBST(PLUGIN_SUFFIX) - AC_SUBST(LINK_PLUGIN) - AC_SUBST(INSTALL_PLUGIN) - AC_SUBST(UNINSTALL_PLUGIN) +]) + +AC_DEFUN([BUILDSYS_BUNDLE], [ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([BUILDSYS_CHECK_IOS]) + AC_REQUIRE([BUILDSYS_PLUGIN]) + + case "$host_os" in + darwin*) + AS_IF([test x"$host_is_ios" = x"yes"], [ + LINK_BUNDLE='${MKDIR_P} $$out && ${INSTALL} -m 644 Info.plist $$out/Info.plist && ${LD} -o $$out/$${out%.bundle} ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}' + ], [ + LINK_BUNDLE='${MKDIR_P} $$out/Contents/MacOS && ${INSTALL} -m 644 Info.plist $$out/Contents/Info.plist && ${LD} -o $$out/Contents/MacOS/$${out%.bundle} ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}' + ]) + + AC_SUBST(LINK_BUNDLE) + + $1 + ;; + esac ]) Index: buildsys.mk.in ================================================================== --- buildsys.mk.in +++ buildsys.mk.in @@ -1,8 +1,8 @@ # # Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, -# 2017, 2018, 2020, 2021, 2022, 2023 +# 2017, 2018, 2020, 2021, 2022, 2023, 2024 # Jonathan Schleifer # # https://fossil.nil.im/buildsys # # Permission to use, copy, modify, and/or distribute this software for any @@ -87,10 +87,11 @@ exec_prefix = @exec_prefix@ bindir = @bindir@ libdir = @libdir@ amigalibdir ?= ${prefix}/libs plugindir ?= ${libdir}/${PACKAGE_NAME} +bundledir ?= ${prefix}/Library/PlugIns/${PACKAGE_NAME} datarootdir = @datarootdir@ datadir = @datadir@ includedir = @includedir@ includesubdir ?= ${PACKAGE_NAME} INSTALL_INCLUDES ?= yes @@ -141,10 +142,11 @@ ${STATIC_AMIGA_LIB}${STATIC_AMIGA_LIB_NOINST} \ ${SHARED_LIB} ${SHARED_LIB_NOINST} \ ${FRAMEWORK} ${FRAMEWORK_NOINST} \ ${AMIGA_LIB} ${AMIGA_LIB_NOINST} \ ${PLUGIN} ${PLUGIN_NOINST} \ + ${BUNDLE} ${BUNDLE_NOINST} \ ${PROG} ${PROG_NOINST} \ ${JARFILE} locales ${MAKE} @MAKEFLAGS_SILENT@ subdirs-after ${MAKE} @MAKEFLAGS_SILENT@ post-all @@ -212,13 +214,11 @@ if rm -fr $@ && \ ${MAKE} @MAKEFLAGS_SILENT@ \ COPY_HEADERS_IF_SUBDIR=${includesubdir} \ COPY_HEADERS_DESTINATION=$$PWD/$@/Headers \ copy-headers-into-framework && \ - if test -f Info.plist; then \ - ${INSTALL} -m 644 Info.plist $@/Info.plist; \ - fi && \ + ${INSTALL} -m 644 Info.plist $@/Info.plist && \ if test -f module.modulemap; then \ ${MKDIR_P} $@/Modules && \ ${INSTALL} -m 644 module.modulemap \ $@/Modules/module.modulemap; \ fi && \ @@ -297,14 +297,24 @@ ${LINK_OK}; \ else \ ${LINK_FAILED}; \ fi -${PLUGIN} ${PLUGIN_NOINST}: ${EXT_DEPS} ${PLUGIN_OBJS} +${PLUGIN} ${PLUGIN_NOINST}: ${EXT_DEPS} ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} + ${LINK_STATUS} + out="$@"; \ + if ${LD} -o $$out ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}; then \ + ${LINK_OK}; \ + else \ + rm -fr $$out; false; \ + ${LINK_FAILED}; \ + fi + +${BUNDLE} ${BUNDLE_NOINST}: ${EXT_DEPS} ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${LINK_STATUS} out="$@"; \ - if @LINK_PLUGIN@; then \ + if rm -fr $$out && @LINK_BUNDLE@ && ${CODESIGN} -fs ${CODESIGN_IDENTITY} $$out; then \ ${LINK_OK}; \ else \ rm -fr $$out; false; \ ${LINK_FAILED}; \ fi @@ -807,11 +817,30 @@ done for i in "" ${PLUGIN}; do \ test x"$$i" = x"" && continue; \ ${INSTALL_STATUS}; \ - if ${MKDIR_P} ${DESTDIR}${plugindir} @INSTALL_PLUGIN@; then \ + if ${MKDIR_P} ${DESTDIR}${plugindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${plugindir}/$$i; then \ + ${INSTALL_OK}; \ + else \ + ${INSTALL_FAILED}; \ + fi \ + done + + for i in "" ${BUNDLE}; do \ + if ${MKDIR_P} ${DESTDIR}${bundledir} && ${INSTALL} -m 755 $$i ${DESTDIR}${bundledir}/$$i; then \ + ${INSTALL_OK}; \ + else \ + ${INSTALL_FAILED}; \ + fi \ + done + for i in "" ${BUNDLE}; do \ + test x"$$i" = x"" && continue; \ + ${INSTALL_STATUS}; \ + rm -fr ${DESTDIR}${bundledir}/$$i; \ + if ${MKDIR_P} ${DESTDIR}${bundledir} && \ + cp -R $$i ${DESTDIR}${bundledir}/; then \ ${INSTALL_OK}; \ else \ ${INSTALL_FAILED}; \ fi \ done @@ -928,19 +957,33 @@ done for i in "" ${PLUGIN}; do \ test x"$$i" = x"" && continue; \ if test -e ${DESTDIR}${plugindir}/$$i; then \ - if : @UNINSTALL_PLUGIN@; then \ + if rm -f ${DESTDIR}${plugindir}/$$i; then \ ${DELETE_OK}; \ else \ ${DELETE_FAILED}; \ fi \ fi \ done rmdir ${DESTDIR}${plugindir} >/dev/null 2>&1 || true + for i in "" ${BUNDLE}; do \ + test x"$$i" = x"" && continue; \ + if test -d ${DESTDIR}${bundledir}/$$i; then \ + if rm -fr ${DESTDIR}${bundledir}/$$i; \ + then \ + ${DELETE_OK}; \ + else \ + ${DELETE_FAILED}; \ + fi \ + fi \ + done + rmdir ${DESTDIR}${bundledir} >/dev/null 2>&1 || true + rmdir ${DESTDIR}${prefix}/Library >/dev/null 2>&1 || true + for i in "" ${DATA}; do \ test x"$$i" = x"" && continue; \ if test -f ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i; then \ if rm -f ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i; \ then \ @@ -1020,11 +1063,12 @@ ${LIB_OBJS_EXTRA} ${AMIGA_LIB_OBJS} ${AMIGA_LIB_OBJS_START} \ ${AMIGA_LIB_OBJS_EXTRA} ${PLUGIN_OBJS} ${PROG} ${PROG_NOINST} \ ${SHARED_LIB} ${SHARED_LIB_NOINST} ${AMIGA_LIB} \ ${AMIGA_LIB_NOINST} ${STATIC_LIB} ${STATIC_LIB_NOINST} \ ${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST} ${STATIC_AMIGA_LIB} \ - ${STATIC_AMIGA_LIB_NOINST} ${FRAMEWORK} ${PLUGIN} ${PLUGIN_NOINST} \ + ${STATIC_AMIGA_LIB_NOINST} ${FRAMEWORK} ${FRAMEWORK_NOINST} \ + ${PLUGIN} ${PLUGIN_NOINST} ${BUNDLE} ${BUNDLE_NOINST} \ ${CLEAN_LIB} ${MO_FILES} ${CLEAN}; do \ test x"$$i" = x"" && continue; \ if test -f $$i -o -d $$i; then \ if rm -fr $$i; then \ ${DELETE_OK}; \