From b4494814398f11f4c9a5dd0c291a7f2481bf71fe Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Wed, 3 Aug 2022 07:20:26 +0400 Subject: [PATCH] Improved OpenVINO debian packages (#12385) --- .../frontends/frontends.cmake | 8 +- .../ncc_naming_style/ncc_naming_style.cmake | 36 +-- cmake/developer_package/packaging/changelog | 17 ++ cmake/developer_package/packaging/copyright | 31 +++ .../developer_package/packaging/debian.cmake | 120 ++++++++-- .../packaging/packaging.cmake | 7 +- cmake/packaging/debian.cmake | 206 +++++++++++------- samples/CMakeLists.txt | 8 +- src/bindings/c/ov/src/CMakeLists.txt | 11 +- src/bindings/c/src/CMakeLists.txt | 12 +- thirdparty/CMakeLists.txt | 4 - 11 files changed, 328 insertions(+), 132 deletions(-) create mode 100644 cmake/developer_package/packaging/changelog create mode 100644 cmake/developer_package/packaging/copyright diff --git a/cmake/developer_package/frontends/frontends.cmake b/cmake/developer_package/frontends/frontends.cmake index 51a0c834d3e..6e123ca2f88 100644 --- a/cmake/developer_package/frontends/frontends.cmake +++ b/cmake/developer_package/frontends/frontends.cmake @@ -198,9 +198,11 @@ macro(ov_add_frontend) target_link_libraries(${TARGET_NAME} PRIVATE ${OV_FRONTEND_LINK_LIBRARIES}) # TODO: define proper library version, currently SOVERSION 2022 - # set_target_properties(${TARGET_NAME} PROPERTIES - # SOVERSION ${OpenVINO_VERSION_MAJOR} - # VERSION ${OpenVINO_VERSION}) + if(CPACK_GENERATOR STREQUAL "DEB") + set_target_properties(${TARGET_NAME} PROPERTIES + SOVERSION ${OpenVINO_VERSION_MAJOR} + VERSION ${OpenVINO_VERSION}) + endif() # WA for TF frontends which always require protobuf (not protobuf-lite) # if TF FE is built in static mode, use protobuf for all other FEs diff --git a/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake b/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake index c2da0f5a732..a6133c22099 100644 --- a/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake +++ b/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake @@ -9,24 +9,26 @@ endif() set(ncc_style_dir "${IEDevScripts_DIR}/ncc_naming_style") set(ncc_style_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/ncc_naming_style") -# try to find_package(Clang QUIET) -# ClangConfig.cmake contains bug that if libclang-XX-dev is not -# installed, then find_package fails with errors even in QUIET mode -configure_file("${ncc_style_dir}/try_find_clang.cmake" - "${ncc_style_bin_dir}/source/CMakeLists.txt" COPYONLY) -execute_process( - COMMAND - "${CMAKE_COMMAND}" -S "${ncc_style_bin_dir}/source" - -B "${ncc_style_bin_dir}/build" - RESULT_VARIABLE clang_find_result - OUTPUT_VARIABLE output_var - ERROR_VARIABLE error_var) +if(ENABLE_NCC_STYLE) + # try to find_package(Clang QUIET) + # ClangConfig.cmake contains bug that if libclang-XX-dev is not + # installed, then find_package fails with errors even in QUIET mode + configure_file("${ncc_style_dir}/try_find_clang.cmake" + "${ncc_style_bin_dir}/source/CMakeLists.txt" COPYONLY) + execute_process( + COMMAND + "${CMAKE_COMMAND}" -S "${ncc_style_bin_dir}/source" + -B "${ncc_style_bin_dir}/build" + RESULT_VARIABLE clang_find_result + OUTPUT_VARIABLE output_var + ERROR_VARIABLE error_var) -if(NOT clang_find_result EQUAL "0") - message(WARNING "Please, install clang-[N] libclang-[N]-dev package (required for ncc naming style check)") - message(WARNING "find_package(Clang) output: ${output_var}") - message(WARNING "find_package(Clang) error: ${error_var}") - set(ENABLE_NCC_STYLE OFF) + if(NOT clang_find_result EQUAL "0") + message(WARNING "Please, install clang-[N] libclang-[N]-dev package (required for ncc naming style check)") + message(WARNING "find_package(Clang) output: ${output_var}") + message(WARNING "find_package(Clang) error: ${error_var}") + set(ENABLE_NCC_STYLE OFF) + endif() endif() # Since we were able to find_package(Clang) in a separate process diff --git a/cmake/developer_package/packaging/changelog b/cmake/developer_package/packaging/changelog new file mode 100644 index 00000000000..cf01c3b7a6d --- /dev/null +++ b/cmake/developer_package/packaging/changelog @@ -0,0 +1,17 @@ +openvino (2022.2.0) unstable; urgency=low + + [Ilya Lavrenov] + * Implemented Debian packages support + * Support of Ubuntu 22.04 + * Support of python 3.10 + * Introduced OpenVINO Runtime 2.0 C API + + -- OpenVINO Developers Thu, 28 Jul 2022 04:17:51 +0800 + +openvino (2022.1.0) unstable; urgency=low + + [Ilya Lavrenov] + * Implemented OpenVINO 2.0 Runtime API for both C++ and Python + * Introduced IR v11 which is aligned with frameworks model format + + -- OpenVINO Developers Thu, 22 Mar 2022 04:12:56 +0800 \ No newline at end of file diff --git a/cmake/developer_package/packaging/copyright b/cmake/developer_package/packaging/copyright new file mode 100644 index 00000000000..0fed50a1be2 --- /dev/null +++ b/cmake/developer_package/packaging/copyright @@ -0,0 +1,31 @@ +This package was debianized by OpenVINO Developers on +Wed, 16 Aug 2006 19:17:30 +0100. + +Copyright: + + deb822.py is Copyright (C) 2005-2006 dann frazier + 2006 John Wright + + changelog.py, setup.py, README.Changelog and the contents of + examples/changelog/ are + Copyright (C) 2006-7 James Westby + Copyright (C) 2008 Canonical Ltd. + + debian_support.py is Copyright (C) 2005 Florian Weimer + + Debtags.py, and the contents of examples/debtags/ are + Copyright (C) 2003--3006 Enrico Zini + + debfile.py, arfile.py, and examples/debfile/* are + Copyright (C) 2007 Stefano Zacchiroli + 2007 Filippo Giunchedi + +Licenses: + + The following modules are released under GPL v2 or above: + changelog.py, debian_support.py, deb822.py + The following modules are released under GPL v3 or above: + debfile.py, arfile.py, debtags.py + +On Debian systems, the complete text of the Apache 2.0 License +can be found in `/usr/share/common-licenses/Apache-2.0'. \ No newline at end of file diff --git a/cmake/developer_package/packaging/debian.cmake b/cmake/developer_package/packaging/debian.cmake index f8849c807b4..face58206bf 100644 --- a/cmake/developer_package/packaging/debian.cmake +++ b/cmake/developer_package/packaging/debian.cmake @@ -55,7 +55,7 @@ macro(ov_override_component_names) # merge all C / C++ samples as a single samples component set(OV_CPACK_COMP_CPP_SAMPLES "samples") set(OV_CPACK_COMP_C_SAMPLES "${OV_CPACK_COMP_CPP_SAMPLES}") - set(OV_CPACK_COMP_PYTHON_SAMPLES "${OV_CPACK_COMP_CPP_SAMPLES}") + # set(OV_CPACK_COMP_PYTHON_SAMPLES "${OV_CPACK_COMP_CPP_SAMPLES}") # move requirements.txt to core-dev set(OV_CPACK_COMP_DEV_REQ_FILES "${OV_CPACK_COMP_CORE_DEV}") # move core_tools to core-dev @@ -101,6 +101,8 @@ macro(ov_debian_specific_settings) set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY "=") # naming convention for debian package files set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") + # need to update this version once we rebuild the same package with additional fixes + # set(CPACK_DEBIAN_PACKAGE_RELEASE "1") endmacro() ov_debian_specific_settings() @@ -108,10 +110,10 @@ ov_debian_specific_settings() # needed to override cmake auto generated files set(def_postinst "${OpenVINO_BINARY_DIR}/_CPack_Packages/postinst") set(def_postrm "${OpenVINO_BINARY_DIR}/_CPack_Packages/postrm") -set(def_triggers "${OpenVINO_BINARY_DIR}/_CPack_Packages/triggers/${package_name}/triggers") +set(def_triggers "${OpenVINO_BINARY_DIR}/_CPack_Packages/triggers") set(triggers_content "activate-noawait ldconfig\n\n") -set(post_content "#!/bin/sh\n\nset -e\n\n") +set(post_content "#!/bin/sh\n\nset -e;\nset -e\n\n") file(REMOVE ${def_postinst} ${def_postrm} ${def_triggers}) file(WRITE "${def_postinst}" "${post_content}") @@ -123,18 +125,59 @@ file(WRITE "${def_triggers}" "${triggers_content}") # # -# ov_add_lintian_suppression( ) +# ov_debian_add_changelog_and_copyright() # -function(ov_add_lintian_suppression comp) +function(ov_debian_add_changelog_and_copyright comp) + string(TOUPPER "${comp}" ucomp) + if(NOT DEFINED CPACK_DEBIAN_${ucomp}_PACKAGE_NAME) + message(FATAL_ERROR "CPACK_DEBIAN_${ucomp}_PACKAGE_NAME is not defined") + else() + set(package_name "${CPACK_DEBIAN_${ucomp}_PACKAGE_NAME}") + endif() + set(package_name "${CPACK_DEBIAN_${ucomp}_PACKAGE_NAME}") + + # copyright + + install(FILES "${OpenVINO_SOURCE_DIR}/cmake/developer_package/packaging/copyright" + DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/${package_name}/ + COMPONENT ${comp}) + + # create changelog.gz + + find_host_program(gzip_PROGRAM NAMES gzip DOC "Path to gzip tool") + if(NOT gzip_PROGRAM) + message(FATAL_ERROR "Failed to find gzip tool") + endif() + + set(changelog_src "${OpenVINO_SOURCE_DIR}/cmake/developer_package/packaging/changelog") + set(package_bin_dir "${OpenVINO_BINARY_DIR}/_CPack_Packages/${package_name}") + set(changelog_output "${package_bin_dir}/changelog") + + file(REMOVE "${changelog_output}") + file(REMOVE "${changelog_output}.gz") + + file(MAKE_DIRECTORY "${package_bin_dir}") + configure_file("${changelog_src}" "${changelog_output}" COPYONLY) + + execute_process(COMMAND gzip -n -9 "${changelog_output}" + WORKING_DIRECTORY "${package_bin_dir}" + OUTPUT_VARIABLE output_message + ERROR_VARIABLE error_message + RESULT_VARIABLE exit_code + OUTPUT_STRIP_TRAILING_WHITESPACE) + + # install changelog.gz + + install(FILES "${changelog_output}.gz" + DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/${package_name}/ + COMPONENT ${comp}) +endfunction() + +# +# ov_debian_add_lintian_suppression( ) +# +function(ov_debian_add_lintian_suppression comp) set(lines ${ARGN}) - list(APPEND lines "copyright-file-contains-full-apache-2-license") - list(APPEND lines "copyright-should-refer-to-common-license-file-for-apache-2") - list(APPEND lines "copyright-without-copyright-notice") - # TODO: fix - list(APPEND lines "changelog-file-missing-in-native-package") - # TODO: remove them - list(APPEND lines "maintainer-script-empty postinst") - list(APPEND lines "maintainer-script-empty postrm") string(TOUPPER "${comp}" ucomp) if(NOT DEFINED CPACK_DEBIAN_${ucomp}_PACKAGE_NAME) @@ -155,34 +198,69 @@ function(ov_add_lintian_suppression comp) set(lintian_override_file "${OpenVINO_BINARY_DIR}/_CPack_Packages/lintian/${package_name}") file(REMOVE ${lintian_override_file}) file(WRITE ${lintian_override_file} ${content}) + install(FILES ${lintian_override_file} DESTINATION ${CMAKE_INSTALL_DATADIR}/lintian/overrides/ COMPONENT ${comp}) endfunction() # -# ov_add_latest_component() +# ov_debian_generate_conflicts() +# +function(ov_debian_generate_conflicts comp) + set(versions ${ARGN}) + string(TOUPPER "${comp}" ucomp) + + # sanity check + if(NOT DEFINED CPACK_DEBIAN_${ucomp}_PACKAGE_NAME) + message(FATAL_ERROR "CPACK_DEBIAN_${ucomp}_PACKAGE_NAME is not defined") + else() + if(NOT DEFINED CPACK_PACKAGE_VERSION) + message(FATAL_ERROR "CPACK_PACKAGE_VERSION is not defined") + endif() + + string(REPLACE "${CPACK_PACKAGE_VERSION}" "" package_name_base "${CPACK_DEBIAN_${ucomp}_PACKAGE_NAME}") + endif() + + foreach(version IN LISTS versions) + if(package_names) + set(package_names "${package_names}, ${package_name_base}${version}") + else() + set(package_names "${package_name_base}${version}") + endif() + endforeach() + + set(CPACK_DEBIAN_${ucomp}_PACKAGE_CONFLICTS "${package_names}" PARENT_SCOPE) +endfunction() + +# +# ov_debian_add_latest_component() # # Adds latest component for `comp`, but without a version # Description and other stuff (arch) is taken from the main component # -macro(ov_add_latest_component comp) +macro(ov_debian_add_latest_component comp) string(TOUPPER "${comp}" ucomp) - set(latest "${ucomp}_LATEST") + set(comp_name "${comp}_latest") + set(upper_case "${ucomp}_LATEST") - set(CPACK_COMPONENT_${latest}_DESCRIPTION "${CPACK_COMPONENT_${ucomp}_DESCRIPTION}") - set(CPACK_COMPONENT_${latest}_ARCHITECTURE "${CPACK_COMPONENT_${ucomp}_ARCHITECTURE}") - set(CPACK_COMPONENT_${latest}_DEPENDS "${ucomp}") + set(CPACK_COMPONENT_${upper_case}_DESCRIPTION "${CPACK_COMPONENT_${ucomp}_DESCRIPTION}") + set(CPACK_COMPONENT_${upper_case}_ARCHITECTURE "${CPACK_COMPONENT_${ucomp}_ARCHITECTURE}") + set(CPACK_COMPONENT_${upper_case}_DEPENDS "${ucomp}") # take package name if(DEFINED CPACK_DEBIAN_${ucomp}_PACKAGE_NAME) string(REPLACE "-${cpack_ver_mm}" "" - CPACK_DEBIAN_${latest}_PACKAGE_NAME + CPACK_DEBIAN_${upper_case}_PACKAGE_NAME "${CPACK_DEBIAN_${ucomp}_PACKAGE_NAME}") else() message(FATAL_ERROR "CPACK_DEBIAN_${ucomp}_PACKAGE_NAME is not defined") endif() + ov_debian_add_lintian_suppression(${comp_name} + # it's umbrella package + "empty-binary-package") + # add latest to a list of debian packages - list(APPEND CPACK_COMPONENTS_ALL ${latest}) + list(APPEND CPACK_COMPONENTS_ALL ${comp_name}) endmacro() diff --git a/cmake/developer_package/packaging/packaging.cmake b/cmake/developer_package/packaging/packaging.cmake index dfe8d1e9f07..39265f9f73e 100644 --- a/cmake/developer_package/packaging/packaging.cmake +++ b/cmake/developer_package/packaging/packaging.cmake @@ -134,17 +134,16 @@ macro(ie_cpack) set(CPACK_PACKAGE_CONTACT "OpenVINO Developers ") set(CPACK_VERBATIM_VARIABLES ON) set(CPACK_COMPONENTS_ALL ${ARGN}) - # TODO: set proper license file + # TODO: set proper license file for Windows installer set(CPACK_RESOURCE_FILE_LICENSE "${OpenVINO_SOURCE_DIR}/LICENSE") - # TODO: check whether we need it # default permissions for directories creation set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE + GROUP_READ GROUP_EXECUTE OWNER_EXECUTE WORLD_READ WORLD_EXECUTE) - # archive operations can be run in parallels since CMake 3.20 + # archive operations can be run in parallel since CMake 3.20 set(CPACK_THREADS 8) if(NOT DEFINED CPACK_STRIP_FILES) diff --git a/cmake/packaging/debian.cmake b/cmake/packaging/debian.cmake index 0f3727fd4d3..78af23c9885 100644 --- a/cmake/packaging/debian.cmake +++ b/cmake/packaging/debian.cmake @@ -6,6 +6,35 @@ # OpenVINO Core components including frontends, plugins, etc # +function(_ov_add_plugin comp is_pseudo) + string(TOUPPER "${comp}" ucomp) + if(NOT DEFINED CPACK_DEBIAN_${ucomp}_PACKAGE_NAME) + message(FATAL_ERROR "CPACK_DEBIAN_${ucomp}_PACKAGE_NAME is not defined") + else() + set(package_name "${CPACK_DEBIAN_${ucomp}_PACKAGE_NAME}") + endif() + + if(is_pseudo) + if(pseudo_plugins_recommends) + set(pseudo_plugins_recommends "${pseudo_plugins_recommends}, ${package_name} (= ${CPACK_PACKAGE_VERSION})") + else() + set(pseudo_plugins_recommends "${package_name} (= ${CPACK_PACKAGE_VERSION})") + endif() + endif() + + if(all_plugins_suggest) + set(all_plugins_suggest "${all_plugins_suggest}, ${package_name} (= ${CPACK_PACKAGE_VERSION})") + else() + set(all_plugins_suggest "${package_name} (= ${CPACK_PACKAGE_VERSION})") + endif() + + list(APPEND installed_plugins ${comp}) + + set(pseudo_plugins_recommends "${pseudo_plugins_recommends}" PARENT_SCOPE) + set(all_plugins_suggest "${all_plugins_suggest}" PARENT_SCOPE) + set(installed_plugins "${installed_plugins}" PARENT_SCOPE) +endfunction() + macro(ov_cpack_settings) # fill a list of components which are part of debian set(cpack_components_all ${CPACK_COMPONENTS_ALL}) @@ -27,24 +56,33 @@ macro(ov_cpack_settings) endforeach() list(REMOVE_DUPLICATES CPACK_COMPONENTS_ALL) - # CPACK_PACKAGE_VERSION_MAJOR.CPACK_PACKAGE_VERSION_MINOR - set(cpack_ver_mm "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") + # version with 3 components + set(cpack_ver_mm "${CPACK_PACKAGE_VERSION}") + # a list of conflicting package versions + set(conflicting_versions + # 2022 release series + 2022.1.0) # core set(CPACK_COMPONENT_CORE_DESCRIPTION "OpenVINO C / C++ Runtime libraries") set(CPACK_DEBIAN_CORE_PACKAGE_NAME "libopenvino-${cpack_ver_mm}") + # we need triggers to run ldconfig for openvino set(CPACK_DEBIAN_CORE_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm};${def_triggers}") - ov_add_lintian_suppression(core - # OpenVINO runtime library is named differently + # We currently don't have versioning for openvino core library + ov_debian_add_lintian_suppression(core + "shlib-without-versioned-soname" "package-name-doesnt-match-sonames") # core_dev - set(CPACK_COMPONENT_CORE_DEV_DESCRIPTION "OpenVINO C / C++ Runtime development files") + set(CPACK_COMPONENT_CORE_DEV_DESCRIPTION "Intel(R) Distribution of OpenVINO(TM) Toolkit C / C++ Development files") set(CPACK_COMPONENT_CORE_DEV_DEPENDS "core") - set(CPACK_DEBIAN_CORE_DEV_PACKAGE_NAME "libopenvino-${cpack_ver_mm}-dev") - set(CPACK_DEBIAN_CORE_DEV_PACKAGE_CONFLICTS "libopenvino2021.3-dev, libopenvino2021.4-dev") - ov_add_lintian_suppression(core_dev) + set(CPACK_DEBIAN_CORE_DEV_PACKAGE_NAME "libopenvino-dev-${cpack_ver_mm}") + ov_debian_generate_conflicts(core_dev ${conflicting_versions}) + + ov_debian_add_lintian_suppression(core_dev + # CVS-79409: create man page for compile_tool + "binary-without-manpage") # # Plugins @@ -55,17 +93,17 @@ macro(ov_cpack_settings) set(CPACK_COMPONENT_HETERO_DESCRIPTION "OpenVINO Hetero plugin") set(CPACK_COMPONENT_HETERO_DEPENDS "core") set(CPACK_DEBIAN_HETERO_PACKAGE_NAME "libopenvino-hetero-${cpack_ver_mm}") - set(CPACK_DEBIAN_HETERO_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm};${def_triggers}") - list(APPEND installed_plugins "hetero") + set(CPACK_DEBIAN_HETERO_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") + _ov_add_plugin(hetero ON) endif() # auto batch if(ENABLE_AUTO_BATCH) - set(CPACK_COMPONENT_BATCH_DESCRIPTION "OpenVINO Auto Batch plugin") + set(CPACK_COMPONENT_BATCH_DESCRIPTION "OpenVINO Automatic Batching plugin") set(CPACK_COMPONENT_BATCH_DEPENDS "core") set(CPACK_DEBIAN_BATCH_PACKAGE_NAME "libopenvino-auto-batch-${cpack_ver_mm}") - set(CPACK_DEBIAN_BATCH_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm};${def_triggers}") - list(APPEND installed_plugins "batch") + set(CPACK_DEBIAN_BATCH_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") + _ov_add_plugin(batch ON) endif() # multi / auto plugins @@ -77,130 +115,146 @@ macro(ov_cpack_settings) endif() set(CPACK_COMPONENT_MULTI_DEPENDS "core") set(CPACK_DEBIAN_MULTI_PACKAGE_NAME "libopenvino-auto-${cpack_ver_mm}") - set(CPACK_DEBIAN_MULTI_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm};${def_triggers}") - list(APPEND installed_plugins "multi") + set(CPACK_DEBIAN_MULTI_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") + _ov_add_plugin(multi ON) elseif(ENABLE_AUTO) set(CPACK_COMPONENT_AUTO_DESCRIPTION "OpenVINO Auto plugin") set(CPACK_COMPONENT_AUTO_DEPENDS "core") set(CPACK_DEBIAN_AUTO_PACKAGE_NAME "libopenvino-auto-${cpack_ver_mm}") - set(CPACK_DEBIAN_AUTO_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm};${def_triggers}") - list(APPEND installed_plugins "auto") + set(CPACK_DEBIAN_AUTO_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") + _ov_add_plugin(auto ON) endif() # intel-cpu if(ENABLE_INTEL_CPU) - set(CPACK_COMPONENT_CPU_DESCRIPTION "OpenVINO Intel CPU plugin") + set(CPACK_COMPONENT_CPU_DESCRIPTION "Intel® CPU") set(CPACK_COMPONENT_CPU_DEPENDS "core") set(CPACK_DEBIAN_CPU_PACKAGE_NAME "libopenvino-intel-cpu-${cpack_ver_mm}") - set(CPACK_DEBIAN_CPU_PACKAGE_SUGGESTS "libopenvino-auto-${cpack_ver_mm} (= ${CPACK_PACKAGE_VERSION}), libopenvino-hetero-${cpack_ver_mm} (= ${CPACK_PACKAGE_VERSION})") - set(CPACK_DEBIAN_CPU_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm};${def_triggers}") - list(APPEND installed_plugins "cpu") + set(CPACK_DEBIAN_CPU_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") + _ov_add_plugin(cpu OFF) endif() # intel-gpu if(ENABLE_INTEL_GPU) - set(CPACK_COMPONENT_GPU_DESCRIPTION "OpenVINO Intel GPU plugin") + set(CPACK_COMPONENT_GPU_DESCRIPTION "Intel® Processor Graphics") set(CPACK_COMPONENT_GPU_DEPENDS "core") set(CPACK_DEBIAN_GPU_PACKAGE_NAME "libopenvino-intel-gpu-${cpack_ver_mm}") - set(CPACK_DEBIAN_GPU_PACKAGE_SUGGESTS "libopenvino-auto-${cpack_ver_mm} (= ${CPACK_PACKAGE_VERSION}), libopenvino-hetero-${cpack_ver_mm} (= ${CPACK_PACKAGE_VERSION})") - set(CPACK_DEBIAN_GPU_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm};${def_triggers}") - list(APPEND installed_plugins "gpu") + set(CPACK_DEBIAN_GPU_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") + _ov_add_plugin(gpu OFF) endif() # intel-myriad if(ENABLE_INTEL_MYRIAD) - set(CPACK_COMPONENT_MYRIAD_DESCRIPTION "OpenVINO Intel Myriad plugin") + set(CPACK_COMPONENT_MYRIAD_DESCRIPTION "Intel® Movidius™ VPU") set(CPACK_COMPONENT_MYRIAD_DEPENDS "core") - set(CPACK_DEBIAN_MYRIAD_PACKAGE_NAME "libopenvino-intel-myriad-${cpack_ver_mm}") - set(CPACK_DEBIAN_MYRIAD_PACKAGE_SUGGESTS "libopenvino-auto-${cpack_ver_mm} (= ${CPACK_PACKAGE_VERSION}), libopenvino-hetero-${cpack_ver_mm} (= ${CPACK_PACKAGE_VERSION})") - set(CPACK_DEBIAN_MYRIAD_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm};${def_triggers}") - list(APPEND installed_plugins "myriad") + set(CPACK_DEBIAN_MYRIAD_PACKAGE_NAME "libopenvino-intel-vpu-${cpack_ver_mm}") + set(CPACK_DEBIAN_MYRIAD_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") + _ov_add_plugin(myriad OFF) endif() # intel-gna if(ENABLE_INTEL_GNA) - set(CPACK_COMPONENT_GNA_DESCRIPTION "OpenVINO Intel GNA plugin") + set(CPACK_COMPONENT_GNA_DESCRIPTION "Intel® Gaussian Neural Accelerator") set(CPACK_COMPONENT_GNA_DEPENDS "core") set(CPACK_DEBIAN_GNA_PACKAGE_NAME "libopenvino-intel-gna-${cpack_ver_mm}") - set(CPACK_DEBIAN_GNA_PACKAGE_SUGGESTS "libopenvino-auto-${cpack_ver_mm} (= ${CPACK_PACKAGE_VERSION}), libopenvino-hetero-${cpack_ver_mm} (= ${CPACK_PACKAGE_VERSION})") + # since we have libgna.so we need to call ldconfig and have `def_triggers` here set(CPACK_DEBIAN_GNA_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm};${def_triggers}") - list(APPEND installed_plugins "gna") + + ov_debian_add_lintian_suppression(gna + # package name matches libopenvino_intel_gna_plugin.so + # but lintian looks at libgna.so.2 since it's a versioned library + "package-name-doesnt-match-sonames") + + _ov_add_plugin(gna OFF) + endif() + + # add pseudo plugins are recommended to core component + if(pseudo_plugins_recommends) + # see https://superuser.com/questions/70031/what-is-the-difference-between-recommended-and-suggested-packages-ubuntu. + # we suppose that pseudo plugins are needed for core + set(CPACK_DEBIAN_CORE_PACKAGE_RECOMMENDS "${pseudo_plugins_recommends}") endif() # # Python bindings # - set(CPACK_COMPONENT_PYTHON_PYTHON3.8_DESCRIPTION "OpenVINO Python bindings") - if(installed_plugins) - set(CPACK_COMPONENT_PYTHON_PYTHON3.8_DEPENDS "${installed_plugins}") - else() - set(CPACK_COMPONENT_PYTHON_PYTHON3.8_DEPENDS "core") + if(ENABLE_PYTHON) + set(CPACK_COMPONENT_PYTHON_PYTHON3.8_DESCRIPTION "OpenVINO Python bindings") + if(installed_plugins) + set(CPACK_COMPONENT_PYTHON_PYTHON3.8_DEPENDS "${installed_plugins}") + else() + set(CPACK_COMPONENT_PYTHON_PYTHON3.8_DEPENDS "core") + endif() + set(CPACK_DEBIAN_PYTHON_PYTHON3.8_PACKAGE_NAME "libopenvino-python-${cpack_ver_mm}") + set(CPACK_DEBIAN_PYTHON_PYTHON3.8_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}") endif() - set(CPACK_DEBIAN_PYTHON_PYTHON3.8_PACKAGE_NAME "libopenvino-python-${cpack_ver_mm}") - set(CPACK_DEBIAN_PYTHON_PYTHON3.8_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm};${def_triggers}") # # Samples # set(samples_build_deps "cmake, g++, gcc, libc6-dev, make") - set(samples_build_deps_suggest "${samples_build_deps}, libopencv-core-dev, libopencv-imgproc-dev, libopencv-imgcodecs-dev") + set(samples_build_deps_suggest "libopencv-core-dev, libopencv-imgproc-dev, libopencv-imgcodecs-dev") # c_samples / cpp_samples - set(CPACK_COMPONENT_SAMPLES_DESCRIPTION "OpenVINO C / C++ samples") + set(CPACK_COMPONENT_SAMPLES_DESCRIPTION "Intel(R) Distribution of OpenVINO(TM) Toolkit C / C++ Samples") set(CPACK_COMPONENT_SAMPLES_DEPENDS "core_dev") - set(CPACK_DEBIAN_SAMPLES_PACKAGE_NAME "libopenvino-samples-${cpack_ver_mm}") - set(CPACK_DEBIAN_SAMPLES_PACKAGE_SUGGESTS "${samples_build_deps_suggest}, libopenvino-hetero-${cpack_ver_mm} (= ${CPACK_PACKAGE_VERSION})") - set(CPACK_DEBIAN_SAMPLES_PACKAGE_DEPENDS "libgflags-dev, nlohmann-json3-dev, zlib1g-dev, ${samples_build_deps}") + set(CPACK_DEBIAN_SAMPLES_PACKAGE_NAME "openvino-samples-${cpack_ver_mm}") + set(CPACK_DEBIAN_SAMPLES_PACKAGE_SUGGESTS "${samples_build_deps_suggest}, ${all_plugins_suggest}") + set(CPACK_DEBIAN_SAMPLES_PACKAGE_DEPENDS "libgflags-dev, nlohmann-json3-dev, zlib1g-dev") + # can be skipped with --no-install-recommends + set(CPACK_DEBIAN_SAMPLES_PACKAGE_RECOMMENDS "${samples_build_deps}") set(CPACK_DEBIAN_SAMPLES_PACKAGE_ARCHITECTURE "all") # python_samples - set(CPACK_COMPONENT_PYTHON_SAMPLES_DESCRIPTION "OpenVINO Python samples") - set(CPACK_COMPONENT_PYTHON_SAMPLES_DEPENDS "python_python3.8") - set(CPACK_DEBIAN_PYTHON_SAMPLES_PACKAGE_NAME "libopenvino-samples-python-${cpack_ver_mm}") + set(CPACK_COMPONENT_PYTHON_SAMPLES_DESCRIPTION "Intel(R) Distribution of OpenVINO(TM) Toolkit Python Samples") + set(CPACK_DEBIAN_PYTHON_SAMPLES_PACKAGE_NAME "openvino-samples-python-${cpack_ver_mm}") + set(CPACK_DEBIAN_PYTHON_SAMPLES_PACKAGE_DEPENDS "python3") set(CPACK_DEBIAN_PYTHON_SAMPLES_PACKAGE_ARCHITECTURE "all") # - # Add virtual packages + # Add umbrella packages # # all libraries - set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "OpenVINO all runtime libraries") + set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Intel(R) Distribution of OpenVINO(TM) Toolkit Libraries") if(installed_plugins) set(CPACK_COMPONENT_LIBRARIES_DEPENDS "${installed_plugins}") else() set(CPACK_COMPONENT_LIBRARIES_DEPENDS "core") endif() - set(CPACK_DEBIAN_LIBRARIES_PACKAGE_NAME "libopenvino-libraries-${cpack_ver_mm}") - list(APPEND CPACK_COMPONENTS_ALL "libraries") + set(CPACK_DEBIAN_LIBRARIES_PACKAGE_NAME "openvino-libraries-${cpack_ver_mm}") + + ov_debian_add_lintian_suppression(libraries + # it's umbrella package + "empty-binary-package") # all libraries-dev - set(CPACK_COMPONENT_LIBRARIES_DEV_DESCRIPTION "OpenVINO all runtime libraries and development files") - set(CPACK_COMPONENT_LIBRARIES_DEV_DEPENDS "core_dev;${installed_plugins}") - set(CPACK_DEBIAN_LIBRARIES_DEV_PACKAGE_NAME "libopenvino-libraries-${cpack_ver_mm}-dev") - list(APPEND CPACK_COMPONENTS_ALL "libraries_dev") + set(CPACK_COMPONENT_LIBRARIES_DEV_DESCRIPTION "Intel(R) Distribution of OpenVINO(TM) Toolkit Libraries and Development files") + set(CPACK_COMPONENT_LIBRARIES_DEV_DEPENDS "core_dev;libraries") + set(CPACK_DEBIAN_LIBRARIES_DEV_PACKAGE_NAME "openvino-libraries-dev-${cpack_ver_mm}") + # ov_debian_generate_conflicts(libraries_dev ${conflicting_versions}) + ov_debian_add_lintian_suppression(libraries_dev + # it's umbrella package + "empty-binary-package") + + # all openvino + set(CPACK_COMPONENT_OPENVINO_DESCRIPTION "Intel(R) Distribution of OpenVINO(TM) Toolkit Libraries and Development files") + set(CPACK_COMPONENT_OPENVINO_DEPENDS "libraries_dev;samples;python_samples") + set(CPACK_DEBIAN_OPENVINO_PACKAGE_NAME "openvino-${cpack_ver_mm}") + ov_debian_add_lintian_suppression(openvino + # it's umbrella package + "empty-binary-package") + + list(APPEND CPACK_COMPONENTS_ALL "libraries;libraries_dev;openvino") # # install debian common files # foreach(comp IN LISTS CPACK_COMPONENTS_ALL) - string(TOUPPER "${comp}" ucomp) - set(package_name "${CPACK_DEBIAN_${ucomp}_PACKAGE_NAME}") - - # copyright - # install(FILES "${OpenVINO_SOURCE_DIR}/LICENSE" - # DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/${package_name}/ - # COMPONENT ${comp} - # RENAME copyright) - - # TODO: install changelog - - # install triggers - install(FILES ${def_triggers} - DESTINATION ../DEBIAN/ - COMPONENT ${comp}) + ov_debian_add_changelog_and_copyright("${comp}") endforeach() # @@ -210,8 +264,12 @@ macro(ov_cpack_settings) # NOTE: we expicitly don't add runtime latest packages # since a user needs to depend on specific VERSIONED runtime package # with fixed SONAMEs, while latest package can be updated multiple times + # ov_debian_add_latest_component(libraries) - # ov_add_latest_component(core_dev) - # ov_add_latest_component(samples) - # ov_add_latest_component(libraries_dev) + ov_debian_add_latest_component(libraries_dev) + ov_debian_add_latest_component(openvino) + + # users can manually install specific version of package + # e.g. sudo apt-get install openvino=2022.1.0-643 + # even if we have package version 2022.2.0 endmacro() diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index e509dc1474c..0c12c1e9ed3 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -27,14 +27,17 @@ ie_cpack_add_component(${OV_CPACK_COMP_CPP_SAMPLES} if(UNIX) install(DIRECTORY cpp/ DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp - USE_SOURCE_PERMISSIONS COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES} PATTERN *.bat EXCLUDE + PATTERN *.sh EXCLUDE PATTERN .clang-format EXCLUDE) + + install(PROGRAMS cpp/build_samples.sh + DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp + COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES}) elseif(WIN32) install(DIRECTORY cpp/ DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp - USE_SOURCE_PERMISSIONS COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES} PATTERN *.sh EXCLUDE PATTERN .clang-format EXCLUDE) @@ -72,5 +75,4 @@ ie_cpack_add_component(${OV_CPACK_COMP_PYTHON_SAMPLES} HIDDEN) install(DIRECTORY python/ DESTINATION ${OV_CPACK_SAMPLESDIR}/python - USE_SOURCE_PERMISSIONS COMPONENT ${OV_CPACK_COMP_PYTHON_SAMPLES}) diff --git a/src/bindings/c/ov/src/CMakeLists.txt b/src/bindings/c/ov/src/CMakeLists.txt index 5e1bf094467..d0d5655746b 100644 --- a/src/bindings/c/ov/src/CMakeLists.txt +++ b/src/bindings/c/ov/src/CMakeLists.txt @@ -30,7 +30,16 @@ ie_add_vs_version_file(NAME ${TARGET_NAME} # export -set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME runtime::ov) +set_target_properties(${TARGET_NAME} PROPERTIES + EXPORT_NAME runtime::ov) + +if(CPACK_GENERATOR STREQUAL "DEB") + # TODO: define proper library version, currently SOVERSION 2022 + set_target_properties(${TARGET_NAME} PROPERTIES + SOVERSION ${OpenVINO_VERSION_MAJOR} + VERSION ${OpenVINO_VERSION}) +endif() + export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") diff --git a/src/bindings/c/src/CMakeLists.txt b/src/bindings/c/src/CMakeLists.txt index 5fd01fe263d..734198c1220 100644 --- a/src/bindings/c/src/CMakeLists.txt +++ b/src/bindings/c/src/CMakeLists.txt @@ -31,11 +31,13 @@ ie_add_vs_version_file(NAME ${TARGET_NAME} # export set_target_properties(${TARGET_NAME} PROPERTIES - EXPORT_NAME runtime::c - # TODO: define proper library version, currently SOVERSION 2022 - # SOVERSION ${OpenVINO_VERSION_MAJOR} - # VERSION ${OpenVINO_VERSION} - ) + EXPORT_NAME runtime::c) + +if(CPACK_GENERATOR STREQUAL "DEB") + set_target_properties(${TARGET_NAME} PROPERTIES + SOVERSION ${OpenVINO_VERSION_MAJOR} + VERSION ${OpenVINO_VERSION}) +endif() export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 5e24822048d..04a5027787f 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -201,22 +201,18 @@ if(CPACK_GENERATOR STREQUAL "DEB") else() install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gflags DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty - USE_SOURCE_PERMISSIONS COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES}) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/zlib DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty - USE_SOURCE_PERMISSIONS COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES}) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/json/nlohmann_json DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty - USE_SOURCE_PERMISSIONS COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES} REGEX .*json/nlohmann_json/test/.* EXCLUDE) endif() install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cnpy DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty - USE_SOURCE_PERMISSIONS COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES})