diff options
author | Dennis Lamm <expeditioneer@gentoo.org> | 2020-12-16 21:03:31 +0100 |
---|---|---|
committer | Dennis Lamm <expeditioneer@gentoo.org> | 2020-12-16 21:16:06 +0100 |
commit | 4182909b88f655ad63ef80baa2df44964ac4f522 (patch) | |
tree | 5d63992ec8808c549666068b517ba04eb564f822 /dev-libs/miniz | |
parent | x11-libs/c++-gtk-utils: Stabilize 2.2.19 amd64, #758788 (diff) | |
download | gentoo-4182909b88f655ad63ef80baa2df44964ac4f522.tar.gz gentoo-4182909b88f655ad63ef80baa2df44964ac4f522.tar.bz2 gentoo-4182909b88f655ad63ef80baa2df44964ac4f522.zip |
dev-libs/miniz: export cmake build targets
Signed-off-by: Dennis Lamm <expeditioneer@gentoo.org>
Diffstat (limited to 'dev-libs/miniz')
-rw-r--r-- | dev-libs/miniz/files/Config.cmake.in | 1 | ||||
-rw-r--r-- | dev-libs/miniz/files/miniz-2.1.0-export-cmake-build-targets.patch | 179 | ||||
-rw-r--r-- | dev-libs/miniz/files/miniz.pc.in | 13 | ||||
-rw-r--r-- | dev-libs/miniz/miniz-2.1.0-r1.ebuild | 38 | ||||
-rw-r--r-- | dev-libs/miniz/miniz-9999.ebuild | 41 |
5 files changed, 272 insertions, 0 deletions
diff --git a/dev-libs/miniz/files/Config.cmake.in b/dev-libs/miniz/files/Config.cmake.in new file mode 100644 index 000000000000..0865ae961005 --- /dev/null +++ b/dev-libs/miniz/files/Config.cmake.in @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") diff --git a/dev-libs/miniz/files/miniz-2.1.0-export-cmake-build-targets.patch b/dev-libs/miniz/files/miniz-2.1.0-export-cmake-build-targets.patch new file mode 100644 index 000000000000..6f8429222700 --- /dev/null +++ b/dev-libs/miniz/files/miniz-2.1.0-export-cmake-build-targets.patch @@ -0,0 +1,179 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,15 @@ +-PROJECT(miniz C) +-cmake_minimum_required(VERSION 2.8) ++cmake_minimum_required(VERSION 3.12) ++ ++project(miniz) ++ ++include(GNUInstallDirs) ++ ++set(MINIZ_API_VERSION 2) ++set(MINIZ_MINOR_VERSION 1) ++set(MINIZ_PATCH_VERSION 0) ++set(MINIZ_VERSION ++ ${MINIZ_API_VERSION}.${MINIZ_MINOR_VERSION}.${MINIZ_PATCH_VERSION}) ++ + if(CMAKE_BUILD_TYPE STREQUAL "") + # CMake defaults to leaving CMAKE_BUILD_TYPE empty. This screws up + # differentiation between debug and release builds. +@@ -8,45 +18,122 @@ + CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE) + endif () + +-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) ++option(BUILD_EXAMPLES "Build examples" ON) ++option(BUILD_SHARED_LIBS "Build shared library instead of static" ON) ++ ++set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin) + ++include(GenerateExportHeader) ++ ++set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + set(miniz_SOURCE miniz.c miniz_zip.c miniz_tinfl.c miniz_tdef.c) ++add_library(${PROJECT_NAME} ${miniz_SOURCE}) ++generate_export_header(${PROJECT_NAME}) ++ ++if(NOT BUILD_SHARED_LIBS) ++string(TOUPPER ${PROJECT_NAME} PROJECT_UPPER) ++set_target_properties(${PROJECT_NAME} ++ PROPERTIES INTERFACE_COMPILE_DEFINITIONS ${PROJECT_UPPER}_STATIC_DEFINE) ++else() ++set_property(TARGET ${PROJECT_NAME} PROPERTY C_VISIBILITY_PRESET hidden) ++endif() ++ ++set_property(TARGET ${PROJECT_NAME} PROPERTY VERSION ${MINIZ_VERSION}) ++set_property(TARGET ${PROJECT_NAME} PROPERTY SOVERSION ${MINIZ_API_VERSION}) ++ ++file(GLOB INSTALL_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h) ++ ++target_compile_definitions(${PROJECT_NAME} ++ PRIVATE $<$<C_COMPILER_ID:GNU>:_GNU_SOURCE>) + +-add_library(miniz ${miniz_SOURCE}) +-target_include_directories(miniz PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") ++# pkg-config file ++configure_file(miniz.pc.in ${CMAKE_BINARY_DIR}/miniz.pc @ONLY) + +-set(EXAMPLE1_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example1.c") +-set(EXAMPLE2_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example2.c") +-set(EXAMPLE3_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example3.c") +-set(EXAMPLE4_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example4.c") +-set(EXAMPLE5_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example5.c") +-set(EXAMPLE6_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example6.c") +-set(MINIZ_TESTER_SRC_LIST +- "${CMAKE_CURRENT_SOURCE_DIR}/tests/miniz_tester.cpp" +- "${CMAKE_CURRENT_SOURCE_DIR}/tests/timer.cpp") ++install(FILES ++ ${CMAKE_BINARY_DIR}/miniz.pc ++ DESTINATION ${CMAKE_INSTALL_DATADIR}/pkgconfig) ++ ++ ++set_property(TARGET ${PROJECT_NAME} PROPERTY ++ INTERFACE_${PROJECT_NAME}_MAJOR_VERSION ${MINIZ_API_VERSION}) ++set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY ++ COMPATIBLE_INTERFACE_STRING ${PROJECT_NAME}_MAJOR_VERSION ++) ++ ++install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ # users can use <miniz.h> or <miniz/miniz.h> ++ INCLUDES DESTINATION include ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} ++) ++ ++include(CMakePackageConfigHelpers) ++write_basic_package_version_file( ++ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake" ++ VERSION ${MINIZ_VERSION} ++ COMPATIBILITY AnyNewerVersion ++) ++ ++export(EXPORT ${PROJECT_NAME}Targets ++ FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Targets.cmake" ++ NAMESPACE ${PROJECT_NAME}:: ++) ++configure_file(Config.cmake.in ++ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake" ++ @ONLY ++) ++ ++set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) ++install(EXPORT ${PROJECT_NAME}Targets ++ FILE ++ ${PROJECT_NAME}Targets.cmake ++ NAMESPACE ++ ${PROJECT_NAME}:: ++ DESTINATION ++ ${ConfigPackageLocation} ++) ++install( ++ FILES ++ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake" ++ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake" ++ DESTINATION ++ ${ConfigPackageLocation} ++ COMPONENT ++ Devel ++) ++ ++if(BUILD_EXAMPLES) ++ set(EXAMPLE1_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example1.c") ++ set(EXAMPLE2_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example2.c") ++ set(EXAMPLE3_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example3.c") ++ set(EXAMPLE4_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example4.c") ++ set(EXAMPLE5_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example5.c") ++ set(EXAMPLE6_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example6.c") ++ set(MINIZ_TESTER_SRC_LIST ++ "${CMAKE_CURRENT_SOURCE_DIR}/tests/miniz_tester.cpp" ++ "${CMAKE_CURRENT_SOURCE_DIR}/tests/timer.cpp") + +-add_executable(example1 ${EXAMPLE1_SRC_LIST}) +-target_link_libraries(example1 miniz) +-add_executable(example2 ${EXAMPLE2_SRC_LIST}) +-target_link_libraries(example2 miniz) +-add_executable(example3 ${EXAMPLE3_SRC_LIST}) +-target_link_libraries(example3 miniz) +-add_executable(example4 ${EXAMPLE4_SRC_LIST}) +-target_link_libraries(example4 miniz) +-add_executable(example5 ${EXAMPLE5_SRC_LIST}) +-target_link_libraries(example5 miniz) +-add_executable(example6 ${EXAMPLE6_SRC_LIST}) +-target_link_libraries(example6 miniz) +-if(${UNIX}) +- target_link_libraries(example6 m) +-endif() ++ add_executable(example1 ${EXAMPLE1_SRC_LIST}) ++ target_link_libraries(example1 miniz) ++ add_executable(example2 ${EXAMPLE2_SRC_LIST}) ++ target_link_libraries(example2 miniz) ++ add_executable(example3 ${EXAMPLE3_SRC_LIST}) ++ target_link_libraries(example3 miniz) ++ add_executable(example4 ${EXAMPLE4_SRC_LIST}) ++ target_link_libraries(example4 miniz) ++ add_executable(example5 ${EXAMPLE5_SRC_LIST}) ++ target_link_libraries(example5 miniz) ++ add_executable(example6 ${EXAMPLE6_SRC_LIST}) ++ target_link_libraries(example6 miniz) ++ if(${UNIX}) ++ target_link_libraries(example6 m) ++ endif() + +-# add_executable(miniz_tester ${MINIZ_TESTER_SRC_LIST}) +-# target_link_libraries(miniz_tester miniz) ++ # add_executable(miniz_tester ${MINIZ_TESTER_SRC_LIST}) ++ # target_link_libraries(miniz_tester miniz) ++endif(BUILD_EXAMPLES) + +-install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets +- ARCHIVE DESTINATION lib +- LIBRARY DESTINATION lib +- ) +-file(GLOB INSTALL_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h) +-install(FILES ${INSTALL_HEADERS} DESTINATION include/${PROJECT_NAME}) +\ No newline at end of file ++set(INCLUDE_INSTALL_DIR "include") ++ ++install(FILES ${INSTALL_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}) diff --git a/dev-libs/miniz/files/miniz.pc.in b/dev-libs/miniz/files/miniz.pc.in new file mode 100644 index 000000000000..51128735847c --- /dev/null +++ b/dev-libs/miniz/files/miniz.pc.in @@ -0,0 +1,13 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ + +Name: @PROJECT_NAME@ +Description: @PROJECT_DESCRIPTION@ +Version: @MINIZ_VERSION@ +URL: @PROJECT_HOMEPAGE_URL@ + +Requires: +Libs: -L${libdir} -lminiz +Cflags: -I${includedir}
\ No newline at end of file diff --git a/dev-libs/miniz/miniz-2.1.0-r1.ebuild b/dev-libs/miniz/miniz-2.1.0-r1.ebuild new file mode 100644 index 000000000000..cc26fba366c0 --- /dev/null +++ b/dev-libs/miniz/miniz-2.1.0-r1.ebuild @@ -0,0 +1,38 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit cmake + +DESCRIPTION="A lossless, high performance data compression library" +HOMEPAGE="https://github.com/richgel999/miniz" +SRC_URI="https://github.com/richgel999/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +DOCS=( ChangeLog.md LICENSE readme.md ) + +PATCHES=( + "${FILESDIR}/${P}-export-cmake-build-targets.patch" +) + +src_prepare() { + cp "${FILESDIR}/Config.cmake.in" . + cp "${FILESDIR}/miniz.pc.in" . + + cmake_src_prepare +} + +src_configure() { + CMAKE_BUILD_TYPE=Release + + local mycmakeargs=( + -DBUILD_EXAMPLES=OFF + ) + + cmake_src_configure +} diff --git a/dev-libs/miniz/miniz-9999.ebuild b/dev-libs/miniz/miniz-9999.ebuild new file mode 100644 index 000000000000..7bdf95f3cf88 --- /dev/null +++ b/dev-libs/miniz/miniz-9999.ebuild @@ -0,0 +1,41 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit cmake + +DESCRIPTION="A lossless, high performance data compression library" +HOMEPAGE="https://github.com/richgel999/miniz" +SRC_URI="" + +if [[ ${PV} == "9999" ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/richgel999/miniz.git" +else + SRC_URI="https://github.com/richgel999/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64 ~x86" +fi + +LICENSE="MIT" +SLOT="0" +IUSE="examples static-libs" + +DOCS=( ChangeLog.md LICENSE readme.md ) + +src_prepare() { + sed -i -e 's/DESTINATION lib/DESTINATION ${CMAKE_INSTALL_LIBDIR}/' CMakeLists.txt + + cmake_src_prepare +} + +src_configure() { + CMAKE_BUILD_TYPE=Release + + local mycmakeargs=( + -DBUILD_EXAMPLES=$(usex examples) + -DBUILD_SHARED_LIBS=$(usex static-libs OFF ON) + ) + + cmake_src_configure +} |