[X2Go-Commits] [x2goclient] 03/12: handle_mxe.sh: rework, make most variables lowercase, change spacing, use proper if-else blocks, do not use special bash features for string comparison etc.

git-admin at x2go.org git-admin at x2go.org
Thu Dec 1 21:54:47 CET 2022


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goclient.

commit 6f881821e89c246dd241d54a50dcfc1936c1103a
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Dec 1 01:36:15 2022 +0100

    handle_mxe.sh: rework, make most variables lowercase, change spacing, use proper if-else blocks, do not use special bash features for string comparison etc.
---
 debian/changelog |  3 ++
 handle_mxe.sh    | 88 ++++++++++++++++++++++++++++++++------------------------
 2 files changed, 53 insertions(+), 38 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index e6f0e92..3b9d190 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -134,6 +134,9 @@ x2goclient (4.1.2.3-0x2go1) UNRELEASED; urgency=medium
       dates for more than 10 years and nobody noticed. Go figure.
     - src/onmainwindow.cpp: convert server-reported time to human readable
       time in Qt's standard format in session list view.
+    - handle_mxe.sh: rework, make most variables lowercase, change spacing,
+      use proper if-else blocks, do not use special bash features for string
+      comparison etc.
   * debian/control:
     + Move to debian/control.in.
   * debian/control.in:
diff --git a/handle_mxe.sh b/handle_mxe.sh
index b0ed1f5..2c88999 100755
--- a/handle_mxe.sh
+++ b/handle_mxe.sh
@@ -1,66 +1,78 @@
 #!/bin/bash
 #
 # prepare or build x2goclient and x2gohelper for Windows using MXE
-# cross build enviroment for Linux (https://mxe.cc/).
+# cross build environment for Linux (https://mxe.cc/).
 #
 # Usage: $0 [prepare] [<config>]
 #
 # prepare means only prepare the build dirs (create them, clean
-# them). If ommitted, it will build the binaries instead.  <config>
-# can be "debug" or "release". Default is "release"
+# them). If omitted, it will build the binaries instead.  <config>
+# can be "debug" or "release". Default is "release".
 #
 #
-# Adjust these values to match your mxe installation:
-MXE_BASE=/usr/lib/mxe/usr
-#MXE_TARGET=i686-w64-mingw32.shared
-MXE_TARGET=i686-w64-mingw32.static
-#MXE_TARGET=x86-64-w64-mingw32.shared
-#MXE_TARGET=x86-64-w64-mingw32.static
-MXE_PATH=${MXE_BASE}/${MXE_TARGET}
+# Adjust these values to match your MXE installation:
+MXE_BASE='/usr/lib/mxe/usr'
+#MXE_TARGET='i686-w64-mingw32.shared
+MXE_TARGET='i686-w64-mingw32.static'
+#MXE_TARGET='x86-64-w64-mingw32.shared'
+#MXE_TARGET='x86-64-w64-mingw32.static'
+mxe_path="${MXE_BASE}/${MXE_TARGET}"
 
-test -d "${MXE_PATH}" || { echo >&2 "Cannot find mxe installation at '$MXE_PATH'"; exit 1; } 
+if ! test -d "${mxe_path}"; then
+  printf 'Cannot find MXE installation at "%s".' "${mxe_path}" >&2
+  exit '1'
+fi
 
-BUILD_DIR="client_build_mxe"
-BUILD_CONFIG=release
+BUILD_DIR='client_build_mxe'
+BUILD_CONFIG='release'
 
-MODE=build
-[ "$1" == "prepare" ] && MODE=prepare && shift
+mode='build'
+if [ 'prepare' = "${1}" ]; then
+  mode='prepare'
+  shift
+fi
 
-if [ "$1" == "debug" ]; then
-    BUILD_CONFIG=debug
-    shift
+if [ 'debug' = "${1}" ]; then
+  BUILD_CONFIG='debug'
+  shift
 fi
 
-export MXE_BASE MXE_TARGET MXE_PATH BUILD_DIR BUILD_CONFIG
+export 'MXE_BASE' 'MXE_TARGETS' 'BUILD_DIR' 'BUILD_CONFIG'
 
-export X2GO_CLIENT_TARGET=
+X2GO_CLIENT_TARGET=''
+export 'X2GO_CLIENT_TARGET'
 
-[ "$MODE" == "build" ] && [ ! -d ${BUILD_DIR} ] && { echo >&2 "Please run '$0 prepare' first"; exit 1; }
+if [ 'build' = "${mode}" ] && [ ! -d "${BUILD_DIR}" ]; then
+  printf 'Please run "%s prepare" first.' "${0}" >&2
+  exit '2'
+fi
 
-if [ "$MODE" == "prepare" ]; then
-    test -e "${BUILD_DIR}" && rm -rf "${BUILD_DIR}"
-    make clean
+if [ 'prepare' = "${mode}" ]; then
+  if test -e "${BUILD_DIR}"; then
+    rm -rf "${BUILD_DIR}"
+  fi
+  make clean
 
-    mkdir -p "${BUILD_DIR}/${BUILD_CONFIG}"
-    pushd "${BUILD_DIR}"
+  mkdir -p "${BUILD_DIR}/${BUILD_CONFIG}"
+  pushd "${BUILD_DIR}"
 
-    ${MXE_PATH}/qt5/bin/lrelease ../x2goclient.pro
+  "${mxe_path}/qt5/bin/lrelease" '../x2goclient.pro'
 
-    # no special Makefile required as qmake will create that
-    ${MXE_PATH}/qt5/bin/qmake ../x2goclient.pro -config "${BUILD_CONFIG}"
+  # no special Makefile required as qmake will create that
+  "${mxe_path}/qt5/bin/qmake" '../x2goclient.pro' -config "${BUILD_CONFIG}"
 
-    popd
+  popd
 else
-    pushd "${BUILD_DIR}"
-    make
-    popd
+  pushd "${BUILD_DIR}"
+  make
+  popd
 fi
 
-pushd x2gohelper
-# here we do not have qmake but an own Makefile for mxe
-if [ "$MODE" == "prepare" ]; then
-    make -f Makefile.mxe clean
+pushd 'x2gohelper'
+# Here we do not have qmake but a unique Makefile for MXE.
+if [ 'prepare' = "${mode}" ]; then
+  make -f 'Makefile.mxe' 'clean'
 else
-    make -f Makefile.mxe
+  make -f 'Makefile.mxe'
 fi
 popd

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list