Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flac: add 1.4.2 #15372

Merged
merged 9 commits into from
Feb 4, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion recipes/flac/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
sources:
"1.4.2":
url: "https://github.com/xiph/flac/releases/download/1.4.2/flac-1.4.2.tar.xz"
sha256: "e322d58a1f48d23d9dd38f432672865f6f79e73a6f9cc5a5f57fcaa83eb5a8e4"
"1.3.3":
url: "https://github.com/xiph/flac/archive/1.3.3.tar.gz"
sha256: "668cdeab898a7dd43cf84739f7e1f3ed6b35ece2ef9968a5c7079fe9adfe1689"
patches:
"1.4.2":
- patch_file: "patches/fix-cmake-1.4.2.patch"
patch_description: "Adapts find_package commands and install destination paths in CMakeLists.txt files."
patch_type: "conan"
"1.3.3":
- patch_file: "patches/fix-cmake.patch"
- patch_file: "patches/fix-cmake-1.3.3.patch"
patch_description: "Various adaptations in CMakeLists.txt files to improve compatibility with Conan."
patch_type: "conan"
36 changes: 21 additions & 15 deletions recipes/flac/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from conan import ConanFile
from conan import ConanFile, conan_version
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, copy, get, rmdir
from conan.tools.scm import Version
import os

required_conan_version = ">=1.47.0"
Expand Down Expand Up @@ -41,7 +42,7 @@ def requirements(self):
self.requires("ogg/1.3.5")

def build_requirements(self):
if self.settings.arch in ["x86", "x86_64"]:
if Version(self.version) < "1.4.2" and self.settings.arch in ["x86", "x86_64"]:
self.tool_requires("nasm/2.15.05")

def layout(self):
Expand All @@ -56,6 +57,8 @@ def generate(self):
tc.variables["BUILD_EXAMPLES"] = False
tc.variables["BUILD_DOCS"] = False
tc.variables["BUILD_TESTING"] = False
# Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840)
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
chausner marked this conversation as resolved.
Show resolved Hide resolved
tc.generate()
cd = CMakeDeps(self)
cd.generate()
Expand All @@ -79,6 +82,8 @@ def package(self):
copy(self, "*.h", src=os.path.join(self.source_folder, "include", "share", "grabbag"),
dst=os.path.join(self.package_folder, "include", "share", "grabbag"), keep_path=False)
rmdir(self, os.path.join(self.package_folder, "share"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "flac")
Expand All @@ -97,16 +102,17 @@ def package_info(self):
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.components["libflac"].system_libs += ["m"]

bin_path = os.path.join(self.package_folder, "bin")
self.output.info("Appending PATH environment variable: {}".format(bin_path))
self.env_info.PATH.append(bin_path)

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
self.cpp_info.filenames["cmake_find_package"] = "flac"
self.cpp_info.filenames["cmake_find_package_multi"] = "flac"
self.cpp_info.names["cmake_find_package"] = "FLAC"
self.cpp_info.names["cmake_find_package_multi"] = "FLAC"
self.cpp_info.components["libflac"].names["cmake_find_package"] = "FLAC"
self.cpp_info.components["libflac"].names["cmake_find_package_multi"] = "FLAC"
self.cpp_info.components["libflac++"].names["cmake_find_package"] = "FLAC++"
self.cpp_info.components["libflac++"].names["cmake_find_package_multi"] = "FLAC++"
# TODO remove once conan v2 is the only support and recipes have been migrated
if Version(conan_version) < "2.0.0-beta":
chausner marked this conversation as resolved.
Show resolved Hide resolved
bin_path = os.path.join(self.package_folder, "bin")
self.output.info("Appending PATH environment variable: {}".format(bin_path))
self.env_info.PATH.append(bin_path)

self.cpp_info.filenames["cmake_find_package"] = "flac"
self.cpp_info.filenames["cmake_find_package_multi"] = "flac"
self.cpp_info.names["cmake_find_package"] = "FLAC"
self.cpp_info.names["cmake_find_package_multi"] = "FLAC"
self.cpp_info.components["libflac"].names["cmake_find_package"] = "FLAC"
self.cpp_info.components["libflac"].names["cmake_find_package_multi"] = "FLAC"
self.cpp_info.components["libflac++"].names["cmake_find_package"] = "FLAC++"
self.cpp_info.components["libflac++"].names["cmake_find_package_multi"] = "FLAC++"
38 changes: 38 additions & 0 deletions recipes/flac/all/patches/fix-cmake-1.4.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,7 +43,7 @@ if(WITH_OGG)
endif()
else()
if(NOT TARGET Ogg::ogg)
- find_package(Ogg REQUIRED)
+ find_package(Ogg REQUIRED CONFIG)
else()
set(OGG_FOUND 1 CACHE INTERNAL "ogg has already been built")
endif()
--- a/src/flac/CMakeLists.txt
+++ b/src/flac/CMakeLists.txt
@@ -21,4 +21,4 @@ target_link_libraries(flacapp
utf8)

install(TARGETS flacapp EXPORT targets
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
+ DESTINATION "${CMAKE_INSTALL_BINDIR}")
--- a/src/metaflac/CMakeLists.txt
+++ b/src/metaflac/CMakeLists.txt
@@ -14,4 +14,4 @@ add_executable(metaflac
target_link_libraries(metaflac FLAC getopt utf8)

install(TARGETS metaflac EXPORT targets
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
+ DESTINATION "${CMAKE_INSTALL_BINDIR}")
--- a/src/share/getopt/CMakeLists.txt
+++ b/src/share/getopt/CMakeLists.txt
@@ -1,8 +1,7 @@
check_include_file("string.h" HAVE_STRING_H)

if(NOT WIN32)
- find_package(Intl)
endif()

add_library(getopt STATIC getopt.c getopt1.c)

2 changes: 2 additions & 0 deletions recipes/flac/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
versions:
"1.4.2":
folder: all
"1.3.3":
folder: all