From 6da3ba48a7d22b1d189e081a6327b331fc09d3d1 Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Sat, 17 Mar 2018 22:15:49 +0100 Subject: [PATCH] gargoyle: fix darwin build /cc ZHF #36454 --- pkgs/games/gargoyle/darwin.patch | 141 +++++++++++++++++++++++++++++++ pkgs/games/gargoyle/default.nix | 5 ++ 2 files changed, 146 insertions(+) diff --git a/pkgs/games/gargoyle/darwin.patch b/pkgs/games/gargoyle/darwin.patch index cf44dffc897c..230f453acad7 100644 --- a/pkgs/games/gargoyle/darwin.patch +++ b/pkgs/games/gargoyle/darwin.patch @@ -26,6 +26,147 @@ index 1f8829d..d8455eb 100644 } SEARCH_SOURCE = +diff --git a/garglk/fontmac.m b/garglk/fontmac.m +index d6e1426..72304a3 100644 +--- a/garglk/fontmac.m ++++ b/garglk/fontmac.m +@@ -167,7 +167,7 @@ static void propfont(char *file, int style) + } + } + +-static NSMutableArray * gli_registered_fonts = nil; ++static NSMutableArray * gli_registered_fonts = nil; + static NSDistributedLock * gli_font_lock = nil; + + void fontreplace(char *font, int type) +@@ -181,7 +181,7 @@ void fontreplace(char *font, int type) + NSFontDescriptor * fontFamilyDescriptor = + [[NSFontDescriptor fontDescriptorWithFontAttributes: nil] fontDescriptorWithFamily: fontFamily]; + +- NSArray * fontMatches = ++ NSArray * fontMatches = + [fontFamilyDescriptor matchingFontDescriptorsWithMandatoryKeys: nil]; + + for (NSFontDescriptor * sysfont in fontMatches) +@@ -197,7 +197,7 @@ void fontreplace(char *font, int type) + + else if ([sysfont symbolicTraits] & NSFontItalicTrait) + style = FONTI; +- ++ + /* find path for font */ + CFURLRef urlRef = CTFontDescriptorCopyAttribute((CTFontDescriptorRef)sysfont, kCTFontURLAttribute); + if (!urlRef) +@@ -259,7 +259,7 @@ void fontload(void) + + // obtain a list of all files in the Fonts directory + NSString * fontFolder = [[NSString stringWithUTF8String: env] stringByAppendingPathComponent: @"Fonts"]; +- NSArray * fontFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtPath: fontFolder error: nil]; ++ NSArray * fontFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtPath: fontFolder error: nil]; + + // create a collection to hold the registered font URLs + gli_registered_fonts = [NSMutableArray new]; +diff --git a/garglk/launchmac.m b/garglk/launchmac.m +index 68deca5..9f752ac 100644 +--- a/garglk/launchmac.m ++++ b/garglk/launchmac.m +@@ -72,14 +72,14 @@ char *winfilters[] = + height: (unsigned int) height + { + [[self openGLContext] makeCurrentContext]; +- ++ + /* allocate new texture */ + glDeleteTextures(1, &output); + glGenTextures(1, &output); + + /* bind target to texture */ +- glEnable(GL_TEXTURE_RECTANGLE_ARB); +- glBindTexture(GL_TEXTURE_RECTANGLE_ARB, output); ++ glEnable(GL_TEXTURE_RECTANGLE_ARB); ++ glBindTexture(GL_TEXTURE_RECTANGLE_ARB, output); + + /* set target parameters */ + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_CACHED_APPLE); +@@ -460,7 +460,7 @@ static BOOL isTextbufferEvent(NSEvent * evt) + if (filter != FILTER_ALL) + { + NSArray * filterTypes = [NSArray arrayWithObject: [NSString stringWithCString: winfilters[filter] +- encoding: NSUTF8StringEncoding]]; ++ encoding: NSUTF8StringEncoding]]; + [openDlg setAllowedFileTypes: filterTypes]; + [openDlg setAllowsOtherFileTypes: NO]; + } +@@ -485,7 +485,7 @@ static BOOL isTextbufferEvent(NSEvent * evt) + if (filter != FILTER_ALL) + { + NSArray * filterTypes = [NSArray arrayWithObject: [NSString stringWithCString: winfilters[filter] +- encoding: NSUTF8StringEncoding]]; ++ encoding: NSUTF8StringEncoding]]; + [saveDlg setAllowedFileTypes: filterTypes]; + [saveDlg setAllowsOtherFileTypes: NO]; + } +@@ -518,7 +518,7 @@ static BOOL isTextbufferEvent(NSEvent * evt) + + { + BOOL openedFirstGame; +- NSMutableDictionary * windows; ++ NSMutableDictionary * windows; + NSConnection * link; + } + - (BOOL) launchFile: (NSString *) file; +@@ -760,20 +760,20 @@ static BOOL isTextbufferEvent(NSEvent * evt) + - (BOOL) launchFileDialog + { + int result; +- ++ + NSOpenPanel * openDlg = [NSOpenPanel openPanel]; + + [openDlg setCanChooseFiles: YES]; + [openDlg setCanChooseDirectories: NO]; + [openDlg setAllowsMultipleSelection: NO]; + [openDlg setTitle: [NSString stringWithCString: AppName encoding: NSUTF8StringEncoding]]; +- ++ + NSMutableArray *filterTypes = [NSMutableArray arrayWithCapacity:100]; +- +- NSEnumerator *docTypeEnum = [[[[NSBundle mainBundle] infoDictionary] ++ ++ NSEnumerator *docTypeEnum = [[[[NSBundle mainBundle] infoDictionary] + objectForKey:@"CFBundleDocumentTypes"] objectEnumerator]; + NSDictionary *docType; +- ++ + while (docType = [docTypeEnum nextObject]) + { + [filterTypes addObjectsFromArray:[docType objectForKey: @"CFBundleTypeExtensions"]]; +diff --git a/garglk/ttsmac.m b/garglk/ttsmac.m +index 9f6ab0e..de3d6fe 100644 +--- a/garglk/ttsmac.m ++++ b/garglk/ttsmac.m +@@ -30,7 +30,7 @@ + #import "sysmac.h" + + // a queue of phrases to feed to the speech synthesizer +-static NSMutableArray * phraseQueue = nil; ++static NSMutableArray * phraseQueue = nil; + static NSRange purgeRange; + + @interface SpeechDelegate : NSObject +@@ -96,10 +96,10 @@ void gli_initialize_tts(void) + NSString * lang = [NSString stringWithCString: gli_conf_speak_language + encoding: NSUTF8StringEncoding]; + +- NSArray * voices = [NSSpeechSynthesizer availableVoices]; ++ NSArray * voices = [NSSpeechSynthesizer availableVoices]; + for (NSString * voice in voices) + { +- NSDictionary * attr = [NSSpeechSynthesizer attributesForVoice: voice]; ++ NSDictionary * attr = [NSSpeechSynthesizer attributesForVoice: voice]; + if ([lang isEqualToString: [attr objectForKey: NSVoiceLocaleIdentifier]]) + { + [synth setVoice: voice]; diff --git a/tads/tads3/vmtz.cpp b/tads/tads3/vmtz.cpp index 5e193a1..dce46f7 100644 --- a/tads/tads3/vmtz.cpp diff --git a/pkgs/games/gargoyle/default.nix b/pkgs/games/gargoyle/default.nix index 4c5b2827a0e8..fc02bdffcad8 100644 --- a/pkgs/games/gargoyle/default.nix +++ b/pkgs/games/gargoyle/default.nix @@ -36,6 +36,11 @@ stdenv.mkDerivation { patches = [ ./darwin.patch ]; + postPatch = '' + substituteInPlace Jamrules \ + --replace -mmacosx-version-min=10.7 -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET + ''; + buildPhase = jamenv + "jam -j$NIX_BUILD_CORES"; installPhase = if stdenv.isDarwin then (builtins.readFile ./darwin.sh) else jamenv + ''