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.txt62
1 files changed, 36 insertions, 26 deletions
diff --git a/src/Build/CMakeLists.txt b/src/Build/CMakeLists.txt
index e59cf7ad..1a34e3fe 100644
--- a/src/Build/CMakeLists.txt
+++ b/src/Build/CMakeLists.txt
@@ -53,21 +53,22 @@ endif( )
# - Detect OSX, CentOS, Debian, Ubuntu or openSUSE platform of the build system
# The following variable(s) will be set
-# $PLATFORM Debian Ubuntu CentOS openSUSE
+# $PLATFORM Debian Ubuntu CentOS openSUSE (TODO)
# $PLATFORM_VERSION
# 9.x 16.04 7.X 42.3
# 10.X 18.04 8.X 15.0
+# ... ... ... ...
# $DISTRO_NAME ${PLATFORM}-${PLATFORM_VERSION}
if ( UNIX )
# /etc/debian_version exists for both Debian and Ubuntu
- if(EXISTS "/etc/debian_version")
+ if(EXISTS "/etc/debian_version")
set ( PLATFORM "Debian" )
# Read lsb-release to get flavour name and flavour release version (only supported one for now is Ubuntu)
if(EXISTS "/etc/lsb-release")
-
+
file(READ "/etc/lsb-release" LSB_RELEASE_ID)
string(REGEX MATCH "DISTRIB_ID=([a-zA-Z0-9 /\\.]+)" _ ${LSB_RELEASE_ID})
set(FULL_FLAVOUR ${CMAKE_MATCH_1})
@@ -83,22 +84,18 @@ if ( UNIX )
else()
file(READ "/etc/debian_version" DEBIAN_RELEASE)
- string(REGEX MATCH "[a-zA-Z0-9 /\\.]+" _ ${DEBIAN_RELEASE})
+ string(REGEX MATCH "([0-9]+\\.[0-9]+)" _ ${DEBIAN_RELEASE})
set(PLATFORM_VERSION ${CMAKE_MATCH_1})
- if( PLATFORM_VERSION STREQUAL "stretch/sid" )
- set( PLATFORM_VERSION "9" )
- endif( PLATFORM_VERSION STREQUAL "stretch/sid" )
-
endif()
# Get debian release version
elseif(EXISTS "/etc/debian_version")
-
+
file(READ "/etc/debian_version" DEBIAN_RELEASE)
- string(REGEX MATCH "[a-zA-Z0-9 /\\.]+" _ ${DEBIAN_RELEASE})
+ string(REGEX MATCH "([0-9]+\\.[0-9]+)" _ ${DEBIAN_RELEASE})
set(PLATFORM_VERSION ${CMAKE_MATCH_1})
-
+
endif()
# Get centos release version
@@ -158,30 +155,24 @@ if ( PLATFORM STREQUAL "Debian" OR PLATFORM STREQUAL "Ubuntu" )
elseif (SUFFIX STREQUAL "64")
SET(ARCHITECTURE amd64)
endif()
- else(NOT DPKG_CMD)
+ else( )
execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
- endif(NOT DPKG_CMD)
+ endif( )
elseif ( ( PLATFORM STREQUAL "CentOS" ) OR ( PLATFORM STREQUAL "openSUSE" ) )
execute_process(COMMAND arch OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
-elseif ( PLATFORM STREQUAL "OSX" )
+else ()
- if ( UNIVERSAL )
- set ( ARCHITECTURE "Univesal-Binary" )
- else ( UNIVERSAL )
- # arch reports Intel using the i386 label rather than intel
- # We use uname -m instead
- execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
- endif( UNIVERSAL )
+ 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/
+# 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 /)
@@ -261,16 +252,27 @@ if ( ( PLATFORM STREQUAL "Debian" ) OR ( PLATFORM STREQUAL "Ubuntu" ) )
set( CPACK_DEBIAN_PACKAGE_RELEASE ${CPACK_PACKAGE_RELEASE} )
set( CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${ARCHITECTURE} ) # mandatory
- set( CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.0-0v5, libfuse2, dmsetup")
+ # Link against gtk3 version of wxWidgets if >= Debian 10 or >= Ubuntu 18.04
+ # Otherwise, link against gtk2 version of wxWidgets
+ if ( ( ( 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, libfuse2, dmsetup" )
+
+ else ()
+
+ set( CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.0-0v5, libfuse2, dmsetup" )
+
+ 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, to do, Section relative to Debian sections (https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections)
+ 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})
+ set(CPACK_DEBIAN_PACKAGE_CONFLICTS "${CONFLICT_PACKAGE}")
elseif ( ( PLATFORM STREQUAL "CentOS" ) OR ( PLATFORM STREQUAL "openSUSE" ) )
@@ -293,9 +295,17 @@ elseif ( ( PLATFORM STREQUAL "CentOS" ) OR ( PLATFORM STREQUAL "openSUSE" ) )
set( CPACK_RPM_PACKAGE_AUTOREQ "no" ) # disable automatic shared libraries dependency detection (most of the time buggy)
if ( PLATFORM STREQUAL "CentOS" )
- set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk3")
+
+ if ( DEFINED WITHGTK3 AND WITHGTK3 )
+ set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk3" )
+ else ()
+ set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk2" )
+ endif()
+
elseif ( PLATFORM STREQUAL "openSUSE" )
+
# TODO
+
endif()
set( CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE ${RPM_PRERM}) # optional