linux deploy

This commit is contained in:
2020-05-12 18:48:59 +03:00
parent e85275c587
commit b07fe9f892
2 changed files with 37 additions and 2 deletions

View File

@@ -19,6 +19,9 @@ include(PIPMacros)
if(NOT DEFINED BUILD_NUMBER)
set(BUILD_NUMBER 9999)
endif()
if("x${BUILD_NUMBER}" STREQUAL "x")
set(BUILD_NUMBER 0)
endif()
set(_ICU_DEFAULT OFF)
if((NOT DEFINED WIN32) AND (NOT DEFINED ANDROID_PLATFORM) AND (NOT DEFINED APPLE))

View File

@@ -598,8 +598,38 @@ macro(deploy_target _T)
set(_CMD_)
set(_has_deploy 0)
if ("x${CMAKE_SYSTEM_NAME}" STREQUAL "xLinux")
set(_os_id "")
set(_os_ver "")
if (CMAKE_CROSSCOMPILING)
find_file(_release_file NAMES os-release lsb-release PATHS "${CMAKE_PREFIX_PATH}/lib" "${CMAKE_PREFIX_PATH}/../etc" 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()
else()
execute_process(COMMAND "lsb_release -si" OUTPUT_VARIABLE _os_id)
execute_process(COMMAND "lsb_release -sr" OUTPUT_VARIABLE _os_ver)
endif()
set(_build "${${_T}_VERSION_BUILD}")
if (NOT "x${_build}" STREQUAL "x")
set(_build "-${_build}")
endif()
if ("x${_TARGET_OS}" STREQUAL "x")
set(_TARGET_OS "linux")
endif()
string(TOLOWER "${_os_id}${_os_ver}" _TARGET_OS)
string(REPLACE "_" "-" _DEBNAME "${_T}")
string(REPLACE "_" "-" _DEBVERSION "${${_T}_VERSION}")
string(REPLACE "_" "-" _DEBVERSION "${${_T}_VERSION}${_build}+${_TARGET_OS}")
set(_DEB_ARCH)
if("_${MY_ARCH}" STREQUAL "_arm64")
set(_DEB_ARCH "arm64")
@@ -670,7 +700,9 @@ macro(deploy_target _T)
endif()
set(_dt_opts -L "${CMAKE_READELF}" --dpkg-workdir "${CMAKE_DPKG_WORKDIR}" -s "${_dt_searchdirs}")
endif()
set(_deb_name "${_TV}_debian_${_DEB_ARCH}.deb")
set(_deb_name "${_TV}_${_TARGET_OS}_${_DEB_ARCH}.deb")
#message("VER = \"${_DEBVERSION}\"")
#message("DEB = \"${_deb_name}\"")
add_custom_target(deploy_${_T}
# gather deb dir
COMMAND rm -rf ${_VERB} "${_AGD}"