diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/libflac | |
Diffstat (limited to 'vcpkg/ports/libflac')
| -rw-r--r-- | vcpkg/ports/libflac/android-cmake.diff | 13 | ||||
| -rw-r--r-- | vcpkg/ports/libflac/cmake-project-include.cmake | 0 | ||||
| -rw-r--r-- | vcpkg/ports/libflac/fix-compile-options.patch | 18 | ||||
| -rw-r--r-- | vcpkg/ports/libflac/fix-find-threads.patch | 15 | ||||
| -rw-r--r-- | vcpkg/ports/libflac/portfile.cmake | 81 | ||||
| -rw-r--r-- | vcpkg/ports/libflac/usage | 8 | ||||
| -rw-r--r-- | vcpkg/ports/libflac/vcpkg.json | 37 |
7 files changed, 172 insertions, 0 deletions
diff --git a/vcpkg/ports/libflac/android-cmake.diff b/vcpkg/ports/libflac/android-cmake.diff new file mode 100644 index 0000000..fc69085 --- /dev/null +++ b/vcpkg/ports/libflac/android-cmake.diff @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9396130..11ef59d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -122,7 +122,7 @@ else() + endif() + + +-if(ANDROID AND CMAKE_SYSTEM_VERSION VERSION_LESS 24 AND (CMAKE_SYSTEM_PROCESSOR MATCHES "i686" OR CMAKE_SYSTEM_PROCESSOR MATCHES "armv7-a")) ++if(ANDROID AND ANDROID_NATIVE_API_LEVEL VERSION_LESS "24" AND (CMAKE_SYSTEM_PROCESSOR MATCHES "i686" OR CMAKE_SYSTEM_PROCESSOR MATCHES "armv7-a")) + # fseeko/ftello may link, but it's not usable before Android API 24 on 32-bit Android + # https://android.googlesource.com/platform/bionic/+/main/docs/32-bit-abi.md + message(STATUS "Disabling fseeko/ftello for 32-bit Android before API 24") diff --git a/vcpkg/ports/libflac/cmake-project-include.cmake b/vcpkg/ports/libflac/cmake-project-include.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/vcpkg/ports/libflac/cmake-project-include.cmake diff --git a/vcpkg/ports/libflac/fix-compile-options.patch b/vcpkg/ports/libflac/fix-compile-options.patch new file mode 100644 index 0000000..9d438da --- /dev/null +++ b/vcpkg/ports/libflac/fix-compile-options.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c83dd83..2d1a7e6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -82,9 +82,11 @@ if(HAVE_WERROR_FLAG) + option(ENABLE_WERROR "Enable -Werror in all Makefiles" OFF) + endif() + ++if(MSVC AND NOT WITH_ASM) ++ add_compile_options(/wd4267 /wd4996) ++endif() ++ + add_compile_options( +- $<$<BOOL:${MSVC}>:/wd4267> +- $<$<BOOL:${MSVC}>:/wd4996> + $<$<BOOL:${ENABLE_WERROR}>:-Werror> + $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<BOOL:${HAVE_WEFFCXX_FLAG}>>:-Weffc++> + $<$<AND:$<COMPILE_LANGUAGE:C>,$<BOOL:${HAVE_DECL_AFTER_STMT_FLAG}>>:-Wdeclaration-after-statement>) diff --git a/vcpkg/ports/libflac/fix-find-threads.patch b/vcpkg/ports/libflac/fix-find-threads.patch new file mode 100644 index 0000000..2804a2f --- /dev/null +++ b/vcpkg/ports/libflac/fix-find-threads.patch @@ -0,0 +1,15 @@ +diff --git a/flac-config.cmake.in b/flac-config.cmake.in +index bcafc4c8..dcf299dd 100644 +--- a/flac-config.cmake.in ++++ b/flac-config.cmake.in +@@ -5,6 +5,10 @@ if(NOT TARGET Ogg::ogg) + find_dependency(Ogg) + endif() + ++if (@ENABLE_MULTITHREADING@) ++ find_dependency(Threads) ++endif() ++ + include("${CMAKE_CURRENT_LIST_DIR}/targets.cmake") + + if(TARGET FLAC::FLAC) diff --git a/vcpkg/ports/libflac/portfile.cmake b/vcpkg/ports/libflac/portfile.cmake new file mode 100644 index 0000000..b33e2e1 --- /dev/null +++ b/vcpkg/ports/libflac/portfile.cmake @@ -0,0 +1,81 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO xiph/flac + REF "${VERSION}" + SHA512 c8e119462205cfd8bbe22b0aff112625d3e51ca11de97e4de06a46fb43a0768d7ec9c245b299b09b7aa4d811c6fc7b57856eaa1c217e82cca9b3ad1c0e545cbe + HEAD_REF master + PATCHES + android-cmake.diff + fix-compile-options.patch + fix-find-threads.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 + multithreading ENABLE_MULTITHREADING +) + +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}") diff --git a/vcpkg/ports/libflac/usage b/vcpkg/ports/libflac/usage new file mode 100644 index 0000000..99b4c80 --- /dev/null +++ b/vcpkg/ports/libflac/usage @@ -0,0 +1,8 @@ +The package libflac provides CMake targets: + + find_package(FLAC CONFIG REQUIRED) + target_link_libraries(main PRIVATE FLAC::FLAC) + + # Or use the C++ API + find_package(FLAC CONFIG REQUIRED) + target_link_libraries(main PRIVATE FLAC::FLAC++) diff --git a/vcpkg/ports/libflac/vcpkg.json b/vcpkg/ports/libflac/vcpkg.json new file mode 100644 index 0000000..9c55a31 --- /dev/null +++ b/vcpkg/ports/libflac/vcpkg.json @@ -0,0 +1,37 @@ +{ + "name": "libflac", + "version": "1.5.0", + "description": "Library for manipulating FLAC files", + "homepage": "https://xiph.org/flac/", + "license": "BSD-3-Clause", + "dependencies": [ + "libogg", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + { + "name": "stack-protector", + "platform": "!emscripten" + } + ], + "features": { + "asm": { + "description": "Use any assembly optimization routines", + "supports": "x86" + }, + "multithreading": { + "description": "Enable multithreading if pthreads is available" + }, + "stack-protector": { + "description": "Build with stack smashing protection", + "supports": "!emscripten" + } + } +} |