VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Build/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/Build/CMakeLists.txt')
-rw-r--r--src/Build/CMakeLists.txt15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/Build/CMakeLists.txt b/src/Build/CMakeLists.txt
index ce3d372b..458040e8 100644
--- a/src/Build/CMakeLists.txt
+++ b/src/Build/CMakeLists.txt
@@ -84,114 +84,125 @@ if ( UNIX )
file(READ "/etc/lsb-release" UBUNTU_RELEASE)
string(REGEX MATCH "DISTRIB_RELEASE=([0-9 /\\.]+)" _ ${UBUNTU_RELEASE})
set(PLATFORM_VERSION ${CMAKE_MATCH_1})
else()
file(READ "/etc/debian_version" DEBIAN_RELEASE)
string(REGEX MATCH "([0-9]+\\.[0-9]+)" _ ${DEBIAN_RELEASE})
set(PLATFORM_VERSION ${CMAKE_MATCH_1})
endif()
# Get debian release version
elseif(EXISTS "/etc/debian_version")
file(READ "/etc/debian_version" DEBIAN_RELEASE)
string(REGEX MATCH "([0-9]+\\.[0-9]+)" _ ${DEBIAN_RELEASE})
set(PLATFORM_VERSION ${CMAKE_MATCH_1})
endif()
# Get centos release version
elseif(EXISTS "/etc/centos-release")
set ( PLATFORM "CentOS" )
file(READ "/etc/centos-release" CENTOS_RELEASE)
string(REGEX MATCH "release ([0-9 /\\.]+)" _ ${CENTOS_RELEASE})
set(PLATFORM_VERSION ${CMAKE_MATCH_1})
+
+ # Get fedora release version
+ elseif(EXISTS "/etc/fedora-release")
+
+ set ( PLATFORM "Fedora" )
+
+ file(READ "/etc/fedora-release" FEDORA_RELEASE)
+ string(REGEX MATCH "release ([0-9 /\\.]+)" _ ${FEDORA_RELEASE})
+ set(PLATFORM_VERSION ${CMAKE_MATCH_1})
# Only if distribution uses systemd and if all previous files didn't exist
# i.e OpenSUSE
elseif(EXISTS "/etc/os-release")
file(READ "/etc/os-release" OS_RELEASE_NAME)
string(REGEX MATCH "NAME=\"([a-zA-Z0-9 /\\.]+)\"" _ ${OS_RELEASE_NAME})
set(FULL_PLATFORM ${CMAKE_MATCH_1})
if (FULL_PLATFORM MATCHES "^.*openSUSE.*$")
set ( PLATFORM "openSUSE" )
elseif ( FULL_PLATFORM MATCHES "^.*Ubuntu.*$")
set ( PLATFORM "Ubuntu" )
elseif ( FULL_PLATFORM MATCHES "^.*Debian.*$")
set ( PLATFORM "Debian" )
elseif ( FULL_PLATFORM MATCHES "^.*CentOS.*$" )
set ( PLATFORM "CentOS" )
+ elseif ( FULL_PLATFORM MATCHES "^.*Fedora.*$" )
+ set ( PLATFORM "Fedora" )
endif ( )
# Get ditribution release version
file(READ "/etc/os-release" OS_RELEASE)
string(REGEX MATCH "VERSION=\"([a-zA-Z0-9 /\\.]+)\"" _ ${OS_RELEASE})
set(PLATFORM_VERSION ${CMAKE_MATCH_1})
endif()
endif ( )
string(REGEX REPLACE " $" "" PLATFORM_VERSION "${PLATFORM_VERSION}") # Trim the last trailing whitespace
set ( DISTRO_NAME ${PLATFORM}-${PLATFORM_VERSION} )
MESSAGE ( STATUS "Platform = ${PLATFORM}" )
MESSAGE ( STATUS "Platform Version = ${PLATFORM_VERSION}" )
MESSAGE ( STATUS "Distribution name = ${DISTRO_NAME}" )
# - Detect the architecture under OSX, Debian, CentOS and OpenSUSE platforms
# The following variable will be set
# $ARCHITECTURE
if ( PLATFORM STREQUAL "Debian" OR PLATFORM STREQUAL "Ubuntu" )
# There is no such thing as i686 architecture on debian, i386 is to be used instead
# dpkg --print-architecture
find_program(DPKG_CMD dpkg)
if(NOT DPKG_CMD)
# Cannot find dpkg in path
# Try best guess following SUFFIX value calculated from CMAKE_SIZEOF_VOID_P
if (SUFFIX STREQUAL "32")
SET(ARCHITECTURE i386)
elseif (SUFFIX STREQUAL "64")
SET(ARCHITECTURE amd64)
endif()
else( )
execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
endif( )
-elseif ( ( PLATFORM STREQUAL "CentOS" ) OR ( PLATFORM STREQUAL "openSUSE" ) )
+elseif ( ( PLATFORM STREQUAL "CentOS" ) OR ( PLATFORM STREQUAL "openSUSE" ) OR ( PLATFORM STREQUAL "Fedora" ))
execute_process(COMMAND arch OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
else ()
MESSAGE(FATAL_ERROR "Unrecognized / unsupported distribution")
endif ( )
MESSAGE ( STATUS "Architecture = ${ARCHITECTURE}" )
# - Create installation folder directory at install time
# This won't lead to the files being actually installed (in CMAKE_INSTALL_PREFIX)
# unless "cmake --build . --target install" is executed, which is not the case here.
#
# Doing things like the following
# - install(DIRECTORY ${VERACRYPT_BUILD_DIR}/usr DESTINATION /)
# - install(DIRECTORY ${VERACRYPT_BUILD_DIR}/usr/bin DESTINATION /usr)
# lead to conflicts despite the usage of CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
# because install() forces CpackRPM to create the DESTINATION folders.
#
# We fix this by installing ALL directories inside '/usr' in '.', and setting
# CPACK_PACKAGING_INSTALL_PREFIX to '/usr'.
# This way, during the packaging, 'bin' and 'share' folders will be installed
# inside '${CPACK_PACKAGE_DIRECTORY}/_CPack_Packages/<system_name>/DEB,RPM/${CPACK_PACKAGE_NAME}/${CPACK_PACKAGING_INSTALL_PREFIX}'.
#
# Also, we use USE_SOURCE_PERMISSIONS to save the permissions
install(DIRECTORY ${VERACRYPT_BUILD_DIR}/usr/bin
DESTINATION .
USE_SOURCE_PERMISSIONS)
install(DIRECTORY ${VERACRYPT_BUILD_DIR}/usr/sbin
@@ -268,61 +279,61 @@ if ( ( PLATFORM STREQUAL "Debian" ) OR ( PLATFORM STREQUAL "Ubuntu" ) )
OR ( ( PLATFORM STREQUAL "Ubuntu" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "23.04" ) ) )
set( CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.2-1, libayatana-appindicator3-1, libfuse2, dmsetup, sudo, libpcsclite1, pcscd" )
elseif ( ( ( PLATFORM STREQUAL "Debian" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "10" ) )
OR ( ( PLATFORM STREQUAL "Ubuntu" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "18.04" ) ) )
set( CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.0-gtk3-0v5, libayatana-appindicator3-1, libfuse2, dmsetup, sudo, libpcsclite1, pcscd" )
else ()
# Link against statically built wxWidgets on Ubuntu 14.04 and older, and Debian 8 and older
if ( ( ( PLATFORM STREQUAL "Debian" ) AND ( PLATFORM_VERSION VERSION_LESS_EQUAL "8" ) )
OR ( ( PLATFORM STREQUAL "Ubuntu" ) AND ( PLATFORM_VERSION VERSION_LESS_EQUAL "14.04" ) ) )
set( CPACK_DEBIAN_PACKAGE_DEPENDS "libgtk2.0-0, libfuse2, dmsetup, sudo, libpcsclite1, pcscd" )
else ()
set( CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.0-0v5, libfuse2, dmsetup, sudo, libpcsclite1, pcscd" )
endif ()
endif()
endif()
set( CPACK_DEBIAN_PACKAGE_MAINTAINER ${CONTACT} ) # mandatory
set( CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY} ) # mandatory
set( CPACK_DEBIAN_ARCHIVE_TYPE "gnutar") # mandatory
set( CPACK_DEBIAN_COMPRESSION_TYPE "gzip") # mandatory
set( CPACK_DEBIAN_PACKAGE_PRIORITY "optional" ) # mandatory
set( CPACK_DEBIAN_PACKAGE_SECTION "libs" ) # recommended, Section relative to Debian sections (https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections)
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${DEBIAN_PREINST};${DEBIAN_POSTINST};${DEBIAN_PRERM};${DEBIAN_POSTRM})
set(CPACK_DEBIAN_PACKAGE_CONFLICTS "${CONFLICT_PACKAGE}")
-elseif ( ( PLATFORM STREQUAL "CentOS" ) OR ( PLATFORM STREQUAL "openSUSE" ) )
+elseif ( ( PLATFORM STREQUAL "CentOS" ) OR ( PLATFORM STREQUAL "openSUSE" ) OR ( PLATFORM STREQUAL "Fedora" ))
# RPM control script(s)
file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Packaging/rpm-control)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Packaging/rpm-control/prerm.sh ${CMAKE_CURRENT_BINARY_DIR}/Packaging/rpm-control/prerm.sh)
set( RPM_PRERM ${CMAKE_CURRENT_BINARY_DIR}/Packaging/rpm-control/prerm.sh)
set( CPACK_GENERATOR "RPM" ) # mandatory
set( CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_SUMMARY} ) # mandatory
set( CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION} ) # mandatory
set( CPACK_RPM_PACKAGE_NAME ${CPACK_PACKAGE_NAME} ) # mandatory
set( CPACK_RPM_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}.rpm ) # mandatory
set( CPACK_RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION} ) # mandatory
set( CPACK_RPM_PACKAGE_ARCHITECTURE ${ARCHITECTURE} ) # mandatory
set( CPACK_RPM_PACKAGE_RELEASE ${CPACK_PACKAGE_RELEASE} ) # mandatory
set( CPACK_RPM_PACKAGE_LICENSE ${CPACK_PACKAGE_LICENSE} ) # mandatory
set( CPACK_RPM_PACKAGE_GROUP "Applications/System" ) # mandatory, https://fedoraproject.org/wiki/RPMGroups
set( CPACK_RPM_PACKAGE_VENDOR ${CPACK_PACKAGE_VENDOR} ) # mandatory
set( CPACK_RPM_PACKAGE_AUTOREQ "no" ) # disable automatic shared libraries dependency detection (most of the time buggy)
if (NOGUI)
set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, sudo" )
else ()
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 gtk+-3.0)
if(GTK3_FOUND)
set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk3, sudo, pcsc-lite" )
else()
set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk2, sudo, pcsc-lite" )
endif()