diff options
Diffstat (limited to 'src/Build')
-rw-r--r-- | src/Build/CMakeLists.txt | 68 | ||||
-rw-r--r-- | src/Build/Include/Makefile.inc | 20 | ||||
-rw-r--r-- | src/Build/Resources/MacOSX/Info.plist.legacy.xml | 2 | ||||
-rw-r--r-- | src/Build/Resources/MacOSX/Info.plist.xml | 4 | ||||
-rwxr-xr-x | src/Build/Tools/MacOSX/yasm | bin | 892672 -> 1696040 bytes | |||
-rwxr-xr-x | src/Build/build_cmake_deb.sh | 130 | ||||
-rw-r--r-- | src/Build/build_cmake_opensuse.sh | 65 | ||||
-rw-r--r-- | src/Build/build_cmake_rpm.sh (renamed from src/Build/build_cmake_rpm_gtk2.sh) | 61 | ||||
-rw-r--r-- | src/Build/build_cmake_rpm_gtk3.sh | 75 | ||||
-rwxr-xr-x | src/Build/build_veracrypt_freebsd.sh | 54 | ||||
-rwxr-xr-x | src/Build/build_veracrypt_linux.sh | 53 | ||||
-rw-r--r-- | src/Build/build_veracrypt_linux_gtk3.sh | 47 | ||||
-rwxr-xr-x | src/Build/build_veracrypt_linux_no_sse2.sh | 53 | ||||
-rwxr-xr-x | src/Build/build_veracrypt_macosx.sh | 146 | ||||
-rw-r--r-- | src/Build/sign_rpm.sh | 54 |
15 files changed, 536 insertions, 296 deletions
diff --git a/src/Build/CMakeLists.txt b/src/Build/CMakeLists.txt index 255e3c27..e3426495 100644 --- a/src/Build/CMakeLists.txt +++ b/src/Build/CMakeLists.txt @@ -9,12 +9,12 @@ if ( NOT DEFINED VERACRYPT_BUILD_DIR ) 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.8" ) -set( VERSION "1.26.8" ) +set( FULL_VERSION "1.26.20" ) +set( VERSION "1.26.20" ) set( RELEASE "1" ) # - Set PROJECT_NAME and CONFLICT_PACKAGE values if (NOGUI) set( PROJECT_NAME "veracrypt-console" ) @@ -109,10 +109,19 @@ if ( UNIX ) 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") @@ -126,10 +135,12 @@ if ( UNIX ) 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}) @@ -162,11 +173,11 @@ if ( PLATFORM STREQUAL "Debian" OR PLATFORM STREQUAL "Ubuntu" ) 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 () @@ -239,21 +250,46 @@ if ( ( PLATFORM STREQUAL "Debian" ) OR ( PLATFORM STREQUAL "Ubuntu" ) ) 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 + # -- Use a distro-specific version string to avoid repository conflicts -- + # e.g. 1.26.17-1~deb11, 1.26.17-1~deb12, 1.26.17-1~ubuntu20.04, etc. + if (PLATFORM STREQUAL "Ubuntu") + # For something like "24.04", it becomes 1.26.17-1~ubuntu24.04 + set(CPACK_DEBIAN_PACKAGE_VERSION + "${VERSION}-${RELEASE}~ubuntu${PLATFORM_VERSION}") + else() # Debian + # Usually just take the major number from e.g. "11.7" => "11" + string(REGEX MATCH "^[0-9]+" PLATFORM_VERSION_MAJOR "${PLATFORM_VERSION}") + set(CPACK_DEBIAN_PACKAGE_VERSION + "${VERSION}-${RELEASE}~deb${PLATFORM_VERSION_MAJOR}") + endif() + 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 - set( CPACK_DEBIAN_PACKAGE_DEPENDS "libfuse2, dmsetup, sudo, libpcsclite1, pcscd" ) + # 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 - if ( ( ( PLATFORM STREQUAL "Debian" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "12" ) ) + # 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" ) ) @@ -280,11 +316,11 @@ if ( ( PLATFORM STREQUAL "Debian" ) OR ( PLATFORM STREQUAL "Ubuntu" ) ) 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) @@ -303,21 +339,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 (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, pcsc-lite" ) - else () - set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk2, sudo, pcsc-lite" ) - endif() - - elseif ( PLATFORM STREQUAL "openSUSE" ) - - set( CPACK_RPM_PACKAGE_REQUIRES "fuse, device-mapper, gtk2, sudo, pcsc-lite" ) + 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 diff --git a/src/Build/Include/Makefile.inc b/src/Build/Include/Makefile.inc index b7ed20c9..281d206a 100644 --- a/src/Build/Include/Makefile.inc +++ b/src/Build/Include/Makefile.inc @@ -12,11 +12,11 @@ $(NAME): $(NAME).a clean: @echo Cleaning $(NAME) - rm -f $(APPNAME) $(NAME).a $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJSSSE41) $(OBJSSSSE3) $(OBJS:.o=.d) $(OBJSEX:.oo=.d) $(OBJSNOOPT:.o0=.d) $(OBJSSSE41:.osse41=.d) $(OBJSSSSE3:.ossse3=.d) *.gch + rm -f $(APPNAME) $(NAME).a $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJSHANI) $(OBJSSSE41) $(OBJSSSSE3) $(OBJARMV8CRYPTO) $(OBJS:.o=.d) $(OBJSEX:.oo=.d) $(OBJSNOOPT:.o0=.d) $(OBJSHANI:.oshani=.d) $(OBJSSSE41:.osse41=.d) $(OBJSSSSE3:.ossse3=.d) $(OBJARMV8CRYPTO:.oarmv8crypto=.d) *.gch %.o: %.c @echo Compiling $(<F) $(CC) $(CFLAGS) -c $< -o $@ @@ -25,22 +25,34 @@ clean: $(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 $@ +%.oarmv8crypto: %.c + @echo Compiling $(<F) + $(CC) $(CFLAGS) -march=armv8-a+crypto -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 $@ @@ -86,12 +98,12 @@ TR_SED_BIN := tr '\n' ' ' | tr -s ' ' ',' | sed -e 's/^,//g' -e 's/,$$/n/' | tr @echo Converting $(<F) $(OD_BIN) $< | $(TR_SED_BIN) >$@ # Dependencies --include $(OBJS:.o=.d) $(OBJSEX:.oo=.d) $(OBJSNOOPT:.o0=.d) $(OBJSSSE41:.osse41=.d) $(OBJSSSSE3:.ossse3=.d) +-include $(OBJS:.o=.d) $(OBJSEX:.oo=.d) $(OBJSNOOPT:.o0=.d) $(OBJSHANI:.oshani=.d) $(OBJSSSE41:.osse41=.d) $(OBJSSSSE3:.ossse3=.d) $(OBJARMV8CRYPTO:.oarmv8crypto=.d) -$(NAME).a: $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJSSSE41) $(OBJSSSSE3) +$(NAME).a: $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJSHANI) $(OBJSSSE41) $(OBJSSSSE3) $(OBJARMV8CRYPTO) @echo Updating library $@ - $(AR) $(AFLAGS) -rcu $@ $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJSSSE41) $(OBJSSSSE3) + $(AR) $(AFLAGS) -rc $@ $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJSHANI) $(OBJSSSE41) $(OBJSSSSE3) $(OBJARMV8CRYPTO) $(RANLIB) $@ diff --git a/src/Build/Resources/MacOSX/Info.plist.legacy.xml b/src/Build/Resources/MacOSX/Info.plist.legacy.xml index ccb97831..5b9ced6e 100644 --- a/src/Build/Resources/MacOSX/Info.plist.legacy.xml +++ b/src/Build/Resources/MacOSX/Info.plist.legacy.xml @@ -72,11 +72,11 @@ <key>CFBundleSignature</key> <string>TRUE</string> <key>CFBundleVersion</key> - <string>1.26.8</string> + <string>_VERSION_</string> <key>CFBundleShortVersionString</key> <string>_VERSION_</string> <key>CFBundleLongVersionString</key> diff --git a/src/Build/Resources/MacOSX/Info.plist.xml b/src/Build/Resources/MacOSX/Info.plist.xml index ec190b59..04ed21c1 100644 --- a/src/Build/Resources/MacOSX/Info.plist.xml +++ b/src/Build/Resources/MacOSX/Info.plist.xml @@ -72,20 +72,20 @@ <key>CFBundleSignature</key> <string>TRUE</string> <key>CFBundleVersion</key> - <string>1.26.8</string> + <string>_VERSION_</string> <key>CFBundleShortVersionString</key> <string>_VERSION_</string> <key>CFBundleLongVersionString</key> <string>VeraCrypt _VERSION_</string> <key>LSMinimumSystemVersion</key> - <string>10.9.0</string> + <string>12.0.0</string> <key>LSRequiresCarbon</key> <false/> <key>CSResourcesFileMapped</key> 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 index a6263a90..8bceb886 100755 --- a/src/Build/build_cmake_deb.sh +++ b/src/Build/build_cmake_deb.sh @@ -1,8 +1,8 @@ #!/bin/sh # -# Copyright (c) 2013-2022 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. # @@ -16,71 +16,99 @@ 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/../../..") -# The sources of wxWidgets 3.2.2.1 must be extracted to the parent directory -export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1 -echo "Using wxWidgets sources in $WX_ROOT" - -cd $SOURCEPATH - -if [ "$#" = "1" ] && [ "$1" = "WXSTATIC" ] -then -echo "Building GUI version of VeraCrypt for DEB using wxWidgets static libraries" - -# This will be the temporary wxWidgets directory -export WX_BUILD_DIR=$PARENTDIR/wxBuildGUI - -# To build wxWidgets without GUI -make WXSTATIC=1 wxbuild || exit 1 -make WXSTATIC=1 clean || exit 1 -make WXSTATIC=1 || exit 1 -make WXSTATIC=1 install DESTDIR="$PARENTDIR/VeraCrypt_Setup/GUI" || exit 1 - +# 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 - -echo "Building GUI version of VeraCrypt for DEB using system wxWidgets" -make clean || exit 1 - -if [ "$#" = "1" ] && [ "$1" = "INDICATOR" ] -then - -make INDICATOR=1 || exit 1 -make INDICATOR=1 install DESTDIR="$PARENTDIR/VeraCrypt_Setup/GUI" || exit 1 - -else - -make || exit 1 -make install DESTDIR="$PARENTDIR/VeraCrypt_Setup/GUI" || exit 1 - + # 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 -fi +# The sources of wxWidgets 3.2.5 must be extracted to the parent directory +export WX_ROOT=$PARENTDIR/wxWidgets-3.2.5 -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 +cd $SOURCEPATH -# This will be the temporary wxWidgets directory -export WX_BUILD_DIR=$PARENTDIR/wxBuildConsole +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 -# 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 "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 -mkdir -p $PARENTDIR/VeraCrypt_Packaging/Console +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 +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 index 622eb4cd..13a75bec 100644 --- a/src/Build/build_cmake_opensuse.sh +++ b/src/Build/build_cmake_opensuse.sh @@ -1,8 +1,8 @@ #!/bin/sh # -# Copyright (c) 2013-2022 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. # @@ -16,62 +16,81 @@ 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/../../..") -# The sources of wxWidgets 3.2.2.1 must be extracted to the parent directory -export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1 -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 for RPM using wxWidgets static libraries" # This will be the temporary wxWidgets directory export WX_BUILD_DIR=$PARENTDIR/wxBuildGui -# To build wxWidgets using GTK-2 -make WXSTATIC=1 wxbuild || exit 1 -ln -s $WX_BUILD_DIR/lib $WX_BUILD_DIR/lib64 +# 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 -# Uncomment below and comment lines above to reuse existing wxWidgets build -# 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 -# To build wxWidgets using GTK-2 -make WXSTATIC=1 NOGUI=1 wxbuild || exit 1 -ln -s $WX_BUILD_DIR/lib $WX_BUILD_DIR/lib64 +# 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 -# Uncomment below and comment lines above to reuse existing wxWidgets build -# 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 GTK-2 -cmake -H$SCRIPTPATH -B$PARENTDIR/VeraCrypt_Packaging/GUI -DVERACRYPT_BUILD_DIR="$PARENTDIR/VeraCrypt_Setup/GUI" -DWITHGTK3=FALSE -DNOGUI=FALSE || exit 1 +# 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" -DWITHGTK3=FALSE -DNOGUI=TRUE || 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_gtk2.sh b/src/Build/build_cmake_rpm.sh index 3f33cc1c..ba6ea355 100644 --- a/src/Build/build_cmake_rpm_gtk2.sh +++ b/src/Build/build_cmake_rpm.sh @@ -1,8 +1,8 @@ #!/bin/sh # -# Copyright (c) 2013-2022 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. # @@ -16,60 +16,79 @@ 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/../../..") -# The sources of wxWidgets 3.2.2.1 must be extracted to the parent directory -export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1 -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 for RPM using wxWidgets static libraries" # This will be the temporary wxWidgets directory export WX_BUILD_DIR=$PARENTDIR/wxBuildGui -# To build wxWidgets using GTK-2 -make WXSTATIC=1 wxbuild || exit 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 install DESTDIR="$PARENTDIR/VeraCrypt_Setup/GUI" || exit 1 -# Uncomment below and comment lines above to reuse existing wxWidgets build -# 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 -# To build wxWidgets using GTK-2 -make WXSTATIC=1 NOGUI=1 wxbuild || exit 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 install DESTDIR="$PARENTDIR/VeraCrypt_Setup/Console" || exit 1 -# Uncomment below and comment lines above to reuse existing wxWidgets build -# 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 GTK-2 -cmake -H$SCRIPTPATH -B$PARENTDIR/VeraCrypt_Packaging/GUI -DVERACRYPT_BUILD_DIR="$PARENTDIR/VeraCrypt_Setup/GUI" -DWITHGTK3=FALSE -DNOGUI=FALSE || exit 1 +# 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" -DWITHGTK3=FALSE -DNOGUI=TRUE || 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_gtk3.sh b/src/Build/build_cmake_rpm_gtk3.sh deleted file mode 100644 index 72556dcf..00000000 --- a/src/Build/build_cmake_rpm_gtk3.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2013-2022 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/../../..") - -# The sources of wxWidgets 3.2.2.1 must be extracted to the parent directory -export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1 -echo "Using wxWidgets sources in $WX_ROOT" - -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 - -# To build wxWidgets using GTK-3 -make WXSTATIC=1 WITHGTK3=1 wxbuild || exit 1 -make WXSTATIC=1 clean || exit 1 -make WXSTATIC=1 || exit 1 -make WXSTATIC=1 install DESTDIR="$PARENTDIR/VeraCrypt_Setup/GUI" || exit 1 - -# Uncomment below and comment lines above to reuse existing wxWidgets build -# 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 - -# To build wxWidgets using GTK-3 -make WXSTATIC=1 WITHGTK3=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 - -# Uncomment below and comment lines above to reuse existing wxWidgets build -# 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 GTK-3 -cmake -H$SCRIPTPATH -B$PARENTDIR/VeraCrypt_Packaging/GUI -DVERACRYPT_BUILD_DIR="$PARENTDIR/VeraCrypt_Setup/GUI" -DWITHGTK3=TRUE -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" -DWITHGTK3=TRUE -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 index 176c8499..892a7eed 100755 --- a/src/Build/build_veracrypt_freebsd.sh +++ b/src/Build/build_veracrypt_freebsd.sh @@ -1,8 +1,8 @@ #!/bin/sh # -# Copyright (c) 2013-2022 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. # @@ -13,36 +13,60 @@ 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 +# 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.2.1 must be extracted to the parent directory -export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1 -echo "Using wxWidgets sources in $WX_ROOT" +# 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 -gmake WXSTATIC=1 wxbuild && gmake WXSTATIC=1 clean && gmake WXSTATIC=1 && gmake WXSTATIC=1 package +# 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 -# Uncomment below and comment line above to reuse existing wxWidgets build -#gmake WXSTATIC=1 clean && gmake WXSTATIC=1 && gmake WXSTATIC=1 package +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 -gmake WXSTATIC=1 NOGUI=1 wxbuild && gmake WXSTATIC=1 NOGUI=1 clean && gmake WXSTATIC=1 NOGUI=1 && gmake WXSTATIC=1 NOGUI=1 package - -# Uncomment below and comment line above to reuse existing wxWidgets build -#gmake WXSTATIC=1 NOGUI=1 clean && gmake WXSTATIC=1 NOGUI=1 && gmake WXSTATIC=1 NOGUI=1 package +# 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 fa928556..b6ac39ed 100755 --- a/src/Build/build_veracrypt_linux.sh +++ b/src/Build/build_veracrypt_linux.sh @@ -1,7 +1,7 @@ # -# Copyright (c) 2013-2022 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. # @@ -18,30 +18,59 @@ PARENTDIR=$(readlink -f "$SCRIPTPATH/../../..") if [ "$(id -u)" != "0" ]; then echo "VeraCrypt must be built by root" 1>&2 exit 1 fi -# the sources of wxWidgets 3.2.2.1 must be extracted to the parent directory -export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1 -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 && make WXSTATIC=1 package - -# Uncomment below and comment line above to reuse existing wxWidgets build -# make WXSTATIC=1 clean && make WXSTATIC=1 && make WXSTATIC=1 package +# 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 && make WXSTATIC=1 NOGUI=1 package - -# Uncomment below and comment line above to reuse existing wxWidgets build -# make WXSTATIC=1 NOGUI=1 clean && make WXSTATIC=1 NOGUI=1 && make WXSTATIC=1 NOGUI=1 package +# 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_gtk3.sh b/src/Build/build_veracrypt_linux_gtk3.sh deleted file mode 100644 index bae6a856..00000000 --- a/src/Build/build_veracrypt_linux_gtk3.sh +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright (c) 2013-2022 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 - -# the sources of wxWidgets 3.2.2.1 must be extracted to the parent directory -export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1 -echo "Using wxWidgets sources in $WX_ROOT" - -cd $SOURCEPATH - -echo "Building GUI version of VeraCrypt" - -# this will be the temporary wxWidgets directory -export WX_BUILD_DIR=$PARENTDIR/wxBuildGui - -make WXSTATIC=1 WITHGTK3=1 wxbuild && make WXSTATIC=1 clean && make WXSTATIC=1 && make WXSTATIC=1 package - -# Uncomment below and comment line above to reuse existing wxWidgets build -#make WXSTATIC=1 clean && make WXSTATIC=1 && make WXSTATIC=1 package - -echo "Building console version of VeraCrypt" - -# this will be the temporary wxWidgets directory -export WX_BUILD_DIR=$PARENTDIR/wxBuildConsole - -make WXSTATIC=1 WITHGTK3=1 NOGUI=1 wxbuild && make WXSTATIC=1 NOGUI=1 clean && make WXSTATIC=1 NOGUI=1 && make WXSTATIC=1 NOGUI=1 package - -# Uncomment below and comment line above to reuse existing wxWidgets build -#make WXSTATIC=1 NOGUI=1 clean && make WXSTATIC=1 NOGUI=1 && make WXSTATIC=1 NOGUI=1 package diff --git a/src/Build/build_veracrypt_linux_no_sse2.sh b/src/Build/build_veracrypt_linux_no_sse2.sh index f68641b9..6f0739c7 100755 --- a/src/Build/build_veracrypt_linux_no_sse2.sh +++ b/src/Build/build_veracrypt_linux_no_sse2.sh @@ -1,7 +1,7 @@ # -# Copyright (c) 2013-2022 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. # @@ -18,30 +18,59 @@ PARENTDIR=$(readlink -f "$SCRIPTPATH/../../..") if [ "$(id -u)" != "0" ]; then echo "VeraCrypt must be built by root" 1>&2 exit 1 fi -# the sources of wxWidgets 3.2.2.1 must be extracted to the parent directory -export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1 -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/wxBuildGuiNoSSE2 -make WXSTATIC=1 NOSSE2=1 wxbuild && make WXSTATIC=1 NOSSE2=1 clean && make WXSTATIC=1 NOSSE2=1 && make WXSTATIC=1 NOSSE2=1 package - -# Uncomment below and comment line above to reuse existing wxWidgets build -# make WXSTATIC=1 NOSSE2=1 clean && make WXSTATIC=1 NOSSE2=1 && make WXSTATIC=1 NOSSE2=1 package +# 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 -make WXSTATIC=1 NOGUI=1 NOSSE2=1 wxbuild && make WXSTATIC=1 NOGUI=1 NOSSE2=1 clean && make WXSTATIC=1 NOGUI=1 NOSSE2=1 && make WXSTATIC=1 NOGUI=1 NOSSE2=1 package - -# Uncomment below and comment line above to reuse existing wxWidgets build -# make WXSTATIC=1 NOGUI=1 NOSSE2=1 clean && make WXSTATIC=1 NOGUI=1 NOSSE2=1 && make WXSTATIC=1 NOGUI=1 NOSSE2=1 package +# 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 12899620..13302442 100755 --- a/src/Build/build_veracrypt_macosx.sh +++ b/src/Build/build_veracrypt_macosx.sh @@ -1,34 +1,150 @@ +#!/usr/bin/env bash + # -# Copyright (c) 2013-2019 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) + +# Default wxWidgets version +DEFAULT_WX_VERSION="3.2.5" +WX_VERSION="$DEFAULT_WX_VERSION" + +# 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) -# the sources of wxWidgets 3.1.2 must be extracted to the parent directory (for night mode) -export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1 -echo "Using wxWidgets sources in $WX_ROOT" +if [ "$fuset" = true ]; then + echo "Building VeraCrypt with FUSE-T support" +else + echo "Building VeraCrypt with MacFUSE support" +fi + +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-3.2.2.1 +export WX_BUILD_DIR="$PARENTDIR/wxBuild-$WX_VERSION" -# define the SDK version to use and OSX minimum target. We target 10.9 by default +# define the SDK version to use and OSX minimum target. We target 12 by default export VC_OSX_TARGET=12 -export VC_OSX_SDK=13 +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=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 +# 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 +echo "VeraCrypt build completed successfully." 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 |