diff --git a/packages/l/libflac/patches/1.4.2/cmake.patch b/packages/l/libflac/patches/1.4.2/cmake.patch
new file mode 100644
index 000000000..45427beee
--- /dev/null
+++ b/packages/l/libflac/patches/1.4.2/cmake.patch
@@ -0,0 +1,31 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 316a8210..52a87c4a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -184,6 +184,10 @@ include_directories("include")
+ include_directories("${CMAKE_CURRENT_BINARY_DIR}")
+ add_definitions(-DHAVE_CONFIG_H)
+ 
++if(WIN32 AND NOT BUILD_SHARED_LIBS)
++    add_definitions(-DFLAC__NO_DLL)
++endif()
++
+ if(MSVC)
+     add_definitions(
+         -D_CRT_SECURE_NO_WARNINGS
+@@ -194,7 +198,6 @@ if(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
+ endif()
+ 
+ add_subdirectory("src")
+-add_subdirectory("microbench")
+ if(BUILD_DOCS)
+     add_subdirectory("doc")
+ endif()
+@@ -202,6 +205,7 @@ if(BUILD_EXAMPLES)
+     add_subdirectory("examples")
+ endif()
+ if(BUILD_TESTING)
++    add_subdirectory("microbench")
+     add_subdirectory("test")
+ endif()
+ 
diff --git a/packages/l/libflac/xmake.lua b/packages/l/libflac/xmake.lua
index 4d91954ba..0944d480a 100644
--- a/packages/l/libflac/xmake.lua
+++ b/packages/l/libflac/xmake.lua
@@ -1,5 +1,4 @@
 package("libflac")
-
     set_homepage("https://xiph.org/flac")
     set_description("Free Lossless Audio Codec")
     set_license("BSD")
@@ -7,7 +6,9 @@ package("libflac")
     set_urls("https://github.com/xiph/flac/archive/$(version).tar.gz",
              "https://github.com/xiph/flac.git")
 
+    add_versions("1.4.2", "8e8e0406fb9e1d177bb4ba8cfed3ca3935d37144eac8f0219a03e8c1ed5cc18e")
     add_versions("1.3.3", "668cdeab898a7dd43cf84739f7e1f3ed6b35ece2ef9968a5c7079fe9adfe1689")
+    add_patches("1.4.2", path.join(os.scriptdir(), "patches", "1.4.2", "cmake.patch"), "0a99382d5d7bd33078572b6cc3af08ee7e5e3618c80754a5fdc400bd69f4e470")
     add_patches("1.3.3", path.join(os.scriptdir(), "patches", "1.3.3", "cmake.patch"), "49baa40ab70d63e74cfc3f0cc2f13824545a618ceaeffdd51d3333d90b37fd32")
     
     if is_plat("mingw") and is_subhost("msys") then
@@ -42,6 +43,7 @@ package("libflac")
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
         table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
+        table.insert(configs, "-DINSTALL_MANPAGES=OFF")
 
         -- fix, undefined reference to `__memset_chk'
         -- @see https://github.com/msys2/MINGW-packages/issues/5803
@@ -53,7 +55,8 @@ package("libflac")
         local libogg = package:dep("libogg"):fetch()
         if libogg then
             local links = table.concat(table.wrap(libogg.links), " ")
-            io.replace("CMakeLists.txt", "find_package(OGG REQUIRED)", "", {plain = true})
+            io.replace("CMakeLists.txt", "find_package(OGG REQUIRED)", "", {plain = true}) -- v1.3.3
+            io.replace("CMakeLists.txt", "find_package(Ogg REQUIRED)", "", {plain = true}) -- v1.3.4+
             io.replace("src/libFLAC/CMakeLists.txt",
             [[
 if(TARGET Ogg::ogg)