Repository: microsoft/vcpkg
Pull request #44940: [libflac] update to 1.5.0
Author: login: abique
Labels: name: category:port-update
description: The issue is with a library, which is requesting update new revision
name: info:needs-maintainer-attention
description: Lets the current 'on rotation' vcpkg maintainer know they need to look at this.
Created: 2025-04-09T16:42:15Z | Merged: 2025-04-11T19:02:46Z

- [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.


Diff:
diff --git a/ports/libflac/android-cmake.diff b/ports/libflac/android-cmake.diff
new file mode 100644
index 00000000000000..fc690854b296c7
--- /dev/null
+++ b/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/ports/libflac/cmake-project-include.cmake b/ports/libflac/cmake-project-include.cmake
new file mode 100644
index 00000000000000..e69de29bb2d1d6
diff --git a/ports/libflac/fix-find-threads.patch b/ports/libflac/fix-find-threads.patch
new file mode 100644
index 00000000000000..2804a2f24991e9
--- /dev/null
+++ b/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/ports/libflac/portfile.cmake b/ports/libflac/portfile.cmake
index 70f0e4fbcffae1..b33e2e1f9ffb6e 100644
--- a/ports/libflac/portfile.cmake
+++ b/ports/libflac/portfile.cmake
@@ -2,10 +2,12 @@ vcpkg_from_github(
     OUT_SOURCE_PATH SOURCE_PATH
     REPO xiph/flac
     REF "${VERSION}"
-    SHA512 3571467a1d557bc03eade2ae9bb1a72fd94a89222e6ad9563078d646aac0b65ed1c3d829fb45dd3a6cdca806f7ba3b6393f0ce6571b43651959acaa1c2106396
+    SHA512 c8e119462205cfd8bbe22b0aff112625d3e51ca11de97e4de06a46fb43a0768d7ec9c245b299b09b7aa4d811c6fc7b57856eaa1c217e82cca9b3ad1c0e545cbe
     HEAD_REF master
     PATCHES
+        android-cmake.diff
         fix-compile-options.patch
+        fix-find-threads.patch
 )
 
 if("asm" IN_LIST FEATURES)
@@ -18,6 +20,7 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
     FEATURES
         asm WITH_ASM
         stack-protector WITH_STACK_PROTECTOR
+        multithreading ENABLE_MULTITHREADING
 )
 
 vcpkg_cmake_configure(
@@ -65,7 +68,7 @@ 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" "")
+        vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/flac.pc" " -lm" "")
     endif()
 endif()
 
diff --git a/ports/libflac/vcpkg.json b/ports/libflac/vcpkg.json
index 1d049c4eee2454..9c55a31de714d1 100644
--- a/ports/libflac/vcpkg.json
+++ b/ports/libflac/vcpkg.json
@@ -1,7 +1,6 @@
 {
   "name": "libflac",
-  "version": "1.4.3",
-  "port-version": 2,
+  "version": "1.5.0",
   "description": "Library for manipulating FLAC files",
   "homepage": "https://xiph.org/flac/",
   "license": "BSD-3-Clause",
@@ -27,6 +26,9 @@
       "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"
diff --git a/versions/baseline.json b/versions/baseline.json
index fa6ebb61535d5c..b3245a895eedd5 100644
--- a/versions/baseline.json
+++ b/versions/baseline.json
@@ -4649,8 +4649,8 @@
       "port-version": 1
     },
     "libflac": {
-      "baseline": "1.4.3",
-      "port-version": 2
+      "baseline": "1.5.0",
+      "port-version": 0
     },
     "libfontenc": {
       "baseline": "1.1.4",
diff --git a/versions/l-/libflac.json b/versions/l-/libflac.json
index 0a6a5e812834a6..b8595faf957521 100644
--- a/versions/l-/libflac.json
+++ b/versions/l-/libflac.json
@@ -1,5 +1,10 @@
 {
   "versions": [
+    {
+      "git-tree": "1b83f01536820e062681fe33109e44bb3f597aca",
+      "version": "1.5.0",
+      "port-version": 0
+    },
     {
       "git-tree": "a92a3397dfb70e6eec94fab7b3665a1288d9f7bd",
       "version": "1.4.3",


Reviews:
user: login: LilyWangLL
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-11T06:06:20Z
user: login: abique
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-11T07:20:01Z
user: login: LilyWangLL
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-11T08:28:02Z
user: login: BillyONeal
body: Please submit these fixes upstream https://github.com/xiph/flac/ . (I took this outside of our usual 'upstream needs 30 days to OK the changes' given that they are small build system fixes that don't otherwise touch product code)

Thanks for the update! Thanks for the Android fix @dg0yt !
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-11T19:02:39Z

Review comments:
diff_hunk: @@ -65,7 +68,7 @@ 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" "")
+        vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/flac.pc" " -lm" "")
path: ports/libflac/portfile.cmake
user: login: LilyWangLL
body: ```suggestion
       vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/flac.pc" " -lm" "")
```
created_at: 2025-04-11T06:05:54Z
author_association: CONTRIBUTOR
diff_hunk: @@ -65,7 +68,7 @@ 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" "")
+        vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/flac.pc" " -lm" "")
path: ports/libflac/portfile.cmake
user: login: LilyWangLL
body: Here's codes have nothing change.
created_at: 2025-04-11T06:06:14Z
author_association: CONTRIBUTOR
diff_hunk: @@ -65,7 +68,7 @@ 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" "")
+        vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/flac.pc" " -lm" "")
path: ports/libflac/portfile.cmake
user: login: abique
body: Zed did fix automatically the indentation.
Why not keep it?
created_at: 2025-04-11T07:20:01Z
author_association: CONTRIBUTOR

PR comments:
user: login: BillyONeal
created_at: 2025-04-09T18:10:14Z
body: The build failures look legitimate:

```console
[1/2] "/vcpkg/downloads/tools/cmake-3.30.1-linux/cmake-3.30.1-linux-x86_64/bin/cmake" -E chdir ".." "/vcpkg/downloads/tools/cmake-3.30.1-linux/cmake-3.30.1-linux-x86_64/bin/cmake" "/mnt/vcpkg-ci/b/fxaudio/src/1.0.0-ac10fcbd08.clean" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=/mnt/vcpkg-ci/p/fxaudio_x64-linux" "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" "-DCMAKE_MAKE_PROGRAM=/vcpkg/downloads/tools/ninja-1.12.1-linux/ninja" "-DCMAKE_SYSTEM_NAME=Linux" "-DBUILD_SHARED_LIBS=OFF" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/vcpkg/scripts/toolchains/linux.cmake" "-DVCPKG_TARGET_TRIPLET=x64-linux" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=external" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=dynamic" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=/vcpkg" "-D_VCPKG_INSTALLED_DIR=/mnt/vcpkg-ci/installed" "-DVCPKG_MANIFEST_INSTALL=OFF"
FAILED: ../CMakeCache.txt 
"/vcpkg/downloads/tools/cmake-3.30.1-linux/cmake-3.30.1-linux-x86_64/bin/cmake" -E chdir ".." "/vcpkg/downloads/tools/cmake-3.30.1-linux/cmake-3.30.1-linux-x86_64/bin/cmake" "/mnt/vcpkg-ci/b/fxaudio/src/1.0.0-ac10fcbd08.clean" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=/mnt/vcpkg-ci/p/fxaudio_x64-linux" "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" "-DCMAKE_MAKE_PROGRAM=/vcpkg/downloads/tools/ninja-1.12.1-linux/ninja" "-DCMAKE_SYSTEM_NAME=Linux" "-DBUILD_SHARED_LIBS=OFF" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/vcpkg/scripts/toolchains/linux.cmake" "-DVCPKG_TARGET_TRIPLET=x64-linux" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=external" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=dynamic" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=/vcpkg" "-D_VCPKG_INSTALLED_DIR=/mnt/vcpkg-ci/installed" "-DVCPKG_MANIFEST_INSTALL=OFF"
-- The CXX compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- FXAUDIO Headers will be installed to: include
-- Configuring done (0.2s)
CMake Error at /mnt/vcpkg-ci/installed/x64-linux/share/FLAC/targets.cmake:60 (set_target_properties):
  The link interface of target "FLAC::FLAC" contains:

    Threads::Threads

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /mnt/vcpkg-ci/installed/x64-linux/share/FLAC/flac-config.cmake:32 (include)
  /vcpkg/scripts/buildsystems/vcpkg.cmake:893 (_find_package)
  /vcpkg/downloads/tools/cmake-3.30.1-linux/cmake-3.30.1-linux-x86_64/share/cmake-3.30/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
  /mnt/vcpkg-ci/installed/x64-linux/share/SndFile/SndFileConfig.cmake:44 (find_dependency)
  /vcpkg/scripts/buildsystems/vcpkg.cmake:893 (_find_package)
  CMakeLists.txt:19 (find_package)
```

Someone is missing a `find_dependency` call.
author_association: MEMBER
user: login: abique
created_at: 2025-04-09T21:09:13Z
body: This is a weird one, I've no idea where this is coming from? :thinking: 
author_association: CONTRIBUTOR
user: login: BillyONeal
created_at: 2025-04-09T21:23:17Z
body: > This is a weird one, I've no idea where this is coming from? 🤔

https://github.com/xiph/flac/commit/8c41e7f62e6ac81101335ca7b96fb8a7ec7792d3 is where `Threads::Threads` came from. 

I'm guessing we just need a patch to `flac-config.cmake.in` which adds

```cmake
if (@ENABLE_MULTITHREADING@)
    find_dependency(Threads)
endif()
```
author_association: MEMBER
user: login: abique
created_at: 2025-04-10T12:06:04Z
body: Android failed because:
```
/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=armv7-none-linux-androideabi28 --sysroot=/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/sysroot -DFLAC__OVERFLOW_DETECT -DHAVE_CONFIG_H -D_DARWIN_C_SOURCE -D_FORTIFY_SOURCE=2 -D_POSIX_PTHREAD_SEMANTICS -D_TANDEM_SOURCE -D__STDC_WANT_IEC_60559_BFP_EXT__ -D__STDC_WANT_IEC_60559_DFP_EXT__ -D__STDC_WANT_IEC_60559_FUNCS_EXT__ -D__STDC_WANT_IEC_60559_TYPES_EXT__ -D__STDC_WANT_LIB_EXT2__ -D__STDC_WANT_MATH_SPEC_FUNCS__ -I/mnt/vcpkg-ci/b/libflac/src/1.5.0-8e269c796c.clean/include -I/mnt/vcpkg-ci/b/libflac/arm-neon-android-dbg -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Winline -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -fPIC   -fno-limit-debug-info    -fPIC -Wdeclaration-after-statement -fstack-protector-strong -MD -MT src/share/getopt/CMakeFiles/getopt.dir/getopt.c.o -MF src/share/getopt/CMakeFiles/getopt.dir/getopt.c.o.d -o src/share/getopt/CMakeFiles/getopt.dir/getopt.c.o -c /mnt/vcpkg-ci/b/libflac/src/1.5.0-8e269c796c.clean/src/share/getopt/getopt.c
In file included from /mnt/vcpkg-ci/b/libflac/src/1.5.0-8e269c796c.clean/src/share/getopt/getopt.c:58:
/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/stdio.h:216:5: error: conflicting types for 'fseek'
  216 | int fseeko(FILE* _Nonnull __fp, off_t __offset, int __whence) __RENAME(fseeko64) __INTRODUCED_IN(24);
      |     ^
/mnt/vcpkg-ci/b/libflac/src/1.5.0-8e269c796c.clean/include/share/compat.h:67:16: note: expanded from macro 'fseeko'
   67 | #define fseeko fseek
      |                ^
/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/stdio.h:207:5: note: previous declaration is here
  207 | int fseek(FILE* _Nonnull __fp, long __offset, int __whence);
      |     ^
/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/stdio.h:217:7: error: conflicting types for 'ftell'
  217 | off_t ftello(FILE* _Nonnull __fp) __RENAME(ftello64) __INTRODUCED_IN(24);
      |       ^
/mnt/vcpkg-ci/b/libflac/src/1.5.0-8e269c796c.clean/include/share/compat.h:68:16: note: expanded from macro 'ftello'
   68 | #define ftello ftell
      |                ^
/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/stdio.h:208:6: note: previous declaration is here
  208 | long ftell(FILE* _Nonnull __fp);
      |      ^
2 errors generated.
```

Is it a problem in the android toolchain?
author_association: CONTRIBUTOR
user: login: dg0yt
created_at: 2025-04-10T16:28:05Z
body: > Is it a problem in the android toolchain?

The recommended NDK toolchain (aka "legacy") sets CMAKE_SYSTEM_VERSION to 1, so libflac's approach to determine ftello absence is flawed even with vcpkg passing value 28 in.

https://android.googlesource.com/platform/ndk/+/refs/heads/main/build/cmake/android-legacy.toolchain.cmake#38

Patch: https://github.com/abique/vcpkg/pull/2



author_association: CONTRIBUTOR
user: login: abique
created_at: 2025-04-11T19:03:55Z
body: Thank you :+1: 
author_association: CONTRIBUTOR