mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-05 11:59:08 +08:00
2a8f2c6467
This fixes the `wasm32-emscripten` build of `libflac`, which would
previously fail with
<details>
<summary>Linking Errors</summary>
```
[59/61] : && /opt/homebrew/Cellar/emscripten/3.1.54/libexec/emcc -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Winline -DNDEBUG -O3 -DNDEBUG microbench/CMakeFiles/benchmark_residual.dir/benchmark_residual.c.o microbench/CMakeFiles/benchmark_residual.dir/util.c.o -o microbench/benchmark_residual.js src/libFLAC/libFLAC.a -lrt -lm <path to vcpkg>/installed/wasm32-emscripten-release/lib/libogg.a && :
FAILED: microbench/benchmark_residual.js
: && /opt/homebrew/Cellar/emscripten/3.1.54/libexec/emcc -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Winline -DNDEBUG -O3 -DNDEBUG microbench/CMakeFiles/benchmark_residual.dir/benchmark_residual.c.o microbench/CMakeFiles/benchmark_residual.dir/util.c.o -o microbench/benchmark_residual.js src/libFLAC/libFLAC.a -lrt -lm <path to vcpkg>/installed/wasm32-emscripten-release/lib/libogg.a && :
wasm-ld: error: microbench/CMakeFiles/benchmark_residual.dir/benchmark_residual.c.o: undefined symbol: __stack_chk_guard
wasm-ld: error: microbench/CMakeFiles/benchmark_residual.dir/benchmark_residual.c.o: undefined symbol: __stack_chk_guard
wasm-ld: error: microbench/CMakeFiles/benchmark_residual.dir/benchmark_residual.c.o: undefined symbol: __stack_chk_fail
wasm-ld: error: microbench/CMakeFiles/benchmark_residual.dir/benchmark_residual.c.o: undefined symbol: __stack_chk_guard
wasm-ld: error: microbench/CMakeFiles/benchmark_residual.dir/benchmark_residual.c.o: undefined symbol: __stack_chk_guard
wasm-ld: error: microbench/CMakeFiles/benchmark_residual.dir/benchmark_residual.c.o: undefined symbol: __stack_chk_fail
```
</details>
The stack protector flag is [documented
here](66152791d8/CMakeLists.txt (L21)
)
and is [unsupported in
Emscripten](https://github.com/emscripten-core/emscripten/issues/17030).
### Checklist
- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [x] SHA512s are updated for each updated download.
- [x] The "supports" clause reflects platforms that may be fixed by this
new version.
- [x] Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.
- [x] Any patches that are no longer applied are deleted from the port's
directory.
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.
79 lines
2.3 KiB
CMake
79 lines
2.3 KiB
CMake
vcpkg_from_github(
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
REPO xiph/flac
|
|
REF "${VERSION}"
|
|
SHA512 3571467a1d557bc03eade2ae9bb1a72fd94a89222e6ad9563078d646aac0b65ed1c3d829fb45dd3a6cdca806f7ba3b6393f0ce6571b43651959acaa1c2106396
|
|
HEAD_REF master
|
|
PATCHES
|
|
fix-compile-options.patch
|
|
)
|
|
|
|
if("asm" IN_LIST FEATURES)
|
|
vcpkg_find_acquire_program(NASM)
|
|
get_filename_component(NASM_PATH "${NASM}" DIRECTORY)
|
|
vcpkg_add_to_path("${NASM_PATH}")
|
|
endif()
|
|
|
|
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
|
FEATURES
|
|
asm WITH_ASM
|
|
stack-protector WITH_STACK_PROTECTOR
|
|
)
|
|
|
|
vcpkg_cmake_configure(
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
OPTIONS
|
|
${FEATURE_OPTIONS}
|
|
-DBUILD_PROGRAMS=OFF
|
|
-DBUILD_EXAMPLES=OFF
|
|
-DBUILD_DOCS=OFF
|
|
-DBUILD_TESTING=OFF
|
|
-DINSTALL_MANPAGES=OFF
|
|
)
|
|
|
|
vcpkg_cmake_install()
|
|
|
|
vcpkg_cmake_config_fixup(PACKAGE_NAME FLAC CONFIG_PATH lib/cmake/FLAC)
|
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
|
file(REMOVE "${CURRENT_PACKAGES_DIR}/share/LICENSE")
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/FLAC/export.h"
|
|
"#if defined(FLAC__NO_DLL)"
|
|
"#if 0"
|
|
)
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/FLAC++/export.h"
|
|
"#if defined(FLAC__NO_DLL)"
|
|
"#if 0"
|
|
)
|
|
else()
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/FLAC/export.h"
|
|
"#if defined(FLAC__NO_DLL)"
|
|
"#if 1"
|
|
)
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/FLAC++/export.h"
|
|
"#if defined(FLAC__NO_DLL)"
|
|
"#if 1"
|
|
)
|
|
endif()
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/flac.pc" " -lm" "")
|
|
|
|
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/flac.pc")
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/flac.pc" " -lm" "")
|
|
endif()
|
|
endif()
|
|
|
|
vcpkg_fixup_pkgconfig()
|
|
|
|
# This license (BSD) is relevant only for library - if someone would want to install
|
|
# FLAC cmd line tools as well additional license (GPL) should be included
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING.Xiph")
|
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|