2016-02-12 11:12:14 +01:00
# We only allow generating distribution packages if:
# - it is a release build (to ensure all generated debian packages are fine to be distributed)
# - tests are not built (because otherwise CPack would start installing googletest with the package as well)
2016-02-13 21:22:34 +01:00
string ( TOUPPER "${CMAKE_BUILD_TYPE}" BUILDTYPE )
if ( BUILDTYPE MATCHES RELEASE AND NOT BUILD_TESTING )
2016-02-12 10:16:38 +01:00
if ( "${CMAKE_VERSION}" VERSION_LESS "3.3" )
# Earlier cmake versions generate .deb packages for which the package manager says they're bad quality
# and asks the user whether they really want to install it. Cmake 3.3 fixes this.
message ( WARNING "Distribution package generation is only supported for CMake version >= 3.3. You're using ${CMAKE_VERSION}. You will be able to build and install CryFS, but you won't be able to generate .deb packages." )
else ( "${CMAKE_VERSION}" VERSION_LESS "3.3" )
# Fix debfiles permissions. Unfortunately, git doesn't store file permissions.
# When installing the .deb package and these files have the wrong permissions, the package manager complains.
execute_process ( COMMAND /bin/bash -c "chmod 0755 ${CMAKE_CURRENT_SOURCE_DIR}/debfiles/*" )
2016-02-11 17:34:08 +01:00
2016-02-12 10:16:38 +01:00
set ( CPACK_GENERATOR TGZ DEB RPM )
set ( CPACK_PACKAGE_NAME "cryfs" )
2016-04-02 23:33:37 +02:00
get_git_version ( GITVERSION_VERSION_STRING )
2016-02-12 10:16:38 +01:00
set ( CPACK_PACKAGE_VERSION "${GITVERSION_VERSION_STRING}" )
set ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Encrypt your files and store them in the cloud." )
set ( CPACK_PACKAGE_DESCRIPTION "CryFS encrypts your files, so you can safely store them anywhere. It works well together with cloud services like Dropbox, iCloud, OneDrive and others." )
set ( CPACK_PACKAGE_CONTACT "Sebastian Messmer <messmer@cryfs.org>" )
set ( CPACK_PACKAGE_VENDOR "Sebastian Messmer" )
set ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE" )
set ( CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}" )
if ( WIN32 AND NOT UNIX )
# There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four (4) backlasshes.
#set(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
#set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\cryfs.exe")
#set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} CryFS")
#set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.cryfs.org")
#set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.cryfs.org")
#set(CPACK_NSIS_CONTACT "messmer@cryfs.org")
#set(CPACK_NSIS_MODIFY_PATH ON)
else ( WIN32 AND NOT UNIX )
2016-02-12 11:12:14 +01:00
set ( CPACK_STRIP_FILES ON )
set ( CPACK_SOURCE_STRIP_FILES ON )
2016-02-12 10:16:38 +01:00
endif ( WIN32 AND NOT UNIX )
set ( CPACK_PACKAGE_EXECUTABLES "cryfs" "CryFS" )
set ( CPACK_DEBIAN_PACKAGE_SECTION "utils" )
set ( CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON )
2017-06-27 01:07:52 +02:00
# Needs gnupg2, lsb-release for postinst script
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "fuse, gnupg2, lsb-release" )
2016-02-11 17:34:08 +01:00
2016-02-12 10:16:38 +01:00
set ( CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://www.cryfs.org" )
set ( CPACK_RPM_PACKAGE_LICENSE "LGPLv3" )
2017-09-02 11:04:20 +02:00
set ( CPACK_RPM_PACKAGE_DESCRIPTION ${ CPACK_PACKAGE_DESCRIPTION } )
set ( CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/bin;/usr/share/man;/usr/share/man/man1" )
2016-02-12 10:16:38 +01:00
set ( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/debfiles/postinst;${CMAKE_CURRENT_SOURCE_DIR}/debfiles/postrm" )
2016-02-11 17:34:08 +01:00
2016-02-12 10:16:38 +01:00
include ( CPack )
endif ( "${CMAKE_VERSION}" VERSION_LESS "3.3" )
2016-02-14 01:57:34 +01:00
endif ( BUILDTYPE MATCHES RELEASE AND NOT BUILD_TESTING )