linphone-desktop/linphone-app/cmake_builder/linphone_package/packaging.cmake.in
Julien Wadel aac2d9f120 Revert back to add signing identity for Macos.
Allow CPACK to sign the application.
Fix cmake options list that wasn't set because of scope.
Make more generic the Windows hack on QtKeyChain.
Use a script to code sign all files (not working in cmake file)
Clean cmake files to use targets.
Rework Mac build.
Avoid to use git if version has been specified with cmake command (LINPHONEAPP_VERSION)
2023-09-22 14:29:10 +02:00

88 lines
4.2 KiB
CMake

############################################################################
# packaging.cmake
# Copyright (C) 2017-2018 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
############################################################################
set(DO_TGZ @CPACK_BINARY_TGZ@)
set(DO_TZ @CPACK_BINARY_TZ@)
set(DO_STGZ @CPACK_BINARY_STGZ@)
set(DO_DRAGNDROP @CPACK_BINARY_DRAGNDROP@)
set(DO_GENERATOR @DO_GENERATOR@)
set(DO_APPIMAGE @DO_APPIMAGE@)
if (NOT "${CMAKE_INSTALL_PREFIX}" MATCHES .*/_CPack_Packages/.*)
if(DO_TGZ)
execute_process( COMMAND ${CMAKE_CPACK_COMMAND} -G TGZ RESULT_VARIABLE CPACK_COMMAND_RESULT)
if(CPACK_COMMAND_RESULT)
message(FATAL_ERROR "Failed to create TGZ package!")
endif()
endif()
if(DO_TZ)
execute_process( COMMAND ${CMAKE_CPACK_COMMAND} -G TZ RESULT_VARIABLE CPACK_COMMAND_RESULT)
if(CPACK_COMMAND_RESULT)
message(FATAL_ERROR "Failed to create TZ package!")
endif()
endif()
if(DO_STGZ)
execute_process( COMMAND ${CMAKE_CPACK_COMMAND} -G STGZ RESULT_VARIABLE CPACK_COMMAND_RESULT)
if(CPACK_COMMAND_RESULT)
message(FATAL_ERROR "Failed to create STGZ package!")
endif()
endif()
if(DO_DRAGNDROP)
execute_process( COMMAND ${CMAKE_CPACK_COMMAND} -G DragNDrop RESULT_VARIABLE CPACK_COMMAND_RESULT)
if(CPACK_COMMAND_RESULT)
message(FATAL_ERROR "Failed to create DragAndDrop package!")
endif()
endif()
if(DO_GENERATOR)
execute_process( COMMAND ${CMAKE_CPACK_COMMAND} -G @CPACK_GENERATOR@ -C @CMAKE_BUILD_TYPE@ RESULT_VARIABLE CPACK_COMMAND_RESULT)
if(CPACK_COMMAND_RESULT)
message(FATAL_ERROR "Failed to create @CPACK_GENERATOR@ package!")
endif()
endif()
if(DO_APPIMAGE)
set(ENV QML_SOURCES_PATHS="@LINPHONE_QML_DIR@")
set(ENV QML_MODULES_PATHS="@LINPHONE_QML_DIR@")
execute_process( COMMAND mkdir -p "WORK/Packages/AppImageDir/" WORKING_DIRECTORY "@CMAKE_INSTALL_PREFIX@/..")
execute_process( COMMAND cp -rf "@LINPHONE_QML_DIR@" "WORK/Packages/AppImageDir/" WORKING_DIRECTORY "@CMAKE_INSTALL_PREFIX@/..")
execute_process( COMMAND "@CMAKE_CURRENT_SOURCE_DIR@/../../tools/create_appimage.sh" @EXECUTABLE_NAME@ @CPACK_PACKAGE_FILE_NAME@ @QT_PATH@ @LINPHONE_BUILDER_SIGNING_IDENTITY@ RESULT_VARIABLE CPACK_COMMAND_RESULT WORKING_DIRECTORY "@CMAKE_INSTALL_PREFIX@/.." )
if(CPACK_COMMAND_RESULT)
message(FATAL_ERROR "Failed to create AppImage package with this command : '@CMAKE_CURRENT_SOURCE_DIR@/../../tools/create_appimage.sh @EXECUTABLE_NAME@ @QT_PATH@ @LINPHONEAPP_VERSION@' at @CMAKE_INSTALL_PREFIX@/..\nMaybe the .appimage already exists and is running. Please remove the file before packaging if it is the case.")
endif()
endif()
if (@PERFORM_SIGNING@)
if(@PASSPHRASE_FILE@)
execute_process(
COMMAND "@CMAKE_CURRENT_SOURCE_DIR@/../../tools/sign_package.bat" 1 "@PASSPHRASE_FILE@" "@SIGNTOOL_COMMAND@" "@PFX_FILE@" "@TIMESTAMP_URL@" @CPACK_PACKAGE_FILE_NAME@.@PACKAGE_EXT@
RESULT_VARIABLE SIGNING_RESULT WORKING_DIRECTORY "@CPACK_PACKAGE_DIRECTORY@"
)
else()
execute_process(
COMMAND "@CMAKE_CURRENT_SOURCE_DIR@/../../tools/sign_package.bat" 2 "@SIGNTOOL_COMMAND@" "@TIMESTAMP_URL@" @SIGN_HASH@ @CPACK_PACKAGE_FILE_NAME@.@PACKAGE_EXT@
RESULT_VARIABLE SIGNING_RESULT WORKING_DIRECTORY "@CPACK_PACKAGE_DIRECTORY@"
)
endif()
if(SIGNING_RESULT)
message(FATAL_ERROR "Failed to sign the package! ${SIGNING_RESULT} ${RESULT_VARIABLE}")
endif()
endif ()
endif ()