Drop OS X 10.7 and Growl support (#2749)
(cherry-picked from commit 39d1476ade
)
This commit is contained in:
parent
4d28725441
commit
cf606d23f3
4 changed files with 18 additions and 129 deletions
|
@ -13,7 +13,6 @@ sdl2_image_required_version="2.0.3"
|
|||
sdl2_mixer_required_version="2.0.2"
|
||||
sdl2_net_required_version="2.0.1"
|
||||
sdl2_ttf_required_version="2.0.14"
|
||||
growl_required_version="2.0.1"
|
||||
###/Required Version Defines
|
||||
|
||||
###Sha256
|
||||
|
@ -22,7 +21,6 @@ sdl2_image_dmg_sha256="f1beefadf4dfc4f923c5cdb37d012fd94063b9c5085f492f9170e0043
|
|||
sdl2_mixer_dmg_sha256="174a371e2acdfa7ae26be71134b9925f46e5257c8c8d608f09a6726a0368606b"
|
||||
sdl2_net_dmg_sha256="3a126e31b323d832be0ef4b9941fc3113b931e42a26e9bcc989487fd5348f858"
|
||||
sdl2_ttf_dmg_sha256="7cdfb4239aaacfed2fd235c12f600b21b193b6ceb60b32b1cbb674fbde04e9f3"
|
||||
growl_zip_sha256="f57c3beeba51738c44f1f741c008815c54352282d1085076e0ed61d6f17806a8"
|
||||
###/Sha256
|
||||
|
||||
###Functions
|
||||
|
@ -60,39 +58,22 @@ framework_install() {
|
|||
fi
|
||||
if [ "$path" == "none" ]; then
|
||||
echo "==> Downloading $PACKAGE $REQUIRED_VERSION"
|
||||
if [ "$PACKAGE" != "Growl" ]; then
|
||||
if [ -f "$PACKAGE-$REQUIRED_VERSION.dmg" ]; then
|
||||
rm "$PACKAGE-$REQUIRED_VERSION.dmg"
|
||||
fi
|
||||
if [ "$PACKAGE" == "SDL2" ]; then
|
||||
wget "https://www.libsdl.org/release/$PACKAGE-$REQUIRED_VERSION.dmg" -q --show-progress
|
||||
else
|
||||
wget "https://www.libsdl.org/projects/$(echo "$PACKAGE" | sed -e 's/SDL2/SDL/g')/release/$PACKAGE-$REQUIRED_VERSION.dmg" -q --show-progress
|
||||
fi
|
||||
if [ "$(shasum -a 256 $PACKAGE-$REQUIRED_VERSION.dmg | awk '{print $1}')" != $SHA256 ]; then
|
||||
echo "Error: SHA256 Checksum of $PACKAGE-$REQUIRED_VERSION.dmg doesn't match!" >&2
|
||||
exit 1
|
||||
fi
|
||||
hdiutil attach "$PACKAGE-$REQUIRED_VERSION.dmg" > /dev/null
|
||||
cp -Rf /Volumes/$PACKAGE/$PACKAGE.framework $PACKAGE.framework
|
||||
hdiutil detach /Volumes/$PACKAGE > /dev/null
|
||||
path="$MY_PATH/temp/$PACKAGE.framework"
|
||||
else
|
||||
if [ -f "$PACKAGE-$REQUIRED_VERSION-SDK.zip" ]; then
|
||||
rm "$PACKAGE-$REQUIRED_VERSION-SDK.zip"
|
||||
fi
|
||||
wget "http://growl.cachefly.net/$PACKAGE-$REQUIRED_VERSION-SDK.zip" -q --show-progress
|
||||
if [ "$(shasum -a 256 $PACKAGE-$REQUIRED_VERSION-SDK.zip | awk '{print $1}')" != $SHA256 ]; then
|
||||
echo "Error: SHA256 Checksum of $PACKAGE-$REQUIRED_VERSION-SDK.zip doesn't match!" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -d "$PACKAGE-$REQUIRED_VERSION-SDK" ]; then
|
||||
rm -rf "$PACKAGE-$REQUIRED_VERSION-SDK"
|
||||
fi
|
||||
unzip "$PACKAGE-$REQUIRED_VERSION-SDK.zip" > /dev/null
|
||||
cp -Rf "$PACKAGE-$REQUIRED_VERSION-SDK/Framework/$PACKAGE.framework" Growl.framework
|
||||
path="$MY_PATH/temp/$PACKAGE.framework"
|
||||
if [ -f "$PACKAGE-$REQUIRED_VERSION.dmg" ]; then
|
||||
rm "$PACKAGE-$REQUIRED_VERSION.dmg"
|
||||
fi
|
||||
if [ "$PACKAGE" == "SDL2" ]; then
|
||||
wget "https://www.libsdl.org/release/$PACKAGE-$REQUIRED_VERSION.dmg" -q --show-progress
|
||||
else
|
||||
wget "https://www.libsdl.org/projects/$(echo "$PACKAGE" | sed -e 's/SDL2/SDL/g')/release/$PACKAGE-$REQUIRED_VERSION.dmg" -q --show-progress
|
||||
fi
|
||||
if [ "$(shasum -a 256 $PACKAGE-$REQUIRED_VERSION.dmg | awk '{print $1}')" != $SHA256 ]; then
|
||||
echo "Error: SHA256 Checksum of $PACKAGE-$REQUIRED_VERSION.dmg doesn't match!" >&2
|
||||
exit 1
|
||||
fi
|
||||
hdiutil attach "$PACKAGE-$REQUIRED_VERSION.dmg" > /dev/null
|
||||
cp -Rf /Volumes/$PACKAGE/$PACKAGE.framework $PACKAGE.framework
|
||||
hdiutil detach /Volumes/$PACKAGE > /dev/null
|
||||
path="$MY_PATH/temp/$PACKAGE.framework"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -223,11 +204,6 @@ sdl2_net_path="$path"
|
|||
framework_install "SDL2_ttf" "$sdl2_ttf_required_version" "$sdl2_ttf_dmg_sha256"
|
||||
sdl2_ttf_path="$path"
|
||||
###/SDL2_ttf
|
||||
|
||||
###Growl
|
||||
framework_install "Growl" "$growl_required_version" "$growl_zip_sha256"
|
||||
growl_path="$path"
|
||||
###/Growl
|
||||
cd ..
|
||||
|
||||
if [ -d "lib" ]; then
|
||||
|
@ -263,7 +239,6 @@ ln -s "$sdl2_image_path"
|
|||
ln -s "$sdl2_mixer_path"
|
||||
ln -s "$sdl2_net_path"
|
||||
ln -s "$sdl2_ttf_path"
|
||||
ln -s "$growl_path"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -816,9 +816,7 @@
|
|||
91FBBAD81CB6BC3F00470BFE /* filesystem_sdl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91FBBAD71CB6BC3F00470BFE /* filesystem_sdl.cpp */; };
|
||||
91FBBADB1CB6D1B700470BFE /* markov_generator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91FBBAD91CB6D1B700470BFE /* markov_generator.cpp */; };
|
||||
B504B94C1284C06B00261FE9 /* tips.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B504B94A1284C06B00261FE9 /* tips.cpp */; };
|
||||
B508D13F10013BF900B12852 /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B508D13E10013BF900B12852 /* Growl.framework */; };
|
||||
B508D14B10013E4700B12852 /* Growl Registration Ticket.growlRegDict in Resources */ = {isa = PBXBuildFile; fileRef = B508D14A10013E4700B12852 /* Growl Registration Ticket.growlRegDict */; };
|
||||
B508D15F10013F8100B12852 /* Growl.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = B508D13E10013BF900B12852 /* Growl.framework */; };
|
||||
B508D193100146E300B12852 /* engine_fai.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B508D191100146E300B12852 /* engine_fai.cpp */; };
|
||||
B508D1FB100155F300B12852 /* helper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B508D1E7100155F300B12852 /* helper.cpp */; };
|
||||
B508D2161001560100B12852 /* stacked_widget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B508D2141001560100B12852 /* stacked_widget.cpp */; };
|
||||
|
@ -1374,7 +1372,6 @@
|
|||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
905440871EE46ABC0091D1AE /* libcrypto.1.1.dylib in Copy Frameworks */,
|
||||
B508D15F10013F8100B12852 /* Growl.framework in Copy Frameworks */,
|
||||
91B622011B76C0A600B00E0F /* libboost_filesystem-mt.dylib in Copy Frameworks */,
|
||||
91B622021B76C0A600B00E0F /* libboost_iostreams-mt.dylib in Copy Frameworks */,
|
||||
91B622031B76C0A600B00E0F /* libboost_locale-mt.dylib in Copy Frameworks */,
|
||||
|
@ -1854,7 +1851,6 @@
|
|||
91FBBADA1CB6D1B700470BFE /* markov_generator.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = markov_generator.hpp; sourceTree = "<group>"; };
|
||||
B504B94A1284C06B00261FE9 /* tips.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tips.cpp; sourceTree = "<group>"; };
|
||||
B504B94B1284C06B00261FE9 /* tips.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = tips.hpp; sourceTree = "<group>"; };
|
||||
B508D13E10013BF900B12852 /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Growl.framework; path = lib/Growl.framework; sourceTree = "<group>"; };
|
||||
B508D14A10013E4700B12852 /* Growl Registration Ticket.growlRegDict */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = "Growl Registration Ticket.growlRegDict"; path = "Resources/Growl Registration Ticket.growlRegDict"; sourceTree = "<group>"; };
|
||||
B508D191100146E300B12852 /* engine_fai.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = engine_fai.cpp; sourceTree = "<group>"; };
|
||||
B508D192100146E300B12852 /* engine_fai.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = engine_fai.hpp; sourceTree = "<group>"; };
|
||||
|
@ -2747,7 +2743,6 @@
|
|||
ECA9E7471CA20AA800A947D6 /* libreadline.7.0.dylib in Frameworks */,
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
|
||||
F4D2A99614DAED0E00CAFF31 /* CoreFoundation.framework in Frameworks */,
|
||||
B508D13F10013BF900B12852 /* Growl.framework in Frameworks */,
|
||||
91B6221D1B76C0F400B00E0F /* libboost_filesystem-mt.dylib in Frameworks */,
|
||||
91B6221E1B76C0F400B00E0F /* libboost_iostreams-mt.dylib in Frameworks */,
|
||||
91B6221F1B76C0F400B00E0F /* libboost_locale-mt.dylib in Frameworks */,
|
||||
|
@ -2881,7 +2876,6 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
46BAF784206672240004711F /* libboost_chrono-mt.dylib */,
|
||||
B508D13E10013BF900B12852 /* Growl.framework */,
|
||||
B55999220EC61F59008DD061 /* SDL2_image.framework */,
|
||||
B55999240EC61F59008DD061 /* SDL2_mixer.framework */,
|
||||
B5599E9B0EC68BF2008DD061 /* SDL2_ttf.framework */,
|
||||
|
@ -6338,7 +6332,7 @@
|
|||
);
|
||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/lib";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.8;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_CFLAGS = (
|
||||
"-Wall",
|
||||
|
@ -6389,7 +6383,7 @@
|
|||
);
|
||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/lib";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.8;
|
||||
OTHER_CFLAGS = (
|
||||
"-Wno-unused-local-typedefs",
|
||||
"-Wno-unused-private-field",
|
||||
|
|
|
@ -40,10 +40,6 @@
|
|||
// apple_notification.mm uses Foundation.h, which is an Objective-C header;
|
||||
// but CoreFoundation.h is a C header which also defines these.
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
#if (defined MAC_OS_X_VERSION_10_8) && (MAC_OS_X_VERSION_10_8 <= MAC_OS_X_VERSION_MAX_ALLOWED)
|
||||
#define HAVE_NS_USER_NOTIFICATION
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace game_config
|
||||
|
@ -298,17 +294,9 @@ version_table_manager::version_table_manager()
|
|||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
// Always compiled in.
|
||||
features.emplace_back(N_("feature^Cocoa notifications back end"));
|
||||
#ifdef HAVE_NS_USER_NOTIFICATION
|
||||
features.back().enabled = true;
|
||||
#endif
|
||||
|
||||
features.emplace_back(N_("feature^Growl notifications back end"));
|
||||
#ifdef HAVE_GROWL
|
||||
features.back().enabled = true;
|
||||
#endif
|
||||
|
||||
#endif /* __APPLE__ */
|
||||
}
|
||||
|
||||
|
|
|
@ -18,21 +18,6 @@
|
|||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#if (defined MAC_OS_X_VERSION_10_8) && (MAC_OS_X_VERSION_10_8 <= MAC_OS_X_VERSION_MAX_ALLOWED)
|
||||
#define HAVE_NS_USER_NOTIFICATION
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GROWL
|
||||
#import "Growl/Growl.h"
|
||||
|
||||
@interface WesnothGrowlDelegate : NSObject <GrowlApplicationBridgeDelegate>
|
||||
@end
|
||||
|
||||
@implementation WesnothGrowlDelegate
|
||||
// Empty delegate to interact with Growl. Implement protocol if we want to handle messages from Growl.
|
||||
@end
|
||||
#endif
|
||||
|
||||
namespace apple_notifications {
|
||||
|
||||
bool available() {
|
||||
|
@ -47,40 +32,20 @@ bool available() {
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_NS_USER_NOTIFICATION
|
||||
void send_cocoa_notification(const std::string& owner, const std::string& message);
|
||||
#endif
|
||||
#ifdef HAVE_GROWL
|
||||
void send_growl_notification(const std::string& owner, const std::string& message, const desktop::notifications::type note_type);
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#ifdef HAVE_NS_USER_NOTIFICATION
|
||||
void send_notification(const std::string& owner, const std::string& message, const desktop::notifications::type note_type) {
|
||||
@autoreleasepool {
|
||||
Class appleNotificationClass = NSClassFromString(@"NSUserNotificationCenter");
|
||||
if (appleNotificationClass) {
|
||||
send_cocoa_notification(owner, message);
|
||||
#ifdef HAVE_GROWL
|
||||
} else {
|
||||
send_growl_notification(owner, message, note_type);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#else // HAVE_NS_USER_NOTIFICATION
|
||||
void send_notification(const std::string& owner, const std::string& message, const desktop::notifications::type note_type) {
|
||||
#ifdef HAVE_GROWL
|
||||
@autoreleasepool {
|
||||
send_growl_notification(owner, message, note_type);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif //end else HAVE_NS_USER_NOTIFICATION
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#ifdef HAVE_NS_USER_NOTIFICATION
|
||||
void send_cocoa_notification(const std::string& owner, const std::string& message) {
|
||||
NSString *title = [NSString stringWithCString:owner.c_str() encoding:NSUTF8StringEncoding];
|
||||
NSString *description = [NSString stringWithCString:message.c_str() encoding:NSUTF8StringEncoding];
|
||||
|
@ -91,39 +56,6 @@ void send_cocoa_notification(const std::string& owner, const std::string& messag
|
|||
|
||||
[[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification:notification];
|
||||
}
|
||||
#endif //end HAVE_NS_USER_NOTIFICATION
|
||||
|
||||
#ifdef HAVE_GROWL
|
||||
void send_growl_notification(const std::string& owner, const std::string& message, const desktop::notifications::type note_type) {
|
||||
static WesnothGrowlDelegate *delegate = nil;
|
||||
if (!delegate) {
|
||||
delegate = [[WesnothGrowlDelegate alloc] init];
|
||||
[GrowlApplicationBridge setGrowlDelegate:delegate];
|
||||
}
|
||||
|
||||
NSString *notificationName = @"";
|
||||
switch (note_type) {
|
||||
case desktop::notifications::CHAT:
|
||||
notificationName = @"Chat Message";
|
||||
break;
|
||||
case desktop::notifications::TURN_CHANGED:
|
||||
notificationName = @"Turn Changed";
|
||||
break;
|
||||
case desktop::notifications::OTHER:
|
||||
notificationName = @"Wesnoth";
|
||||
break;
|
||||
}
|
||||
NSString *title = [NSString stringWithCString:owner.c_str() encoding:NSUTF8StringEncoding];
|
||||
NSString *description = [NSString stringWithCString:message.c_str() encoding:NSUTF8StringEncoding];
|
||||
[GrowlApplicationBridge notifyWithTitle:title
|
||||
description:description
|
||||
notificationName:notificationName
|
||||
iconData:nil
|
||||
priority:0
|
||||
isSticky:NO
|
||||
clickContext:nil];
|
||||
}
|
||||
#endif //end HAVE_GROWL
|
||||
|
||||
}
|
||||
#endif //end __APPLE__
|
||||
|
|
Loading…
Add table
Reference in a new issue