biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / development / tools / xcbuild / platforms.nix
blob0108ac8ef69734996bd106c13c5c846dc2e14f61
1 { stdenv, runCommand, lib, sdks, xcodePlatform, writeText }:
3 let
5   inherit (lib.generators) toPlist;
7   Info = {
8     CFBundleIdentifier = "com.apple.platform.${lib.toLower xcodePlatform}";
9     Type = "Platform";
10     Name = lib.toLower xcodePlatform;
11   };
13   Version = {
14     ProjectName = "OSXPlatformSupport";
15   };
17   # These files are all based off of Xcode spec fies found in
18   # /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/PrivatePlugIns/IDEOSXSupportCore.ideplugin/Contents/Resources.
20   # Based off of the "MacOSX Architectures.xcspec" file. All i386 stuff
21   # is removed because NixPkgs only supports darwin-x86_64 and darwin-arm64.
22   Architectures = [
23     {
24       Identifier = "Standard";
25       Type = "Architecture";
26       Name = "Standard Architectures (Apple Silicon, 64-bit Intel)";
27       RealArchitectures = [ "arm64" "x86_64" ];
28       ArchitectureSetting = "ARCHS_STANDARD";
29     }
30     {
31       Identifier = "Universal";
32       Type = "Architecture";
33       Name = "Universal (Apple Silicon, 64-bit Intel)";
34       RealArchitectures = [ "arm64" "x86_64" ];
35       ArchitectureSetting = "ARCHS_STANDARD_32_64_BIT";
36     }
37     {
38       Identifier = "Native";
39       Type = "Architecture";
40       Name = "Native Architecture of Build Machine";
41       ArchitectureSetting = "NATIVE_ARCH_ACTUAL";
42     }
43     {
44       Identifier = "Standard64bit";
45       Type = "Architecture";
46       Name = "Apple Silicon, 64-bit Intel";
47       RealArchitectures = [ "arm64" "x86_64" ];
48       ArchitectureSetting = "ARCHS_STANDARD_64_BIT";
49     }
50     {
51       Identifier = if stdenv.isAarch64 then "arm64" else "x86_64";
52       Type = "Architecture";
53       Name = "Apple Silicon or Intel 64-bit";
54     }
55     {
56       Identifier = "Standard_Including_64_bit";
57       Type = "Architecture";
58       Name = "Standard Architectures (including 64-bit)";
59       RealArchitectures = [ "arm64" "x86_64" ];
60       ArchitectureSetting = "ARCHS_STANDARD_INCLUDING_64_BIT";
61     }
62   ];
64   # Based off of the "MacOSX Package Types.xcspec" file. Only keep the
65   # bare minimum needed.
66   PackageTypes = [
67     {
68       Identifier = "com.apple.package-type.mach-o-executable";
69       Type = "PackageType";
70       Name = "Mach-O Executable";
71       DefaultBuildSettings = {
72         EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
73         EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
74       };
75       ProductReference = {
76         FileType = "compiled.mach-o.executable";
77         Name = "$(EXECUTABLE_NAME)";
78       };
79     }
80     {
81       Identifier = "com.apple.package-type.mach-o-objfile";
82       Type = "PackageType";
83       Name = "Mach-O Object File";
84       DefaultBuildSettings = {
85         EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
86         EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
87       };
88       ProductReference = {
89         FileType = "compiled.mach-o.objfile";
90         Name = "$(EXECUTABLE_NAME)";
91       };
92     }
93     {
94       Identifier = "com.apple.package-type.mach-o-dylib";
95       Type = "PackageType";
96       Name = "Mach-O Dynamic Library";
97       DefaultBuildSettings = {
98         EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
99         EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
100       };
101       ProductReference = {
102         FileType = "compiled.mach-o.dylib";
103         Name = "$(EXECUTABLE_NAME)";
104       };
105     }
106     {
107       Identifier = "com.apple.package-type.static-library";
108       Type = "PackageType";
109       Name = "Mach-O Static Library";
110       DefaultBuildSettings = {
111         EXECUTABLE_PREFIX = "lib";
112         EXECUTABLE_SUFFIX = ".a";
113         EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
114         EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
115       };
116       ProductReference = {
117         FileType = "archive.ar";
118         Name = "$(EXECUTABLE_NAME)";
119         IsLaunchable = "NO";
120       };
121     }
122     {
123       Identifier = "com.apple.package-type.wrapper";
124       Type = "PackageType";
125       Name = "Wrapper";
126       DefaultBuildSettings = {
127         WRAPPER_SUFFIX = ".bundle";
128         WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)";
129         CONTENTS_FOLDER_PATH = "$(WRAPPER_NAME)/Contents";
130         EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
131         EXECUTABLE_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/MacOS";
132         EXECUTABLE_PATH = "$(EXECUTABLE_FOLDER_PATH)/$(EXECUTABLE_NAME)";
133         INFOPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/Info.plist";
134         INFOSTRINGS_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/InfoPlist.strings";
135         PKGINFO_PATH = "$(CONTENTS_FOLDER_PATH)/PkgInfo";
136         PBDEVELOPMENTPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/pbdevelopment.plist";
137         VERSIONPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/version.plist";
138         PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Headers";
139         PRIVATE_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PrivateHeaders";
140         EXECUTABLES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Executables";
141         FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Frameworks";
142         SHARED_FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/SharedFrameworks";
143         SHARED_SUPPORT_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/SharedSupport";
144         UNLOCALIZED_RESOURCES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Resources";
145         LOCALIZED_RESOURCES_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/$(DEVELOPMENT_LANGUAGE).lproj";
146         DOCUMENTATION_FOLDER_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/Documentation";
147         PLUGINS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PlugIns";
148         SCRIPTS_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Scripts";
149       };
150       ProductReference = {
151         FileType = "wrapper.cfbundle";
152         Name = "$(WRAPPER_NAME)";
153         IsLaunchable = "NO";
154       };
155     }
156     {
157       Identifier = "com.apple.package-type.wrapper.application";
158       Type = "PackageType";
159       BasedOn = "com.apple.package-type.wrapper";
160       Name = "Application Wrapper";
161       DefaultBuildSettings = {
162         GENERATE_PKGINFO_FILE = "YES";
163       };
164       ProductReference = {
165         FileType = "wrapper.application";
166         Name = "$(WRAPPER_NAME)";
167         IsLaunchable = "YES";
168       };
169     }
170   ];
172   # Based off of the "MacOSX Product Types.xcspec" file. All
173   # bundles/wrapper are removed, because we prefer dynamic products in
174   # NixPkgs.
175   ProductTypes = [
176     {
177       Identifier = "com.apple.product-type.tool";
178       Type = "ProductType";
179       Name = "Command-line Tool";
180       PackageTypes = [ "com.apple.package-type.mach-o-executable" ];
181     }
182     {
183       Identifier = "com.apple.product-type.objfile";
184       Type = "ProductType";
185       Name = "Object File";
186       PackageTypes = [ "com.apple.package-type.mach-o-objfile" ];
187     }
188     {
189       Identifier = "com.apple.product-type.library.dynamic";
190       Type = "ProductType";
191       Name = "Dynamic Library";
192       PackageTypes = [ "com.apple.package-type.mach-o-dylib" ];
193       DefaultBuildProperties = {
194         FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)";
195         MACH_O_TYPE = "mh_dylib";
196         REZ_EXECUTABLE = "YES";
197         EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)";
198         EXECUTABLE_EXTENSION = "dylib";
199         DYLIB_COMPATIBILITY_VERSION = "1";
200         DYLIB_CURRENT_VERSION = "1";
201         FRAMEWORK_FLAG_PREFIX = "-framework";
202         LIBRARY_FLAG_PREFIX = "-l";
203         LIBRARY_FLAG_NOSPACE = "YES";
204         STRIP_STYLE = "debugging";
205         GCC_INLINES_ARE_PRIVATE_EXTERN = "YES";
206         CODE_SIGNING_ALLOWED = "YES";
207         CODE_SIGNING_REQUIRED = "NO";
208       };
209     }
210     {
211       Identifier = "com.apple.product-type.library.static";
212       Type = "ProductType";
213       Name = "Static Library";
214       PackageTypes = [ "com.apple.package-type.static-library" ];
215       DefaultBuildProperties = {
216         FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)";
217         MACH_O_TYPE = "staticlib";
218         REZ_EXECUTABLE = "YES";
219         EXECUTABLE_PREFIX = "lib";
220         EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)";
221         EXECUTABLE_EXTENSION = "a";
222         FRAMEWORK_FLAG_PREFIX = "-framework";
223         LIBRARY_FLAG_PREFIX = "-l";
224         LIBRARY_FLAG_NOSPACE = "YES";
225         STRIP_STYLE = "debugging";
226         SEPARATE_STRIP = "YES";
227         CLANG_ENABLE_MODULE_DEBUGGING = "NO";
228       };
229     }
230     {
231       Type = "ProductType";
232       Identifier = "com.apple.product-type.bundle";
233       Name = "Bundle";
234       DefaultBuildProperties = {
235         FULL_PRODUCT_NAME = "$(WRAPPER_NAME)";
236         MACH_O_TYPE = "mh_bundle";
237         WRAPPER_PREFIX = "";
238         WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
239         WRAPPER_EXTENSION = "bundle";
240         WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)";
241         FRAMEWORK_FLAG_PREFIX = "-framework";
242         LIBRARY_FLAG_PREFIX = "-l";
243         LIBRARY_FLAG_NOSPACE = "YES";
244         STRIP_STYLE = "non-global";
245       };
246       PackageTypes = [ "com.apple.package-type.wrapper" ];
247       IsWrapper = "YES";
248       HasInfoPlist = "YES";
249       HasInfoPlistStrings = "YES";
250     }
251     {
252       Identifier = "com.apple.product-type.application";
253       Type = "ProductType";
254       BasedOn = "com.apple.product-type.bundle";
255       Name = "Application";
256       DefaultBuildProperties = {
257         MACH_O_TYPE = "mh_execute";
258         WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
259         WRAPPER_EXTENSION = "app";
260       };
261       PackageTypes = [ "com.apple.package-type.wrapper.application" ];
262     }
263     {
264       Type = "ProductType";
265       Identifier = "com.apple.product-type.framework";
266       Name = "Bundle";
267       DefaultBuildProperties = {
268         FULL_PRODUCT_NAME = "$(WRAPPER_NAME)";
269         MACH_O_TYPE = "mh_bundle";
270         WRAPPER_PREFIX = "";
271         WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
272         WRAPPER_EXTENSION = "bundle";
273         WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)";
274         FRAMEWORK_FLAG_PREFIX = "-framework";
275         LIBRARY_FLAG_PREFIX = "-l";
276         LIBRARY_FLAG_NOSPACE = "YES";
277         STRIP_STYLE = "non-global";
278       };
279       PackageTypes = [ "com.apple.package-type.wrapper" ];
280       IsWrapper = "YES";
281       HasInfoPlist = "YES";
282       HasInfoPlistStrings = "YES";
283     }
284   ];
288 runCommand "Platforms" {} ''
289   platform=$out/${xcodePlatform}.platform
291   install -D ${writeText "Info.plist" (toPlist {} Info)} $platform/Info.plist
292   install -D ${writeText "version.plist" (toPlist {} Version)} $platform/version.plist
293   install -D ${writeText "Architectures.xcspec" (toPlist {} Architectures)} $platform/Developer/Library/Xcode/Specifications/Architectures.xcspec
294   install -D ${writeText "PackageTypes.xcspec" (toPlist {} PackageTypes)} $platform/Developer/Library/Xcode/Specifications/PackageTypes.xcspec
295   install -D ${writeText "ProductTypes.xcspec" (toPlist {} ProductTypes)} $platform/Developer/Library/Xcode/Specifications/ProductTypes.xcspec
297   ln -s $platform $platform/usr
299   mkdir -p $platform/Developer
300   ln -s ${sdks} $platform/Developer/SDKs