diff --git a/recipes/audiowaveform/all/conandata.yml b/recipes/audiowaveform/all/conandata.yml new file mode 100644 index 0000000000000..2e2ba28ceca12 --- /dev/null +++ b/recipes/audiowaveform/all/conandata.yml @@ -0,0 +1,15 @@ +sources: + "1.10.1": + url: "https://github.com/bbc/audiowaveform/archive/refs/tags/1.10.1.tar.gz" + sha256: "bd283d84dc84fda84f4090fddde9a5bef924c588dd7bf6acaa8f7b946efb42a4" +patches: + "1.10.1": + - patch_file: "patches/0001-1.10.1_find_packages.patch" + patch_description: "Inject thirdparties from conan" + patch_type: "conan" + - patch_file: "patches/0002-1.10.1_remove_flags.patch" + patch_description: "Remove custom compile flags" + patch_type: "conan" + - patch_file: "patches/0003-1.10.1_remove_documentation.patch" + patch_description: "Remove documenation" + patch_type: "conan" diff --git a/recipes/audiowaveform/all/conanfile.py b/recipes/audiowaveform/all/conanfile.py new file mode 100644 index 0000000000000..4d5e42ee98a02 --- /dev/null +++ b/recipes/audiowaveform/all/conanfile.py @@ -0,0 +1,94 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd, valid_min_cppstd +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc +import os + + +required_conan_version = ">=1.53.0" + + +class AudiowaveformConan(ConanFile): + name = "audiowaveform" + description = "C++ program to generate waveform data and render waveform images from audio files" + license = "GPL-3.0-or-later" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://waveform.prototyping.bbc.co.uk/" + topics = ("audio", "c-plus-plus") + package_type = "application" + settings = "os", "arch", "compiler", "build_type" + + @property + def _min_cppstd(self): + return 11 + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + pass + + def configure(self): + pass + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("libgd/2.3.3") + self.requires("libid3tag/0.15.1b") + self.requires("libmad/0.15.1b") + self.requires("libsndfile/1.2.2") + self.requires("boost/1.85.0") + + def package_id(self): + del self.info.settings.compiler + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} can not be built on Visual Studio and msvc.") + + def build_requirements(self): + pass + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_TESTS"] = False + if not valid_min_cppstd(self, self._min_cppstd): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + rm(self, "Find*.cmake", os.path.join(self.source_folder, "CMake")) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] + + # TODO: Legacy, to be removed on Conan 2.0 + bin_folder = os.path.join(self.package_folder, "bin") + self.env_info.PATH.append(bin_folder) diff --git a/recipes/audiowaveform/all/patches/0001-1.10.1_find_packages.patch b/recipes/audiowaveform/all/patches/0001-1.10.1_find_packages.patch new file mode 100644 index 0000000000000..e4f3afcf4da27 --- /dev/null +++ b/recipes/audiowaveform/all/patches/0001-1.10.1_find_packages.patch @@ -0,0 +1,66 @@ +Use packages that are provided by conan +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -88,40 +88,11 @@ if(BUILD_STATIC) + endif() + endif(BUILD_STATIC) + +-find_package(LibGD REQUIRED) +-if(LIBGD_FOUND) +- message(STATUS "LIBGD_INCLUDE_DIRS='${LIBGD_INCLUDE_DIRS}'") +- message(STATUS "LIBGD_LIBRARIES=${LIBGD_LIBRARIES}") +- include_directories(${LIBGD_INCLUDE_DIRS}) +-endif(LIBGD_FOUND) +- +-find_package(LibSndFile REQUIRED) +-if(LIBSNDFILE_FOUND) +- message(STATUS "LIBSNDFILE_INCLUDE_DIRS='${LIBSNDFILE_INCLUDE_DIRS}'") +- message(STATUS "LIBSNDFILE_LIBRARIES=${LIBSNDFILE_LIBRARIES}") +- include_directories(${LIBSNDFILE_INCLUDE_DIRS}) +-endif(LIBSNDFILE_FOUND) +- +-find_package(LibMad REQUIRED) +-if(LIBMAD_FOUND) +- message(STATUS "LIBMAD_INCLUDE_DIRS='${LIBMAD_INCLUDE_DIRS}'") +- message(STATUS "LIBMAD_LIBRARIES=${LIBMAD_LIBRARIES}") +- include_directories(${LIBMAD_INCLUDE_DIRS}) +-endif(LIBMAD_FOUND) +- +-find_package(LibId3Tag REQUIRED) +-if(LIBID3TAG_FOUND) +- message(STATUS "LIBID3TAG_INCLUDE_DIRS='${LIBID3TAG_INCLUDE_DIRS}'") +- message(STATUS "LIBID3TAG_LIBRARIES=${LIBID3TAG_LIBRARIES}") +- include_directories(${LIBID3TAG_INCLUDE_DIRS}) +-endif(LIBID3TAG_FOUND) +- +-find_package(Boost 1.46.0 COMPONENTS program_options filesystem regex system REQUIRED) +-if(Boost_FOUND) +- message(STATUS "Boost_INCLUDE_DIRS='${Boost_INCLUDE_DIRS}'") +- message(STATUS "Boost_LIBRARIES='${Boost_LIBRARIES}'") +- include_directories(${Boost_INCLUDE_DIRS}) +-endif(Boost_FOUND) ++find_package(libgd REQUIRED CONFIG) ++find_package(SndFile REQUIRED CONFIG) ++find_package(libmad REQUIRED CONFIG) ++find_package(libid3tag REQUIRED CONFIG) ++find_package(Boost COMPONENTS program_options filesystem regex REQUIRED) + + #------------------------------------------------------------------------------- + # +@@ -278,11 +249,11 @@ add_executable(audiowaveform ${SRCS}) + + # Specify libraries to link against. + set(LIBS +- ${LIBSNDFILE_LIBRARIES} +- ${LIBGD_LIBRARIES} +- ${LIBMAD_LIBRARIES} +- ${LIBID3TAG_LIBRARIES} +- ${Boost_LIBRARIES} ++ SndFile::sndfile ++ libgd::libgd ++ libmad::libmad ++ libid3tag::libid3tag ++ Boost::program_options Boost::filesystem Boost::regex + ) + + target_link_libraries(audiowaveform ${LIBS}) diff --git a/recipes/audiowaveform/all/patches/0002-1.10.1_remove_flags.patch b/recipes/audiowaveform/all/patches/0002-1.10.1_remove_flags.patch new file mode 100644 index 0000000000000..ac2bac6bbfe1a --- /dev/null +++ b/recipes/audiowaveform/all/patches/0002-1.10.1_remove_flags.patch @@ -0,0 +1,19 @@ +Remove custom compile flags +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -162,6 +162,7 @@ if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.6.3") + message(FATAL_ERROR "g++ 4.6.3 or later required") + endif() + ++if(0) + if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.7") + set(CMAKE_CXX_FLAGS "-std=c++11") + else() +@@ -178,6 +179,7 @@ if(APPLE AND BUILD_STATIC) + set(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") + endif() ++endif() + + message(STATUS "CMAKE_CXX_COMPILER_VERSION='${CMAKE_CXX_COMPILER_VERSION}'") + message(STATUS "CMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'") diff --git a/recipes/audiowaveform/all/patches/0003-1.10.1_remove_documentation.patch b/recipes/audiowaveform/all/patches/0003-1.10.1_remove_documentation.patch new file mode 100644 index 0000000000000..c8cc66eaa8a38 --- /dev/null +++ b/recipes/audiowaveform/all/patches/0003-1.10.1_remove_documentation.patch @@ -0,0 +1,34 @@ +Remove documentation target +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -314,6 +314,7 @@ endif() + # + #------------------------------------------------------------------------------- + ++if(0) + file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/doc) + + add_custom_command( +@@ -334,6 +335,7 @@ add_custom_target(doc + ) + + add_dependencies(audiowaveform doc) ++endif() + + #------------------------------------------------------------------------------- + # +@@ -347,6 +349,7 @@ message(STATUS "CMAKE_INSTALL_PREFIX='${CMAKE_INSTALL_PREFIX}'") + install(TARGETS audiowaveform DESTINATION bin) + + # Install man pages ++if(0) + install( + FILES ${PROJECT_BINARY_DIR}/doc/audiowaveform.1.gz + DESTINATION share/man/man1 +@@ -356,5 +359,6 @@ install( + FILES ${PROJECT_BINARY_DIR}/doc/audiowaveform.5.gz + DESTINATION share/man/man5 + ) ++endif() + + #------------------------------------------------------------------------------- diff --git a/recipes/audiowaveform/all/test_package/conanfile.py b/recipes/audiowaveform/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5b8eaa02f81b6 --- /dev/null +++ b/recipes/audiowaveform/all/test_package/conanfile.py @@ -0,0 +1,13 @@ +from conan import ConanFile + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def test(self): + self.run("audiowaveform --version") diff --git a/recipes/audiowaveform/config.yml b/recipes/audiowaveform/config.yml new file mode 100644 index 0000000000000..5492c2a9aab5c --- /dev/null +++ b/recipes/audiowaveform/config.yml @@ -0,0 +1,3 @@ +versions: + "1.10.1": + folder: all