diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-07-06 15:33:26 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-07-06 15:33:26 +0200 |
commit | 8b89ba8b22628cdd0a45628e627c02ef11d72579 (patch) | |
tree | d99e25be7955b4c0df7172a62d340880e8bb1ef4 | |
parent | 230d1682a8eb4310b39efcbfd3009cb409d58d95 (diff) | |
download | VeraCrypt-8b89ba8b22628cdd0a45628e627c02ef11d72579.tar.gz VeraCrypt-8b89ba8b22628cdd0a45628e627c02ef11d72579.zip |
Linux: fix detection logic of parent folder in build scripts
-rwxr-xr-x | src/Build/build_cmake_deb.sh | 26 | ||||
-rw-r--r-- | src/Build/build_cmake_opensuse.sh | 27 | ||||
-rw-r--r-- | src/Build/build_cmake_rpm.sh | 27 | ||||
-rwxr-xr-x | src/Build/build_veracrypt_freebsd.sh | 33 | ||||
-rwxr-xr-x | src/Build/build_veracrypt_linux.sh | 27 | ||||
-rwxr-xr-x | src/Build/build_veracrypt_linux_no_sse2.sh | 27 | ||||
-rwxr-xr-x | src/Build/build_veracrypt_macosx.sh | 26 |
7 files changed, 117 insertions, 76 deletions
diff --git a/src/Build/build_cmake_deb.sh b/src/Build/build_cmake_deb.sh index 5aca3589..8bceb886 100755 --- a/src/Build/build_cmake_deb.sh +++ b/src/Build/build_cmake_deb.sh @@ -18,22 +18,27 @@ export SOURCEPATH=$(readlink -f "$SCRIPTPATH/..") # Directory where the VeraCrypt has been checked out export PARENTDIR=$(readlink -f "$SCRIPTPATH/../../..") -# Check if wxWidgets-3.2.5 exists in PARENTDIR; if not, use /tmp -if [ ! -d "$PARENTDIR/wxWidgets-3.2.5" ]; then +# 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 -# Exit with error if wxWidgets is not found -if [ ! -d "$WX_ROOT" ]; then - echo "Error: wxWidgets-3.2.5 not found in either the default PARENTDIR or /tmp. Exiting." - exit 1 -fi - -echo "Using wxWidgets sources in $WX_ROOT" - cd $SOURCEPATH build_and_install() { @@ -57,6 +62,7 @@ build_and_install() { 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 diff --git a/src/Build/build_cmake_opensuse.sh b/src/Build/build_cmake_opensuse.sh index 923238ad..13a75bec 100644 --- a/src/Build/build_cmake_opensuse.sh +++ b/src/Build/build_cmake_opensuse.sh @@ -18,22 +18,27 @@ export SOURCEPATH=$(readlink -f "$SCRIPTPATH/..") # Directory where the VeraCrypt has been checked out export PARENTDIR=$(readlink -f "$SCRIPTPATH/../../..") -# Check if wxWidgets-3.2.5 exists in PARENTDIR; if not, use /tmp -if [ ! -d "$PARENTDIR/wxWidgets-3.2.5" ]; then +# 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 -# Exit with error if wxWidgets is not found -if [ ! -d "$WX_ROOT" ]; then - echo "Error: wxWidgets-3.2.5 not found in either the default PARENTDIR or /tmp. Exiting." - exit 1 -fi - -echo "Using wxWidgets sources in $WX_ROOT" - cd $SOURCEPATH echo "Building GUI version of VeraCrypt for RPM using wxWidgets static libraries" @@ -45,6 +50,7 @@ export WX_BUILD_DIR=$PARENTDIR/wxBuildGui 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 @@ -66,6 +72,7 @@ export WX_BUILD_DIR=$PARENTDIR/wxBuildConsole 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 diff --git a/src/Build/build_cmake_rpm.sh b/src/Build/build_cmake_rpm.sh index f9f4bd5b..ba6ea355 100644 --- a/src/Build/build_cmake_rpm.sh +++ b/src/Build/build_cmake_rpm.sh @@ -18,22 +18,27 @@ export SOURCEPATH=$(readlink -f "$SCRIPTPATH/..") # Directory where the VeraCrypt has been checked out export PARENTDIR=$(readlink -f "$SCRIPTPATH/../../..") -# Check if wxWidgets-3.2.5 exists in PARENTDIR; if not, use /tmp -if [ ! -d "$PARENTDIR/wxWidgets-3.2.5" ]; then +# 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 -# Exit with error if wxWidgets is not found -if [ ! -d "$WX_ROOT" ]; then - echo "Error: wxWidgets-3.2.5 not found in either the default PARENTDIR or /tmp. Exiting." - exit 1 -fi - -echo "Using wxWidgets sources in $WX_ROOT" - cd $SOURCEPATH echo "Building GUI version of VeraCrypt for RPM using wxWidgets static libraries" @@ -45,6 +50,7 @@ export WX_BUILD_DIR=$PARENTDIR/wxBuildGui 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 @@ -65,6 +71,7 @@ export WX_BUILD_DIR=$PARENTDIR/wxBuildConsole 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 diff --git a/src/Build/build_veracrypt_freebsd.sh b/src/Build/build_veracrypt_freebsd.sh index d3acf92d..892a7eed 100755 --- a/src/Build/build_veracrypt_freebsd.sh +++ b/src/Build/build_veracrypt_freebsd.sh @@ -15,28 +15,27 @@ 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 if wxWidgets-3.2.5 exists in PARENTDIR; if not, use /tmp -if [ ! -d "$PARENTDIR/wxWidgets-3.2.5" ]; then +# 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 -# Exit with error if wxWidgets is not found -if [ ! -d "$WX_ROOT" ]; then - echo "Error: wxWidgets-3.2.5 not found in either the default PARENTDIR or /tmp. Exiting." - exit 1 -fi - -echo "Using wxWidgets sources in $WX_ROOT" - cd $SOURCEPATH echo "Building GUI version of VeraCrypt" @@ -48,6 +47,7 @@ export WX_BUILD_DIR=$PARENTDIR/wxBuildGui 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 @@ -64,6 +64,7 @@ export WX_BUILD_DIR=$PARENTDIR/wxBuildConsole 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 diff --git a/src/Build/build_veracrypt_linux.sh b/src/Build/build_veracrypt_linux.sh index af00859c..b6ac39ed 100755 --- a/src/Build/build_veracrypt_linux.sh +++ b/src/Build/build_veracrypt_linux.sh @@ -20,22 +20,27 @@ if [ "$(id -u)" != "0" ]; then exit 1 fi -# Check if wxWidgets-3.2.5 exists in PARENTDIR; if not, use /tmp -if [ ! -d "$PARENTDIR/wxWidgets-3.2.5" ]; then +# 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 -# Exit with error if wxWidgets is not found -if [ ! -d "$WX_ROOT" ]; then - echo "Error: wxWidgets-3.2.5 not found in either the default PARENTDIR or /tmp. Exiting." - exit 1 -fi - -echo "Using wxWidgets sources in $WX_ROOT" - cd $SOURCEPATH echo "Building GUI version of VeraCrypt" @@ -47,6 +52,7 @@ export WX_BUILD_DIR=$PARENTDIR/wxBuildGui 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 @@ -62,6 +68,7 @@ export WX_BUILD_DIR=$PARENTDIR/wxBuildConsole 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 diff --git a/src/Build/build_veracrypt_linux_no_sse2.sh b/src/Build/build_veracrypt_linux_no_sse2.sh index e5e46252..6f0739c7 100755 --- a/src/Build/build_veracrypt_linux_no_sse2.sh +++ b/src/Build/build_veracrypt_linux_no_sse2.sh @@ -20,22 +20,27 @@ if [ "$(id -u)" != "0" ]; then exit 1 fi -# Check if wxWidgets-3.2.5 exists in PARENTDIR; if not, use /tmp -if [ ! -d "$PARENTDIR/wxWidgets-3.2.5" ]; then +# 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 -# Exit with error if wxWidgets is not found -if [ ! -d "$WX_ROOT" ]; then - echo "Error: wxWidgets-3.2.5 not found in either the default PARENTDIR or /tmp. Exiting." - exit 1 -fi - -echo "Using wxWidgets sources in $WX_ROOT" - cd $SOURCEPATH echo "Building GUI version of VeraCrypt" @@ -47,6 +52,7 @@ export WX_BUILD_DIR=$PARENTDIR/wxBuildGuiNoSSE2 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 @@ -62,6 +68,7 @@ export WX_BUILD_DIR=$PARENTDIR/wxBuildConsoleNoSSE2 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 diff --git a/src/Build/build_veracrypt_macosx.sh b/src/Build/build_veracrypt_macosx.sh index 0198bd37..5319fa6a 100755 --- a/src/Build/build_veracrypt_macosx.sh +++ b/src/Build/build_veracrypt_macosx.sh @@ -55,22 +55,27 @@ if [ -n "$brew" ]; then exit 0 fi -# Check if wxWidgets-3.2.5 exists in PARENTDIR; if not, use /tmp -if [ ! -d "$PARENTDIR/wxWidgets-3.2.5" ]; then +# 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 -# Exit with error if wxWidgets is not found -if [ ! -d "$WX_ROOT" ]; then - echo "Error: wxWidgets-3.2.5 not found in either the default PARENTDIR or /tmp. Exiting." - exit 1 -fi - -echo "Using wxWidgets sources in $WX_ROOT" - # this will be the temporary wxWidgets directory export WX_BUILD_DIR=$PARENTDIR/wxBuild-3.2.5 @@ -86,6 +91,7 @@ echo "Building VeraCrypt" 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 |