|
61 | 61 | '-DCMAKE_PREFIX_PATH="{}" ' |
62 | 62 | '-DCMAKE_INSTALL_PREFIX="{}" ' |
63 | 63 | ).format(prefix_dir, prefix_dir) |
| 64 | +CMAKE_PREVENT_REEXPORT = "" |
64 | 65 |
|
65 | 66 | # Try to use Ninja to build things if it's available. Much faster. |
66 | 67 | # On Windows, I first need to figure out how to make it aware of VC, bitness, |
|
81 | 82 | print("# Making a 32 bit build.") |
82 | 83 | bitness = 32 |
83 | 84 |
|
| 85 | + CMAKE_PREVENT_REEXPORT += "-Wl,--exclude-libs,libharfbuzz " |
| 86 | + if BUILD_ZLIB or BUILD_LIBPNG: |
| 87 | + CMAKE_PREVENT_REEXPORT += "-Wl,--exclude-libs,libz " |
| 88 | + if BUILD_LIBPNG: |
| 89 | + CMAKE_PREVENT_REEXPORT += "-Wl,--exclude-libs,libpng " |
| 90 | + |
84 | 91 | if sys.platform == "darwin": |
85 | 92 | print("# Making a 64 bit build.") |
86 | 93 | CMAKE_GLOBAL_SWITCHES += ( |
|
91 | 98 | ) |
92 | 99 | bitness = 64 |
93 | 100 |
|
| 101 | + # the library path is needed for the '-hidden-lx' option to work |
| 102 | + CMAKE_PREVENT_REEXPORT += "-Wl,-L{} ".format(lib_dir) |
| 103 | + CMAKE_PREVENT_REEXPORT += "-Wl,-hidden-lharfbuzz " |
| 104 | + if BUILD_ZLIB or BUILD_LIBPNG: |
| 105 | + CMAKE_PREVENT_REEXPORT += "-Wl,-hidden-lz " |
| 106 | + if BUILD_LIBPNG: |
| 107 | + CMAKE_PREVENT_REEXPORT += "-Wl,-hidden-lpng " |
| 108 | + |
94 | 109 | if "linux" in sys.platform: |
95 | 110 | c_flags = cxx_flags = "-O2" |
96 | 111 | ld_flags = "" |
|
124 | 139 | '-DCMAKE_LD_FLAGS="{}" '.format(ld_flags) |
125 | 140 | ) |
126 | 141 |
|
| 142 | + CMAKE_PREVENT_REEXPORT += "-Wl,--exclude-libs,libharfbuzz " |
| 143 | + if BUILD_ZLIB or BUILD_LIBPNG: |
| 144 | + CMAKE_PREVENT_REEXPORT += "-Wl,--exclude-libs,libz " |
| 145 | + if BUILD_LIBPNG: |
| 146 | + CMAKE_PREVENT_REEXPORT += "-Wl,--exclude-libs,libpng " |
| 147 | + |
127 | 148 |
|
128 | 149 | def shell(cmd, cwd=None): |
129 | 150 | """Run a shell command specified by cmd string.""" |
@@ -249,8 +270,10 @@ def ensure_downloaded(url, sha256_sum): |
249 | 270 | '-DHarfBuzz_INCLUDE_DIRS="{}" ' |
250 | 271 | '-DPNG_INCLUDE_DIRS="{}" ' |
251 | 272 | '-DZLIB_INCLUDE_DIRS="{}" ' |
| 273 | + # prevent re-export of symbols from harfbuzz, libpng and zlib |
| 274 | + '-DCMAKE_SHARED_LINKER_FLAGS="{}" ' |
252 | 275 | "-DSKIP_INSTALL_HEADERS=ON " |
253 | | - "{} ..".format(harfbuzz_includes, libpng_includes, zlib_includes, CMAKE_GLOBAL_SWITCHES), |
| 276 | + "{} ..".format(harfbuzz_includes, libpng_includes, zlib_includes, CMAKE_PREVENT_REEXPORT, CMAKE_GLOBAL_SWITCHES), |
254 | 277 | cwd=build_dir_ft, |
255 | 278 | ) |
256 | 279 | shell("cmake --build . --config Release --target install --parallel", cwd=build_dir_ft) |
|
0 commit comments