VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2024-07-06 16:36:56 +0200
committerGitHub <noreply@github.com>2024-07-06 16:36:56 +0200
commitbc5c32ad14a6607e7e91fb61c09a21e70ffeac8b (patch)
tree6e1b797b6b145dc0235b017ba40616b5e08b7893
parent3095fc265a2c4104953abc664a8640efb900e897 (diff)
downloadVeraCrypt-bc5c32ad14a6607e7e91fb61c09a21e70ffeac8b.tar.gz
VeraCrypt-bc5c32ad14a6607e7e91fb61c09a21e70ffeac8b.zip
Linux: Add Github CI workflow for Linux (#1374)
* Linux/MacOSX: during build, fallback to /tmp if wxWidgets sources not found in parent directory * Linux: Add Github workflow to build .deb files and test generated binaries * Linux: fix wrong wxWidgets extract path in yaml * fix: fix wrong wxWidgets extract path in yaml * Linux: harmonize content of test volumes and update Github workflow for this * Fix corrupted test container * Linux: optimize Github workflow by caching wxBuildConsole and wxBuildGUI folders We also modify build script to detect the presence of wxBuildConsole and wxBuildGUI folders and reuse them * Remove files mistakenly added * Linux: Fix wrong test for Github workflow * Linux: use static build of wxWidgets for GUI in Github workflow * Linux: upload also .deb SHA256SUM file if it is generated in Github workflow * Linux: fix detection logic of parent folder in build scripts * Github workflow: add build_cmake_deb.sh as trigger to build-linux.yml * Github workflow: add wxWidgets source code to the cache of workflow
-rw-r--r--.github/workflows/build-linux.yml213
-rw-r--r--Tests/test.sha256.hcbin524288 -> 524288 bytes
-rw-r--r--Tests/test.sha512.hcbin524288 -> 524288 bytes
-rw-r--r--Tests/test.streebog.hcbin524288 -> 524288 bytes
-rw-r--r--Tests/test.whirlpool.hcbin524288 -> 524288 bytes
-rwxr-xr-xsrc/Build/build_cmake_deb.sh27
-rw-r--r--src/Build/build_cmake_opensuse.sh53
-rw-r--r--src/Build/build_cmake_rpm.sh49
-rwxr-xr-xsrc/Build/build_veracrypt_freebsd.sh50
-rwxr-xr-xsrc/Build/build_veracrypt_linux.sh49
-rwxr-xr-xsrc/Build/build_veracrypt_linux_no_sse2.sh49
-rwxr-xr-xsrc/Build/build_veracrypt_macosx.sh36
12 files changed, 452 insertions, 74 deletions
diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml
new file mode 100644
index 00000000..a6bb0139
--- /dev/null
+++ b/.github/workflows/build-linux.yml
@@ -0,0 +1,213 @@
+name: Build and test Linux
+
+on:
+ push:
+ branches: [ "CI" ]
+ paths:
+ - 'src/Build/Include/Makefile.inc'
+ - 'src/Build/CMakeLists.txt'
+ - 'src/Build/build_cmake_deb.sh'
+ - 'src/Common/*.h'
+ - 'src/Common/*.cpp'
+ - 'src/Common/*.c'
+ - 'src/Core/**'
+ - 'src/Crypto/**'
+ - 'src/Driver/Fuse/**'
+ - 'src/Main/**'
+ - 'src/PKCS11/**'
+ - 'src/Platform/**'
+ - 'src/Resources/**'
+ - 'src/Setup/Linux/**'
+ - 'src/Volume/**'
+ - 'src/Makefile'
+ - '.github/workflows/build-linux.yml'
+ pull_request:
+ branches: [ "CI" ]
+ paths:
+ - 'src/Build/Include/Makefile.inc'
+ - 'src/Build/CMakeLists.txt'
+ - 'src/Build/build_cmake_deb.sh'
+ - 'src/Common/*.h'
+ - 'src/Common/*.cpp'
+ - 'src/Common/*.c'
+ - 'src/Core/**'
+ - 'src/Crypto/**'
+ - 'src/Driver/Fuse/**'
+ - 'src/Main/**'
+ - 'src/PKCS11/**'
+ - 'src/Platform/**'
+ - 'src/Resources/**'
+ - 'src/Setup/Linux/**'
+ - 'src/Volume/**'
+ - 'src/Makefile'
+ - '.github/workflows/build-linux.yml'
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
+env:
+ WXWIDGETS_VERSION: 3.2.5
+
+jobs:
+ ubuntu-build:
+
+ runs-on: ubuntu-22.04
+ timeout-minutes: 30
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Generate cache key
+ id: cache-key
+ run: |
+ echo "cache_key=$(echo ${{ env.WXWIDGETS_VERSION }}-$(sha256sum src/Makefile .github/workflows/build-linux.yml | awk '{print $1}'))" >> $GITHUB_OUTPUT
+
+ - name: Cache wxBuildConsole
+ uses: actions/cache@v3
+ id: cache-wxbuildconsole
+ with:
+ path: /tmp/wxBuildConsole
+ key: wxBuildConsole-${{ steps.cache-key.outputs.cache_key }}
+
+ - name: Cache wxBuildGUI
+ uses: actions/cache@v3
+ id: cache-wxbuildgui
+ with:
+ path: /tmp/wxBuildGUI
+ key: wxBuildGUI-${{ steps.cache-key.outputs.cache_key }}
+
+ - name: Cache wxWidgets
+ uses: actions/cache@v3
+ id: cache-wxwidgets
+ with:
+ path: /tmp/wxWidgets-${{ env.WXWIDGETS_VERSION }}
+ key: wxWidgets-${{ steps.cache-key.outputs.cache_key }}
+
+ - name: Install dependencies
+ run: sudo apt-get update && sudo apt-get install -y wget tar libpcsclite-dev libfuse-dev yasm libgtk-3-dev libayatana-appindicator3-dev cmake debhelper
+
+ - name: Download and extract wxWidgets to /tmp if build folders are missing
+ if: steps.cache-wxbuildconsole.outputs.cache-hit != 'true' || steps.cache-wxbuildgui.outputs.cache-hit != 'true' || steps.cache-wxwidgets.outputs.cache-hit != 'true'
+ run: |
+ wget https://github.com/wxWidgets/wxWidgets/releases/download/v${{ env.WXWIDGETS_VERSION }}/wxWidgets-${{ env.WXWIDGETS_VERSION }}.tar.bz2 -O /tmp/wxWidgets-${{ env.WXWIDGETS_VERSION }}.tar.bz2
+ mkdir -p /tmp/wxWidgets-${{ env.WXWIDGETS_VERSION }}
+ tar -xjf /tmp/wxWidgets-${{ env.WXWIDGETS_VERSION }}.tar.bz2 -C /tmp/wxWidgets-${{ env.WXWIDGETS_VERSION }} --strip-components=1
+
+ - name: Build VeraCrypt .deb packages
+ run: |
+ chmod +x src/Build/build_cmake_deb.sh
+ src/Build/build_cmake_deb.sh WXSTATIC INDICATOR
+
+ - name: Upload GUI .deb packages
+ uses: actions/upload-artifact@v3
+ with:
+ name: veracrypt-gui-debs
+ path: /tmp/VeraCrypt_Packaging/GUI/Packaging/veracrypt-*.*
+
+ - name: Upload Console .deb packages
+ uses: actions/upload-artifact@v3
+ with:
+ name: veracrypt-console-debs
+ path: /tmp/VeraCrypt_Packaging/Console/Packaging/veracrypt-console-*.*
+
+ - name: Install and test VeraCrypt GUI .deb packages
+ run: |
+ sudo apt install -y /tmp/VeraCrypt_Packaging/GUI/Packaging/veracrypt-*.deb
+ veracrypt --text --test && veracrypt --text --version
+ sudo veracrypt --text --non-interactive Tests/test.sha256.hc --hash sha256 --slot 1 --password test --mount-options=ro
+ sudo veracrypt --text --non-interactive Tests/test.sha512.hc --hash sha512 --slot 2 --password test --mount-options=ro
+ sudo veracrypt --text --non-interactive Tests/test.streebog.hc --hash streebog --slot 3 --password test --mount-options=ro
+ sudo veracrypt --text --non-interactive Tests/test.whirlpool.hc --hash whirlpool --slot 4 --password test --mount-options=ro
+ sudo veracrypt --text --list
+ echo -n "Dummy" > /tmp/expected_content.txt
+ if cmp -s /media/veracrypt1/Dummy.txt /tmp/expected_content.txt; then
+ echo "Content of test.sha256.hc is valid."
+ else
+ echo "Content of test.sha256.hc is invalid!"
+ exit 1
+ fi
+ if cmp -s /media/veracrypt2/Dummy.txt /tmp/expected_content.txt; then
+ echo "Content of test.sha512.hc is valid."
+ else
+ echo "Content of test.sha512.hc is invalid!"
+ exit 1
+ fi
+ if cmp -s /media/veracrypt3/Dummy.txt /tmp/expected_content.txt; then
+ echo "Content of test.streebog.hc is valid."
+ else
+ echo "Content of test.streebog.hc is invalid!"
+ exit 1
+ fi
+ if cmp -s /media/veracrypt4/Dummy.txt /tmp/expected_content.txt; then
+ echo "Content of test.whirlpool.hc is valid."
+ else
+ echo "Content of test.whirlpool.hc is invalid!"
+ exit 1
+ fi
+ sudo veracrypt -d
+ sudo apt remove -y veracrypt
+
+ - name: Install and test VeraCrypt Console .deb packages
+ run: |
+ sudo apt install -y /tmp/VeraCrypt_Packaging/Console/Packaging/veracrypt-console-*.deb
+ veracrypt --test && veracrypt --version
+ sudo veracrypt --non-interactive Tests/test.sha256.hc --hash sha256 --slot 1 --password test --mount-options=ro
+ sudo veracrypt --non-interactive Tests/test.sha512.hc --hash sha512 --slot 2 --password test --mount-options=ro
+ sudo veracrypt --non-interactive Tests/test.streebog.hc --hash streebog --slot 3 --password test --mount-options=ro
+ sudo veracrypt --non-interactive Tests/test.whirlpool.hc --hash whirlpool --slot 4 --password test --mount-options=ro
+ sudo veracrypt --list
+ echo -n "Dummy" > /tmp/expected_content.txt
+ if cmp -s /media/veracrypt1/dummy.txt /tmp/expected_content.txt; then
+ echo "Content of test.sha256.hc is valid."
+ else
+ echo "Content of test.sha256.hc is invalid!"
+ exit 1
+ fi
+ if cmp -s /media/veracrypt2/dummy.txt /tmp/expected_content.txt; then
+ echo "Content of test.sha512.hc is valid."
+ else
+ echo "Content of test.sha512.hc is invalid!"
+ exit 1
+ fi
+ if cmp -s /media/veracrypt3/dummy.txt /tmp/expected_content.txt; then
+ echo "Content of test.streebog.hc is valid."
+ else
+ echo "Content of test.streebog.hc is invalid!"
+ exit 1
+ fi
+ if cmp -s /media/veracrypt4/dummy.txt /tmp/expected_content.txt; then
+ echo "Content of test.whirlpool.hc is valid."
+ else
+ echo "Content of test.whirlpool.hc is invalid!"
+ exit 1
+ fi
+ sudo veracrypt -d
+ sudo apt remove -y veracrypt-console
+
+ - name: Cleanup old caches
+ uses: actions/github-script@v6
+ if: always()
+ with:
+ github-token: ${{ secrets.WORKFLOW_TOKEN }}
+ script: |
+ const caches = await github.rest.actions.getActionsCacheList({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ })
+ for (const cache of caches.data.actions_caches) {
+ if (cache.key.startsWith('wxBuildConsole-') || cache.key.startsWith('wxBuildGUI-') || cache.key.startsWith('wxWidgets-')) {
+ if (cache.key !== `wxBuildConsole-${{ steps.cache-key.outputs.cache_key }}` &&
+ cache.key !== `wxBuildGUI-${{ steps.cache-key.outputs.cache_key }}` &&
+ cache.key !== `wxWidgets-${{ steps.cache-key.outputs.cache_key }}`) {
+ console.log(`Deleting cache with key: ${cache.key}`)
+ await github.rest.actions.deleteActionsCacheById({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ cache_id: cache.id,
+ })
+ }
+ }
+ }
+
diff --git a/Tests/test.sha256.hc b/Tests/test.sha256.hc
index 72633079..fa7d0113 100644
--- a/Tests/test.sha256.hc
+++ b/Tests/test.sha256.hc
Binary files differ
diff --git a/Tests/test.sha512.hc b/Tests/test.sha512.hc
index d8045aa6..ccafa883 100644
--- a/Tests/test.sha512.hc
+++ b/Tests/test.sha512.hc
Binary files differ
diff --git a/Tests/test.streebog.hc b/Tests/test.streebog.hc
index 569d0856..72dc93ce 100644
--- a/Tests/test.streebog.hc
+++ b/Tests/test.streebog.hc
Binary files differ
diff --git a/Tests/test.whirlpool.hc b/Tests/test.whirlpool.hc
index bfbf6c12..c46c405e 100644
--- a/Tests/test.whirlpool.hc
+++ b/Tests/test.whirlpool.hc
Binary files differ
diff --git a/src/Build/build_cmake_deb.sh b/src/Build/build_cmake_deb.sh
index 17103a61..8bceb886 100755
--- a/src/Build/build_cmake_deb.sh
+++ b/src/Build/build_cmake_deb.sh
@@ -18,9 +18,26 @@ 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
-echo "Using wxWidgets sources in $WX_ROOT"
cd $SOURCEPATH
@@ -41,7 +58,13 @@ build_and_install() {
wxstatic_value=""
if [ "$wxstatic" = "WXSTATIC" ]; then
wxstatic_value="WXSTATIC=1"
- make $wxstatic_value $nogui 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_value $nogui wxbuild || exit 1
+ fi
fi
indicator_value=""
diff --git a/src/Build/build_cmake_opensuse.sh b/src/Build/build_cmake_opensuse.sh
index 52bed78a..13a75bec 100644
--- a/src/Build/build_cmake_opensuse.sh
+++ b/src/Build/build_cmake_opensuse.sh
@@ -18,9 +18,26 @@ 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
-echo "Using wxWidgets sources in $WX_ROOT"
cd $SOURCEPATH
@@ -29,18 +46,19 @@ 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 native GTK version
-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?"
@@ -50,18 +68,19 @@ echo "Building console version of VeraCrypt for RPM using wxWidgets static libra
# This will be the temporary wxWidgets directory
export WX_BUILD_DIR=$PARENTDIR/wxBuildConsole
-# To build wxWidgets using native GTK version
-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
diff --git a/src/Build/build_cmake_rpm.sh b/src/Build/build_cmake_rpm.sh
index 938bf40f..ba6ea355 100644
--- a/src/Build/build_cmake_rpm.sh
+++ b/src/Build/build_cmake_rpm.sh
@@ -18,9 +18,26 @@ 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
-echo "Using wxWidgets sources in $WX_ROOT"
cd $SOURCEPATH
@@ -29,17 +46,18 @@ 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 native GTK version
-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?"
@@ -49,17 +67,18 @@ echo "Building console version of VeraCrypt for RPM using wxWidgets static libra
# This will be the temporary wxWidgets directory
export WX_BUILD_DIR=$PARENTDIR/wxBuildConsole
-# To build wxWidgets using native GTK version
-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
diff --git a/src/Build/build_veracrypt_freebsd.sh b/src/Build/build_veracrypt_freebsd.sh
index fe7f1f84..892a7eed 100755
--- a/src/Build/build_veracrypt_freebsd.sh
+++ b/src/Build/build_veracrypt_freebsd.sh
@@ -15,15 +15,26 @@ 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.5 must be extracted to the parent directory
+# The sources of wxWidgets 3.2.5 must be extracted to the parent directory
export WX_ROOT=$PARENTDIR/wxWidgets-3.2.5
-echo "Using wxWidgets sources in $WX_ROOT"
cd $SOURCEPATH
@@ -32,17 +43,30 @@ 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 f8c8c325..b6ac39ed 100755
--- a/src/Build/build_veracrypt_linux.sh
+++ b/src/Build/build_veracrypt_linux.sh
@@ -20,9 +20,26 @@ if [ "$(id -u)" != "0" ]; then
exit 1
fi
-# the sources of wxWidgets 3.2.5 must be extracted to the parent directory
+# 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
-echo "Using wxWidgets sources in $WX_ROOT"
cd $SOURCEPATH
@@ -31,17 +48,29 @@ 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_no_sse2.sh b/src/Build/build_veracrypt_linux_no_sse2.sh
index 5f29dc49..6f0739c7 100755
--- a/src/Build/build_veracrypt_linux_no_sse2.sh
+++ b/src/Build/build_veracrypt_linux_no_sse2.sh
@@ -20,9 +20,26 @@ if [ "$(id -u)" != "0" ]; then
exit 1
fi
-# the sources of wxWidgets 3.2.5 must be extracted to the parent directory
+# 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
-echo "Using wxWidgets sources in $WX_ROOT"
cd $SOURCEPATH
@@ -31,17 +48,29 @@ 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 aaaae8b5..5319fa6a 100755
--- a/src/Build/build_veracrypt_macosx.sh
+++ b/src/Build/build_veracrypt_macosx.sh
@@ -55,9 +55,26 @@ if [ -n "$brew" ]; then
exit 0
fi
-# the sources of wxWidgets 3.2.5 must be extracted to the parent directory (for night mode)
+# 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
-echo "Using wxWidgets sources in $WX_ROOT"
# this will be the temporary wxWidgets directory
export WX_BUILD_DIR=$PARENTDIR/wxBuild-3.2.5
@@ -70,8 +87,13 @@ echo "Using MacOSX SDK $VC_OSX_SDK with target set to $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
-
+# 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 || exit 1
+fi
+make WXSTATIC=FULL clean || exit 1
+make WXSTATIC=FULL || exit 1
+make WXSTATIC=FULL package || exit 1