From f113f779502e08ed57f2c2c8a2ef65ebfff861fd Mon Sep 17 00:00:00 2001 From: su_v Date: Wed, 20 Aug 2014 03:15:30 +0200 Subject: Support compiling ScriptExec on newer versions of OS X (please review) (bzr r13506.1.6) --- .../ScriptExec/ScriptExec.xcode/project.pbxproj | 451 --------------------- .../ScriptExec.xcodeproj/project.pbxproj | 24 +- packaging/macosx/ScriptExec/main.c | 193 ++------- 3 files changed, 48 insertions(+), 620 deletions(-) delete mode 100644 packaging/macosx/ScriptExec/ScriptExec.xcode/project.pbxproj (limited to 'packaging/macosx/ScriptExec') diff --git a/packaging/macosx/ScriptExec/ScriptExec.xcode/project.pbxproj b/packaging/macosx/ScriptExec/ScriptExec.xcode/project.pbxproj deleted file mode 100644 index bc081d5ef..000000000 --- a/packaging/macosx/ScriptExec/ScriptExec.xcode/project.pbxproj +++ /dev/null @@ -1,451 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 39; - objects = { - 0249A66BFF388E3F11CA2CEA = { - isa = PBXFileReference; - lastKnownFileType = archive.ar; - name = "libstdc++.a"; - path = "/usr/lib/libstdc++.a"; - refType = 0; - sourceTree = ""; - }; -//020 -//021 -//022 -//023 -//024 -//080 -//081 -//082 -//083 -//084 - 0867D6AAFE840B52C02AAC07 = { - children = ( - 0867D6ABFE840B52C02AAC07, - ); - isa = PBXVariantGroup; - name = InfoPlist.strings; - refType = 4; - sourceTree = ""; - }; - 0867D6ABFE840B52C02AAC07 = { - fileEncoding = 10; - isa = PBXFileReference; - lastKnownFileType = text.plist.strings; - name = English; - path = English.lproj/InfoPlist.strings; - refType = 4; - sourceTree = ""; - }; -//080 -//081 -//082 -//083 -//084 -//190 -//191 -//192 -//193 -//194 - 195DF8CFFE9D517E11CA2CBB = { - children = ( - 8D0C4E970486CD37000505A6, - ); - isa = PBXGroup; - name = Products; - refType = 4; - sourceTree = ""; - }; -//190 -//191 -//192 -//193 -//194 -//200 -//201 -//202 -//203 -//204 - 20286C28FDCF999611CA2CEA = { - buildSettings = { - }; - buildStyles = ( - 4A9504C5FFE6A39111CA0CBA, - 4A9504C6FFE6A39111CA0CBA, - ); - hasScannedForEncodings = 1; - isa = PBXProject; - mainGroup = 20286C29FDCF999611CA2CEA; - projectDirPath = ""; - targets = ( - 8D0C4E890486CD37000505A6, - ); - }; - 20286C29FDCF999611CA2CEA = { - children = ( - 20286C2AFDCF999611CA2CEA, - 20286C2CFDCF999611CA2CEA, - 20286C32FDCF999611CA2CEA, - 195DF8CFFE9D517E11CA2CBB, - ); - isa = PBXGroup; - name = ScriptExec; - path = ""; - refType = 4; - sourceTree = ""; - }; - 20286C2AFDCF999611CA2CEA = { - children = ( - 32DBCF6D0370B57F00C91783, - 20286C2BFDCF999611CA2CEA, - ); - isa = PBXGroup; - name = Sources; - path = ""; - refType = 4; - sourceTree = ""; - }; - 20286C2BFDCF999611CA2CEA = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.c; - path = main.c; - refType = 4; - sourceTree = ""; - }; - 20286C2CFDCF999611CA2CEA = { - children = ( - 664C29F0060ECDC4006EC560, - B8DCE042056DAC3500C390B0, - 8D0C4E960486CD37000505A6, - B8DCE048056DAC5000C390B0, - 0867D6AAFE840B52C02AAC07, - ); - isa = PBXGroup; - name = Resources; - path = ""; - refType = 4; - sourceTree = ""; - }; - 20286C32FDCF999611CA2CEA = { - children = ( - 20286C33FDCF999611CA2CEA, - 4A9504CAFFE6A41611CA0CBA, - 4A9504C8FFE6A3BC11CA0CBA, - 0249A66BFF388E3F11CA2CEA, - B8DCE04E056DACAE00C390B0, - ); - isa = PBXGroup; - name = "External Frameworks and Libraries"; - path = ""; - refType = 4; - sourceTree = ""; - }; - 20286C33FDCF999611CA2CEA = { - fallbackIsa = PBXFileReference; - isa = PBXFrameworkReference; - lastKnownFileType = wrapper.framework; - name = Carbon.framework; - path = /System/Library/Frameworks/Carbon.framework; - refType = 0; - sourceTree = ""; - }; -//200 -//201 -//202 -//203 -//204 -//320 -//321 -//322 -//323 -//324 - 32DBCF6D0370B57F00C91783 = { - fileEncoding = 4; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - path = ScriptExec_Prefix.pch; - refType = 4; - sourceTree = ""; - }; -//320 -//321 -//322 -//323 -//324 -//4A0 -//4A1 -//4A2 -//4A3 -//4A4 - 4A9504C5FFE6A39111CA0CBA = { - buildRules = ( - ); - buildSettings = { - COPY_PHASE_STRIP = NO; - DEBUGGING_SYMBOLS = YES; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - OPTIMIZATION_CFLAGS = "-O0"; - ZERO_LINK = YES; - }; - isa = PBXBuildStyle; - name = Development; - }; - 4A9504C6FFE6A39111CA0CBA = { - buildRules = ( - ); - buildSettings = { - COPY_PHASE_STRIP = YES; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_OPTIMIZATION_LEVEL = s; - ZERO_LINK = NO; - }; - isa = PBXBuildStyle; - name = Deployment; - }; - 4A9504C8FFE6A3BC11CA0CBA = { - fallbackIsa = PBXFileReference; - isa = PBXFrameworkReference; - lastKnownFileType = wrapper.framework; - name = ApplicationServices.framework; - path = /System/Library/Frameworks/ApplicationServices.framework; - refType = 0; - sourceTree = ""; - }; - 4A9504CAFFE6A41611CA0CBA = { - fallbackIsa = PBXFileReference; - isa = PBXFrameworkReference; - lastKnownFileType = wrapper.framework; - name = CoreServices.framework; - path = /System/Library/Frameworks/CoreServices.framework; - refType = 0; - sourceTree = ""; - }; -//4A0 -//4A1 -//4A2 -//4A3 -//4A4 -//660 -//661 -//662 -//663 -//664 - 664C29F0060ECDC4006EC560 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = text.script.sh; - path = openDoc; - refType = 4; - sourceTree = ""; - }; - 664C29F1060ECDC4006EC560 = { - fileRef = 664C29F0060ECDC4006EC560; - isa = PBXBuildFile; - settings = { - }; - }; -//660 -//661 -//662 -//663 -//664 -//8D0 -//8D1 -//8D2 -//8D3 -//8D4 - 8D0C4E890486CD37000505A6 = { - buildPhases = ( - 8D0C4E8A0486CD37000505A6, - 8D0C4E8C0486CD37000505A6, - 8D0C4E8F0486CD37000505A6, - 8D0C4E910486CD37000505A6, - 8D0C4E940486CD37000505A6, - ); - buildRules = ( - ); - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ""; - GCC_ENABLE_TRIGRAPHS = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = ScriptExec_Prefix.pch; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; - GCC_WARN_UNKNOWN_PRAGMAS = NO; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Applications"; - LIBRARY_SEARCH_PATHS = ""; - LIBRARY_STYLE = Static; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = ScriptExec; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; - WRAPPER_EXTENSION = app; - }; - dependencies = ( - ); - isa = PBXNativeTarget; - name = ScriptExec; - productInstallPath = "$(HOME)/Applications"; - productName = ScriptExec; - productReference = 8D0C4E970486CD37000505A6; - productType = "com.apple.product-type.application"; - }; - 8D0C4E8A0486CD37000505A6 = { - buildActionMask = 2147483647; - files = ( - 8D0C4E8B0486CD37000505A6, - ); - isa = PBXHeadersBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 8D0C4E8B0486CD37000505A6 = { - fileRef = 32DBCF6D0370B57F00C91783; - isa = PBXBuildFile; - settings = { - }; - }; - 8D0C4E8C0486CD37000505A6 = { - buildActionMask = 2147483647; - files = ( - 8D0C4E8D0486CD37000505A6, - B8DCE045056DAC3500C390B0, - B8DCE049056DAC5000C390B0, - 664C29F1060ECDC4006EC560, - ); - isa = PBXResourcesBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 8D0C4E8D0486CD37000505A6 = { - fileRef = 0867D6AAFE840B52C02AAC07; - isa = PBXBuildFile; - settings = { - }; - }; - 8D0C4E8F0486CD37000505A6 = { - buildActionMask = 2147483647; - files = ( - 8D0C4E900486CD37000505A6, - ); - isa = PBXSourcesBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 8D0C4E900486CD37000505A6 = { - fileRef = 20286C2BFDCF999611CA2CEA; - isa = PBXBuildFile; - settings = { - ATTRIBUTES = ( - ); - }; - }; - 8D0C4E910486CD37000505A6 = { - buildActionMask = 2147483647; - files = ( - 8D0C4E920486CD37000505A6, - 8D0C4E930486CD37000505A6, - B8DCE04F056DACAE00C390B0, - ); - isa = PBXFrameworksBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 8D0C4E920486CD37000505A6 = { - fileRef = 20286C33FDCF999611CA2CEA; - isa = PBXBuildFile; - settings = { - }; - }; - 8D0C4E930486CD37000505A6 = { - fileRef = 0249A66BFF388E3F11CA2CEA; - isa = PBXBuildFile; - settings = { - }; - }; - 8D0C4E940486CD37000505A6 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXRezBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 8D0C4E960486CD37000505A6 = { - fileEncoding = 4; - isa = PBXFileReference; - lastKnownFileType = text.plist; - path = Info.plist; - refType = 4; - sourceTree = ""; - }; - 8D0C4E970486CD37000505A6 = { - explicitFileType = wrapper.application; - includeInIndex = 0; - isa = PBXFileReference; - path = ScriptExec.app; - refType = 3; - sourceTree = BUILT_PRODUCTS_DIR; - }; -//8D0 -//8D1 -//8D2 -//8D3 -//8D4 -//B80 -//B81 -//B82 -//B83 -//B84 - B8DCE042056DAC3500C390B0 = { - isa = PBXFileReference; - lastKnownFileType = wrapper.nib; - path = MenuBar.nib; - refType = 4; - sourceTree = ""; - }; - B8DCE045056DAC3500C390B0 = { - fileRef = B8DCE042056DAC3500C390B0; - isa = PBXBuildFile; - settings = { - }; - }; - B8DCE048056DAC5000C390B0 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = text.script.sh; - path = script; - refType = 4; - sourceTree = ""; - }; - B8DCE049056DAC5000C390B0 = { - fileRef = B8DCE048056DAC5000C390B0; - isa = PBXBuildFile; - settings = { - }; - }; - B8DCE04E056DACAE00C390B0 = { - isa = PBXFileReference; - lastKnownFileType = wrapper.framework; - name = Security.framework; - path = /System/Library/Frameworks/Security.framework; - refType = 0; - sourceTree = ""; - }; - B8DCE04F056DACAE00C390B0 = { - fileRef = B8DCE04E056DACAE00C390B0; - isa = PBXBuildFile; - settings = { - }; - }; - }; - rootObject = 20286C28FDCF999611CA2CEA; -} diff --git a/packaging/macosx/ScriptExec/ScriptExec.xcodeproj/project.pbxproj b/packaging/macosx/ScriptExec/ScriptExec.xcodeproj/project.pbxproj index 3d0fe0120..0443dd764 100644 --- a/packaging/macosx/ScriptExec/ScriptExec.xcodeproj/project.pbxproj +++ b/packaging/macosx/ScriptExec/ScriptExec.xcodeproj/project.pbxproj @@ -12,14 +12,12 @@ 8D0C4E8D0486CD37000505A6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */; }; 8D0C4E900486CD37000505A6 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 20286C2BFDCF999611CA2CEA /* main.c */; settings = {ATTRIBUTES = (); }; }; 8D0C4E920486CD37000505A6 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 20286C33FDCF999611CA2CEA /* Carbon.framework */; }; - 8D0C4E930486CD37000505A6 /* libstdc++.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0249A66BFF388E3F11CA2CEA /* libstdc++.a */; }; B8DCE045056DAC3500C390B0 /* MenuBar.nib in Resources */ = {isa = PBXBuildFile; fileRef = B8DCE042056DAC3500C390B0 /* MenuBar.nib */; }; B8DCE049056DAC5000C390B0 /* script in Resources */ = {isa = PBXBuildFile; fileRef = B8DCE048056DAC5000C390B0 /* script */; }; B8DCE04F056DACAE00C390B0 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B8DCE04E056DACAE00C390B0 /* Security.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 0249A66BFF388E3F11CA2CEA /* libstdc++.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libstdc++.a"; path = "/usr/lib/libstdc++.a"; sourceTree = ""; }; 0867D6ABFE840B52C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 20286C2BFDCF999611CA2CEA /* main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; 20286C33FDCF999611CA2CEA /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; @@ -40,7 +38,6 @@ buildActionMask = 2147483647; files = ( 8D0C4E920486CD37000505A6 /* Carbon.framework in Frameworks */, - 8D0C4E930486CD37000505A6 /* libstdc++.a in Frameworks */, B8DCE04F056DACAE00C390B0 /* Security.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -94,7 +91,6 @@ 20286C33FDCF999611CA2CEA /* Carbon.framework */, 4A9504CAFFE6A41611CA0CBA /* CoreServices.framework */, 4A9504C8FFE6A3BC11CA0CBA /* ApplicationServices.framework */, - 0249A66BFF388E3F11CA2CEA /* libstdc++.a */, B8DCE04E056DACAE00C390B0 /* Security.framework */, ); name = "External Frameworks and Libraries"; @@ -140,9 +136,15 @@ 20286C28FDCF999611CA2CEA /* Project object */ = { isa = PBXProject; buildConfigurationList = 78E9AE1A0A36A8E3000D76A8 /* Build configuration list for PBXProject "ScriptExec" */; + compatibilityVersion = "Xcode 2.4"; + developmentRegion = English; hasScannedForEncodings = 1; + knownRegions = ( + en, + ); mainGroup = 20286C29FDCF999611CA2CEA /* ScriptExec */; projectDirPath = ""; + projectRoot = ""; targets = ( 8D0C4E890486CD37000505A6 /* ScriptExec */, ); @@ -199,6 +201,8 @@ 78E9AE170A36A8E3000D76A8 /* Development */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386"; COPY_PHASE_STRIP = NO; DEBUGGING_SYMBOLS = YES; FRAMEWORK_SEARCH_PATHS = ""; @@ -217,7 +221,6 @@ INSTALL_PATH = "$(HOME)/Applications"; LIBRARY_SEARCH_PATHS = ""; LIBRARY_STYLE = Static; - OPTIMIZATION_CFLAGS = "-O0"; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; OTHER_REZFLAGS = ""; @@ -236,6 +239,8 @@ 78E9AE180A36A8E3000D76A8 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386"; COPY_PHASE_STRIP = YES; FRAMEWORK_SEARCH_PATHS = ""; GCC_ENABLE_FIX_AND_CONTINUE = NO; @@ -270,6 +275,8 @@ 78E9AE190A36A8E3000D76A8 /* Default */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386"; FRAMEWORK_SEARCH_PATHS = ""; GCC_ENABLE_TRIGRAPHS = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; @@ -300,25 +307,18 @@ 78E9AE1B0A36A8E3000D76A8 /* Development */ = { isa = XCBuildConfiguration; buildSettings = { - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; }; name = Development; }; 78E9AE1C0A36A8E3000D76A8 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = ( - ppc, - i386, - ); - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; }; name = Deployment; }; 78E9AE1D0A36A8E3000D76A8 /* Default */ = { isa = XCBuildConfiguration; buildSettings = { - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; }; name = Default; }; diff --git a/packaging/macosx/ScriptExec/main.c b/packaging/macosx/ScriptExec/main.c index f413d438a..e754057a9 100644 --- a/packaging/macosx/ScriptExec/main.c +++ b/packaging/macosx/ScriptExec/main.c @@ -6,6 +6,7 @@ With modifications by Aaron Voisine for gimp.app With modifications by Marianne gagnon for Wilber-loves-apple With modifications by Michael Wybrow for Inkscape.app + With modifications by ~suv for Inkscape.app 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 @@ -39,7 +40,12 @@ #pragma mark Includes // Apple stuff + +// Note: including Carbon prevents building the launcher app in x86_64 +// used for StandardAlert in RequestUserAttention(), +// RedFatalAlert() and X11FailedHandler() #include + #include #include #include @@ -83,15 +89,14 @@ static void *OpenDoc(void *arg); static OSErr ExecuteScript(char *script, pid_t *pid); static void GetParameters(void); -static char* GetScript(void); -static char* GetOpenDoc(void); +static unsigned char* GetScript(void); +static unsigned char* GetOpenDoc(void); OSErr LoadMenuBar(char *appName); -static OSStatus FSMakePath(FSSpec file, char *path, long maxPathSize); +static OSStatus FSMakePath(FSRef fileRef, unsigned char *path, long maxPathSize); static void RedFatalAlert(Str255 errorString, Str255 expStr); -static short DoesFileExist(char *path); -static OSStatus FixFCCache(void); +static short DoesFileExist(unsigned char *path); static OSErr AppQuitAEHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon); @@ -109,7 +114,7 @@ static OSErr AppReopenAppAEHandler(const AppleEvent *theAppleEvent, static OSStatus CompileAppleScript(const void* text, long textLength, AEDesc *resultData); static OSStatus SimpleCompileAppleScript(const char* theScript); -static void runScript(); +static OSErr runScript(); /////////////////////////////////////// // Globals @@ -181,7 +186,7 @@ int main(int argc, char* argv[]) GetParameters(); //load data from files containing exec settings // compile "icon clicked" script so it's ready to execute - SimpleCompileAppleScript("tell application \"X11\" to activate"); + SimpleCompileAppleScript("tell application \"XQuartz\" to activate"); RunApplicationEventLoop(); //Run the event loop return 0; @@ -253,116 +258,6 @@ static OSStatus FCCacheFailedHandler(EventHandlerCallRef theHandlerCall, } -static size_t safeRead(int d, void *buf, size_t nbytes) -{ - ssize_t bytesToRead = nbytes; - ssize_t bytesRead = 0; - char *offset = (char *) buf; - - while ((bytesToRead > 0)) - { - bytesRead = read(d, offset, bytesToRead); - if (bytesRead > 0) - { - offset += bytesRead; - bytesToRead -= bytesRead; - } - else if (bytesRead == 0) - { - // Reached EOF. - break; - } - else if (bytesRead == -1) - { - if ((errno == EINTR) || (errno == EAGAIN)) - { - // Try again. - continue; - } - return 0; - } - } - return bytesRead; -} - - -///////////////////////////////////// -// Code to run fc-cache on first run -///////////////////////////////////// -static OSStatus FixFCCache (void) -{ - FILE *fileConnToChild = NULL; - int fdConnToChild = 0; - pid_t childPID = WAIT_ANY; - size_t bytesChildPID; - size_t bytesRead; - int status; - - char commandStr[] = "/usr/X11R6/bin/fc-cache"; - char *commandArgs[] = { "-f", NULL }; - - // Run fc-cache - AuthorizationItem authItems[] = - { - { - kAuthorizationRightExecute, - strlen(commandStr), - commandStr, - 0 - } - }; - AuthorizationItemSet authItemSet = - { - 1, - authItems - }; - AuthorizationRef authRef = NULL; - OSStatus err = AuthorizationCreate (NULL, &authItemSet, - kAuthorizationFlagInteractionAllowed | - kAuthorizationFlagExtendRights, &authRef); - - if (err == errAuthorizationSuccess) - { - err = AuthorizationExecuteWithPrivileges(authRef, commandStr, - kAuthorizationFlagDefaults, commandArgs, - &fileConnToChild); - - if (err == errAuthorizationSuccess) - { - // Unfortunately, AuthorizationExecuteWithPrivileges - // does not return the process ID associated with the - // process it runs. The best solution we have it to - // try and get the process ID from the file descriptor. - // This is based on example code from Apple's - // MoreAuthSample. - - fdConnToChild = fileno(fileConnToChild); - - // Try an get the process ID of the fc-cache command - bytesChildPID = sizeof(childPID); - bytesRead = safeRead(fdConnToChild, &childPID, - bytesChildPID); - if (bytesRead != bytesChildPID) - { - // If we can't get it the best alternative - // is to wait for any child to finish. - childPID = WAIT_ANY; - } - - if (fileConnToChild != NULL) { - fclose(fileConnToChild); - } - - // Wait for child process to finish. - waitpid(childPID, &status, 0); - } - } - AuthorizationFree(authRef, kAuthorizationFlagDestroyRights); - - return err; -} - - /////////////////////////////////// // Execution thread starts here /////////////////////////////////// @@ -448,14 +343,13 @@ static void GetParameters (void) /////////////////////////////////////// // Get path to the script in Resources folder /////////////////////////////////////// -static char* GetScript (void) +static unsigned char* GetScript (void) { CFStringRef fileName; CFBundleRef appBundle; CFURLRef scriptFileURL; FSRef fileRef; - FSSpec fileSpec; - char *path; + unsigned char *path; //get CF URL for script if (! (appBundle = CFBundleGetMainBundle())) return NULL; @@ -472,13 +366,9 @@ static char* GetScript (void) CFRelease(scriptFileURL); CFRelease(fileName); - //convert FSRef to FSSpec - if (FSGetCatalogInfo(&fileRef, kFSCatInfoNone, NULL, NULL, &fileSpec, - NULL)) return NULL; - //create path string if (! (path = malloc(kMaxPathLength))) return NULL; - if (FSMakePath(fileSpec, path, kMaxPathLength)) return NULL; + if (FSMakePath(fileRef, path, kMaxPathLength)) return NULL; if (! DoesFileExist(path)) return NULL; return path; @@ -487,14 +377,13 @@ static char* GetScript (void) /////////////////////////////////////// // Gets the path to openDoc in Resources folder /////////////////////////////////////// -static char* GetOpenDoc (void) +static unsigned char* GetOpenDoc (void) { CFStringRef fileName; CFBundleRef appBundle; CFURLRef openDocFileURL; FSRef fileRef; - FSSpec fileSpec; - char *path; + unsigned char *path; //get CF URL for openDoc if (! (appBundle = CFBundleGetMainBundle())) return NULL; @@ -511,13 +400,9 @@ static char* GetOpenDoc (void) CFRelease(openDocFileURL); CFRelease(fileName); - //convert FSRef to FSSpec - if (FSGetCatalogInfo(&fileRef, kFSCatInfoNone, NULL, NULL, &fileSpec, - NULL)) return NULL; - //create path string if (! (path = malloc(kMaxPathLength))) return NULL; - if (FSMakePath(fileSpec, path, kMaxPathLength)) return NULL; + if (FSMakePath(fileRef, path, kMaxPathLength)) return NULL; if (! DoesFileExist(path)) return NULL; return path; @@ -545,14 +430,8 @@ OSErr LoadMenuBar (char *appName) /////////////////////////////////////// // Generate path string from FSSpec record /////////////////////////////////////// -static OSStatus FSMakePath(FSSpec file, char *path, long maxPathSize) +static OSStatus FSMakePath(FSRef fileRef, unsigned char *path, long maxPathSize) { - OSErr err = noErr; - FSRef fileRef; - - //create file reference from file spec - if (err = FSpMakeFSRef(&file, &fileRef)) return err; - // and then convert the FSRef to a path return FSRefMakePath(&fileRef, path, maxPathSize); } @@ -569,9 +448,9 @@ static void RedFatalAlert (Str255 errorString, Str255 expStr) /////////////////////////////////////// // Determines whether file exists at path or not /////////////////////////////////////// -static short DoesFileExist (char *path) +static short DoesFileExist (unsigned char *path) { - if (access(path, F_OK) == -1) return false; + if (access((char *)path, F_OK) == -1) return false; return true; } @@ -590,7 +469,7 @@ static OSErr AppQuitAEHandler(const AppleEvent *theAppleEvent, if (! taskDone && pid) { //kill the script process brutally kill(pid, 9); - printf("Platypus App: PID %d killed brutally\n", pid); + printf("Inkscape.app: PID %d killed brutally\n", pid); } pthread_cancel(tid); @@ -610,31 +489,31 @@ static OSErr AppOpenDocAEHandler(const AppleEvent *theAppleEvent, #pragma unused (reply, refCon) OSErr err = noErr; - AEDescList fileSpecList; + AEDescList fileRefList; AEKeyword keyword; DescType type; short i; long count, actualSize; - FSSpec fileSpec; - char path[kMaxPathLength]; + FSRef fileRef; + unsigned char path[kMaxPathLength]; while (numArgs > 0) free(fileArgs[numArgs--]); //Read the AppleEvent err = AEGetParamDesc(theAppleEvent, keyDirectObject, typeAEList, - &fileSpecList); + &fileRefList); - err = AECountItems(&fileSpecList, &count); //Count number of files + err = AECountItems(&fileRefList, &count); //Count number of files for (i = 1; i <= count; i++) { //iteratively process each file - //get fsspec from apple event - if (! (err = AEGetNthPtr(&fileSpecList, i, typeFSS, &keyword, &type, - (Ptr)&fileSpec, sizeof(FSSpec), &actualSize))) + //get fsref from apple event + if (! (err = AEGetNthPtr(&fileRefList, i, typeFSRef, &keyword, &type, + (Ptr)&fileRef, sizeof(FSRef), &actualSize))) { - //get path from file spec - if ((err = FSMakePath(fileSpec, (unsigned char *)&path, + //get path from file ref + if ((err = FSMakePath(fileRef, (unsigned char *)&path, kMaxPathLength))) return err; if (numArgs == kMaxArgumentsToScript) break; @@ -659,7 +538,7 @@ static OSErr AppOpenDocAEHandler(const AppleEvent *theAppleEvent, static OSErr AppReopenAppAEHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon) { - runScript(); + return runScript(); } // if app is being opened @@ -724,12 +603,12 @@ static OSStatus X11FailedHandler(EventHandlerCallRef theHandlerCall, params.position = kWindowDefaultPosition; StandardAlert(kAlertStopAlert, "\pFailed to start X11", - "\pInkscape.app requires Apple's X11, which is freely downloadable from Apple's website for Panther (10.3.x) users and available as an optional install from the installation DVD for Tiger (10.4.x) users.\n\nPlease install X11 and restart Inkscape.", + "\pInkscape.app requires XQuartz.", ¶ms, &itemHit); if (itemHit == kAlertStdAlertCancelButton) { - OpenURL("http://www.apple.com/downloads/macosx/apple/macosx_updates/x11formacosx.html"); + OpenURL("http://xquartz.macosforge.org/landing/"); } ExitToShell(); @@ -774,7 +653,7 @@ static OSStatus CompileAppleScript(const void* text, long textLength, } /* runs the compiled applescript */ -static void runScript() +static OSErr runScript() { /* run the script */ err = OSAExecute(theComponent, scriptID, kOSANullScript, -- cgit v1.2.3 From c1f2cee561acdbd6963c5bf9300953ef40140e8e Mon Sep 17 00:00:00 2001 From: su_v Date: Wed, 20 Aug 2014 03:44:01 +0200 Subject: remove support for X11 on Panther and Tiger (Leopard and later use launchd) (bzr r13506.1.11) --- packaging/macosx/ScriptExec/main.c | 59 ++------------------------------------ 1 file changed, 3 insertions(+), 56 deletions(-) (limited to 'packaging/macosx/ScriptExec') diff --git a/packaging/macosx/ScriptExec/main.c b/packaging/macosx/ScriptExec/main.c index e754057a9..c9c6ffaa8 100644 --- a/packaging/macosx/ScriptExec/main.c +++ b/packaging/macosx/ScriptExec/main.c @@ -28,7 +28,7 @@ /* * This app laucher basically takes care of: - * - launching Inkscape and X11 when double-clicked + * - launching Inkscape when double-clicked * - bringing X11 to the top when its icon is clicked in the dock (via a small applescript) * - catch file dropped on icon events (and double-clicked gimp documents) and notify gimp. * - catch quit events performed outside gimp, e.g. on the dock icon. @@ -43,7 +43,7 @@ // Note: including Carbon prevents building the launcher app in x86_64 // used for StandardAlert in RequestUserAttention(), -// RedFatalAlert() and X11FailedHandler() +// RedFatalAlert() #include #include @@ -73,7 +73,6 @@ #define kEventClassRedFatalAlert 911 // custom carbon event types -#define kEventKindX11Failed 911 #define kEventKindFCCacheFailed 912 //maximum arguments the script accepts @@ -104,8 +103,6 @@ static OSErr AppOpenDocAEHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon); static OSErr AppOpenAppAEHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon); -static OSStatus X11FailedHandler(EventHandlerCallRef theHandlerCall, - EventRef theEvent, void *userData); static OSStatus FCCacheFailedHandler(EventHandlerCallRef theHandlerCall, EventRef theEvent, void *userData); static OSErr AppReopenAppAEHandler(const AppleEvent *theAppleEvent, @@ -149,7 +146,6 @@ extern char **environ; int main(int argc, char* argv[]) { OSErr err = noErr; - EventTypeSpec X11events = { kEventClassRedFatalAlert, kEventKindX11Failed }; EventTypeSpec FCCacheEvents = { kEventClassRedFatalAlert, kEventKindFCCacheFailed }; InitCursor(); @@ -169,9 +165,6 @@ int main(int argc, char* argv[]) NewAEEventHandlerUPP(AppReopenAppAEHandler), 0, false); - err += InstallEventHandler(GetApplicationEventTarget(), - NewEventHandlerUPP(X11FailedHandler), 1, - &X11events, NULL, NULL); err += InstallEventHandler(GetApplicationEventTarget(), NewEventHandlerUPP(FCCacheFailedHandler), 1, &FCCacheEvents, NULL, NULL); @@ -268,12 +261,7 @@ static void *Execute (void *arg) taskDone = false; OSErr err = ExecuteScript(scriptPath, &pid); - if (err == (OSErr)11) { - CreateEvent(NULL, kEventClassRedFatalAlert, kEventKindX11Failed, 0, - kEventAttributeNone, &event); - PostEventToQueue(GetMainEventQueue(), event, kEventPriorityStandard); - } - else if (err == (OSErr)12) { + if (err == (OSErr)12) { CreateEvent(NULL, kEventClassRedFatalAlert, kEventKindFCCacheFailed, 0, kEventAttributeNone, &event); PostEventToQueue(GetMainEventQueue(), event, kEventPriorityHigh); @@ -577,47 +565,6 @@ static void OpenURL(Str255 url) } -////////////////////////////////// -// Handler for when X11 fails to start -////////////////////////////////// -static OSStatus X11FailedHandler(EventHandlerCallRef theHandlerCall, - EventRef theEvent, void *userData) -{ - #pragma unused(theHanderCall, theEvent, userData) - - pthread_join(tid, NULL); - if (odtid) pthread_join(odtid, NULL); - - SInt16 itemHit; - const char *getX11 = "\pGet X11 for Panther"; - - AlertStdAlertParamRec params; - params.movable = true; - params.helpButton = false; - params.filterProc = NULL; - params.defaultText = (StringPtr) kAlertDefaultOKText; - params.cancelText = getX11; - params.otherText = NULL; - params.defaultButton = kAlertStdAlertOKButton; - params.cancelButton = kAlertStdAlertCancelButton; - params.position = kWindowDefaultPosition; - - StandardAlert(kAlertStopAlert, "\pFailed to start X11", - "\pInkscape.app requires XQuartz.", - ¶ms, &itemHit); - - if (itemHit == kAlertStdAlertCancelButton) - { - OpenURL("http://xquartz.macosforge.org/landing/"); - } - - ExitToShell(); - - - return noErr; -} - - // Compile and run a small AppleScript. The code below does no cleanup and no proper error checks // but since it's there until the app is shut down, and since we know the script is okay, // there should not be any problems. -- cgit v1.2.3 From 1cabe7fe34f3012599169d8c112db4393d5d929d Mon Sep 17 00:00:00 2001 From: su_v Date: Wed, 20 Aug 2014 04:43:31 +0200 Subject: ScriptExec: cleanup (remove defined but not used function) (bzr r13506.1.16) --- packaging/macosx/ScriptExec/main.c | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'packaging/macosx/ScriptExec') diff --git a/packaging/macosx/ScriptExec/main.c b/packaging/macosx/ScriptExec/main.c index c9c6ffaa8..0e4efd4e8 100644 --- a/packaging/macosx/ScriptExec/main.c +++ b/packaging/macosx/ScriptExec/main.c @@ -542,29 +542,6 @@ static OSErr AppOpenAppAEHandler(const AppleEvent *theAppleEvent, } -static void OpenURL(Str255 url) -{ - // Use Internet Config to hand the URL to the appropriate application, as - // set by the user in the Internet Preferences pane. - ICInstance icInstance; - // Applications creator code: - OSType signature = 'Inks'; - OSStatus error = ICStart( &icInstance, signature ); - if ( error == noErr ) - { - ConstStr255Param hint = 0x0; - const char* data = url; - long length = strlen(url); - long start = 0; - long end = length; - // Don't bother testing return value (error); launched application will - // report problems. - ICLaunchURL( icInstance, hint, data, length, &start, &end ); - ICStop( icInstance ); - } -} - - // Compile and run a small AppleScript. The code below does no cleanup and no proper error checks // but since it's there until the app is shut down, and since we know the script is okay, // there should not be any problems. -- cgit v1.2.3 From 08c216563001beb88226d75384e7436c81a5d70e Mon Sep 17 00:00:00 2001 From: su_v Date: Wed, 20 Aug 2014 15:06:40 +0200 Subject: use $XDG_CACHE_HOME/inkscape instead of ~/.inkscape-etc for generated rc and loader cache files (bzr r13506.1.23) --- packaging/macosx/ScriptExec/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'packaging/macosx/ScriptExec') diff --git a/packaging/macosx/ScriptExec/main.c b/packaging/macosx/ScriptExec/main.c index 0e4efd4e8..37b3a4ff3 100644 --- a/packaging/macosx/ScriptExec/main.c +++ b/packaging/macosx/ScriptExec/main.c @@ -241,8 +241,9 @@ static OSStatus FCCacheFailedHandler(EventHandlerCallRef theHandlerCall, ShowFirstStartWarningDialog(); // Note that we've seen the warning. - system("test -d \"$HOME/.inkscape-etc\" || mkdir -p \"$HOME/.inkscape-etc\"; " - "touch \"$HOME/.inkscape-etc/.fccache-new\""); + // TODO: somehow make this aware of $XDG_CACHE_HOME as set in the launcher + system("test -d \"$HOME/.cache/inkscape\" || mkdir -p \"$HOME/.cache/inkscape\"; " + "touch \"$HOME/.cache/inkscape/.fccache-new\""); // Rerun now. OSErr err = ExecuteScript(scriptPath, &pid); ExitToShell(); -- cgit v1.2.3 From b0641984cc0670a084bc5945e28100b154f57178 Mon Sep 17 00:00:00 2001 From: su_v Date: Thu, 21 Aug 2014 12:26:09 +0200 Subject: launcher scripts: move fc-cache alert to script, define xdg setup in single location and source it from script and openDoc (bzr r13506.1.36) --- packaging/macosx/ScriptExec/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packaging/macosx/ScriptExec') diff --git a/packaging/macosx/ScriptExec/main.c b/packaging/macosx/ScriptExec/main.c index 37b3a4ff3..e3f066d70 100644 --- a/packaging/macosx/ScriptExec/main.c +++ b/packaging/macosx/ScriptExec/main.c @@ -227,6 +227,7 @@ static void ShowFirstStartWarningDialog(void) ////////////////////////////////// // Handler for when fontconfig caches need to be generated +// TODO: remove (alert and touch moved to launcher script) ////////////////////////////////// static OSStatus FCCacheFailedHandler(EventHandlerCallRef theHandlerCall, EventRef theEvent, void *userData) @@ -241,7 +242,6 @@ static OSStatus FCCacheFailedHandler(EventHandlerCallRef theHandlerCall, ShowFirstStartWarningDialog(); // Note that we've seen the warning. - // TODO: somehow make this aware of $XDG_CACHE_HOME as set in the launcher system("test -d \"$HOME/.cache/inkscape\" || mkdir -p \"$HOME/.cache/inkscape\"; " "touch \"$HOME/.cache/inkscape/.fccache-new\""); // Rerun now. -- cgit v1.2.3 From 99f62f496173d577426f7827a7dce453e89969a7 Mon Sep 17 00:00:00 2001 From: su_v Date: Mon, 8 Sep 2014 03:32:48 +0200 Subject: add initial support for Quartz backend (no gtk-mac-integration, no native shortcut modifiers) (bzr r13506.1.74) --- .../launcher-quartz-no-macintegration.sh | 183 +++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100755 packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh (limited to 'packaging/macosx/ScriptExec') diff --git a/packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh b/packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh new file mode 100755 index 000000000..db5861c83 --- /dev/null +++ b/packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh @@ -0,0 +1,183 @@ +#!/bin/sh +# +# Author: Aaron Voisine +# Inkscape Modifications: +# Michael Wybrow +# Jean-Olivier Irisson +# ~suv +# + +[ -n "$INK_DEBUG_LAUNCHER" ] && set -x + +CWD="$(cd "$(dirname "$0")" && pwd)" +# e.g. /Applications/Inkscape.app/Contents/MacOS +TOP="$(dirname "$CWD")/Resources" +# e.g. /Applications/Inkscape.app/Contents/Resources +BASE="$(echo "$TOP" | sed -e 's/\/Contents\/Resources.*$//')" +# e.g. /Applications/Inkscape.app + +source "${TOP}/xdg_setup.sh" +source "${TOP}/alert_fccache.sh" + +# FIXME: Inkscape needs better relocation support for OS X (get rid of the relative +# path hack in src/path-prefix.h for osxapp-enabled builds). Until then, below change +# of working directory is required: +# +# Due to changes after 0.48, we have change working directory in the script named 'inkscape': +# recursive calls to inkscape from python-based extensions otherwise cause the app to hang or +# fail (for python-based extensions, inkscape changes the working directory to the +# script's directory, and inkscape launched by python script thus can't find resources +# like the now essential 'units.xml' in INKSCAPE_UIDIR relative to the working directory). +cd "$BASE" || exit 1 + +# don't prepend to $PATH in recursive calls: +if [ -z "$INK_PATH_ORIG" ]; then + + # Brutally add many things to the PATH. If the directories do not exist, they won't be used anyway. + # the 'classic' PATH additions: + # /usr/local/bin which, though standard, doesn't seem to be in the PATH + # Fink + # MacPorts (former DarwinPorts) + # LaTeX distribution for Mac OS X + PATH_OTHER="/usr/texbin:/opt/local/bin:/sw/bin/:/usr/local/bin" + + # Put /usr/bin at beginning of path so we make sure we use Apple's python + # over one that may be installed be Macports, Fink or some other means. + PATH_PYTHON="/usr/bin" + + # Put $TOP/bin at beginning of path so we make sure that recursive calls + # to inkscape don't pull in other inkscape binaries with different setup. + # Also allows to override system python with custom wrapper script, and + # e.g. to support GIMP.app or gimp for external editing and GIMP XCF export. + PATH_pkgbin="$CWD:$TOP/bin" + + # save orig, new PATH + export INK_PATH_ORIG="$PATH" + export PATH="$PATH_pkgbin:$PATH_PYTHON:$PATH_OTHER:$INK_PATH_ORIG" +fi + +# Setup PYTHONPATH to use python modules shipped with Inkscape +OSXMINORNO="$(/usr/bin/sw_vers -productVersion | cut -d. -f2)" +build_arch=__build_arch__ +if [ $OSXMINORNO -gt "5" ]; then + if [ $OSXMINORNO -eq "6" ]; then + export VERSIONER_PYTHON_VERSION=2.6 + else # if [ $OSXMINORNO -ge "7" ]; then + export VERSIONER_PYTHON_VERSION=2.7 + fi + if [ $build_arch = "i386" ]; then + export VERSIONER_PYTHON_PREFER_32_BIT=yes + else # build & runtime arch x86_64 + export VERSIONER_PYTHON_PREFER_32_BIT=no + fi +fi +PYTHON_VERS="$(python -V 2>&1 | cut -c 8-10)" +export PYTHONPATH="$TOP/lib/python$PYTHON_VERS/site-packages/" + +# fallback for missing $INK_CACHE_DIR +if [ -z "$INK_CACHE_DIR" ]; then + INK_CACHE_DIR="${HOME}/.cache/inkscape" + mkdir -p "$INK_CACHE_DIR" + [ $_DEBUG ] && echo "INK_CACHE_DIR: falling back to $INK_CACHE_DIR" +fi + +export FONTCONFIG_PATH="$TOP/etc/fonts" +export PANGO_RC_FILE="${INK_CACHE_DIR}/pangorc" +export GTK_IM_MODULE_FILE="${INK_CACHE_DIR}/immodules.cache" +export GDK_PIXBUF_MODULE_FILE="${INK_CACHE_DIR}/loaders.cache" +export GTK_DATA_PREFIX="$TOP" +export GTK_EXE_PREFIX="$TOP" +export GTK_PATH="$TOP" +export GNOME_VFS_MODULE_CONFIG_PATH="$TOP/etc/gnome-vfs-2.0/modules" +export GNOME_VFS_MODULE_PATH="$TOP/lib/gnome-vfs-2.0/modules" +export GIO_USE_VFS="local" +export GVFS_REMOTE_VOLUME_MONITOR_IGNORE=1 +export GVFS_DISABLE_FUSE=1 +export XDG_DATA_DIRS="$TOP/share" +export ASPELL_CONF="prefix $TOP;" +export POPPLER_DATADIR="$TOP/share/poppler" + +# no DBUS for now +unset DBUS_LAUNCHD_SESSION_BUS_SOCKET +unset DBUS_SESSION_BUS_ADDRESS + +# Note: This requires the path with the exact ImageMagic version number. +# The actual version is inserted by the packaging script. +export MAGICK_CONFIGURE_PATH="$TOP/lib/ImageMagick-IMAGEMAGICKVER/config:$TOP/share/ImageMagick-IMAGEMAGICKVER_MAJOR/config" +export MAGICK_CODER_FILTER_PATH="$TOP/lib/ImageMagick-IMAGEMAGICKVER/modules-Q16/filters" +export MAGICK_CODER_MODULE_PATH="$TOP/lib/ImageMagick-IMAGEMAGICKVER/modules-Q16/coders" + +export INKSCAPE_SHAREDIR="$TOP/share/inkscape" +export INKSCAPE_PLUGINDIR="$TOP/lib/inkscape" +export INKSCAPE_LOCALEDIR="$TOP/share/locale" + +# Handle the case where the directory storing Inkscape has special characters +# ('#', '&', '|') in the name. These need to be escaped to work properly for +# various configuration files. +ESCAPEDTOP=`echo "$TOP" | sed 's/#/\\\\\\\\#/' | sed 's/&/\\\\\\&/g' | sed 's/|/\\\\\\|/g'` + +# Set GTK theme (only if there is no .gtkrc-2.0 in the user's home) +if [[ ! -e "$HOME/.gtkrc-2.0" ]]; then + export GTK2_RC_FILES="$ESCAPEDTOP/etc/gtk-2.0/gtkrc" +fi + +# If the AppleCollationOrder preference doesn't exist, we fall back to using +# the AppleLocale preference. +LANGSTR=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null` +if [ "x$LANGSTR" == "x" -o "x$LANGSTR" == "xroot" ] +then + LANGSTR=`defaults read .GlobalPreferences AppleLocale 2>/dev/null | \ + sed 's/_.*//'` + [ $_DEBUG ] && echo "Setting LANGSTR from AppleLocale: $LANGSTR" 1>&2 +else + [ $_DEBUG ] && echo "Setting LANGSTR from AppleCollationOrder: $LANGSTR" 1>&2 +fi + +# NOTE: Have to add ".UTF-8" to the LANG since omitting causes Inkscape +# to crash on startup in locale_from_utf8(). +if [ "x$LANGSTR" == "x" ] +then + # override broken script + [ $_DEBUG ] && echo "Overriding empty LANGSTR" 1>&2 + export LANG="en_US.UTF-8" +else + tmpLANG="`grep \"\`echo $LANGSTR\`_\" /usr/share/locale/locale.alias | \ + tail -n1 | sed 's/\./ /' | awk '{print $2}'`" + if [ "x$tmpLANG" == "x" ] + then + # override broken script + [ $_DEBUG ] && echo "Overriding empty LANG from /usr/share/locale/locale.alias" 1>&2 + export LANG="en_US.UTF-8" + else + [ $_DEBUG ] && echo "Setting LANG from /usr/share/locale/locale.alias" 1>&2 + export LANG="$tmpLANG.UTF-8" + fi +fi +[ $_DEBUG ] && echo "Setting Language: $LANG" 1>&2 +export LC_ALL="$LANG" + +sed 's|${INK_CACHE_DIR}|'"$INK_CACHE_DIR|g" "$TOP/etc/pango/pangorc" > "${INK_CACHE_DIR}/pangorc" +sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/etc/pango/pango.modules" \ + > "${INK_CACHE_DIR}/pango.modules" +sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/lib/gtk-2.0/__gtk_version__/immodules.cache" \ + > "${INK_CACHE_DIR}/immodules.cache" +sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/lib/gdk-pixbuf-2.0/__gdk_pixbuf_version__/loaders.cache" \ + > "${INK_CACHE_DIR}/loaders.cache" + +case "$INK_DEBUG" in + gdb) + EXEC="gdb --args" ;; + lldb) + EXEC="lldb -- " ;; + dtruss) + EXEC="dtruss" ;; + *) + EXEC="exec" ;; +esac +unset INK_DEBUG # ignore for recursive calls + +if [ "x$INK_DEBUG_SHELL" != "x" ]; then + exec bash +else + $EXEC "$CWD/inkscape-bin" "$@" +fi -- cgit v1.2.3 From b8f04680d3b169543839b4aad65d79ef599577f7 Mon Sep 17 00:00:00 2001 From: su_v Date: Wed, 10 Sep 2014 15:05:08 +0200 Subject: update launcher for quartz backend too (no external loader cache files) (bzr r13506.1.87) --- .../launcher-quartz-no-macintegration.sh | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'packaging/macosx/ScriptExec') diff --git a/packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh b/packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh index db5861c83..d449b5121 100755 --- a/packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh +++ b/packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh @@ -74,17 +74,11 @@ fi PYTHON_VERS="$(python -V 2>&1 | cut -c 8-10)" export PYTHONPATH="$TOP/lib/python$PYTHON_VERS/site-packages/" -# fallback for missing $INK_CACHE_DIR -if [ -z "$INK_CACHE_DIR" ]; then - INK_CACHE_DIR="${HOME}/.cache/inkscape" - mkdir -p "$INK_CACHE_DIR" - [ $_DEBUG ] && echo "INK_CACHE_DIR: falling back to $INK_CACHE_DIR" -fi - export FONTCONFIG_PATH="$TOP/etc/fonts" -export PANGO_RC_FILE="${INK_CACHE_DIR}/pangorc" -export GTK_IM_MODULE_FILE="${INK_CACHE_DIR}/immodules.cache" -export GDK_PIXBUF_MODULE_FILE="${INK_CACHE_DIR}/loaders.cache" +export PANGO_RC_FILE="$TOP/etc/pango/pangorc" +export PANGO_SYSCONFDIR="$TOP/etc" +export GTK_IM_MODULE_FILE="$TOP/lib/gtk-2.0/__gtk_version__/immodules.cache" +export GDK_PIXBUF_MODULE_FILE="$TOP/lib/gdk-pixbuf-2.0/__gtk_version__/loaders.cache" export GTK_DATA_PREFIX="$TOP" export GTK_EXE_PREFIX="$TOP" export GTK_PATH="$TOP" @@ -156,14 +150,6 @@ fi [ $_DEBUG ] && echo "Setting Language: $LANG" 1>&2 export LC_ALL="$LANG" -sed 's|${INK_CACHE_DIR}|'"$INK_CACHE_DIR|g" "$TOP/etc/pango/pangorc" > "${INK_CACHE_DIR}/pangorc" -sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/etc/pango/pango.modules" \ - > "${INK_CACHE_DIR}/pango.modules" -sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/lib/gtk-2.0/__gtk_version__/immodules.cache" \ - > "${INK_CACHE_DIR}/immodules.cache" -sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/lib/gdk-pixbuf-2.0/__gdk_pixbuf_version__/loaders.cache" \ - > "${INK_CACHE_DIR}/loaders.cache" - case "$INK_DEBUG" in gdb) EXEC="gdb --args" ;; -- cgit v1.2.3 From f7d3d05a888af969102b8277fc2d92d39d7eea8f Mon Sep 17 00:00:00 2001 From: su_v Date: Fri, 24 Oct 2014 07:01:09 +0200 Subject: Update for osx packaging (re merge review by bryce) (bzr r13634.1.1) --- packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'packaging/macosx/ScriptExec') diff --git a/packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh b/packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh index d449b5121..05ffbe5c8 100755 --- a/packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh +++ b/packaging/macosx/ScriptExec/launcher-quartz-no-macintegration.sh @@ -7,6 +7,12 @@ # ~suv # +get_env_current () +{ + env | awk -F= '/[a-zA-Z_][a-zA-Z_0-9]*=/ {if (!system("[ -n \"${" $1 "+y}\" ]")) print $1 }' | sort | uniq +} +[ -z "$_env_orig" ] && export _env_orig="$(get_env_current)" + [ -n "$INK_DEBUG_LAUNCHER" ] && set -x CWD="$(cd "$(dirname "$0")" && pwd)" @@ -23,7 +29,7 @@ source "${TOP}/alert_fccache.sh" # path hack in src/path-prefix.h for osxapp-enabled builds). Until then, below change # of working directory is required: # -# Due to changes after 0.48, we have change working directory in the script named 'inkscape': +# Due to changes after 0.48, we have to change working directory in the script named 'inkscape': # recursive calls to inkscape from python-based extensions otherwise cause the app to hang or # fail (for python-based extensions, inkscape changes the working directory to the # script's directory, and inkscape launched by python script thus can't find resources -- cgit v1.2.3