diff options
Diffstat (limited to 'src/Build')
-rw-r--r-- | src/Build/CMakeLists.txt | 361 | ||||
-rw-r--r-- | src/Build/Include/Makefile.inc | 46 | ||||
-rw-r--r-- | src/Build/Packaging/debian-control/prerm | 9 | ||||
-rw-r--r-- | src/Build/Packaging/rpm-control/prerm.sh | 9 | ||||
-rw-r--r-- | src/Build/Resources/MacOSX/Info.plist.legacy.xml | 106 | ||||
-rw-r--r-- | src/Build/Resources/MacOSX/Info.plist.xml | 5 | ||||
-rwxr-xr-x | src/Build/Tools/MacOSX/nasm | bin | 1818752 -> 0 bytes | |||
-rwxr-xr-x | src/Build/Tools/MacOSX/yasm | bin | 892672 -> 1696040 bytes | |||
-rwxr-xr-x | src/Build/build_cmake_deb.sh | 114 | ||||
-rw-r--r-- | src/Build/build_cmake_opensuse.sh | 96 | ||||
-rw-r--r-- | src/Build/build_cmake_rpm.sh | 94 | ||||
-rwxr-xr-x | src/Build/build_veracrypt_freebsd.sh | 72 | ||||
-rwxr-xr-x | src/Build/build_veracrypt_linux.sh | 53 | ||||
-rwxr-xr-x | src/Build/build_veracrypt_linux_no_sse2.sh | 76 | ||||
-rwxr-xr-x | src/Build/build_veracrypt_macosx.sh | 149 | ||||
-rwxr-xr-x | src/Build/build_veracrypt_macosx_legacy.sh | 33 | ||||
-rw-r--r-- | src/Build/sign_rpm.sh | 54 |
17 files changed, 1241 insertions, 36 deletions
diff --git a/src/Build/CMakeLists.txt b/src/Build/CMakeLists.txt new file mode 100644 index 00000000..b8a7c8ad --- /dev/null +++ b/src/Build/CMakeLists.txt @@ -0,0 +1,361 @@ +# - Minimum CMake version +cmake_minimum_required(VERSION 2.8.0) + +# - Obligatory parameters +# -DVERACRYPT_BUILD_DIR : folder that contains 'usr' folder +# -DNOGUI : TRUE if building 'Console' version, 'FALSE' if building 'GUI' version +if ( NOT DEFINED VERACRYPT_BUILD_DIR ) + MESSAGE(FATAL_ERROR "VERACRYPT_BUILD_DIR variable MUST BE set to the path of the folder which contains 'usr' folder") +elseif ( NOT DEFINED NOGUI ) + MESSAGE(FATAL_ERROR "NOGUI variable MUST BE set to TRUE if building 'Console' version, 'FALSE' otherwise") +endif() + +# - Set version of the package +set( FULL_VERSION "1.26.17" ) +set( VERSION "1.26.17" ) +set( RELEASE "1" ) + +# - Set PROJECT_NAME and CONFLICT_PACKAGE values +if (NOGUI) + set( PROJECT_NAME "veracrypt-console" ) + set( CONFLICT_PACKAGE "veracrypt" ) +else() + set( PROJECT_NAME "veracrypt" ) + set( CONFLICT_PACKAGE "veracrypt-console" ) +endif() +project(${PROJECT_NAME}) + +# - Check whether 'Tcdefs.h' and 'License.txt' exist +if(NOT EXISTS "$ENV{SOURCEPATH}/Common/Tcdefs.h") + MESSAGE(FATAL_ERROR "Tcdefs.h does not exist.") +elseif(NOT EXISTS "$ENV{SOURCEPATH}/License.txt") + MESSAGE(FATAL_ERROR "License.txt does not exist.") +endif() + +# - Detect build system bitness +# The following variable will be set +# $SUFFIX 32 64 +# $CMAKE_SYSTEM_NAME Windows Linux Darwin +# N.B : +# To build for 32-bit under 64-bit, set 'CMAKE_SIZEOF_VOID_P' to '4' +if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) + + # Build System is under 64-bit arch + set (SUFFIX "64") + MESSAGE(STATUS "Build System = ${CMAKE_SYSTEM_NAME} - Bitness : 64-bit - Compiler : ${CMAKE_CXX_COMPILER_ID}") + +elseif( CMAKE_SIZEOF_VOID_P EQUAL 4 ) + + # Build System is under 32-bit arch + set (SUFFIX "32") + MESSAGE(STATUS "Build System = ${CMAKE_SYSTEM_NAME} - Bitness : 32-bit - Compiler : ${CMAKE_CXX_COMPILER_ID}") + +else( ) + + MESSAGE(FATAL_ERROR "Could not detect system bitness") + +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 (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") + + 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}) + + if (FULL_FLAVOUR MATCHES "^.*Ubuntu.*$") + + set ( PLATFORM "Ubuntu" ) + + 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" ) 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 + DESTINATION . + USE_SOURCE_PERMISSIONS) +install(DIRECTORY ${VERACRYPT_BUILD_DIR}/usr/share + DESTINATION . + USE_SOURCE_PERMISSIONS) +set(CPACK_PACKAGING_INSTALL_PREFIX "/usr") + +# For packaging +# CPack will first install into ${CPACK_PACKAGE_DIRECTORY}/_CPack_Packages/<system_name>/DEB,RPM/${CPACK_PACKAGE_NAME}/${CPACK_PACKAGING_INSTALL_PREFIX} +# See https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/PackageGenerators +# See https://cmake.org/cmake/help/latest/cpack_gen/deb.html +# See https://cmake.org/cmake/help/latest/cpack_gen/rpm.html +# + +# Installation scripts should be provided in this order +# PREINST;POSTINST;PRERM;POSTRM + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Packaging) # creates the Packaging directory under build directory when CMake generates the build system + +set( VENDOR "IDRIX" ) +set( LICENSE "VeraCrypt License" ) +set( CONTACT "VeraCrypt Team <veracrypt@idrix.fr>" ) +set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Disk encryption with strong security based on TrueCrypt." ) +set( CPACK_PACKAGE_DESCRIPTION "This package contains binaries for VeraCrypt, a disk encryption with strong security based on TrueCrypt." ) +set( CPACK_PACKAGE_NAME ${PROJECT_NAME} ) +set( CPACK_PACKAGE_VERSION ${VERSION} ) +set( CPACK_PACKAGE_RELEASE ${RELEASE} ) +set( CPACK_PACKAGE_VENDOR ${VENDOR} ) +set( CPACK_PACKAGE_LICENSE ${LICENSE} ) +set( CPACK_RESOURCE_FILE_LICENSE "$ENV{SOURCEPATH}/License.txt") +set( CPACK_PACKAGE_CONTACT ${CONTACT} ) +set( CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${FULL_VERSION}-${DISTRO_NAME}-${ARCHITECTURE} ) +set( CPACK_PACKAGE_CHECKSUM SHA256 ) +set( CPACK_PACKAGE_RELOCATABLE "OFF") # Disable package relocation (especially for rpm) +set( CPACK_PACKAGE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Packaging ) + +if ( ( PLATFORM STREQUAL "Debian" ) OR ( PLATFORM STREQUAL "Ubuntu" ) ) + + # Debian control script(s) + file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Packaging/debian-control) + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Packaging/debian-control/prerm ${CMAKE_CURRENT_BINARY_DIR}/Packaging/debian-control/prerm) + set( DEBIAN_PRERM ${CMAKE_CURRENT_BINARY_DIR}/Packaging/debian-control/prerm) + + set( CPACK_GENERATOR "DEB" ) # mandatory + set( CPACK_DEBIAN_PACKAGE_NAME ${CPACK_PACKAGE_NAME} ) # mandatory + set( CPACK_DEBIAN_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}.deb ) # mandatory + set( CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION} ) # mandatory + set( CPACK_DEBIAN_PACKAGE_RELEASE ${CPACK_PACKAGE_RELEASE} ) + set( CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${ARCHITECTURE} ) # mandatory + + if (NOGUI) + # Link against statically built wxWidgets so that we don't depend on any GTK library + # In case of Ubuntu 24.04/ Debian 13 or newer, libfuse2 package was renamed libfuse2t64 + if ( ( ( PLATFORM STREQUAL "Debian" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "13" ) ) + OR ( ( PLATFORM STREQUAL "Ubuntu" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "24.04" ) ) ) + set( CPACK_DEBIAN_PACKAGE_DEPENDS "libfuse2t64, dmsetup, sudo, libpcsclite1, pcscd" ) + else () + set( CPACK_DEBIAN_PACKAGE_DEPENDS "libfuse2, dmsetup, sudo, libpcsclite1, pcscd" ) + endif() + else () + # Link against gtk3 version of wxWidgets if >= Debian 10 or >= Ubuntu 18.04 + # Otherwise, link against gtk2 version of wxWidgets + # In case of Ubuntu 24.04, we depend on libfuse2t64 instead of libfuse2 and we link statically against wxWidgets + # because there is a bug in wxWidgets that ships with Ubuntu 24.04 and which was fixed in wxWidgets 3.2.5 + if ( ( ( PLATFORM STREQUAL "Debian" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "13" ) ) + OR ( ( PLATFORM STREQUAL "Ubuntu" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "24.04" ) ) ) + + set( CPACK_DEBIAN_PACKAGE_DEPENDS "libgtk-3-0t64, libayatana-appindicator3-1, libfuse2t64, dmsetup, sudo, libpcsclite1, pcscd" ) + + elseif ( ( ( PLATFORM STREQUAL "Debian" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "12" ) ) + 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" ) 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() + endif() + + set( CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE ${RPM_PRERM}) # optional + + # Prevents CPack from generating file conflicts + # This is to avoid having %dir of these directories in the .spec file + set( CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr" ) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/bin" ) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/sbin" ) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share" ) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/applications" ) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/doc" ) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/mime" ) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/mime/packages" ) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/pixmaps" ) + + set( CPACK_RPM_PACKAGE_RELOCATABLE "OFF" ) + set( CPACK_RPM_PACKAGE_CONFLICTS "${CONFLICT_PACKAGE}") + +endif() + +include(CPack) diff --git a/src/Build/Include/Makefile.inc b/src/Build/Include/Makefile.inc index 9a38dcee..0f68df36 100644 --- a/src/Build/Include/Makefile.inc +++ b/src/Build/Include/Makefile.inc @@ -3,9 +3,9 @@ # Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed # by the TrueCrypt License 3.0. # # Modifications and additions to the original source code (contained in this file) -# and all other portions of this file are Copyright (c) 2013-2016 IDRIX +# and all other portions of this file are Copyright (c) 2013-2017 IDRIX # and are governed by the Apache License 2.0 the full text of which is # contained in the file License.txt included in VeraCrypt binary and source # code distribution packages. # @@ -13,27 +13,55 @@ $(NAME): $(NAME).a clean: @echo Cleaning $(NAME) - rm -f $(APPNAME) $(NAME).a $(OBJS) $(OBJSEX) $(OBJS:.o=.d) *.gch + rm -f $(APPNAME) $(NAME).a $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJSHANI) $(OBJSSSE41) $(OBJSSSSE3) $(OBJS:.o=.d) $(OBJSEX:.oo=.d) $(OBJSNOOPT:.o0=.d) $(OBJSHANI:.oshani=.d) $(OBJSSSE41:.osse41=.d) $(OBJSSSSE3:.ossse3=.d) *.gch %.o: %.c @echo Compiling $(<F) $(CC) $(CFLAGS) -c $< -o $@ +%.o0: %.c + @echo Compiling $(<F) + $(CC) $(CFLAGS) -O0 -c $< -o $@ + +%.osse41: %.c + @echo Compiling $(<F) + $(CC) $(CFLAGS) -mssse3 -msse4.1 -c $< -o $@ + +%.oshani: %.c + @echo Compiling $(<F) + $(CC) $(CFLAGS) -mssse3 -msse4.1 -msha -c $< -o $@ + +%.ossse3: %.c + @echo Compiling $(<F) + $(CC) $(CFLAGS) -mssse3 -c $< -o $@ + %.o: %.cpp @echo Compiling $(<F) $(CXX) $(CXXFLAGS) -c $< -o $@ +%.osse41: %.cpp + @echo Compiling $(<F) + $(CXX) $(CXXFLAGS) -mssse3 -msse4.1 -c $< -o $@ + +%.oshani: %.cpp + @echo Compiling $(<F) + $(CXX) $(CXXFLAGS) -mssse3 -msse4.1 -msha -c $< -o $@ + +%.ossse3: %.cpp + @echo Compiling $(<F) + $(CXX) $(CXXFLAGS) -mssse3 -c $< -o $@ + %.o: %.S @echo Compiling $(<F) $(CC) $(CFLAGS) -c $< -o $@ ifeq "$(PLATFORM)" "MacOSX" %.o: %.asm @echo Assembling $(<F) - $(AS) $(ASFLAGS) -f macho32 -o $@.32 $< - $(AS) $(ASFLAGS) -f macho64 -o $@.64 $< + $(AS) $(ASFLAGS32) -f macho32 -o $@.32 $< + $(AS) $(ASFLAGS64) -f macho64 -o $@.64 $< lipo -create $@.32 $@.64 -output $@ else %.o: %.asm @echo Assembling $(<F) @@ -46,9 +74,13 @@ endif $(CXX) $(CXXFLAGS) -g0 -c $< || (rm -f $(<F).gch && exit 1) # Embedded files +ifeq "$(PLATFORM)" "OpenBSD" +OD_BIN := ggod -v -t u1 -A n +else OD_BIN := od -v -t u1 -A n +endif TR_SED_BIN := tr '\n' ' ' | tr -s ' ' ',' | sed -e 's/^,//g' -e 's/,$$/n/' | tr 'n' '\n' %.xml.h: %.xml @echo Converting $(<F) @@ -63,11 +95,11 @@ TR_SED_BIN := tr '\n' ' ' | tr -s ' ' ',' | sed -e 's/^,//g' -e 's/,$$/n/' | tr $(OD_BIN) $< | $(TR_SED_BIN) >$@ # Dependencies --include $(OBJS:.o=.d) $(OBJSEX:.oo=.d) +-include $(OBJS:.o=.d) $(OBJSEX:.oo=.d) $(OBJSNOOPT:.o0=.d) $(OBJSHANI:.oshani=.d) $(OBJSSSE41:.osse41=.d) $(OBJSSSSE3:.ossse3=.d) -$(NAME).a: $(OBJS) $(OBJSEX) +$(NAME).a: $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJSHANI) $(OBJSSSE41) $(OBJSSSSE3) @echo Updating library $@ - $(AR) $(AFLAGS) -rcu $@ $(OBJS) $(OBJSEX) + $(AR) $(AFLAGS) -rc $@ $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJSHANI) $(OBJSSSE41) $(OBJSSSSE3) $(RANLIB) $@ diff --git a/src/Build/Packaging/debian-control/prerm b/src/Build/Packaging/debian-control/prerm new file mode 100644 index 00000000..d2e3894e --- /dev/null +++ b/src/Build/Packaging/debian-control/prerm @@ -0,0 +1,9 @@ +#!/bin/sh +V="$(mount | grep veracrypt_aux_mnt)" +if [ ! -z "$V" ] +then + echo "Error: All VeraCrypt volumes must be dismounted first." >&2 + exit 1 +else + exit 0 +fi
\ No newline at end of file diff --git a/src/Build/Packaging/rpm-control/prerm.sh b/src/Build/Packaging/rpm-control/prerm.sh new file mode 100644 index 00000000..d2e3894e --- /dev/null +++ b/src/Build/Packaging/rpm-control/prerm.sh @@ -0,0 +1,9 @@ +#!/bin/sh +V="$(mount | grep veracrypt_aux_mnt)" +if [ ! -z "$V" ] +then + echo "Error: All VeraCrypt volumes must be dismounted first." >&2 + exit 1 +else + exit 0 +fi
\ No newline at end of file diff --git a/src/Build/Resources/MacOSX/Info.plist.legacy.xml b/src/Build/Resources/MacOSX/Info.plist.legacy.xml new file mode 100644 index 00000000..5b9ced6e --- /dev/null +++ b/src/Build/Resources/MacOSX/Info.plist.legacy.xml @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> +<plist version="0.9"> +<dict> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + + <key>CFBundleIdentifier</key> + <string>org.idrix.VeraCrypt</string> + + <key>UTExportedTypeDeclarations</key> + <array> + <dict> + <key>UTTypeIdentifier</key> + <string>org.idrix.veracrypt.hc</string> + + <key>UTTypeDescription</key> + <string>VeraCrypt Container File</string> + + <key>UTTypeConformsTo</key> + <array> + <string>public.data</string> + </array> + + <key>UTTypeTagSpecification</key> + <dict> + <key>public.filename-extension</key> + <array> + <string>hc</string> + <string>tc</string> + </array> + + <key>public.mime-type</key> + <string>application/veracrypt</string> + </dict> + </dict> + </array> + + <key>CFBundleDocumentTypes</key> + <array> + <dict> + <key>CFBundleTypeIconFile</key> + <string>VeraCrypt_Volume.icns</string> + <key>CFBundleTypeName</key> + <string>VeraCrypt Container File</string> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>LSHandlerRank</key> + <string>Owner</string> + <key>LSItemContentTypes</key> + <array> + <!-- my app supports files with my custom extension (see UTExportedTypeDeclarations) --> + <string>org.idrix.veracrypt.hc</string> + </array> + </dict> + </array> + + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + + <key>CFBundleExecutable</key> + <string>VeraCrypt</string> + + <key>CFBundleIconFile</key> + <string>VeraCrypt.icns</string> + + <key>CFBundleName</key> + <string>VeraCrypt</string> + + <key>CFBundlePackageType</key> + <string>APPL</string> + + <key>CFBundleSignature</key> + <string>TRUE</string> + + <key>CFBundleVersion</key> + <string>_VERSION_</string> + + <key>CFBundleShortVersionString</key> + <string>_VERSION_</string> + + <key>CFBundleLongVersionString</key> + <string>VeraCrypt _VERSION_</string> + + <key>LSArchitecturePriority</key> + <array> + <string>x86_64</string> + <string>i386</string> + </array> + + <key>LSMinimumSystemVersion</key> + <string>10.7.0</string> + + <key>LSRequiresCarbon</key> + <false/> + + <key>CSResourcesFileMapped</key> + <true/> + + <key>NSHighResolutionCapable</key> + <true/> + + <key>NSPrincipalClass</key> + <string>NSApplication</string> +</dict> +</plist> diff --git a/src/Build/Resources/MacOSX/Info.plist.xml b/src/Build/Resources/MacOSX/Info.plist.xml index 3186c226..04ed21c1 100644 --- a/src/Build/Resources/MacOSX/Info.plist.xml +++ b/src/Build/Resources/MacOSX/Info.plist.xml @@ -73,16 +73,19 @@ <key>CFBundleSignature</key> <string>TRUE</string> <key>CFBundleVersion</key> - <string>1.20.2</string> + <string>_VERSION_</string> <key>CFBundleShortVersionString</key> <string>_VERSION_</string> <key>CFBundleLongVersionString</key> <string>VeraCrypt _VERSION_</string> + <key>LSMinimumSystemVersion</key> + <string>12.0.0</string> + <key>LSRequiresCarbon</key> <false/> <key>CSResourcesFileMapped</key> diff --git a/src/Build/Tools/MacOSX/nasm b/src/Build/Tools/MacOSX/nasm Binary files differdeleted file mode 100755 index 7d2c38ac..00000000 --- a/src/Build/Tools/MacOSX/nasm +++ /dev/null diff --git a/src/Build/Tools/MacOSX/yasm b/src/Build/Tools/MacOSX/yasm Binary files differindex d17889a9..36a9c0d4 100755 --- a/src/Build/Tools/MacOSX/yasm +++ b/src/Build/Tools/MacOSX/yasm diff --git a/src/Build/build_cmake_deb.sh b/src/Build/build_cmake_deb.sh new file mode 100755 index 00000000..8bceb886 --- /dev/null +++ b/src/Build/build_cmake_deb.sh @@ -0,0 +1,114 @@ +#!/bin/sh +# +# Copyright (c) 2013-2024 IDRIX +# Governed by the Apache License 2.0 the full text of which is contained +# in the file License.txt included in VeraCrypt binary and source +# code distribution packages. +# + +# Errors should cause script to exit +set -e + +# Absolute path to this script +export SCRIPT=$(readlink -f "$0") +# Absolute path this script is in +export SCRIPTPATH=$(dirname "$SCRIPT") +# Source directory which contains the Makefile +export SOURCEPATH=$(readlink -f "$SCRIPTPATH/..") +# Directory where the VeraCrypt has been checked out +export PARENTDIR=$(readlink -f "$SCRIPTPATH/../../..") + +# Check the condition of wxBuildConsole and wxWidgets-3.2.5 in the original PARENTDIR +if [ -d "$PARENTDIR/wxBuildConsole" ]; then + echo "Using existing PARENTDIR: $PARENTDIR, wxBuildConsole is present." +elif [ -d "$PARENTDIR/wxWidgets-3.2.5" ]; then + echo "Using existing PARENTDIR: $PARENTDIR, wxWidgets-3.2.5 is present." +else + # Change PARENTDIR to /tmp and check conditions again + export PARENTDIR="/tmp" + if [ -d "$PARENTDIR/wxBuildConsole" ]; then + echo "Switched to PARENTDIR: /tmp, wxBuildConsole is present in /tmp." + elif [ -d "$PARENTDIR/wxWidgets-3.2.5" ]; then + echo "Switched to PARENTDIR: /tmp, wxWidgets-3.2.5 is present in /tmp." + else + echo "Error: Neither wxBuildConsole nor wxWidgets-3.2.5 found in /tmp. Exiting." + exit 1 + fi +fi + +# The sources of wxWidgets 3.2.5 must be extracted to the parent directory +export WX_ROOT=$PARENTDIR/wxWidgets-3.2.5 + +cd $SOURCEPATH + +build_and_install() { + target=$1 + wxstatic=$2 + indicator=$3 + nogui="" + + # Determine wxWidgets build directory based on target + if [ "$target" = "Console" ]; then + export WX_BUILD_DIR="$PARENTDIR/wxBuildConsole" + nogui="NOGUI=1" + else + export WX_BUILD_DIR="$PARENTDIR/wxBuildGUI" + fi + + wxstatic_value="" + if [ "$wxstatic" = "WXSTATIC" ]; then + wxstatic_value="WXSTATIC=1" + # Check if wx-config exists in WX_BUILD_DIR + if [ -L "${WX_BUILD_DIR}/wx-config" ]; then + echo "wx-config already exists in ${WX_BUILD_DIR}. Skipping wxbuild." + else + echo "Using wxWidgets sources in $WX_ROOT" + make $wxstatic_value $nogui wxbuild || exit 1 + fi + fi + + indicator_value="" + if [ "$indicator" = "INDICATOR" ]; then + indicator_value="INDICATOR=1" + fi + + make $wxstatic_value $indicator_value $nogui clean || exit 1 + make $wxstatic_value $indicator_value $nogui || exit 1 + make $wxstatic_value $indicator_value $nogui install DESTDIR="$PARENTDIR/VeraCrypt_Setup/$target" || exit 1 +} + +# Handle arguments +case "$1$2" in +"WXSTATIC") + echo "Building GUI version of VeraCrypt for DEB using wxWidgets static libraries" + build_and_install "GUI" "WXSTATIC" "" + ;; +"INDICATOR") + echo "Building GUI version of VeraCrypt for DEB using system wxWidgets and indicator" + build_and_install "GUI" "" "INDICATOR" + ;; +"WXSTATICINDICATOR"|"INDICATORWXSTATIC") + echo "Building GUI version of VeraCrypt for DEB using wxWidgets static libraries and indicator" + build_and_install "GUI" "WXSTATIC" "INDICATOR" + ;; +*) + echo "Building GUI version of VeraCrypt for DEB using system wxWidgets" + build_and_install "GUI" "" "" + ;; +esac + +echo "Building console version of VeraCrypt for DEB using wxWidgets static libraries" +build_and_install "Console" "WXSTATIC" "" + +echo "Creating VeraCrypt DEB packages" + +# -DCPACK_RPM_PACKAGE_DEBUG=TRUE for debugging cpack DEB +# -DCPACK_RPM_PACKAGE_DEBUG=TRUE for debugging cpack DEB + +mkdir -p $PARENTDIR/VeraCrypt_Packaging/{GUI,Console} + +cmake -H$SCRIPTPATH -B$PARENTDIR/VeraCrypt_Packaging/GUI -DVERACRYPT_BUILD_DIR="$PARENTDIR/VeraCrypt_Setup/GUI" -DNOGUI=FALSE || exit 1 +cpack --config $PARENTDIR/VeraCrypt_Packaging/GUI/CPackConfig.cmake || exit 1 + +cmake -H$SCRIPTPATH -B$PARENTDIR/VeraCrypt_Packaging/Console -DVERACRYPT_BUILD_DIR="$PARENTDIR/VeraCrypt_Setup/Console" -DNOGUI=TRUE || exit 1 +cpack --config $PARENTDIR/VeraCrypt_Packaging/Console/CPackConfig.cmake || exit 1 diff --git a/src/Build/build_cmake_opensuse.sh b/src/Build/build_cmake_opensuse.sh new file mode 100644 index 00000000..13a75bec --- /dev/null +++ b/src/Build/build_cmake_opensuse.sh @@ -0,0 +1,96 @@ +#!/bin/sh +# +# Copyright (c) 2013-2024 IDRIX +# Governed by the Apache License 2.0 the full text of which is contained +# in the file License.txt included in VeraCrypt binary and source +# code distribution packages. +# + +# Errors should cause script to exit +set -e + +# Absolute path to this script +export SCRIPT=$(readlink -f "$0") +# Absolute path this script is in +export SCRIPTPATH=$(dirname "$SCRIPT") +# Source directory which contains the Makefile +export SOURCEPATH=$(readlink -f "$SCRIPTPATH/..") +# Directory where the VeraCrypt has been checked out +export PARENTDIR=$(readlink -f "$SCRIPTPATH/../../..") + +# Check the condition of wxBuildConsole and wxWidgets-3.2.5 in the original PARENTDIR +if [ -d "$PARENTDIR/wxBuildConsole" ]; then + echo "Using existing PARENTDIR: $PARENTDIR, wxBuildConsole is present." +elif [ -d "$PARENTDIR/wxWidgets-3.2.5" ]; then + echo "Using existing PARENTDIR: $PARENTDIR, wxWidgets-3.2.5 is present." +else + # Change PARENTDIR to /tmp and check conditions again + export PARENTDIR="/tmp" + if [ -d "$PARENTDIR/wxBuildConsole" ]; then + echo "Switched to PARENTDIR: /tmp, wxBuildConsole is present in /tmp." + elif [ -d "$PARENTDIR/wxWidgets-3.2.5" ]; then + echo "Switched to PARENTDIR: /tmp, wxWidgets-3.2.5 is present in /tmp." + else + echo "Error: Neither wxBuildConsole nor wxWidgets-3.2.5 found in /tmp. Exiting." + exit 1 + fi +fi + +# The sources of wxWidgets 3.2.5 must be extracted to the parent directory +export WX_ROOT=$PARENTDIR/wxWidgets-3.2.5 + +cd $SOURCEPATH + +echo "Building GUI version of VeraCrypt for RPM using wxWidgets static libraries" + +# This will be the temporary wxWidgets directory +export WX_BUILD_DIR=$PARENTDIR/wxBuildGui + +# Check if wx-config exists in WX_BUILD_DIR +if [ -L "${WX_BUILD_DIR}/wx-config" ]; then + echo "wx-config already exists in ${WX_BUILD_DIR}. Skipping wxbuild." +else + echo "Using wxWidgets sources in $WX_ROOT" + make WXSTATIC=1 wxbuild || exit 1 + ln -s $WX_BUILD_DIR/lib $WX_BUILD_DIR/lib64 +fi + +make WXSTATIC=1 clean || exit 1 +make WXSTATIC=1 || exit 1 +make WXSTATIC=1 install DESTDIR="$PARENTDIR/VeraCrypt_Setup/GUI" || exit 1 + +echo "Building console version of VeraCrypt for RPM 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 + +# This will be the temporary wxWidgets directory +export WX_BUILD_DIR=$PARENTDIR/wxBuildConsole + +# Check if wx-config exists in WX_BUILD_DIR +if [ -L "${WX_BUILD_DIR}/wx-config" ]; then + echo "wx-config already exists in ${WX_BUILD_DIR}. Skipping wxbuild." +else + echo "Using wxWidgets sources in $WX_ROOT" + make WXSTATIC=1 NOGUI=1 wxbuild || exit 1 + ln -s $WX_BUILD_DIR/lib $WX_BUILD_DIR/lib64 +fi + +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 RPM packages " + +# -DCPACK_RPM_PACKAGE_DEBUG=TRUE for debugging cpack RPM +# -DCPACK_RPM_PACKAGE_DEBUG=TRUE for debugging cpack RPM + +mkdir -p $PARENTDIR/VeraCrypt_Packaging/GUI +mkdir -p $PARENTDIR/VeraCrypt_Packaging/Console + +# wxWidgets was built using native GTK version +cmake -H$SCRIPTPATH -B$PARENTDIR/VeraCrypt_Packaging/GUI -DVERACRYPT_BUILD_DIR="$PARENTDIR/VeraCrypt_Setup/GUI" -DNOGUI=FALSE || exit 1 +cpack --config $PARENTDIR/VeraCrypt_Packaging/GUI/CPackConfig.cmake || exit 1 +cmake -H$SCRIPTPATH -B$PARENTDIR/VeraCrypt_Packaging/Console -DVERACRYPT_BUILD_DIR="$PARENTDIR/VeraCrypt_Setup/Console" -DNOGUI=TRUE || exit 1 +cpack --config $PARENTDIR/VeraCrypt_Packaging/Console/CPackConfig.cmake|| exit 1 diff --git a/src/Build/build_cmake_rpm.sh b/src/Build/build_cmake_rpm.sh new file mode 100644 index 00000000..ba6ea355 --- /dev/null +++ b/src/Build/build_cmake_rpm.sh @@ -0,0 +1,94 @@ +#!/bin/sh +# +# Copyright (c) 2013-2024 IDRIX +# Governed by the Apache License 2.0 the full text of which is contained +# in the file License.txt included in VeraCrypt binary and source +# code distribution packages. +# + +# Errors should cause script to exit +set -e + +# Absolute path to this script +export SCRIPT=$(readlink -f "$0") +# Absolute path this script is in +export SCRIPTPATH=$(dirname "$SCRIPT") +# Source directory which contains the Makefile +export SOURCEPATH=$(readlink -f "$SCRIPTPATH/..") +# Directory where the VeraCrypt has been checked out +export PARENTDIR=$(readlink -f "$SCRIPTPATH/../../..") + +# Check the condition of wxBuildConsole and wxWidgets-3.2.5 in the original PARENTDIR +if [ -d "$PARENTDIR/wxBuildConsole" ]; then + echo "Using existing PARENTDIR: $PARENTDIR, wxBuildConsole is present." +elif [ -d "$PARENTDIR/wxWidgets-3.2.5" ]; then + echo "Using existing PARENTDIR: $PARENTDIR, wxWidgets-3.2.5 is present." +else + # Change PARENTDIR to /tmp and check conditions again + export PARENTDIR="/tmp" + if [ -d "$PARENTDIR/wxBuildConsole" ]; then + echo "Switched to PARENTDIR: /tmp, wxBuildConsole is present in /tmp." + elif [ -d "$PARENTDIR/wxWidgets-3.2.5" ]; then + echo "Switched to PARENTDIR: /tmp, wxWidgets-3.2.5 is present in /tmp." + else + echo "Error: Neither wxBuildConsole nor wxWidgets-3.2.5 found in /tmp. Exiting." + exit 1 + fi +fi + +# The sources of wxWidgets 3.2.5 must be extracted to the parent directory +export WX_ROOT=$PARENTDIR/wxWidgets-3.2.5 + +cd $SOURCEPATH + +echo "Building GUI version of VeraCrypt for RPM using wxWidgets static libraries" + +# This will be the temporary wxWidgets directory +export WX_BUILD_DIR=$PARENTDIR/wxBuildGui + +# Check if wx-config exists in WX_BUILD_DIR +if [ -L "${WX_BUILD_DIR}/wx-config" ]; then + echo "wx-config already exists in ${WX_BUILD_DIR}. Skipping wxbuild." +else + echo "Using wxWidgets sources in $WX_ROOT" + make WXSTATIC=1 wxbuild || exit 1 +fi + +make WXSTATIC=1 clean || exit 1 +make WXSTATIC=1 || exit 1 +make WXSTATIC=1 install DESTDIR="$PARENTDIR/VeraCrypt_Setup/GUI" || exit 1 + +echo "Building console version of VeraCrypt for RPM 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 + +# This will be the temporary wxWidgets directory +export WX_BUILD_DIR=$PARENTDIR/wxBuildConsole + +# Check if wx-config exists in WX_BUILD_DIR +if [ -L "${WX_BUILD_DIR}/wx-config" ]; then + echo "wx-config already exists in ${WX_BUILD_DIR}. Skipping wxbuild." +else + echo "Using wxWidgets sources in $WX_ROOT" + make WXSTATIC=1 NOGUI=1 wxbuild || exit 1 +fi + +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 RPM packages " + +# -DCPACK_RPM_PACKAGE_DEBUG=TRUE for debugging cpack RPM +# -DCPACK_RPM_PACKAGE_DEBUG=TRUE for debugging cpack RPM + +mkdir -p $PARENTDIR/VeraCrypt_Packaging/GUI +mkdir -p $PARENTDIR/VeraCrypt_Packaging/Console + +# wxWidgets was built using native GTK version +cmake -H$SCRIPTPATH -B$PARENTDIR/VeraCrypt_Packaging/GUI -DVERACRYPT_BUILD_DIR="$PARENTDIR/VeraCrypt_Setup/GUI" -DNOGUI=FALSE || exit 1 +cpack --config $PARENTDIR/VeraCrypt_Packaging/GUI/CPackConfig.cmake || exit 1 +cmake -H$SCRIPTPATH -B$PARENTDIR/VeraCrypt_Packaging/Console -DVERACRYPT_BUILD_DIR="$PARENTDIR/VeraCrypt_Setup/Console" -DNOGUI=TRUE || exit 1 +cpack --config $PARENTDIR/VeraCrypt_Packaging/Console/CPackConfig.cmake || exit 1 diff --git a/src/Build/build_veracrypt_freebsd.sh b/src/Build/build_veracrypt_freebsd.sh new file mode 100755 index 00000000..892a7eed --- /dev/null +++ b/src/Build/build_veracrypt_freebsd.sh @@ -0,0 +1,72 @@ +#!/bin/sh +# +# Copyright (c) 2013-2024 IDRIX +# Governed by the Apache License 2.0 the full text of which is contained +# in the file License.txt included in VeraCrypt binary and source +# code distribution packages. +# + +# Absolute path to this script +SCRIPT=$(readlink -f "$0") +# Absolute path this script is in +SCRIPTPATH=$(dirname "$SCRIPT") +# source directory which contains the Makefile +SOURCEPATH=$(readlink -f "$SCRIPTPATH/..") +# directory where the VeraCrypt has been checked out +PARENTDIR=$(readlink -f "$SCRIPTPATH/../../..") + +# Check the condition of wxBuildConsole and wxWidgets-3.2.5 in the original PARENTDIR +if [ -d "$PARENTDIR/wxBuildConsole" ]; then + echo "Using existing PARENTDIR: $PARENTDIR, wxBuildConsole is present." +elif [ -d "$PARENTDIR/wxWidgets-3.2.5" ]; then + echo "Using existing PARENTDIR: $PARENTDIR, wxWidgets-3.2.5 is present." +else + # Change PARENTDIR to /tmp and check conditions again + export PARENTDIR="/tmp" + if [ -d "$PARENTDIR/wxBuildConsole" ]; then + echo "Switched to PARENTDIR: /tmp, wxBuildConsole is present in /tmp." + elif [ -d "$PARENTDIR/wxWidgets-3.2.5" ]; then + echo "Switched to PARENTDIR: /tmp, wxWidgets-3.2.5 is present in /tmp." + else + echo "Error: Neither wxBuildConsole nor wxWidgets-3.2.5 found in /tmp. Exiting." + exit 1 + fi +fi + +# The sources of wxWidgets 3.2.5 must be extracted to the parent directory +export WX_ROOT=$PARENTDIR/wxWidgets-3.2.5 + +cd $SOURCEPATH + +echo "Building GUI version of VeraCrypt" + +# this will be the temporary wxWidgets directory +export WX_BUILD_DIR=$PARENTDIR/wxBuildGui + +# Check if wx-config exists in WX_BUILD_DIR +if [ -L "${WX_BUILD_DIR}/wx-config" ]; then + echo "wx-config already exists in ${WX_BUILD_DIR}. Skipping wxbuild." +else + echo "Using wxWidgets sources in $WX_ROOT" + gmake WXSTATIC=1 wxbuild || exit 1 +fi + +gmake WXSTATIC=1 clean || exit 1 +gmake WXSTATIC=1 || exit 1 +gmake WXSTATIC=1 package || exit 1 + +echo "Building console version of VeraCrypt" + +# this will be the temporary wxWidgets directory +export WX_BUILD_DIR=$PARENTDIR/wxBuildConsole + +# Check if wx-config exists in WX_BUILD_DIR +if [ -L "${WX_BUILD_DIR}/wx-config" ]; then + echo "wx-config already exists in ${WX_BUILD_DIR}. Skipping wxbuild." +else + echo "Using wxWidgets sources in $WX_ROOT" + gmake WXSTATIC=1 NOGUI=1 wxbuild || exit 1 +fi +gmake WXSTATIC=1 NOGUI=1 clean || exit 1 +gmake WXSTATIC=1 NOGUI=1 || exit 1 +gmake WXSTATIC=1 NOGUI=1 package || exit 1 diff --git a/src/Build/build_veracrypt_linux.sh b/src/Build/build_veracrypt_linux.sh index 0b90e692..b6ac39ed 100755 --- a/src/Build/build_veracrypt_linux.sh +++ b/src/Build/build_veracrypt_linux.sh @@ -1,6 +1,6 @@ # -# Copyright (c) 2013-2016 IDRIX +# Copyright (c) 2013-2024 IDRIX # Governed by the Apache License 2.0 the full text of which is contained # in the file License.txt included in VeraCrypt binary and source # code distribution packages. # @@ -19,29 +19,58 @@ if [ "$(id -u)" != "0" ]; then echo "VeraCrypt must be built by root" 1>&2 exit 1 fi -# the sources of wxWidgets 3.0.2 must be extracted to the parent directory -export WX_ROOT=$PARENTDIR/wxWidgets-3.0.2 -echo "Using wxWidgets sources in $WX_ROOT" +# Check the condition of wxBuildConsole and wxWidgets-3.2.5 in the original PARENTDIR +if [ -d "$PARENTDIR/wxBuildConsole" ]; then + echo "Using existing PARENTDIR: $PARENTDIR, wxBuildConsole is present." +elif [ -d "$PARENTDIR/wxWidgets-3.2.5" ]; then + echo "Using existing PARENTDIR: $PARENTDIR, wxWidgets-3.2.5 is present." +else + # Change PARENTDIR to /tmp and check conditions again + export PARENTDIR="/tmp" + if [ -d "$PARENTDIR/wxBuildConsole" ]; then + echo "Switched to PARENTDIR: /tmp, wxBuildConsole is present in /tmp." + elif [ -d "$PARENTDIR/wxWidgets-3.2.5" ]; then + echo "Switched to PARENTDIR: /tmp, wxWidgets-3.2.5 is present in /tmp." + else + echo "Error: Neither wxBuildConsole nor wxWidgets-3.2.5 found in /tmp. Exiting." + exit 1 + fi +fi + +# The sources of wxWidgets 3.2.5 must be extracted to the parent directory +export WX_ROOT=$PARENTDIR/wxWidgets-3.2.5 cd $SOURCEPATH echo "Building GUI version of VeraCrypt" # this will be the temporary wxWidgets directory export WX_BUILD_DIR=$PARENTDIR/wxBuildGui -make WXSTATIC=1 wxbuild && make WXSTATIC=1 clean && make WXSTATIC=1 - -# Uncomment below and comment line above to reuse existing wxWidgets build -# make WXSTATIC=1 clean && make WXSTATIC=1 +# Check if wx-config exists in WX_BUILD_DIR +if [ -L "${WX_BUILD_DIR}/wx-config" ]; then + echo "wx-config already exists in ${WX_BUILD_DIR}. Skipping wxbuild." +else + echo "Using wxWidgets sources in $WX_ROOT" + make WXSTATIC=1 wxbuild || exit 1 +fi +make WXSTATIC=1 clean || exit 1 +make WXSTATIC=1 || exit 1 +make WXSTATIC=1 package || exit 1 echo "Building console version of VeraCrypt" # this will be the temporary wxWidgets directory export WX_BUILD_DIR=$PARENTDIR/wxBuildConsole -make WXSTATIC=1 NOGUI=1 wxbuild && make WXSTATIC=1 NOGUI=1 clean && make WXSTATIC=1 NOGUI=1 - -# Uncomment below and comment line above to reuse existing wxWidgets build -# make WXSTATIC=1 NOGUI=1 clean && make WXSTATIC=1 NOGUI=1 +# Check if wx-config exists in WX_BUILD_DIR +if [ -L "${WX_BUILD_DIR}/wx-config" ]; then + echo "wx-config already exists in ${WX_BUILD_DIR}. Skipping wxbuild." +else + echo "Using wxWidgets sources in $WX_ROOT" + make WXSTATIC=1 NOGUI=1 wxbuild || exit 1 +fi +make WXSTATIC=1 NOGUI=1 clean || exit 1 +make WXSTATIC=1 NOGUI=1 || exit 1 +make WXSTATIC=1 NOGUI=1 package || exit 1 diff --git a/src/Build/build_veracrypt_linux_no_sse2.sh b/src/Build/build_veracrypt_linux_no_sse2.sh new file mode 100755 index 00000000..6f0739c7 --- /dev/null +++ b/src/Build/build_veracrypt_linux_no_sse2.sh @@ -0,0 +1,76 @@ +# +# Copyright (c) 2013-2024 IDRIX +# Governed by the Apache License 2.0 the full text of which is contained +# in the file License.txt included in VeraCrypt binary and source +# code distribution packages. +# + +# Absolute path to this script +SCRIPT=$(readlink -f "$0") +# Absolute path this script is in +SCRIPTPATH=$(dirname "$SCRIPT") +# source directory which contains the Makefile +SOURCEPATH=$(readlink -f "$SCRIPTPATH/..") +# directory where the VeraCrypt has been checked out +PARENTDIR=$(readlink -f "$SCRIPTPATH/../../..") + +# Make sure only root can run our script +if [ "$(id -u)" != "0" ]; then + echo "VeraCrypt must be built by root" 1>&2 + exit 1 +fi + +# Check the condition of wxBuildConsole and wxWidgets-3.2.5 in the original PARENTDIR +if [ -d "$PARENTDIR/wxBuildConsole" ]; then + echo "Using existing PARENTDIR: $PARENTDIR, wxBuildConsole is present." +elif [ -d "$PARENTDIR/wxWidgets-3.2.5" ]; then + echo "Using existing PARENTDIR: $PARENTDIR, wxWidgets-3.2.5 is present." +else + # Change PARENTDIR to /tmp and check conditions again + export PARENTDIR="/tmp" + if [ -d "$PARENTDIR/wxBuildConsole" ]; then + echo "Switched to PARENTDIR: /tmp, wxBuildConsole is present in /tmp." + elif [ -d "$PARENTDIR/wxWidgets-3.2.5" ]; then + echo "Switched to PARENTDIR: /tmp, wxWidgets-3.2.5 is present in /tmp." + else + echo "Error: Neither wxBuildConsole nor wxWidgets-3.2.5 found in /tmp. Exiting." + exit 1 + fi +fi + +# The sources of wxWidgets 3.2.5 must be extracted to the parent directory +export WX_ROOT=$PARENTDIR/wxWidgets-3.2.5 + +cd $SOURCEPATH + +echo "Building GUI version of VeraCrypt" + +# this will be the temporary wxWidgets directory +export WX_BUILD_DIR=$PARENTDIR/wxBuildGuiNoSSE2 + +# Check if wx-config exists in WX_BUILD_DIR +if [ -L "${WX_BUILD_DIR}/wx-config" ]; then + echo "wx-config already exists in ${WX_BUILD_DIR}. Skipping wxbuild." +else + echo "Using wxWidgets sources in $WX_ROOT" + make WXSTATIC=1 NOSSE2=1 wxbuild || exit 1 +fi +make WXSTATIC=1 NOSSE2=1 clean || exit 1 +make WXSTATIC=1 NOSSE2=1 || exit 1 +make WXSTATIC=1 NOSSE2=1 package || exit 1 + +echo "Building console version of VeraCrypt" + +# this will be the temporary wxWidgets directory +export WX_BUILD_DIR=$PARENTDIR/wxBuildConsoleNoSSE2 + +# Check if wx-config exists in WX_BUILD_DIR +if [ -L "${WX_BUILD_DIR}/wx-config" ]; then + echo "wx-config already exists in ${WX_BUILD_DIR}. Skipping wxbuild." +else + echo "Using wxWidgets sources in $WX_ROOT" + make WXSTATIC=1 NOGUI=1 NOSSE2=1 wxbuild || exit 1 +fi +make WXSTATIC=1 NOGUI=1 NOSSE2=1 clean || exit 1 +make WXSTATIC=1 NOGUI=1 NOSSE2=1 || exit 1 +make WXSTATIC=1 NOGUI=1 NOSSE2=1 package || exit diff --git a/src/Build/build_veracrypt_macosx.sh b/src/Build/build_veracrypt_macosx.sh index f8146422..13302442 100755 --- a/src/Build/build_veracrypt_macosx.sh +++ b/src/Build/build_veracrypt_macosx.sh @@ -1,33 +1,150 @@ +#!/usr/bin/env bash + # -# Copyright (c) 2013-2016 IDRIX +# Copyright (c) 2013-2024 IDRIX # Governed by the Apache License 2.0 the full text of which is contained # in the file License.txt included in VeraCrypt binary and source # code distribution packages. # +# Exit immediately if a command exits with a non-zero status +set -e + # Absolute path this script is in -SCRIPTPATH=$(cd "$(dirname "$0")"; pwd) +SCRIPTPATH=$(cd "$(dirname "$0")" && pwd) # source directory which contains the Makefile -SOURCEPATH=$(cd "$(dirname "$SCRIPTPATH/../.")"; pwd) +SOURCEPATH=$(cd "$(dirname "$SCRIPTPATH/../.")" && pwd) # directory where the VeraCrypt project has been checked out -PARENTDIR=$(cd "$(dirname "$SCRIPTPATH/../../../.")"; pwd) +PARENTDIR=$(cd "$(dirname "$SCRIPTPATH/../../../.")" && pwd) -# the sources of wxWidgets 3.0.2 must be extracted to the parent directory -export WX_ROOT=$PARENTDIR/wxWidgets-3.0.2 -echo "Using wxWidgets sources in $WX_ROOT" +# Default wxWidgets version +DEFAULT_WX_VERSION="3.2.5" +WX_VERSION="$DEFAULT_WX_VERSION" -# this will be the temporary wxWidgets directory -export WX_BUILD_DIR=$PARENTDIR/wxBuild +# Initialize flags +brew=false +package=false +fuset=false +local_build=false + +# Function to display usage information +usage() { + echo "Usage: $0 [options]" + echo "Options:" + echo " -b Use Homebrew to build with precompiled packages" + echo " -p Create a package after building" + echo " -f Build with FUSE-T support" + echo " -l Use local wxWidgets and disable universal binaries" + echo " -v <version> Specify wxWidgets version (default: $DEFAULT_WX_VERSION)" + echo " -h Display this help message" + exit 1 +} + +# Parse command-line options +while getopts "bpflv:h" flag +do + case "${flag}" in + b) brew=true;; + p) package=true;; + f) fuset=true;; + l) local_build=true;; + v) + if [ -z "$OPTARG" ]; then + echo "Error: -v requires a version argument." + usage + fi + WX_VERSION=${OPTARG} + ;; + h) usage;; + *) usage;; + esac +done + +export VC_OSX_FUSET=$([ "$fuset" = true ] && echo 1 || echo 0) + +if [ "$fuset" = true ]; then + echo "Building VeraCrypt with FUSE-T support" +else + echo "Building VeraCrypt with MacFUSE support" +fi -# define the SDK version to use. We use 10.6 by default -export VC_OSX_TARGET=10.6 -echo "Using MacOSX SDK $VC_OSX_TARGET" +if [ "$brew" = true ]; then + if ! command -v brew &> /dev/null; then + echo "Homebrew is not installed. Please install Homebrew or run without the -b flag." + exit 1 + fi + + export VC_OSX_SDK=$(xcrun --show-sdk-version) # use the latest version installed, this might fail + export VC_OSX_TARGET=${VC_OSX_SDK} + echo "Using MacOSX SDK $VC_OSX_SDK with target set to $VC_OSX_TARGET" + cd "$SOURCEPATH" + + echo "Building VeraCrypt with precompiled homebrew packages" + cellar=$(brew --cellar "wxwidgets") + version=$(brew list --versions "wxwidgets" | head -1 | awk '{print $2}') + export WX_BUILD_DIR="$cellar/$version/bin" + # skip signing and build only for local arch + export LOCAL_DEVELOPMENT_BUILD=true + # set the correct CPU arch for Makefile + export CPU_ARCH=$(uname -m) + export AS=$(which yasm) + export COMPILE_ASM=$( if [[ "$CPU_ARCH" != "arm64" ]]; then echo true; else echo false; fi ) + make clean + make + if [ "$package" = true ]; then + make package + fi + exit 0 +fi + +if [ "$local_build" = true ]; then + echo "Building VeraCrypt with local wxWidgets support and no universal binary" + export LOCAL_DEVELOPMENT_BUILD=true +fi + +# Check the condition of wxBuildConsole and wxWidgets-$WX_VERSION in the original PARENTDIR +if [ -d "$PARENTDIR/wxBuildConsole" ]; then + echo "Using existing PARENTDIR: $PARENTDIR, wxBuildConsole is present." +elif [ -d "$PARENTDIR/wxWidgets-$WX_VERSION" ]; then + echo "Using existing PARENTDIR: $PARENTDIR, wxWidgets-$WX_VERSION is present." +else + # Change PARENTDIR to /tmp and check conditions again + export PARENTDIR="/tmp" + if [ -d "$PARENTDIR/wxBuildConsole" ]; then + echo "Switched to PARENTDIR: /tmp, wxBuildConsole is present in /tmp." + elif [ -d "$PARENTDIR/wxWidgets-$WX_VERSION" ]; then + echo "Switched to PARENTDIR: /tmp, wxWidgets-$WX_VERSION is present in /tmp." + else + echo "Error: Neither wxBuildConsole nor wxWidgets-$WX_VERSION found in /tmp. Exiting." + exit 1 + fi +fi + +# The sources of wxWidgets $WX_VERSION must be extracted to the parent directory +export WX_ROOT="$PARENTDIR/wxWidgets-$WX_VERSION" + +# this will be the temporary wxWidgets directory +export WX_BUILD_DIR="$PARENTDIR/wxBuild-$WX_VERSION" +# define the SDK version to use and OSX minimum target. We target 12 by default +export VC_OSX_TARGET=12 +export VC_OSX_SDK=$(xcrun --show-sdk-version) #use the latest version installed +echo "Using MacOSX SDK $VC_OSX_SDK with target set to $VC_OSX_TARGET" -cd $SOURCEPATH +cd "$SOURCEPATH" echo "Building VeraCrypt" -make WXSTATIC=1 wxbuild && make WXSTATIC=1 clean && make WXSTATIC=1 +# Check if wx-config exists in WX_BUILD_DIR +if [ -L "${WX_BUILD_DIR}/wx-config" ]; then + echo "wx-config already exists in ${WX_BUILD_DIR}. Skipping wxbuild." +else + echo "Using wxWidgets sources in $WX_ROOT" + make WXSTATIC=FULL wxbuild +fi +make WXSTATIC=FULL clean +make WXSTATIC=FULL +if [ "$package" = true ]; then + make WXSTATIC=FULL package +fi -# Uncomment below and comment line above to reuse existing wxWidgets build -# make WXSTATIC=1 clean && make WXSTATIC=1 +echo "VeraCrypt build completed successfully." diff --git a/src/Build/build_veracrypt_macosx_legacy.sh b/src/Build/build_veracrypt_macosx_legacy.sh new file mode 100755 index 00000000..70226f2e --- /dev/null +++ b/src/Build/build_veracrypt_macosx_legacy.sh @@ -0,0 +1,33 @@ +# +# Copyright (c) 2013-2017 IDRIX +# Governed by the Apache License 2.0 the full text of which is contained +# in the file License.txt included in VeraCrypt binary and source +# code distribution packages. +# + +# Absolute path this script is in +SCRIPTPATH=$(cd "$(dirname "$0")"; pwd) +# source directory which contains the Makefile +SOURCEPATH=$(cd "$(dirname "$SCRIPTPATH/../.")"; pwd) +# directory where the VeraCrypt project has been checked out +PARENTDIR=$(cd "$(dirname "$SCRIPTPATH/../../../.")"; pwd) + +# the sources of wxWidgets 3.1.2 must be extracted to the parent directory +export WX_ROOT=$PARENTDIR/wxWidgets-3.1.2 +echo "Using wxWidgets sources in $WX_ROOT" +# this will be the temporary wxWidgets directory +export WX_BUILD_DIR=$PARENTDIR/wxBuild + +# define the SDK version to use. We use 10.7 by default +export VC_OSX_TARGET=10.7 +export VC_OSX_SDK=10.9 +echo "Using MacOSX SDK $VC_OSX_TARGET" + + +cd $SOURCEPATH + +echo "Building VeraCrypt" +make WXSTATIC=FULL wxbuild && make WXSTATIC=FULL clean && make WXSTATIC=FULL && make WXSTATIC=FULL package + +# Uncomment below and comment line above to reuse existing wxWidgets build +# make WXSTATIC=FULL clean && make WXSTATIC=FULL && make WXSTATIC=FULL package diff --git a/src/Build/sign_rpm.sh b/src/Build/sign_rpm.sh new file mode 100644 index 00000000..9abc041e --- /dev/null +++ b/src/Build/sign_rpm.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# Function to display usage information +usage() { + echo "Usage: $0 <directory>" + exit 1 +} + +# Check if a directory was provided as an argument +if [ $# -ne 1 ]; then + usage +fi + +DIRECTORY="$1" + +# Check if the specified directory exists +if [ ! -d "$DIRECTORY" ]; then + echo "Error: Directory '$DIRECTORY' does not exist." + exit 1 +fi + +# Check if there are any RPM files in the directory +shopt -s nullglob # Make the glob return an empty array if no match +rpm_files=("$DIRECTORY"/*.rpm) + +if [ ${#rpm_files[@]} -eq 0 ]; then + echo "No RPM files found in directory '$DIRECTORY'." + exit 0 +fi + +# Iterate over each RPM file in the directory +for rpm_file in "${rpm_files[@]}"; do + echo "Processing $rpm_file..." + + # Remove the existing signature if any + echo "Removing existing signature from $rpm_file (if any)..." + rpmsign --delsign "$rpm_file" || { + echo "Failed to remove signature from $rpm_file." + exit 1 + } + + # Sign the RPM file + echo "Signing $rpm_file..." + rpmsign --define "_gpg_name veracrypt@idrix.fr" \ + --define "_gpg_digest_algo sha512" \ + --define "_source_filedigest_algorithm 10" \ + --define "_binary_filedigest_algorithm 10" \ + --addsign "$rpm_file" || { + echo "Failed to sign $rpm_file. Aborting." + exit 1 + } + + echo "Successfully signed $rpm_file." +done |