diff --git a/recipes/minimp3/all/conandata.yml b/recipes/minimp3/all/conandata.yml new file mode 100644 index 0000000000000..f89f24964d012 --- /dev/null +++ b/recipes/minimp3/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "20200221": + url: "https://github.com/lieff/minimp3/archive/9229f280ad475a434d7592255dc01534db65504f.zip" + sha256: "263dd1b9538780ae5489dddb4ab0397aa2d2c6ea7783bef4c7a0aad9555569ec" diff --git a/recipes/minimp3/all/conanfile.py b/recipes/minimp3/all/conanfile.py new file mode 100644 index 0000000000000..00c849aad8802 --- /dev/null +++ b/recipes/minimp3/all/conanfile.py @@ -0,0 +1,29 @@ +import os + +from conans import ConanFile, tools + +class Minimp3Conan(ConanFile): + name = "minimp3" + description = "Minimalistic MP3 decoder single header library." + license = "CC0-1.0" + topics = ("conan", "minimp3", "decoder", "mp3", "header-only") + homepage = "https://github.com/lieff/minimp3" + url = "https://github.com/conan-io/conan-center-index" + no_copy_source = True + + @property + def _source_subfolder(self): + return "source_subfolder" + + def source(self): + tools.get(**self.conan_data["sources"][self.version]) + url = self.conan_data["sources"][self.version]["url"] + extracted_dir = "minimp3-" + os.path.splitext(os.path.basename(url))[0] + os.rename(extracted_dir, self._source_subfolder) + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + self.copy(pattern="minimp3*.h", dst="include", src=self._source_subfolder) + + def package_id(self): + self.info.header_only() diff --git a/recipes/minimp3/all/test_package/CMakeLists.txt b/recipes/minimp3/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..8f49103f0066e --- /dev/null +++ b/recipes/minimp3/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 2.8.11) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/minimp3/all/test_package/conanfile.py b/recipes/minimp3/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ea57a464900be --- /dev/null +++ b/recipes/minimp3/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +import os + +from conans import ConanFile, CMake, tools + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/minimp3/all/test_package/test_package.c b/recipes/minimp3/all/test_package/test_package.c new file mode 100644 index 0000000000000..a2ef95cb2f369 --- /dev/null +++ b/recipes/minimp3/all/test_package/test_package.c @@ -0,0 +1,9 @@ +#define MINIMP3_IMPLEMENTATION +#include + +int main() { + static mp3dec_t mp3d; + mp3dec_init(&mp3d); + + return 0; +} diff --git a/recipes/minimp3/config.yml b/recipes/minimp3/config.yml new file mode 100644 index 0000000000000..3f89667d90237 --- /dev/null +++ b/recipes/minimp3/config.yml @@ -0,0 +1,3 @@ +versions: + "20200221": + folder: all