|
15 | 15 |
|
16 | 16 | swift_cflags = ['-DDEPLOYMENT_RUNTIME_SWIFT']
|
17 | 17 | if Configuration.current.target.sdk == OSType.Linux:
|
18 |
| - foundation.CFLAGS = '`${PKG_CONFIG} icu-uc icu-i18n --cflags-only-I` -DDEPLOYMENT_TARGET_LINUX -D_GNU_SOURCE -DCF_CHARACTERSET_DATA_DIR="CoreFoundation/CharacterSets"' |
19 |
| - foundation.LDFLAGS = '${SWIFT_USE_LINKER} -Wl,@./CoreFoundation/linux.ld -lswiftGlibc `${PKG_CONFIG} icu-uc icu-i18n --libs` -Wl,-Bsymbolic ' |
| 18 | + foundation.CFLAGS = '-DDEPLOYMENT_TARGET_LINUX -D_GNU_SOURCE -DCF_CHARACTERSET_DATA_DIR="CoreFoundation/CharacterSets"' |
| 19 | + foundation.LDFLAGS = '${SWIFT_USE_LINKER} -Wl,@./CoreFoundation/linux.ld -lswiftGlibc -Wl,-Bsymbolic ' |
20 | 20 | Configuration.current.requires_pkg_config = True
|
21 | 21 | elif Configuration.current.target.sdk == OSType.FreeBSD:
|
22 | 22 | foundation.CFLAGS = '-DDEPLOYMENT_TARGET_FREEBSD -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/local/include/curl '
|
|
61 | 61 | '-Wno-unused-variable',
|
62 | 62 | '-Wno-int-conversion',
|
63 | 63 | '-Wno-unused-function',
|
64 |
| - '-I${SYSROOT}/usr/include/libxml2', |
65 |
| - '-I${SYSROOT}/usr/include/curl', |
66 | 64 | '-I./',
|
67 | 65 | ])
|
68 | 66 |
|
69 | 67 | swift_cflags += [
|
70 | 68 | '-I${BUILD_DIR}/Foundation/usr/lib/swift',
|
71 |
| - '-I${SYSROOT}/usr/include/libxml2', |
72 |
| - '-I${SYSROOT}/usr/include/curl' |
73 | 69 | ]
|
74 | 70 |
|
75 | 71 | if "XCTEST_BUILD_DIR" in Configuration.current.variables:
|
76 | 72 | swift_cflags += [
|
77 | 73 | '-I${XCTEST_BUILD_DIR}',
|
78 | 74 | '-L${XCTEST_BUILD_DIR}',
|
79 |
| - '-I${SYSROOT}/usr/include/libxml2', |
80 |
| - '-I${SYSROOT}/usr/include/curl' |
81 | 75 | ]
|
82 | 76 |
|
83 |
| -triple = Configuration.current.target.triple |
84 |
| -if triple.find("linux") != -1: |
85 |
| - foundation.LDFLAGS += '-lcurl ' |
| 77 | +if Configuration.current.requires_pkg_config: |
| 78 | + pkg_config_dependencies = [ |
| 79 | + 'icu-i18n', |
| 80 | + 'icu-uc', |
| 81 | + 'libcurl', |
| 82 | + 'libxml-2.0', |
| 83 | + ] |
| 84 | + for package_name in pkg_config_dependencies: |
| 85 | + try: |
| 86 | + package = PkgConfig(package_name) |
| 87 | + except PkgConfig.Error as e: |
| 88 | + sys.exit("pkg-config error for package {}: {}".format(package_name, e)) |
| 89 | + foundation.CFLAGS += ' {} '.format(' '.join(package.cflags)) |
| 90 | + foundation.LDFLAGS += ' {} '.format(' '.join(package.ldflags)) |
| 91 | + swift_cflags += package.swiftc_flags |
| 92 | +else: |
| 93 | + foundation.CFLAGS += ''.join([ |
| 94 | + '-I${SYSROOT}/usr/include/curl ', |
| 95 | + '-I${SYSROOT}/usr/include/libxml2 ', |
| 96 | + ]) |
| 97 | + foundation.LDFLAGS += ''.join([ |
| 98 | + '-lcurl ', |
| 99 | + '-lxml2 ', |
| 100 | + ]) |
| 101 | + swift_cflags += ''.join([ |
| 102 | + '-I${SYSROOT}/usr/include/curl ', |
| 103 | + '-I${SYSROOT}/usr/include/libxml2 ', |
| 104 | + ]) |
86 | 105 |
|
| 106 | +triple = Configuration.current.target.triple |
87 | 107 | if triple == "armv7-none-linux-androideabi":
|
88 | 108 | foundation.LDFLAGS += '-llog '
|
89 | 109 | else:
|
90 | 110 | foundation.LDFLAGS += '-lpthread '
|
91 | 111 |
|
92 |
| -foundation.LDFLAGS += '-ldl -lm -lswiftCore -lxml2 ' |
| 112 | +foundation.LDFLAGS += '-ldl -lm -lswiftCore ' |
93 | 113 |
|
94 | 114 | # Configure use of Dispatch in CoreFoundation and Foundation if libdispatch is being built
|
95 | 115 | if "LIBDISPATCH_SOURCE_DIR" in Configuration.current.variables:
|
|
0 commit comments