15
15
#include <dlfcn.h>
16
16
#endif
17
17
18
- #if CFBUNDLE_ALLOW_FHS_BUNDLES
19
- #if __LP64__
20
- #define _CFBundleFHSArchDirectorySuffix "64"
21
- #else // !__LP64__
22
- #define _CFBundleFHSArchDirectorySuffix "32"
23
- #endif // __LP64__
18
+ #if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS
24
19
25
- CONST_STRING_DECL (_CFBundleFHSDirectory_bin , "bin" );
26
- CONST_STRING_DECL (_CFBundleFHSDirectory_sbin , "sbin" );
27
- CONST_STRING_DECL (_CFBundleFHSDirectory_libWithArchSuffix , "lib" _CFBundleFHSArchDirectorySuffix );
28
- CONST_STRING_DECL (_CFBundleFHSDirectory_lib , "lib" );
20
+ #if DEPLOYMENT_TARGET_LINUX
21
+ #if __LP64__
22
+ #define _CFBundleFHSArchDirectorySuffix "64"
23
+ #else // !__LP64__
24
+ #define _CFBundleFHSArchDirectorySuffix "32"
25
+ #endif // __LP64__
26
+ #endif // DEPLOYMENT_TARGET_LINUX
29
27
30
- #define _CFBundleFHSExecutablesDirectorySuffix CFSTR(".executables")
28
+ CONST_STRING_DECL (_kCFBundleFHSDirectory_bin , "bin" );
29
+ CONST_STRING_DECL (_kCFBundleFHSDirectory_sbin , "sbin" );
30
+ CONST_STRING_DECL (_kCFBundleFHSDirectory_lib , "lib" );
31
+ #if DEPLOYMENT_TARGET_LINUX
32
+ CONST_STRING_DECL (_kCFBundleFHSDirectory_libWithArchSuffix , "lib" _CFBundleFHSArchDirectorySuffix );
33
+ #endif
31
34
35
+ #define _CFBundleFHSExecutablesDirectorySuffix CFSTR(".executables")
32
36
#define _CFBundleFHSDirectoryCLiteral_libexec "libexec"
33
37
38
+ #if DEPLOYMENT_TARGET_LINUX
39
+ #define _CFBundleFHSDirectoriesInExecutableSearchOrder \
40
+ _kCFBundleFHSDirectory_bin, \
41
+ _kCFBundleFHSDirectory_sbin, \
42
+ _kCFBundleFHSDirectory_libWithArchSuffix, \
43
+ _kCFBundleFHSDirectory_lib
44
+ #else
34
45
#define _CFBundleFHSDirectoriesInExecutableSearchOrder \
35
- _CFBundleFHSDirectory_bin , \
36
- _CFBundleFHSDirectory_sbin , \
37
- _CFBundleFHSDirectory_libWithArchSuffix, \
38
- _CFBundleFHSDirectory_lib
46
+ _kCFBundleFHSDirectory_bin , \
47
+ _kCFBundleFHSDirectory_sbin , \
48
+ _kCFBundleFHSDirectory_lib
49
+ #endif // DEPLOYMENT_TARGET_LINUX
39
50
40
- #endif // CFBUNDLE_ALLOW_FHS_BUNDLES
51
+ #endif // !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS
41
52
42
53
// This is here because on iPhoneOS with the dyld shared cache, we remove binaries from their
43
54
// original locations on disk, so checking whether a binary's path exists is no longer sufficient.
@@ -62,7 +73,7 @@ static CFURLRef _CFBundleCopyExecutableURLRaw(CFURLRef urlPath, CFStringRef exeN
62
73
CFURLRef executableURL = NULL ;
63
74
if (!urlPath || !exeName ) return NULL ;
64
75
65
- #if CFBUNDLE_ALLOW_FHS_BUNDLES
76
+ #if ! DEPLOYMENT_RUNTIME_OBJC && ! DEPLOYMENT_TARGET_WINDOWS
66
77
if (!executableURL ) {
67
78
executableURL = CFURLCreateWithFileSystemPathRelativeToBase (kCFAllocatorSystemDefault , exeName , kCFURLPOSIXPathStyle , false, urlPath );
68
79
if (!_binaryLoadable (executableURL )) {
@@ -192,7 +203,7 @@ static CFURLRef _CFBundleCopyExecutableURLInDirectory2(CFBundleRef bundle, CFURL
192
203
Boolean doExecSearch = true;
193
204
#endif
194
205
195
- #if CFBUNDLE_ALLOW_FHS_BUNDLES
206
+ #if ! DEPLOYMENT_RUNTIME_OBJC && ! DEPLOYMENT_TARGET_WINDOWS
196
207
if (lookupMainExe && bundle && bundle -> _isFHSInstalledBundle ) {
197
208
// For a FHS installed bundle, the URL points to share/Bundle.resources, and the binary is in:
198
209
@@ -214,13 +225,13 @@ static CFURLRef _CFBundleCopyExecutableURLInDirectory2(CFBundleRef bundle, CFURL
214
225
215
226
CFRelease (prefix );
216
227
}
217
- #endif // CFBUNDLE_ALLOW_FHS_BUNDLES
228
+ #endif // !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS
218
229
219
230
// Now, look for the executable inside the bundle.
220
231
if (!foundIt && doExecSearch && 0 != version ) {
221
232
CFURLRef exeDirURL = NULL ;
222
233
223
- #if CFBUNDLE_ALLOW_FHS_BUNDLES
234
+ #if ! DEPLOYMENT_RUNTIME_OBJC && ! DEPLOYMENT_TARGET_WINDOWS
224
235
if (bundle && bundle -> _isFHSInstalledBundle ) {
225
236
CFURLRef withoutExtension = CFURLCreateCopyDeletingPathExtension (kCFAllocatorSystemDefault , url );
226
237
CFStringRef lastPathComponent = CFURLCopyLastPathComponent (withoutExtension );
@@ -235,14 +246,14 @@ static CFURLRef _CFBundleCopyExecutableURLInDirectory2(CFBundleRef bundle, CFURL
235
246
CFRelease (libexec );
236
247
CFRelease (exeDirName );
237
248
} else
238
- #endif // CFBUNDLE_ALLOW_FHS_BUNDLES
249
+ #endif // !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS
239
250
if (1 == version ) {
240
251
exeDirURL = CFURLCreateWithString (kCFAllocatorSystemDefault , _CFBundleExecutablesURLFromBase1 , url );
241
252
} else if (2 == version ) {
242
253
exeDirURL = CFURLCreateWithString (kCFAllocatorSystemDefault , _CFBundleExecutablesURLFromBase2 , url );
243
254
} else {
244
- #if DEPLOYMENT_TARGET_WINDOWS || CFBUNDLE_ALLOW_FHS_BUNDLES
245
- // On Windows, Linyx if the bundle URL is foo.resources, then the executable is at the same level as the .resources directory
255
+ #if DEPLOYMENT_TARGET_WINDOWS || ! DEPLOYMENT_RUNTIME_OBJC
256
+ // On Windows and on targets that support FHS bundles, if the bundle URL is foo.resources, then the executable is at the same level as the .resources directory
246
257
CFStringRef extension = CFURLCopyPathExtension (url );
247
258
if (extension && CFEqual (extension , _CFBundleSiblingResourceDirectoryExtension )) {
248
259
exeDirURL = CFURLCreateCopyDeletingLastPathComponent (kCFAllocatorSystemDefault , url );
0 commit comments