Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

gargoyle: fix darwin build

/cc ZHF #36454

(cherry picked from commit 6da3ba48a7d22b1d189e081a6327b331fc09d3d1)

+146
+141
pkgs/games/gargoyle/darwin.patch
··· 26 26 } 27 27 28 28 SEARCH_SOURCE = 29 + diff --git a/garglk/fontmac.m b/garglk/fontmac.m 30 + index d6e1426..72304a3 100644 31 + --- a/garglk/fontmac.m 32 + +++ b/garglk/fontmac.m 33 + @@ -167,7 +167,7 @@ static void propfont(char *file, int style) 34 + } 35 + } 36 + 37 + -static NSMutableArray<NSURL *> * gli_registered_fonts = nil; 38 + +static NSMutableArray * gli_registered_fonts = nil; 39 + static NSDistributedLock * gli_font_lock = nil; 40 + 41 + void fontreplace(char *font, int type) 42 + @@ -181,7 +181,7 @@ void fontreplace(char *font, int type) 43 + NSFontDescriptor * fontFamilyDescriptor = 44 + [[NSFontDescriptor fontDescriptorWithFontAttributes: nil] fontDescriptorWithFamily: fontFamily]; 45 + 46 + - NSArray<NSFontDescriptor *> * fontMatches = 47 + + NSArray * fontMatches = 48 + [fontFamilyDescriptor matchingFontDescriptorsWithMandatoryKeys: nil]; 49 + 50 + for (NSFontDescriptor * sysfont in fontMatches) 51 + @@ -197,7 +197,7 @@ void fontreplace(char *font, int type) 52 + 53 + else if ([sysfont symbolicTraits] & NSFontItalicTrait) 54 + style = FONTI; 55 + - 56 + + 57 + /* find path for font */ 58 + CFURLRef urlRef = CTFontDescriptorCopyAttribute((CTFontDescriptorRef)sysfont, kCTFontURLAttribute); 59 + if (!urlRef) 60 + @@ -259,7 +259,7 @@ void fontload(void) 61 + 62 + // obtain a list of all files in the Fonts directory 63 + NSString * fontFolder = [[NSString stringWithUTF8String: env] stringByAppendingPathComponent: @"Fonts"]; 64 + - NSArray<NSString *> * fontFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtPath: fontFolder error: nil]; 65 + + NSArray * fontFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtPath: fontFolder error: nil]; 66 + 67 + // create a collection to hold the registered font URLs 68 + gli_registered_fonts = [NSMutableArray new]; 69 + diff --git a/garglk/launchmac.m b/garglk/launchmac.m 70 + index 68deca5..9f752ac 100644 71 + --- a/garglk/launchmac.m 72 + +++ b/garglk/launchmac.m 73 + @@ -72,14 +72,14 @@ char *winfilters[] = 74 + height: (unsigned int) height 75 + { 76 + [[self openGLContext] makeCurrentContext]; 77 + - 78 + + 79 + /* allocate new texture */ 80 + glDeleteTextures(1, &output); 81 + glGenTextures(1, &output); 82 + 83 + /* bind target to texture */ 84 + - glEnable(GL_TEXTURE_RECTANGLE_ARB); 85 + - glBindTexture(GL_TEXTURE_RECTANGLE_ARB, output); 86 + + glEnable(GL_TEXTURE_RECTANGLE_ARB); 87 + + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, output); 88 + 89 + /* set target parameters */ 90 + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_CACHED_APPLE); 91 + @@ -460,7 +460,7 @@ static BOOL isTextbufferEvent(NSEvent * evt) 92 + if (filter != FILTER_ALL) 93 + { 94 + NSArray * filterTypes = [NSArray arrayWithObject: [NSString stringWithCString: winfilters[filter] 95 + - encoding: NSUTF8StringEncoding]]; 96 + + encoding: NSUTF8StringEncoding]]; 97 + [openDlg setAllowedFileTypes: filterTypes]; 98 + [openDlg setAllowsOtherFileTypes: NO]; 99 + } 100 + @@ -485,7 +485,7 @@ static BOOL isTextbufferEvent(NSEvent * evt) 101 + if (filter != FILTER_ALL) 102 + { 103 + NSArray * filterTypes = [NSArray arrayWithObject: [NSString stringWithCString: winfilters[filter] 104 + - encoding: NSUTF8StringEncoding]]; 105 + + encoding: NSUTF8StringEncoding]]; 106 + [saveDlg setAllowedFileTypes: filterTypes]; 107 + [saveDlg setAllowsOtherFileTypes: NO]; 108 + } 109 + @@ -518,7 +518,7 @@ static BOOL isTextbufferEvent(NSEvent * evt) 110 + <GargoyleApp, NSApplicationDelegate, NSWindowDelegate> 111 + { 112 + BOOL openedFirstGame; 113 + - NSMutableDictionary<NSNumber *, GargoyleWindow *> * windows; 114 + + NSMutableDictionary * windows; 115 + NSConnection * link; 116 + } 117 + - (BOOL) launchFile: (NSString *) file; 118 + @@ -760,20 +760,20 @@ static BOOL isTextbufferEvent(NSEvent * evt) 119 + - (BOOL) launchFileDialog 120 + { 121 + int result; 122 + - 123 + + 124 + NSOpenPanel * openDlg = [NSOpenPanel openPanel]; 125 + 126 + [openDlg setCanChooseFiles: YES]; 127 + [openDlg setCanChooseDirectories: NO]; 128 + [openDlg setAllowsMultipleSelection: NO]; 129 + [openDlg setTitle: [NSString stringWithCString: AppName encoding: NSUTF8StringEncoding]]; 130 + - 131 + + 132 + NSMutableArray *filterTypes = [NSMutableArray arrayWithCapacity:100]; 133 + - 134 + - NSEnumerator *docTypeEnum = [[[[NSBundle mainBundle] infoDictionary] 135 + + 136 + + NSEnumerator *docTypeEnum = [[[[NSBundle mainBundle] infoDictionary] 137 + objectForKey:@"CFBundleDocumentTypes"] objectEnumerator]; 138 + NSDictionary *docType; 139 + - 140 + + 141 + while (docType = [docTypeEnum nextObject]) 142 + { 143 + [filterTypes addObjectsFromArray:[docType objectForKey: @"CFBundleTypeExtensions"]]; 144 + diff --git a/garglk/ttsmac.m b/garglk/ttsmac.m 145 + index 9f6ab0e..de3d6fe 100644 146 + --- a/garglk/ttsmac.m 147 + +++ b/garglk/ttsmac.m 148 + @@ -30,7 +30,7 @@ 149 + #import "sysmac.h" 150 + 151 + // a queue of phrases to feed to the speech synthesizer 152 + -static NSMutableArray<NSString *> * phraseQueue = nil; 153 + +static NSMutableArray * phraseQueue = nil; 154 + static NSRange purgeRange; 155 + 156 + @interface SpeechDelegate : NSObject <NSSpeechSynthesizerDelegate> 157 + @@ -96,10 +96,10 @@ void gli_initialize_tts(void) 158 + NSString * lang = [NSString stringWithCString: gli_conf_speak_language 159 + encoding: NSUTF8StringEncoding]; 160 + 161 + - NSArray<NSString *> * voices = [NSSpeechSynthesizer availableVoices]; 162 + + NSArray * voices = [NSSpeechSynthesizer availableVoices]; 163 + for (NSString * voice in voices) 164 + { 165 + - NSDictionary<NSString *, id> * attr = [NSSpeechSynthesizer attributesForVoice: voice]; 166 + + NSDictionary * attr = [NSSpeechSynthesizer attributesForVoice: voice]; 167 + if ([lang isEqualToString: [attr objectForKey: NSVoiceLocaleIdentifier]]) 168 + { 169 + [synth setVoice: voice]; 29 170 diff --git a/tads/tads3/vmtz.cpp b/tads/tads3/vmtz.cpp 30 171 index 5e193a1..dce46f7 100644 31 172 --- a/tads/tads3/vmtz.cpp
+5
pkgs/games/gargoyle/default.nix
··· 36 36 37 37 patches = [ ./darwin.patch ]; 38 38 39 + postPatch = '' 40 + substituteInPlace Jamrules \ 41 + --replace -mmacosx-version-min=10.7 -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET 42 + ''; 43 + 39 44 buildPhase = jamenv + "jam -j$NIX_BUILD_CORES"; 40 45 41 46 installPhase = if stdenv.isDarwin then (builtins.readFile ./darwin.sh) else jamenv + ''