[Scummvm-git-logs] scummvm master -> a933a0d261c924380df1510ff783f9eca8ac066d

criezy noreply at scummvm.org
Sun May 22 22:42:50 UTC 2022


This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5118c60874 MACOSX: Pull a getResourceAppBundlePathMacOSX() wrapper from addSysArchivesToSearchSet()
4672ba71dd PLUGINS: Let macOS use its resource bundle as a valid plugin directory
808134e3c9 BUILD: Use `strip -x` when using plugins and stripping the main binary on macOS
09959e34c5 MACOSX: Make it possible to embed plugins when making a macOS bundle
dedabbcfa1 BUILD: Use $(PRE_OBJS_FLAGS) in scummvm-static macos target
a933a0d261 MACOSX: Switch getResourceAppBundlePathMacOSX() to Objective-C


Commit: 5118c60874fc2fab98d403ed8c085c6cb5655da9
    https://github.com/scummvm/scummvm/commit/5118c60874fc2fab98d403ed8c085c6cb5655da9
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-05-22T23:42:45+01:00

Commit Message:
MACOSX: Pull a getResourceAppBundlePathMacOSX() wrapper from addSysArchivesToSearchSet()

Changed paths:
    backends/platform/sdl/macosx/macosx.cpp
    backends/platform/sdl/macosx/macosx_wrapper.h
    backends/platform/sdl/macosx/macosx_wrapper.mm


diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index b23c190fdf4..0809ab0d686 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -43,8 +43,8 @@
 #include "common/fs.h"
 #include "common/translation.h"
 
-#include "ApplicationServices/ApplicationServices.h"	// for LSOpenFSRef
-#include "CoreFoundation/CoreFoundation.h"	// for CF* stuff
+#include <ApplicationServices/ApplicationServices.h>	// for LSOpenFSRef
+#include <CoreFoundation/CoreFoundation.h>	// for CF* stuff
 
 // For querying number of MIDI devices
 #include <pthread.h>
@@ -132,17 +132,10 @@ void OSystem_MacOSX::addSysArchivesToSearchSet(Common::SearchSet &s, int priorit
 	OSystem_POSIX::addSysArchivesToSearchSet(s, priority);
 
 	// Get URL of the Resource directory of the .app bundle
-	CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
-	if (fileUrl) {
-		// Try to convert the URL to an absolute path
-		UInt8 buf[MAXPATHLEN];
-		if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf))) {
-			// Success: Add it to the search path
-			Common::String bundlePath((const char *)buf);
-			// Search with a depth of 2 so the shaders are found
-			s.add("__OSX_BUNDLE__", new Common::FSDirectory(bundlePath, 2), priority);
-		}
-		CFRelease(fileUrl);
+	Common::String bundlePath = getResourceAppBundlePathMacOSX();
+	if (!bundlePath.empty()) {
+		// Success: search with a depth of 2 so the shaders are found
+		s.add("__OSX_BUNDLE__", new Common::FSDirectory(bundlePath, 2), priority);
 	}
 }
 
diff --git a/backends/platform/sdl/macosx/macosx_wrapper.h b/backends/platform/sdl/macosx/macosx_wrapper.h
index 6e2f1ef4590..0af5ac09d9d 100644
--- a/backends/platform/sdl/macosx/macosx_wrapper.h
+++ b/backends/platform/sdl/macosx/macosx_wrapper.h
@@ -29,5 +29,6 @@ bool hasTextInClipboardMacOSX();
 Common::U32String getTextFromClipboardMacOSX();
 bool setTextInClipboardMacOSX(const Common::U32String &text);
 Common::String getDesktopPathMacOSX();
+Common::String getResourceAppBundlePathMacOSX();
 
 #endif
diff --git a/backends/platform/sdl/macosx/macosx_wrapper.mm b/backends/platform/sdl/macosx/macosx_wrapper.mm
index f79c6c9909b..44ff0d317e6 100644
--- a/backends/platform/sdl/macosx/macosx_wrapper.mm
+++ b/backends/platform/sdl/macosx/macosx_wrapper.mm
@@ -30,6 +30,7 @@
 #include <Foundation/NSPathUtilities.h>
 #include <AvailabilityMacros.h>
 #include <CoreFoundation/CFString.h>
+#include <CoreFoundation/CoreFoundation.h>
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
 #define NSPasteboardTypeString NSStringPboardType
@@ -110,3 +111,18 @@ Common::String getDesktopPathMacOSX() {
 		return Common::String();
 	return Common::String([path fileSystemRepresentation]);
 }
+
+Common::String getResourceAppBundlePathMacOSX() {
+	CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
+	if (fileUrl) {
+		// Try to convert the URL to an absolute path
+		UInt8 buf[MAXPATHLEN];
+		if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf))) {
+			CFRelease(fileUrl);
+			return Common::String((const char *)buf);
+		}
+		CFRelease(fileUrl);
+	}
+
+	return Common::String();
+}


Commit: 4672ba71dde373a5b45228d85d5f576d40bcba29
    https://github.com/scummvm/scummvm/commit/4672ba71dde373a5b45228d85d5f576d40bcba29
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-05-22T23:42:45+01:00

Commit Message:
PLUGINS: Let macOS use its resource bundle as a valid plugin directory

Changed paths:
  A backends/plugins/sdl/macosx/macosx-provider.cpp
  A backends/plugins/sdl/macosx/macosx-provider.h
    backends/module.mk
    backends/platform/sdl/macosx/macosx-main.cpp


diff --git a/backends/module.mk b/backends/module.mk
index 03e8d961b8a..8f271af0952 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -211,6 +211,11 @@ MODULE_OBJS += \
 	text-to-speech/macosx/macosx-text-to-speech.o
 endif
 
+ifdef SDL_BACKEND
+MODULE_OBJS += \
+	plugins/sdl/macosx/macosx-provider.o
+endif
+
 endif
 
 ifdef WIN32
diff --git a/backends/platform/sdl/macosx/macosx-main.cpp b/backends/platform/sdl/macosx/macosx-main.cpp
index 4d4d87c5eed..c449d9fdee3 100644
--- a/backends/platform/sdl/macosx/macosx-main.cpp
+++ b/backends/platform/sdl/macosx/macosx-main.cpp
@@ -24,7 +24,7 @@
 #ifdef MACOSX
 
 #include "backends/platform/sdl/macosx/macosx.h"
-#include "backends/plugins/sdl/sdl-provider.h"
+#include "backends/plugins/sdl/macosx/macosx-provider.h"
 #include "base/main.h"
 
 int main(int argc, char *argv[]) {
@@ -37,7 +37,7 @@ int main(int argc, char *argv[]) {
 	g_system->init();
 
 #ifdef DYNAMIC_MODULES
-	PluginManager::instance().addPluginProvider(new SDLPluginProvider());
+	PluginManager::instance().addPluginProvider(new MacOSXPluginProvider());
 #endif
 
 	// Invoke the actual ScummVM main entry point:
diff --git a/backends/plugins/sdl/macosx/macosx-provider.cpp b/backends/plugins/sdl/macosx/macosx-provider.cpp
new file mode 100644
index 00000000000..7e42863f664
--- /dev/null
+++ b/backends/plugins/sdl/macosx/macosx-provider.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/scummsys.h"
+
+#if defined(DYNAMIC_MODULES) && defined(SDL_BACKEND) && defined(MACOSX)
+
+#include "backends/plugins/sdl/macosx/macosx-provider.h"
+#include "backends/platform/sdl/macosx/macosx_wrapper.h"
+
+#include "common/fs.h"
+
+void MacOSXPluginProvider::addCustomDirectories(Common::FSList &dirs) const {
+	Common::String bundlePath = getResourceAppBundlePathMacOSX();
+	if (!bundlePath.empty())
+		dirs.push_back(Common::FSNode(bundlePath));
+}
+
+#endif // defined(DYNAMIC_MODULES) && defined(SDL_BACKEND) && defined(MACOSX)
diff --git a/backends/plugins/sdl/macosx/macosx-provider.h b/backends/plugins/sdl/macosx/macosx-provider.h
new file mode 100644
index 00000000000..90dd42f8eb5
--- /dev/null
+++ b/backends/plugins/sdl/macosx/macosx-provider.h
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef BACKENDS_PLUGINS_SDL_MACOSX_PROVIDER_H
+#define BACKENDS_PLUGINS_SDL_MACOSX_PROVIDER_H
+
+#include "backends/plugins/sdl/sdl-provider.h"
+
+#if defined(DYNAMIC_MODULES) && defined(SDL_BACKEND) && defined(MACOSX)
+
+class MacOSXPluginProvider : public SDLPluginProvider {
+protected:
+	void addCustomDirectories(Common::FSList &dirs) const;
+};
+
+#endif // defined(DYNAMIC_MODULES) && defined(SDL_BACKEND) && defined(MACOSX)
+
+#endif


Commit: 808134e3c94d393d02b013f007379201f9797f49
    https://github.com/scummvm/scummvm/commit/808134e3c94d393d02b013f007379201f9797f49
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-05-22T23:42:45+01:00

Commit Message:
BUILD: Use `strip -x` when using plugins and stripping the main binary on macOS

Global symbols should be kept when building dylibs.

Changed paths:
    configure


diff --git a/configure b/configure
index 3705b493440..4c602d6a1a6 100755
--- a/configure
+++ b/configure
@@ -2159,7 +2159,7 @@ if test "$have_gcc" = yes ; then
 elif test "$have_icc" = yes ; then
 	# ICC does not support pedantic, while GCC and clang do.
 	add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP'
-fi;
+fi
 
 #
 # Set status about C++11 mode
@@ -2818,7 +2818,7 @@ EOF
 			fi
 		fi
 
-		# Avoid "file has no symbols" noise from ranlib, if it's new enough
+		# Avoid "file has no symbols" noise from ranlib, if it's new enough
 		ranlib_version=`$_ranlib -V 2>/dev/null`
 		if test -n "$ranlib_version" ; then
 			ranlib_version="`echo "${ranlib_version}" | sed -ne 's/.*cctools-\([0-9]\{1,\}\).*/\1/gp'`"
@@ -4084,6 +4084,7 @@ POST_OBJS_FLAGS := -Wl,-no-whole-archive
 		_plugin_prefix=""
 		_plugin_suffix=".plugin"
 		append_var LIBS "-ldl"
+		append_var _strip "-x"
 _mak_plugins='
 PLUGIN_EXTRA_DEPS = $(EXECUTABLE)
 PLUGIN_LDFLAGS  += -bundle -bundle_loader $(EXECUTABLE) -exported_symbols_list "$(srcdir)/plugin.exp"


Commit: 09959e34c5f1c29ce33f39b3ab9c5252304104de
    https://github.com/scummvm/scummvm/commit/09959e34c5f1c29ce33f39b3ab9c5252304104de
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-05-22T23:42:45+01:00

Commit Message:
MACOSX: Make it possible to embed plugins when making a macOS bundle

Changed paths:
    ports.mk


diff --git a/ports.mk b/ports.mk
index 85852a9014a..2490d33ee39 100644
--- a/ports.mk
+++ b/ports.mk
@@ -158,6 +158,9 @@ endif
 	cp $(bundle_name)/Contents/Resources/COPYING.FREEFONT $(bundle_name)/Contents/Resources/COPYING-FREEFONT
 	cp $(bundle_name)/Contents/Resources/COPYING.OFL $(bundle_name)/Contents/Resources/COPYING-OFL
 	cp $(bundle_name)/Contents/Resources/COPYING.BSD $(bundle_name)/Contents/Resources/COPYING-BSD
+ifdef DYNAMIC_MODULES
+	cp $(PLUGINS) $(bundle_name)/Contents/Resources/
+endif
 	chmod 644 $(bundle_name)/Contents/Resources/*
 ifneq ($(DIST_FILES_SHADERS),)
 	chmod 755 $(bundle_name)/Contents/Resources/shaders
@@ -172,9 +175,9 @@ endif
 	codesign -s - --deep --force $(bundle_name)
 
 ifdef USE_DOCKTILEPLUGIN
-bundle: scummvm-static scummvm.docktileplugin bundle-pack
+bundle: scummvm-static plugins scummvm.docktileplugin bundle-pack
 else
-bundle: scummvm-static bundle-pack
+bundle: scummvm-static plugins bundle-pack
 endif
 
 iphonebundle: iphone


Commit: dedabbcfa1a0b87e9b3f04824fa0f4b3e208dc5c
    https://github.com/scummvm/scummvm/commit/dedabbcfa1a0b87e9b3f04824fa0f4b3e208dc5c
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-05-22T23:42:45+01:00

Commit Message:
BUILD: Use $(PRE_OBJS_FLAGS) in scummvm-static macos target

Otherwise, making a macOS bundle with plugins wouldn't load any of
these plugins (i.e. -all_load is required).

Changed paths:
    ports.mk


diff --git a/ports.mk b/ports.mk
index 2490d33ee39..945c761e5a9 100644
--- a/ports.mk
+++ b/ports.mk
@@ -475,7 +475,7 @@ endif
 # We use -force_cpusubtype_ALL to ensure the binary runs on every
 # PowerPC machine.
 scummvm-static: $(DETECT_OBJS) $(OBJS)
-	+$(LD) $(LDFLAGS) -force_cpusubtype_ALL -o scummvm-static $(DETECT_OBJS) $(OBJS) \
+	+$(LD) $(LDFLAGS) -force_cpusubtype_ALL -o scummvm-static $(PRE_OBJS_FLAGS) $(DETECT_OBJS) $(OBJS) $(POST_OBJS_FLAGS) \
 		-framework CoreMIDI \
 		$(OSX_STATIC_LIBS) \
 		$(OSX_ZLIB)


Commit: a933a0d261c924380df1510ff783f9eca8ac066d
    https://github.com/scummvm/scummvm/commit/a933a0d261c924380df1510ff783f9eca8ac066d
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-05-22T23:42:45+01:00

Commit Message:
MACOSX: Switch getResourceAppBundlePathMacOSX() to Objective-C

As suggested by criezy, we don't need to use the C-bridge from Core
Foundation now that the wrapper has been moved to an Objective-C file.

Changed paths:
    backends/platform/sdl/macosx/macosx_wrapper.mm


diff --git a/backends/platform/sdl/macosx/macosx_wrapper.mm b/backends/platform/sdl/macosx/macosx_wrapper.mm
index 44ff0d317e6..0e4b7e903d0 100644
--- a/backends/platform/sdl/macosx/macosx_wrapper.mm
+++ b/backends/platform/sdl/macosx/macosx_wrapper.mm
@@ -27,10 +27,10 @@
 
 #include <AppKit/NSPasteboard.h>
 #include <Foundation/NSArray.h>
+#include <Foundation/NSBundle.h>
 #include <Foundation/NSPathUtilities.h>
 #include <AvailabilityMacros.h>
 #include <CoreFoundation/CFString.h>
-#include <CoreFoundation/CoreFoundation.h>
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
 #define NSPasteboardTypeString NSStringPboardType
@@ -113,16 +113,8 @@ Common::String getDesktopPathMacOSX() {
 }
 
 Common::String getResourceAppBundlePathMacOSX() {
-	CFURLRef fileUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
-	if (fileUrl) {
-		// Try to convert the URL to an absolute path
-		UInt8 buf[MAXPATHLEN];
-		if (CFURLGetFileSystemRepresentation(fileUrl, true, buf, sizeof(buf))) {
-			CFRelease(fileUrl);
-			return Common::String((const char *)buf);
-		}
-		CFRelease(fileUrl);
-	}
-
-	return Common::String();
+	NSString *bundlePath = [[NSBundle mainBundle] resourcePath];
+	if (bundlePath == nil)
+		return Common::String();
+	return Common::String([bundlePath fileSystemRepresentation]);
 }




More information about the Scummvm-git-logs mailing list