diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2019-12-21 02:45:08 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2019-12-21 02:46:50 +0100 |
commit | f8beac6ebd00ac8b8e1286a34dfb52ef92d7e89c (patch) | |
tree | 302821f96fe5faafb528bf56a3b8765e70ffff85 | |
parent | de52f51f5bac0a25df78c071d9038f0232b45ca6 (diff) | |
download | VeraCrypt-f8beac6ebd00ac8b8e1286a34dfb52ef92d7e89c.tar.gz VeraCrypt-f8beac6ebd00ac8b8e1286a34dfb52ef92d7e89c.zip |
Linux: Fix building and packaging console-only version to remove dependency on GTK
-rw-r--r-- | src/Build/CMakeLists.txt | 47 | ||||
-rwxr-xr-x | src/Build/build_cmake_deb.sh | 17 |
2 files changed, 41 insertions, 23 deletions
diff --git a/src/Build/CMakeLists.txt b/src/Build/CMakeLists.txt index f1a176c6..0c602f03 100644 --- a/src/Build/CMakeLists.txt +++ b/src/Build/CMakeLists.txt @@ -242,19 +242,24 @@ if ( ( PLATFORM STREQUAL "Debian" ) OR ( PLATFORM STREQUAL "Ubuntu" ) ) set( CPACK_DEBIAN_PACKAGE_RELEASE ${CPACK_PACKAGE_RELEASE} ) set( CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${ARCHITECTURE} ) # mandatory - # 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, sudo" ) - + if (NOGUI) + # We build wxWidgets statically so that we don't depend on any GTK library + set( CPACK_DEBIAN_PACKAGE_DEPENDS "libfuse2, dmsetup, sudo" ) else () - - set( CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.0-0v5, libfuse2, dmsetup, sudo" ) + # 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, sudo" ) + + else () + set( CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.0-0v5, libfuse2, dmsetup, sudo" ) + + 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 @@ -284,19 +289,23 @@ elseif ( ( PLATFORM STREQUAL "CentOS" ) OR ( PLATFORM STREQUAL "openSUSE" ) ) 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 ( PLATFORM STREQUAL "CentOS" ) + if (NOGUI) + set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, sudo" ) + else () + if ( PLATFORM STREQUAL "CentOS" ) + + if ( DEFINED WITHGTK3 AND WITHGTK3 ) + set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk3, sudo" ) + else () + set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk2, sudo" ) + endif() + + elseif ( PLATFORM STREQUAL "openSUSE" ) - if ( DEFINED WITHGTK3 AND WITHGTK3 ) - set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk3, sudo" ) - else () set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk2, sudo" ) endif() - - elseif ( PLATFORM STREQUAL "openSUSE" ) - - set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk2, sudo" ) endif() - + set( CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE ${RPM_PRERM}) # optional # Prevents CPack from generating file conflicts diff --git a/src/Build/build_cmake_deb.sh b/src/Build/build_cmake_deb.sh index 3be23dda..7b546fdd 100755 --- a/src/Build/build_cmake_deb.sh +++ b/src/Build/build_cmake_deb.sh @@ -19,15 +19,24 @@ make clean || exit 1 make || exit 1 make install DESTDIR="$PARENTDIR/VeraCrypt_Setup/GUI" || exit 1 -echo "Building console version of VeraCrypt for DEB using system wxWidgets" +echo "Building console version of VeraCrypt for DEB using wxWidgets static libraries" # This is to avoid " Error: Unable to initialize GTK+, is DISPLAY set properly?" # when building over SSH without X11 Forwarding # export DISPLAY=:0.0 -make NOGUI=1 clean || exit 1 -make NOGUI=1 || exit 1 -make NOGUI=1 install DESTDIR="$PARENTDIR/VeraCrypt_Setup/Console" || exit 1 +# The sources of wxWidgets 3.0.4 must be extracted to the parent directory +export WX_ROOT=$PARENTDIR/wxWidgets-3.0.4 +echo "Using wxWidgets sources in $WX_ROOT" + +# This will be the temporary wxWidgets directory +export WX_BUILD_DIR=$PARENTDIR/wxBuildConsole + +# To build wxWidgets without GUI +make WXSTATIC=1 NOGUI=1 wxbuild || exit 1 +make WXSTATIC=1 NOGUI=1 clean || exit 1 +make WXSTATIC=1 NOGUI=1 || exit 1 +make WXSTATIC=1 NOGUI=1 install DESTDIR="$PARENTDIR/VeraCrypt_Setup/Console" || exit 1 echo "Creating VeraCrypt DEB packages" |