From d2c6a879b9f7a21bd3b06ef52f5f3ccc1fbf87e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Mon, 9 Dec 2024 13:56:54 +0100 Subject: [PATCH 1/6] Use fork for libid3tag --- recipes/libid3tag/all/CMakeLists.txt | 21 ---- recipes/libid3tag/all/conandata.yml | 6 +- recipes/libid3tag/all/conanfile.py | 105 ++++-------------- .../libid3tag/all/test_package/conanfile.py | 10 +- .../libid3tag/all/test_package/test_package.c | 13 ++- 5 files changed, 41 insertions(+), 114 deletions(-) delete mode 100644 recipes/libid3tag/all/CMakeLists.txt diff --git a/recipes/libid3tag/all/CMakeLists.txt b/recipes/libid3tag/all/CMakeLists.txt deleted file mode 100644 index cbee8d19a93e7..0000000000000 --- a/recipes/libid3tag/all/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -cmake_minimum_required(VERSION 3.15) -project(libid3tag LANGUAGES C) - -file(GLOB SOURCES "*.c" "*.h") -add_library(libid3tag ${SOURCES} ${HEADERS}) -target_include_directories(libid3tag PRIVATE msvc++) - -# https://github.com/markjeee/libid3tag/blob/master/msvc%2B%2B/libid3tag.dsp#L43-L44 -target_compile_options(libid3tag PRIVATE /W2 "$<$:/Od;/GZ>" "$<$:/O2>") -target_compile_definitions(libid3tag PRIVATE HAVE_CONFIG_H "$<$:DEBUG;>" "$<$:NDEBUG>") -set_property(TARGET libid3tag PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON) - -find_package(ZLIB REQUIRED CONFIG) -target_link_libraries(libid3tag PRIVATE ZLIB::ZLIB) - -install(TARGETS libid3tag - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin -) -install(FILES id3tag.h DESTINATION include) diff --git a/recipes/libid3tag/all/conandata.yml b/recipes/libid3tag/all/conandata.yml index e1a2be66778cb..a8183f5791725 100644 --- a/recipes/libid3tag/all/conandata.yml +++ b/recipes/libid3tag/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "0.15.1b": - url: "https://downloads.sourceforge.net/project/mad/libid3tag/0.15.1b/libid3tag-0.15.1b.tar.gz" - sha256: 63da4f6e7997278f8a3fef4c6a372d342f705051d1eeb6a46a86b03610e26151 + "0.16.3": + url: "https://codeberg.org/tenacityteam/libid3tag/archive/0.16.3.tar.gz" + sha256: "0561009778513a95d91dac33cee8418d6622f710450a7cb56a74636d53b588cb" diff --git a/recipes/libid3tag/all/conanfile.py b/recipes/libid3tag/all/conanfile.py index 0ec68a73afc05..4fe5d2c1ab542 100644 --- a/recipes/libid3tag/all/conanfile.py +++ b/recipes/libid3tag/all/conanfile.py @@ -1,17 +1,10 @@ import os from conan import ConanFile -from conan.errors import ConanInvalidConfiguration -from conan.tools.apple import fix_apple_shared_install_name, is_apple_os -from conan.tools.build import cross_building from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout -from conan.tools.env import VirtualBuildEnv -from conan.tools.files import chdir, copy, get, rm, replace_in_file -from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps -from conan.tools.layout import basic_layout -from conan.tools.microsoft import is_msvc +from conan.tools.files import copy, get, rmdir -required_conan_version = ">=1.53.0" +required_conan_version = ">=2.4" class LibId3TagConan(ConanFile): @@ -19,7 +12,7 @@ class LibId3TagConan(ConanFile): description = "ID3 tag manipulation library." license = "GPL-2.0-or-later" url = "https://github.com/conan-io/conan-center-index" - homepage = "https://www.underbit.com/products/mad/" + homepage = "https://codeberg.org/tenacityteam/libid3tag/" topics = ("mad", "id3", "MPEG", "audio", "decoder") package_type = "library" @@ -33,96 +26,38 @@ class LibId3TagConan(ConanFile): "fPIC": True, } - def export_sources(self): - copy(self, "CMakeLists.txt", self.recipe_folder, os.path.join(self.export_sources_folder, "src")) - - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC - - def configure(self): - if self.options.shared: - self.options.rm_safe("fPIC") - self.settings.rm_safe("compiler.libcxx") - self.settings.rm_safe("compiler.cppstd") + languages = ["C"] + implements = ["auto_shared_fpic"] def layout(self): - if is_msvc(self): - cmake_layout(self, src_folder="src") - else: - basic_layout(self, src_folder="src") + cmake_layout(self, src_folder="src") def requirements(self): self.requires("zlib/[>=1.2.11 <2]") - def validate_build(self): - if cross_building(self) and is_apple_os(self) and self.options.shared: - # Cannot cross-build due to a very old version of libtool that does not - # correctly propagate `-sysroot` or `-arch` when creating a shared library - raise ConanInvalidConfiguration("Shared library cross-building is not supported on Apple platforms") - - def build_requirements(self): - if not is_msvc(self): - self.tool_requires("gnu-config/cci.20210814") - if self.settings_build.os == "Windows": - self.win_bash = True - if not self.conf.get("tools.microsoft.bash:path", check_type=str): - self.tool_requires("msys2/cci.latest") - def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): - if is_msvc(self): - tc = CMakeToolchain(self) - tc.preprocessor_definitions["ID3TAG_EXPORT"] = "__declspec(dllexport)" if self.options.shared else "" - tc.generate() - deps = CMakeDeps(self) - deps.generate() - else: - venv = VirtualBuildEnv(self) - venv.generate() - tc = AutotoolsToolchain(self) - tc.generate() - deps = AutotoolsDeps(self) - deps.generate() + tc = CMakeToolchain(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - if is_msvc(self): - # https://github.com/markjeee/libid3tag/blob/master/id3tag.h#L355-L358 - replace_in_file(self, os.path.join(self.source_folder, "id3tag.h"), - "extern char", "ID3TAG_EXPORT extern char") - cmake = CMake(self) - cmake.configure() - cmake.build() - else: - for gnu_config in [ - self.conf.get("user.gnu-config:config_guess", check_type=str), - self.conf.get("user.gnu-config:config_sub", check_type=str), - ]: - if gnu_config: - copy(self, os.path.basename(gnu_config), os.path.dirname(gnu_config), self.source_folder) - with chdir(self, self.source_folder): - autotools = Autotools(self) - autotools.configure() - autotools.make() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): for license_file in ["COPYRIGHT", "COPYING", "CREDITS"]: copy(self, license_file, self.source_folder, os.path.join(self.package_folder, "licenses")) - if is_msvc(self): - cmake = CMake(self) - cmake.install() - else: - with chdir(self, self.source_folder): - autotools = Autotools(self) - autotools.install() - rm(self, "*.la", self.package_folder, recursive=True) - fix_apple_shared_install_name(self) + + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - if is_msvc(self): - self.cpp_info.libs = ["libid3tag"] - self.cpp_info.defines.append("ID3TAG_EXPORT=" + ("__declspec(dllimport)" if self.options.shared else "")) - else: - self.cpp_info.libs = ["id3tag"] + self.cpp_info.libs = ["id3tag"] diff --git a/recipes/libid3tag/all/test_package/conanfile.py b/recipes/libid3tag/all/test_package/conanfile.py index ef5d7042163ec..a79daf414be2e 100644 --- a/recipes/libid3tag/all/test_package/conanfile.py +++ b/recipes/libid3tag/all/test_package/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import cmake_layout, CMake +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + generators = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" def requirements(self): @@ -15,6 +15,12 @@ def requirements(self): def layout(self): cmake_layout(self) + def generate(self): + tc = CMakeToolchain(self) + if self.settings.os == "Windows" and self.dependencies[self.tested_reference_str].options.shared: + tc.preprocessor_definitions["CCI_SKIP_GLOBALS"] = 1 + tc.generate() + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/libid3tag/all/test_package/test_package.c b/recipes/libid3tag/all/test_package/test_package.c index ef86650029180..fd7fe74969036 100644 --- a/recipes/libid3tag/all/test_package/test_package.c +++ b/recipes/libid3tag/all/test_package/test_package.c @@ -4,13 +4,20 @@ int main() { - printf("id3tag version: %s\n", id3_version); - printf("id3tag copyright: %s\n", id3_copyright); - printf("id3tag author: %s\n", id3_author); + printf("id3tag version: %s\n", ID3_VERSION); + printf("id3tag author: %s\n", ID3_AUTHOR); + #ifndef CCI_SKIP_GLOBALS + // Ensure extern variables also work. + // This is disabled for shared due to Window + // WINDOWS_EXPORT_ALL_SYMBOLS still needs __declspec usage + // for global data symbols as per CMake docs + // but upstream does not use it printf("id3tag build: %s\n", id3_build); + #endif struct id3_tag tag; id3_tag_version(&tag); + printf("id3tag default tag version: %d\n", tag.version); return 0; } From f1c04d3d187f945176a4f791f8435663b353ef6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Mon, 9 Dec 2024 14:06:51 +0100 Subject: [PATCH 2/6] Further cleanup --- recipes/libid3tag/all/conanfile.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/recipes/libid3tag/all/conanfile.py b/recipes/libid3tag/all/conanfile.py index 4fe5d2c1ab542..1f5b1c9c9ff6d 100644 --- a/recipes/libid3tag/all/conanfile.py +++ b/recipes/libid3tag/all/conanfile.py @@ -14,6 +14,7 @@ class LibId3TagConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://codeberg.org/tenacityteam/libid3tag/" topics = ("mad", "id3", "MPEG", "audio", "decoder") + generators = "CMakeDeps", "CMakeToolchain" package_type = "library" settings = "os", "arch", "compiler", "build_type" @@ -38,12 +39,6 @@ def requirements(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) - def generate(self): - tc = CMakeToolchain(self) - tc.generate() - deps = CMakeDeps(self) - deps.generate() - def build(self): cmake = CMake(self) cmake.configure() From c9e3b9f3dcc5acd6b2a0ea40260faa196f495141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Mon, 9 Dec 2024 14:08:30 +0100 Subject: [PATCH 3/6] Hush the linter --- recipes/libid3tag/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/libid3tag/all/conanfile.py b/recipes/libid3tag/all/conanfile.py index 1f5b1c9c9ff6d..8893776ddf0e6 100644 --- a/recipes/libid3tag/all/conanfile.py +++ b/recipes/libid3tag/all/conanfile.py @@ -1,7 +1,7 @@ import os from conan import ConanFile -from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout +from conan.tools.cmake import CMake, cmake_layout from conan.tools.files import copy, get, rmdir required_conan_version = ">=2.4" From c492c5945bd3a55b5097155dda294e23b903905c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Mon, 9 Dec 2024 14:17:42 +0100 Subject: [PATCH 4/6] update config.yml --- recipes/libid3tag/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/libid3tag/config.yml b/recipes/libid3tag/config.yml index e7028aaa1acf5..aebc28f27ed97 100644 --- a/recipes/libid3tag/config.yml +++ b/recipes/libid3tag/config.yml @@ -1,3 +1,3 @@ versions: - "0.15.1b": + "0.16.3": folder: all From 9aa11bdc3d6e4347a310eaa2cda56497f93a7b55 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 12 Dec 2024 17:05:25 +0100 Subject: [PATCH 5/6] Update recipes/libid3tag/all/conanfile.py Co-authored-by: Martin Valgur --- recipes/libid3tag/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/libid3tag/all/conanfile.py b/recipes/libid3tag/all/conanfile.py index 8893776ddf0e6..3f3beb9e6daea 100644 --- a/recipes/libid3tag/all/conanfile.py +++ b/recipes/libid3tag/all/conanfile.py @@ -13,7 +13,7 @@ class LibId3TagConan(ConanFile): license = "GPL-2.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://codeberg.org/tenacityteam/libid3tag/" - topics = ("mad", "id3", "MPEG", "audio", "decoder") + topics = ("mad", "id3", "mp3", "MPEG", "audio", "decoder") generators = "CMakeDeps", "CMakeToolchain" package_type = "library" From dce42ec9393ed9cb69e0aa73050b5a7083c1634c Mon Sep 17 00:00:00 2001 From: Luis Caro Campos <3535649+jcar87@users.noreply.github.com> Date: Thu, 9 Jan 2025 13:59:41 +0000 Subject: [PATCH 6/6] libid3tag: match upstream target names --- recipes/libid3tag/all/conanfile.py | 10 ++++++++++ recipes/libid3tag/all/test_package/CMakeLists.txt | 4 ++-- recipes/libid3tag/all/test_package/conanfile.py | 2 -- recipes/libid3tag/all/test_package/test_package.c | 11 ----------- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/recipes/libid3tag/all/conanfile.py b/recipes/libid3tag/all/conanfile.py index 3f3beb9e6daea..ecd9d02816275 100644 --- a/recipes/libid3tag/all/conanfile.py +++ b/recipes/libid3tag/all/conanfile.py @@ -3,6 +3,7 @@ from conan import ConanFile from conan.tools.cmake import CMake, cmake_layout from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version required_conan_version = ">=2.4" @@ -56,3 +57,12 @@ def package(self): def package_info(self): self.cpp_info.libs = ["id3tag"] + + if Version(self.version) >= "0.16": + # These are the actual upstream target names + # However older versions of the recipe did not reflect these - + # So ensure only newly published versions use these target names, to prevent breakages + # (consumers still have to update when they move to using a new version) + self.cpp_info.set_property("cmake_file_name", "id3tag") + self.cpp_info.set_property("cmake_target_name", "id3tag::id3tag") + self.cpp_info.set_property("pkg_config_name", "id3tag") diff --git a/recipes/libid3tag/all/test_package/CMakeLists.txt b/recipes/libid3tag/all/test_package/CMakeLists.txt index 5735549609ad1..fb1586277b921 100644 --- a/recipes/libid3tag/all/test_package/CMakeLists.txt +++ b/recipes/libid3tag/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.15) project(test_package C) -find_package(libid3tag REQUIRED CONFIG) +find_package(id3tag REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE libid3tag::libid3tag) +target_link_libraries(${PROJECT_NAME} PRIVATE id3tag::id3tag) diff --git a/recipes/libid3tag/all/test_package/conanfile.py b/recipes/libid3tag/all/test_package/conanfile.py index a79daf414be2e..a804618d0f86f 100644 --- a/recipes/libid3tag/all/test_package/conanfile.py +++ b/recipes/libid3tag/all/test_package/conanfile.py @@ -17,8 +17,6 @@ def layout(self): def generate(self): tc = CMakeToolchain(self) - if self.settings.os == "Windows" and self.dependencies[self.tested_reference_str].options.shared: - tc.preprocessor_definitions["CCI_SKIP_GLOBALS"] = 1 tc.generate() def build(self): diff --git a/recipes/libid3tag/all/test_package/test_package.c b/recipes/libid3tag/all/test_package/test_package.c index fd7fe74969036..7e9688dc0c76f 100644 --- a/recipes/libid3tag/all/test_package/test_package.c +++ b/recipes/libid3tag/all/test_package/test_package.c @@ -4,17 +4,6 @@ int main() { - printf("id3tag version: %s\n", ID3_VERSION); - printf("id3tag author: %s\n", ID3_AUTHOR); - #ifndef CCI_SKIP_GLOBALS - // Ensure extern variables also work. - // This is disabled for shared due to Window - // WINDOWS_EXPORT_ALL_SYMBOLS still needs __declspec usage - // for global data symbols as per CMake docs - // but upstream does not use it - printf("id3tag build: %s\n", id3_build); - #endif - struct id3_tag tag; id3_tag_version(&tag);