From 3b44f9d6c5e66553b756e0fa76f09a0148c98e97 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Fri, 20 Mar 2015 14:06:48 +0000 Subject: [PATCH 01/14] Added ignore for OpenSSL This is to stop buildbot from wiping out the openssl dir when switching. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e400bc2f..4bdaf615 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ config.h /ext/cryptopp562 /ext/gmock-1.6.0 /ext/gtest-1.6.0 +/ext/openssl /src/gui/Makefile* /src/gui/object_script* /src/gui/tmp From f5cac2846e548dba287cc430cb6d8551d5221e54 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Mon, 2 Mar 2015 17:31:43 +0000 Subject: [PATCH 02/14] Removed obsolete code and used Qt to codesign #4397 --- ext/toolchain/commands1.py | 71 ++++---------------------------------- 1 file changed, 7 insertions(+), 64 deletions(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index 3dcfb1c1..1b476764 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -795,8 +795,6 @@ class InternalCommands: for target in targets: self.macPostMake(target) - self.fixQtFrameworksLayout() - def symlink(self, source, target): if not os.path.exists(target): os.symlink(source, target) @@ -805,39 +803,6 @@ class InternalCommands: if os.path.exists(source): shutil.move(source, target) - def fixQtFrameworksLayout(self): - # reorganize Qt frameworks layout on Mac 10.9.5 or later - # http://goo.gl/BFnQ8l - # QtCore example: - # QtCore.framework/ - # QtCore -> Versions/Current/QtCore - # Resources -> Versions/Current/Resources - # Versions/ - # Current -> 5 - # 5/ - # QtCore - # Resources/ - # Info.plist - dir = self.getGenerator().binDir - target = dir + "/Synergy.app/Contents/Frameworks" - (major, minor) = self.getMacVersion() - if major == 10: - if minor >= 9: - for root, dirs, files in os.walk(target): - for dir in dirs: - if dir.startswith("Qt"): - self.try_chdir(target + "/" + dir +"/Versions") - self.symlink("5", "Current") - self.move("../Resources", "5") - self.restore_chdir() - - self.try_chdir(target + "/" + dir) - dot = dir.find('.') - frameworkName = dir[:dot] - self.symlink("Versions/Current/" + frameworkName, frameworkName) - self.symlink("Versions/Current/Resources", "Resources") - self.restore_chdir() - def macPostMake(self, target): dir = self.getGenerator().binDir @@ -859,46 +824,24 @@ class InternalCommands: shutil.copy(targetDir + "/synmacph", launchServicesDir) if self.enableMakeGui: + + self.loadConfig() + if not self.macIdentity: + raise Exception("run config with --mac-identity") + # use qt to copy libs to bundle so no dependencies are needed. do not create a # dmg at this point, since we need to sign it first, and then create our own # after signing (so that qt does not affect the signed app bundle). - bin = "macdeployqt Synergy.app -verbose=2" + bin = "macdeployqt Synergy.app -verbose=2 -codesign='" + self.macIdentity + "'" self.try_chdir(dir) err = os.system(bin) self.restore_chdir() if err != 0: raise Exception(bin + " failed with error: " + str(err)) - - (qMajor, qMinor, qRev) = self.getQmakeVersion() - if qMajor <= 4: - frameworkRootDir = "/Library/Frameworks" - else: - # TODO: auto-detect, qt can now be installed anywhere. - frameworkRootDir = "/Developer/Qt5.2.1/5.2.1/clang_64/lib" - - target = dir + "/Synergy.app/Contents/Frameworks" - - # copy the missing Info.plist files for the frameworks. - for root, dirs, files in os.walk(target): - for dir in dirs: - if dir.startswith("Qt"): - shutil.copy( - frameworkRootDir + "/" + dir + "/Contents/Info.plist", - target + "/" + dir + "/Resources/") def signmac(self): - self.loadConfig() - if not self.macIdentity: - raise Exception("run config with --mac-identity") - - self.try_chdir("bin") - err = os.system( - 'codesign --deep -fs "' + self.macIdentity + '" Synergy.app') - self.restore_chdir() - - if err != 0: - raise Exception("codesign failed with error: " + str(err)) + print "signmac is now obsolete" def signwin(self, pfx, pwdFile, dist): generator = self.getGeneratorFromConfig().cmakeName From c05d7fad36f9b5025846a16681c5072e477d996d Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Mon, 2 Mar 2015 17:50:42 +0000 Subject: [PATCH 03/14] Removed remnants of synmacph tool #4398 --- ext/toolchain/commands1.py | 6 -- src/gui/gui.pro | 4 +- src/gui/res/mac/Info.plist | 4 - src/gui/src/AXDatabaseCleaner.h | 42 -------- src/gui/src/AXDatabaseCleaner.mm | 166 ------------------------------- src/gui/src/main.cpp | 4 - 6 files changed, 1 insertion(+), 225 deletions(-) delete mode 100644 src/gui/src/AXDatabaseCleaner.h delete mode 100644 src/gui/src/AXDatabaseCleaner.mm diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index 1b476764..b40af000 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -817,12 +817,6 @@ class InternalCommands: shutil.copy(targetDir + "/synergys", bundleBinDir) shutil.copy(targetDir + "/syntool", bundleBinDir) - if self.macSdk == "10.9": - launchServicesDir = dir + "/Synergy.app/Contents/Library/LaunchServices/" - if not os.path.exists(launchServicesDir): - os.makedirs(launchServicesDir) - shutil.copy(targetDir + "/synmacph", launchServicesDir) - if self.enableMakeGui: self.loadConfig() diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 0576f266..c3a37d3e 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -89,9 +89,7 @@ HEADERS += src/MainWindow.h \ src/CommandProcess.h RESOURCES += res/Synergy.qrc RC_FILE = res/win/Synergy.rc -macx { - HEADERS += src/AXDatabaseCleaner.h - OBJECTIVE_SOURCES += src/AXDatabaseCleaner.mm +macx { QMAKE_INFO_PLIST = res/mac/Info.plist TARGET = Synergy QSYNERGY_ICON.files = res/mac/Synergy.icns diff --git a/src/gui/res/mac/Info.plist b/src/gui/res/mac/Info.plist index 992df616..c2e4eac7 100644 --- a/src/gui/res/mac/Info.plist +++ b/src/gui/res/mac/Info.plist @@ -17,9 +17,5 @@ CFBundleIdentifier synergy SMPrivilegedExecutables - - synmacph - anchor apple generic and identifier "synmacph" and (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = SP58PFWX5L) - diff --git a/src/gui/src/AXDatabaseCleaner.h b/src/gui/src/AXDatabaseCleaner.h deleted file mode 100644 index dc41f31b..00000000 --- a/src/gui/src/AXDatabaseCleaner.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * synergy -- mouse and keyboard sharing utility - * Copyright (C) 2014 Synergy Si Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file COPYING that should have accompanied this file. - * - * This package 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 . - */ - -#pragma once - -#include - -// HACK: ideally this file should not be included in project, -// if it is below marvericks, but it seems that .pro can't -// specify mac version -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 - -class AXDatabaseCleaner { -public: - AXDatabaseCleaner(); - ~AXDatabaseCleaner(); - - bool loadPrivilegeHelper(); - bool xpcConnect(); - bool privilegeCommand(const char* command); - -private: - class Private; - Private* m_private; - bool m_waitForResponse; -}; - -#endif diff --git a/src/gui/src/AXDatabaseCleaner.mm b/src/gui/src/AXDatabaseCleaner.mm deleted file mode 100644 index 96435b1e..00000000 --- a/src/gui/src/AXDatabaseCleaner.mm +++ /dev/null @@ -1,166 +0,0 @@ -/* - * synergy -- mouse and keyboard sharing utility - * Copyright (C) 2014 Synergy Si Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file COPYING that should have accompanied this file. - * - * This package 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 . - */ - -#import "AXDatabaseCleaner.h" - -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 - -#import -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 -#import -#endif -#import -#import -#import - -const NSString* const label = @"synmacph"; - -class AXDatabaseCleaner::Private { -public: - NSAutoreleasePool* autoReleasePool; - AuthorizationRef authRef; - xpc_connection_t xpcConnection; -}; - -AXDatabaseCleaner::AXDatabaseCleaner() -{ - m_private = new Private; - m_private->autoReleasePool = [[NSAutoreleasePool alloc] init]; - - m_waitForResponse = false; -} - -AXDatabaseCleaner::~AXDatabaseCleaner() -{ - [m_private->autoReleasePool release]; - delete m_private; -} - -bool AXDatabaseCleaner::loadPrivilegeHelper() -{ -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 // mavericks - - OSStatus status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &m_private->authRef); - if (status != errAuthorizationSuccess) { - assert(NO); - m_private->authRef = NULL; - } - - AuthorizationItem authItem = {kSMRightBlessPrivilegedHelper, 0, NULL, 0}; - AuthorizationRights authRights = {1, &authItem}; - AuthorizationFlags flags = kAuthorizationFlagDefaults - | kAuthorizationFlagInteractionAllowed - | kAuthorizationFlagPreAuthorize - | kAuthorizationFlagExtendRights; - - BOOL result = NO; - NSError* error = nil; - - status = AuthorizationCopyRights(m_private->authRef, &authRights, kAuthorizationEmptyEnvironment, flags, NULL); - if (status != errAuthorizationSuccess) { - error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil]; - } - else { - CFErrorRef cfError; - result = (BOOL)SMJobBless(kSMDomainSystemLaunchd, (CFStringRef)label, m_private->authRef, &cfError); - - if (!result) { - error = CFBridgingRelease(cfError); - } - } - - if (!result) { - assert(error != nil); - NSLog(@"bless error: domain= %@ / code= %d", [error domain], (int) [error code]); - return false; - } - - return true; -} - -bool AXDatabaseCleaner::xpcConnect() -{ - const char *cStr = [label cStringUsingEncoding:NSASCIIStringEncoding]; - m_private->xpcConnection = xpc_connection_create_mach_service( - cStr, - NULL, - XPC_CONNECTION_MACH_SERVICE_PRIVILEGED); - - if (!m_private->xpcConnection) { - NSLog(@"failed to create xpc connection"); - return false; - } - - xpc_connection_set_event_handler(m_private->xpcConnection, ^(xpc_object_t event) { - xpc_type_t type = xpc_get_type(event); - - if (type == XPC_TYPE_ERROR) { - if (event == XPC_ERROR_CONNECTION_INTERRUPTED) { - NSLog(@"xpc connection interupted"); - - } - else if (event == XPC_ERROR_CONNECTION_INVALID) { - NSLog(@"xpc connection invalid, releasing"); - xpc_release(m_private->xpcConnection); - } - else { - NSLog(@"unexpected xpc connection error"); - } - } - else { - NSLog(@"unexpected xpc connection event"); - } - }); - - xpc_connection_resume(m_private->xpcConnection); - - return true; -} - -bool AXDatabaseCleaner::privilegeCommand(const char* command) -{ - xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0); - xpc_dictionary_set_string(message, "request", command); - m_waitForResponse = true; - - xpc_connection_send_message_with_reply( - m_private->xpcConnection, - message, - dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), - ^(xpc_object_t event) { - const char* response = xpc_dictionary_get_string(event, "reply"); - NSLog(@"reply from helper tool: %s", response); - m_waitForResponse = false; - }); - - QTime time = QTime::currentTime(); - time.start(); - - while (m_waitForResponse) { - sleep(1); - if (time.elapsed() > 10000) { - QMessageBox::critical(NULL, "Synergy", - QObject::tr("No response from helper tool.Restart Synergy may solve this problem.")); - return false; - } - } -#endif - - return true; -} - -#endif diff --git a/src/gui/src/main.cpp b/src/gui/src/main.cpp index 2e3df613..4bdff3ec 100644 --- a/src/gui/src/main.cpp +++ b/src/gui/src/main.cpp @@ -32,10 +32,6 @@ #if defined(Q_OS_MAC) #include -#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 -#include "AXDatabaseCleaner.h" -#endif - #endif class QThreadImpl : public QThread From 3deb5492d60f2f181ea42aa0ff5b98410b29a7c4 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Mon, 2 Mar 2015 18:06:23 +0000 Subject: [PATCH 04/14] Removed remnants of synmacph tool (part 2) #4398 --- ext/toolchain/commands1.py | 59 -------------------- src/cmd/CMakeLists.txt | 6 -- src/cmd/synmacph/CMakeLists.txt | 39 ------------- src/cmd/synmacph/Info.plist | 18 ------ src/cmd/synmacph/Launchd.plist | 12 ---- src/cmd/synmacph/synmacph.c | 99 --------------------------------- 6 files changed, 233 deletions(-) delete mode 100644 src/cmd/synmacph/CMakeLists.txt delete mode 100644 src/cmd/synmacph/Info.plist delete mode 100644 src/cmd/synmacph/Launchd.plist delete mode 100644 src/cmd/synmacph/synmacph.c diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index b40af000..f29a721e 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -484,12 +484,6 @@ class InternalCommands: if generator.cmakeName.find('Eclipse') != -1: self.fixCmakeEclipseBug() - - # only on osx 10.9 mavericks. - # manually change .xcodeproj to add code sign for - # synmacph project and specify its info.plist - if self.macSdk == "10.9" and generator.cmakeName.find('Xcode') != -1: - self.fixXcodeProject(target) if err != 0: raise Exception('CMake encountered error: ' + str(err)) @@ -591,59 +585,6 @@ class InternalCommands: file.write(content) file.truncate() file.close() - - def fixXcodeProject(self, target): - print "Fixing Xcode project..." - - insertContent = ( - "CODE_SIGN_IDENTITY = '%s';\n" - "INFOPLIST_FILE = %s/src/cmd/synmacph/Info.plist;\n") % ( - self.macIdentity, - os.getcwd() - ) - - dir = self.getBuildDir(target) - file = open(dir + '/synergy.xcodeproj/project.pbxproj', 'r+') - contents = file.readlines() - - buildConfigurationsFound = None - releaseConfigRefFound = None - releaseBuildSettingsFound = None - fixed = None - releaseConfigRef = ""; - - for line in contents: - if buildConfigurationsFound: - matchObj = re.search(r'\s*(.*)\s*\/\*\s*Release\s*\*\/,', line, re.I) - if matchObj: - releaseConfigRef = matchObj.group(1) - releaseConfigRefFound = True - break - elif buildConfigurationsFound == None: - if 'PBXNativeTarget "synmacph" */ = {' in line: - buildConfigurationsFound = True - - if not releaseConfigRefFound: - raise Exception("Release config ref not found.") - - for n, line in enumerate(contents): - if releaseBuildSettingsFound == None: - if releaseConfigRef + '/* Release */ = {' in line: - releaseBuildSettingsFound = True - elif fixed == None: - if 'buildSettings = {' in line: - contents[n] = line + insertContent - fixed = True - - if not fixed: - raise Exception("Xcode project was not fixed.") - - file.seek(0) - for line in contents: - file.write(line) - file.truncate() - file.close() - return def persist_cmake(self): # even though we're running `cmake --version`, we're only doing this for the 0 return diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index ea7ff60c..0e7e8d1a 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -23,9 +23,3 @@ add_subdirectory(syntool) if (WIN32) add_subdirectory(synergyp) endif() - -if (APPLE) - if (OSX_TARGET_MINOR GREATER 8) - add_subdirectory(synmacph) - endif() -endif() diff --git a/src/cmd/synmacph/CMakeLists.txt b/src/cmd/synmacph/CMakeLists.txt deleted file mode 100644 index 6555a1a4..00000000 --- a/src/cmd/synmacph/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -# synergy -- mouse and keyboard sharing utility -# Copyright (C) 2014 Synergy Si Ltd. -# -# This package is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# found in the file COPYING that should have accompanied this file. -# -# This package 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 . - -file(GLOB sources "*.c" "*.plist") - -include_directories( - ../ -) - -add_executable(synmacph ${sources}) - -get_target_property(current_property synmacph LINK_FLAGS) - -set(OTHER_LINK_FLAGS "-sectcreate __TEXT __info_plist ${root_dir}/src/cmd/synmacph/Info.plist -sectcreate __TEXT __launchd_plist ${root_dir}/src/cmd/synmacph/Launchd.plist") - -if (NOT ${current_property}) - set_target_properties(synmacph PROPERTIES LINK_FLAGS ${OTHER_LINK_FLAGS}) -endif() - -target_link_libraries(synmacph) - -if (CONF_CPACK) - install(TARGETS - synmacph - COMPONENT core - DESTINATION bin) -endif() \ No newline at end of file diff --git a/src/cmd/synmacph/Info.plist b/src/cmd/synmacph/Info.plist deleted file mode 100644 index fcbc5a88..00000000 --- a/src/cmd/synmacph/Info.plist +++ /dev/null @@ -1,18 +0,0 @@ - - - - - CFBundleIdentifier - synmacph - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - synmacph - CFBundleVersion - 1.5 - SMAuthorizedClients - - anchor apple generic and identifier "synergy" and (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = SP58PFWX5L) - - - diff --git a/src/cmd/synmacph/Launchd.plist b/src/cmd/synmacph/Launchd.plist deleted file mode 100644 index 9ac34f46..00000000 --- a/src/cmd/synmacph/Launchd.plist +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Label - synmacph - MachServices - - synmacph - - - diff --git a/src/cmd/synmacph/synmacph.c b/src/cmd/synmacph/synmacph.c deleted file mode 100644 index 652feded..00000000 --- a/src/cmd/synmacph/synmacph.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * synergy -- mouse and keyboard sharing utility - * Copyright (C) 2014 Synergy Si Ltd. - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file COPYING that should have accompanied this file. - * - * This package 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 . - */ - -#include -#include -#include -#include -#include - -const char* const label = "synmacph"; - -static void xpcEventHandler(xpc_connection_t connection, xpc_object_t event); -static void xpcConnectionHandler(xpc_connection_t connection); - -static void xpcEventHandler(xpc_connection_t connection, xpc_object_t event) -{ - syslog(LOG_NOTICE, "received event in helper"); - - xpc_type_t type = xpc_get_type(event); - - if (type == XPC_TYPE_ERROR) { - if (event == XPC_ERROR_CONNECTION_INVALID) { - // the client process on the other end of the connection has either - // crashed or cancelled the connection. After receiving this error, - // the connection is in an invalid state, and you do not need to - // call xpc_connection_cancel(). Just tear down any associated state - // here. - } - else if (event == XPC_ERROR_TERMINATION_IMMINENT) { - // handle per-connection termination cleanup. - } - } - else { - xpc_connection_t remote = xpc_dictionary_get_remote_connection(event); - - const char* command = xpc_dictionary_get_string(event, "request"); - syslog(LOG_NOTICE, "received command in helper: %s", command); - system(command); - - xpc_object_t reply = xpc_dictionary_create_reply(event); - xpc_dictionary_set_string(reply, "reply", "command has been executed"); - xpc_connection_send_message(remote, reply); - xpc_release(reply); - } -} - -static void xpcConnectionHandler(xpc_connection_t connection) -{ - syslog(LOG_NOTICE, "configuring message event handler for helper"); - - xpc_connection_set_event_handler(connection, ^(xpc_object_t event) { - xpcEventHandler(connection, event); - }); - - xpc_connection_resume(connection); -} - -int main(int argc, const char * argv[]) -{ -#pragma unused(argc) -#pragma unused(argv) - - xpc_connection_t service = xpc_connection_create_mach_service( - label, - dispatch_get_main_queue(), - XPC_CONNECTION_MACH_SERVICE_LISTENER); - - if (!service) { - syslog(LOG_NOTICE, "failed to create service"); - exit(EXIT_FAILURE); - } - - syslog(LOG_NOTICE, "configuring connection event handler for helper"); - xpc_connection_set_event_handler(service, ^(xpc_object_t connection) { - xpcConnectionHandler(connection); - }); - - xpc_connection_resume(service); - - dispatch_main(); - - xpc_release(service); - - return EXIT_SUCCESS; -} From 0b4d480bcc8725e0894a0755e6a5d83cb1cb91cf Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Tue, 3 Mar 2015 18:05:59 +0000 Subject: [PATCH 05/14] Removed remnants of synmacph tool (part 3) #4398 --- src/gui/res/mac/Info.plist | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/res/mac/Info.plist b/src/gui/res/mac/Info.plist index c2e4eac7..5cd23eaf 100644 --- a/src/gui/res/mac/Info.plist +++ b/src/gui/res/mac/Info.plist @@ -16,6 +16,5 @@ Synergy CFBundleIdentifier synergy - SMPrivilegedExecutables From e0cb5bda6ed26498a14d102f8aa906c8bd0dfa3e Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 18:38:25 +0000 Subject: [PATCH 06/14] Separated post back build into release and debug #4464 Also related to #4463 --- ext/toolchain/commands1.py | 114 ++++++++++++++------------- temp.diff | 153 +++++++++++++++++++++++++++++++++++++ 2 files changed, 215 insertions(+), 52 deletions(-) create mode 100644 temp.diff diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index f29a721e..ccbe04e6 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -698,43 +698,47 @@ class InternalCommands: raise Exception('Build command not supported with generator: ' + generator) def makeGui(self, targets, args=""): - name = "Synergy.app" - self.try_chdir(self.getGenerator().binDir) - if os.path.exists(name): - print "removing exisiting bundle" - shutil.rmtree(name) - self.restore_chdir() + for target in targets: + + if sys.platform == 'win32': + + gui_make_cmd = self.w32_make_cmd + ' ' + target + args + print 'Make GUI command: ' + gui_make_cmd - if sys.platform == 'win32': - gui_make_cmd = self.w32_make_cmd - elif sys.platform in ['linux2', 'sunos5', 'freebsd7', 'darwin']: - gui_make_cmd = self.make_cmd + " -w" - else: - raise Exception('Unsupported platform: ' + sys.platform) - - gui_make_cmd += args - - print 'Make GUI command: ' + gui_make_cmd - - if sys.platform == 'win32': - for target in targets: self.try_chdir(self.gui_dir) - err = os.system(gui_make_cmd + ' ' + target) + err = os.system(gui_make_cmd) self.restore_chdir() if err != 0: raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) - else: - self.try_chdir(self.gui_dir) - err = os.system(gui_make_cmd) - self.restore_chdir() - if err != 0: - raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) + elif sys.platform in ['linux2', 'sunos5', 'freebsd7', 'darwin']: - if sys.platform == 'darwin' and not "clean" in args: - for target in targets: - self.macPostMake(target) + gui_make_cmd = self.make_cmd + " -w" + args + print 'Make GUI command: ' + gui_make_cmd + + # start with a clean app bundle + targetDir = self.getGenerator().getBinDir(target) + bundleTargetDir = targetDir + '/Synergy.app' + if os.path.exists(bundleTargetDir): + shutil.rmtree(bundleTargetDir) + + binDir = self.getGenerator().binDir + bundleTempDir = binDir + '/Synergy.app' + if os.path.exists(bundleTempDir): + shutil.rmtree(bundleTempDir) + + self.try_chdir(self.gui_dir) + err = os.system(gui_make_cmd) + self.restore_chdir() + + if err != 0: + raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) + + if sys.platform == 'darwin' and not "clean" in args: + self.macPostGuiMake(target) + else: + raise Exception('Unsupported platform: ' + sys.platform) def symlink(self, source, target): if not os.path.exists(target): @@ -744,36 +748,41 @@ class InternalCommands: if os.path.exists(source): shutil.move(source, target) - def macPostMake(self, target): + def macPostGuiMake(self, target): - dir = self.getGenerator().binDir + bundle = 'Synergy.app' + binDir = self.getGenerator().binDir + targetDir = self.getGenerator().getBinDir(target) + bundleTempDir = binDir + '/' + bundle + bundleTargetDir = targetDir + '/' + bundle + + if os.path.exists(bundleTempDir): + shutil.move(bundleTempDir, bundleTargetDir) if self.enableMakeCore: # copy core binaries into the bundle, since the gui # now looks for the binaries in the current app dir. - targetDir = self.getGenerator().getBinDir(target) - bundleBinDir = dir + "/Synergy.app/Contents/MacOS/" + bundleBinDir = bundleTargetDir + "/Contents/MacOS/" shutil.copy(targetDir + "/synergyc", bundleBinDir) shutil.copy(targetDir + "/synergys", bundleBinDir) shutil.copy(targetDir + "/syntool", bundleBinDir) - if self.enableMakeGui: + self.loadConfig() + if not self.macIdentity: + raise Exception("run config with --mac-identity") - self.loadConfig() - if not self.macIdentity: - raise Exception("run config with --mac-identity") + if sys.version_info < (2, 4): + raise Exception("Python 2.4 or greater required.") - # use qt to copy libs to bundle so no dependencies are needed. do not create a - # dmg at this point, since we need to sign it first, and then create our own - # after signing (so that qt does not affect the signed app bundle). - bin = "macdeployqt Synergy.app -verbose=2 -codesign='" + self.macIdentity + "'" - self.try_chdir(dir) - err = os.system(bin) - self.restore_chdir() - - if err != 0: - raise Exception(bin + " failed with error: " + str(err)) + output = os.popen( + "macdeployqt %s/Synergy.app -verbose=2 -codesign='%s'" % ( + targetDir, self.macIdentity)).read() + + print output + + if "ERROR" in output: + raise Exception("macdeployqt failed") def signmac(self): print "signmac is now obsolete" @@ -1183,16 +1192,16 @@ class InternalCommands: def distMac(self): self.loadConfig() - dir = self.getGenerator().binDir + binDir = self.getGenerator().getBinDir('Release') name = "Synergy" - dist = dir + "/" + name + dist = binDir + "/" + name # ensure dist dir is clean if os.path.exists(dist): shutil.rmtree(dist) os.makedirs(dist) - shutil.move(dir + "/" + name + ".app", dist + "/" + name + ".app") + shutil.move(binDir + "/" + name + ".app", dist + "/" + name + ".app") self.try_chdir(dist) err = os.system("ln -s /Applications") @@ -1205,7 +1214,7 @@ class InternalCommands: cmd = "hdiutil create " + fileName + " -srcfolder ./" + name + "/ -ov" - self.try_chdir(dir) + self.try_chdir(binDir) err = os.system(cmd) self.restore_chdir() @@ -1376,8 +1385,9 @@ class InternalCommands: pattern = re.escape(self.project + '-') + '\d+\.\d+\.\d+' + re.escape('-' + platform + '.' + ext) - # only use release dir if not windows target = '' + if type == 'mac': + target = 'Release' for filename in os.listdir(self.getBinDir(target)): if re.search(pattern, filename): diff --git a/temp.diff b/temp.diff new file mode 100644 index 00000000..7f46f6e2 --- /dev/null +++ b/temp.diff @@ -0,0 +1,153 @@ +diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py +index f29a721..cdd2ac6 100644 +--- a/ext/toolchain/commands1.py ++++ b/ext/toolchain/commands1.py +@@ -698,43 +698,49 @@ class InternalCommands: + raise Exception('Build command not supported with generator: ' + generator) + + def makeGui(self, targets, args=""): +- name = "Synergy.app" +- self.try_chdir(self.getGenerator().binDir) +- if os.path.exists(name): +- print "removing exisiting bundle" +- shutil.rmtree(name) +- self.restore_chdir() +- +- if sys.platform == 'win32': +- gui_make_cmd = self.w32_make_cmd +- elif sys.platform in ['linux2', 'sunos5', 'freebsd7', 'darwin']: +- gui_make_cmd = self.make_cmd + " -w" +- else: +- raise Exception('Unsupported platform: ' + sys.platform) +- +- gui_make_cmd += args +- +- print 'Make GUI command: ' + gui_make_cmd ++ for target in targets: + +- if sys.platform == 'win32': +- for target in targets: ++ if sys.platform == 'win32': ++ ++ gui_make_cmd = self.w32_make_cmd + ' ' + target + args ++ print 'Make GUI command: ' + gui_make_cmd ++ + self.try_chdir(self.gui_dir) +- err = os.system(gui_make_cmd + ' ' + target) ++ err = os.system(gui_make_cmd) + self.restore_chdir() + + if err != 0: + raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) +- else: +- self.try_chdir(self.gui_dir) +- err = os.system(gui_make_cmd) +- self.restore_chdir() + +- if err != 0: +- raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) ++ elif sys.platform in ['linux2', 'sunos5', 'freebsd7', 'darwin']: + +- if sys.platform == 'darwin' and not "clean" in args: +- for target in targets: +- self.macPostMake(target) ++ gui_make_cmd = self.make_cmd + " -w" + args ++ print 'Make GUI command: ' + gui_make_cmd ++ ++ # start with a clean app bundle ++ targetDir = self.getGenerator().getBinDir(target) ++ bundleTargetDir = targetDir + '/Synergy.app' ++ print bundleTargetDir ++ if os.path.exists(bundleTargetDir): ++ shutil.rmtree(bundleTargetDir) ++ ++ binDir = self.getGenerator().binDir ++ bundleTempDir = binDir + '/Synergy.app' ++ print bundleTempDir ++ if os.path.exists(bundleTempDir): ++ shutil.rmtree(bundleTempDir) ++ ++ self.try_chdir(self.gui_dir) ++ err = os.system(gui_make_cmd) ++ self.restore_chdir() ++ ++ if err != 0: ++ raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) ++ ++ if sys.platform == 'darwin' and not "clean" in args: ++ self.macPostGuiMake(target) ++ else: ++ raise Exception('Unsupported platform: ' + sys.platform) + + def symlink(self, source, target): + if not os.path.exists(target): +@@ -744,36 +750,51 @@ class InternalCommands: + if os.path.exists(source): + shutil.move(source, target) + +- def macPostMake(self, target): ++ def macPostGuiMake(self, target): + +- dir = self.getGenerator().binDir ++ bundle = 'Synergy.app' ++ binDir = self.getGenerator().binDir ++ targetDir = self.getGenerator().getBinDir(target) ++ bundleTempDir = binDir + '/' + bundle ++ bundleTargetDir = targetDir + '/' + bundle ++ ++ if os.path.exists(bundleTempDir): ++ shutil.move(bundleTempDir, bundleTargetDir) + + if self.enableMakeCore: + # copy core binaries into the bundle, since the gui + # now looks for the binaries in the current app dir. + +- targetDir = self.getGenerator().getBinDir(target) +- bundleBinDir = dir + "/Synergy.app/Contents/MacOS/" ++ bundleBinDir = bundleTargetDir + "/Contents/MacOS/" + shutil.copy(targetDir + "/synergyc", bundleBinDir) + shutil.copy(targetDir + "/synergys", bundleBinDir) + shutil.copy(targetDir + "/syntool", bundleBinDir) + +- if self.enableMakeGui: ++ self.loadConfig() ++ if not self.macIdentity: ++ raise Exception("run config with --mac-identity") + +- self.loadConfig() +- if not self.macIdentity: +- raise Exception("run config with --mac-identity") +- +- # use qt to copy libs to bundle so no dependencies are needed. do not create a +- # dmg at this point, since we need to sign it first, and then create our own +- # after signing (so that qt does not affect the signed app bundle). +- bin = "macdeployqt Synergy.app -verbose=2 -codesign='" + self.macIdentity + "'" +- self.try_chdir(dir) +- err = os.system(bin) +- self.restore_chdir() ++ if sys.version_info < (2, 4): ++ raise Exception("Python 2.4 or greater required.") + +- if err != 0: +- raise Exception(bin + " failed with error: " + str(err)) ++ self.try_chdir(targetDir) ++ ++ p = subprocess.Popen( ++ ["macdeployqt", "Synergy.app", "-verbose=2", ++ "-codesign='" + self.macIdentity + "'"], ++ stdout=subprocess.PIPE, stderr=subprocess.PIPE) ++ ++ stdout, stderr = p.communicate() ++ ++ self.restore_chdir() ++ ++ # print stderr to standard out, since macdeployqt sends ++ # everything to stderr making it meaningless. ++ print stdout ++ print stderr ++ ++ if "ERROR" in stderr: ++ raise Exception("macdeployqt failed") + + def signmac(self): + print "signmac is now obsolete" From ccaf4a8ef38a12487dd62c15015da37508526cc7 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Thu, 5 Mar 2015 17:30:08 +0000 Subject: [PATCH 07/14] Removed toolchain code to skip packages #4407 --- ext/toolchain/ftputil.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ext/toolchain/ftputil.py b/ext/toolchain/ftputil.py index bbb9a271..cac71e7d 100644 --- a/ext/toolchain/ftputil.py +++ b/ext/toolchain/ftputil.py @@ -27,14 +27,6 @@ class FtpUploader: ftp = FTP(self.host, self.user, self.password) ftp.cwd(self.dir) - - # check to see if we should stop here - if not replace: - files = ftp.nlst() - if dest in files: - print 'Already exists, skipping.' - ftp.close() - return f = open(src, 'rb') ftp.storbinary('STOR ' + dest, f) From 88d85204db79ae0453686c9fe27affbbc415aa68 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 18:57:09 +0000 Subject: [PATCH 08/14] Fixed distftp source file path #4464 --- ext/toolchain/commands1.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index ccbe04e6..45141701 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -1313,12 +1313,8 @@ class InternalCommands: dest = self.dist_name_rev(type) print 'Uploading %s to FTP server %s...' % (dest, ftp.host) - srcDir = 'bin/' - generator = self.getGeneratorFromConfig().cmakeName - #if not generator.startswith('Visual Studio'): - # srcDir += 'release/' - - ftp.run(srcDir + src, dest) + binDir = self.getGenerator().getBinDir('Release') + ftp.run(binDir + '/' + src, dest) print 'Done' def getDebianArch(self): From dcf8a9f5f0894fb6fe840f0ad1efea5caf3e535d Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 19:05:43 +0000 Subject: [PATCH 09/14] Changed use of popen to getstatusoutput #4464 The getstatusoutput function seems easier to use --- ext/toolchain/commands1.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index 45141701..4355f982 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -775,13 +775,12 @@ class InternalCommands: if sys.version_info < (2, 4): raise Exception("Python 2.4 or greater required.") - output = os.popen( + output = commands.getstatusoutput( "macdeployqt %s/Synergy.app -verbose=2 -codesign='%s'" % ( - targetDir, self.macIdentity)).read() + targetDir, self.macIdentity)) - print output - - if "ERROR" in output: + print output[1] + if "ERROR" in output[1]: raise Exception("macdeployqt failed") def signmac(self): From 2e060cc2f3abebe26ca4aef05a78aa9a9ee00999 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 19:35:59 +0000 Subject: [PATCH 10/14] ChangeLog for 1.6.3 --- ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index b6dc7236..ee6e9e6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1.6.3 +===== +Bug #4349 - Mouse click does not always bring window to front +Bug #4463 - Unidentified developer error on Mac OS X +Bug #4464 - Code signing verify failure not reported on Mac build +Enhancement #4455 - Replace version with branch name in package filename + 1.6.2 ===== Bug #4227 - Helper tool crashes when service checks elevation state From 0edb3a74b3771300b4721186bceb62bb11694906 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 19:59:07 +0000 Subject: [PATCH 11/14] Fixed #4465 - Added syntool sign call --- ext/toolchain/commands1.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index 4355f982..31074cb0 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -803,6 +803,7 @@ class InternalCommands: self.signFile(pfx, pwd, 'bin/Release', 'synergyc.exe') self.signFile(pfx, pwd, 'bin/Release', 'synergys.exe') self.signFile(pfx, pwd, 'bin/Release', 'synergyd.exe') + self.signFile(pfx, pwd, 'bin/Release', 'syntool.exe') self.signFile(pfx, pwd, 'bin/Release', 'synwinhk.dll') def signFile(self, pfx, pwd, dir, file): From a833611804bbd5359845ffac30756d1db0bfff02 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 20:01:13 +0000 Subject: [PATCH 12/14] Updated ChangeLog for 1.6.3 --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index ee6e9e6a..0e00bdc6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ Bug #4349 - Mouse click does not always bring window to front Bug #4463 - Unidentified developer error on Mac OS X Bug #4464 - Code signing verify failure not reported on Mac build +Bug #4465 - Binary (syntool) is not code signed on Windows Enhancement #4455 - Replace version with branch name in package filename 1.6.2 From 162ed1fef55b7976a10e7cc45b9180c587b25171 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 21:15:53 +0000 Subject: [PATCH 13/14] Disabled code signing for old Qt versions #4464 --- ext/toolchain/commands1.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index 31074cb0..3b234161 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -775,9 +775,16 @@ class InternalCommands: if sys.version_info < (2, 4): raise Exception("Python 2.4 or greater required.") - output = commands.getstatusoutput( - "macdeployqt %s/Synergy.app -verbose=2 -codesign='%s'" % ( - targetDir, self.macIdentity)) + (qMajor, qMinor, qRev) = self.getQmakeVersion() + if qMajor >= 5: + output = commands.getstatusoutput( + "macdeployqt %s/Synergy.app -verbose=2 -codesign='%s'" % ( + targetDir, self.macIdentity)) + else: + # no code signing available in old versions + output = commands.getstatusoutput( + "macdeployqt %s/Synergy.app -verbose=2" % ( + targetDir)) print output[1] if "ERROR" in output[1]: From 9706252fb9df7b3a52624b99963e43e30a9515c7 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 22:01:49 +0000 Subject: [PATCH 14/14] Only trust errors for macdeployqt 5+ #4464 --- ext/toolchain/commands1.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index 3b234161..9f4cb4a5 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -788,7 +788,10 @@ class InternalCommands: print output[1] if "ERROR" in output[1]: - raise Exception("macdeployqt failed") + (qMajor, qMinor, qRev) = self.getQmakeVersion() + if qMajor >= 5: + # only listen to errors in qt 5+ + raise Exception("macdeployqt failed") def signmac(self): print "signmac is now obsolete"