linux deploy

This commit is contained in:
2020-05-12 22:39:16 +03:00
parent b07fe9f892
commit de17f93679

View File

@@ -600,34 +600,35 @@ macro(deploy_target _T)
if ("x${CMAKE_SYSTEM_NAME}" STREQUAL "xLinux") if ("x${CMAKE_SYSTEM_NAME}" STREQUAL "xLinux")
set(_os_id "") set(_os_id "")
set(_os_ver "") set(_os_ver "")
set(_paths "/usr/lib" "/etc")
if (CMAKE_CROSSCOMPILING) if (CMAKE_CROSSCOMPILING)
find_file(_release_file NAMES os-release lsb-release PATHS "${CMAKE_PREFIX_PATH}/lib" "${CMAKE_PREFIX_PATH}/../etc" NO_DEFAULT_PATH) set(_paths "${CMAKE_PREFIX_PATH}/lib" "${CMAKE_PREFIX_PATH}/../etc")
if (NOT "x${_release_file}" STREQUAL "x")
file(STRINGS "${_release_file}" _lines)
foreach(_l ${_lines})
if ("${_l}" MATCHES "VERSION_ID=.*")
string(SUBSTRING "${_l}" 11 -1 _os_ver)
string(REPLACE "\"" "" _os_ver "${_os_ver}")
#message("VERSION_ID ${_os_ver}")
elseif ("${_l}" MATCHES "ID=.*")
string(SUBSTRING "${_l}" 3 -1 _os_id)
string(REPLACE "\"" "" _os_id "${_os_id}")
#message("ID ${_os_id}")
endif()
endforeach()
endif()
else()
execute_process(COMMAND "lsb_release -si" OUTPUT_VARIABLE _os_id)
execute_process(COMMAND "lsb_release -sr" OUTPUT_VARIABLE _os_ver)
endif() endif()
find_file(_release_file NAMES os-release lsb-release PATHS ${_paths} NO_DEFAULT_PATH)
if (NOT "x${_release_file}" STREQUAL "x")
file(STRINGS "${_release_file}" _lines)
foreach(_l ${_lines})
if ("${_l}" MATCHES "VERSION_ID=.*")
string(SUBSTRING "${_l}" 11 -1 _os_ver)
string(REPLACE "\"" "" _os_ver "${_os_ver}")
#message("VERSION_ID ${_os_ver}")
elseif ("${_l}" MATCHES "ID=.*")
string(SUBSTRING "${_l}" 3 -1 _os_id)
string(REPLACE "\"" "" _os_id "${_os_id}")
#message("ID ${_os_id}")
endif()
endforeach()
endif()
#execute_process(COMMAND "lsb_release -si" OUTPUT_VARIABLE _os_id)
#execute_process(COMMAND "lsb_release -sr" OUTPUT_VARIABLE _os_ver)
set(_build "${${_T}_VERSION_BUILD}") set(_build "${${_T}_VERSION_BUILD}")
if (NOT "x${_build}" STREQUAL "x") if (NOT "x${_build}" STREQUAL "x")
set(_build "-${_build}") set(_build "-${_build}")
endif() endif()
string(TOLOWER "${_os_id}${_os_ver}" _TARGET_OS)
if ("x${_TARGET_OS}" STREQUAL "x") if ("x${_TARGET_OS}" STREQUAL "x")
set(_TARGET_OS "linux") set(_TARGET_OS "linux")
endif() endif()
string(TOLOWER "${_os_id}${_os_ver}" _TARGET_OS)
string(REPLACE "_" "-" _DEBNAME "${_T}") string(REPLACE "_" "-" _DEBNAME "${_T}")
string(REPLACE "_" "-" _DEBVERSION "${${_T}_VERSION}${_build}+${_TARGET_OS}") string(REPLACE "_" "-" _DEBVERSION "${${_T}_VERSION}${_build}+${_TARGET_OS}")
set(_DEB_ARCH) set(_DEB_ARCH)