From 10d163f4c5f8c2391bf3b0803c737ef593235733 Mon Sep 17 00:00:00 2001 From: Jacob Gustafson <7557867+Poikilos@users.noreply.github.com> Date: Tue, 10 Jan 2023 23:16:18 -0500 Subject: [PATCH 1/6] Account for how qt6 & qmake-qt5 coexist & check vars. qmake is called qmake-qt5 now, so this change will make the script work on more systems. It also allows people to set the name using MY_QMAKE, and now this script no longer overwrites the MY_QT_PATH if the user has done export MY_QT_PATH before running this script. --- unixBuildScript.sh | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/unixBuildScript.sh b/unixBuildScript.sh index 2c8e6d1..62696b8 100755 --- a/unixBuildScript.sh +++ b/unixBuildScript.sh @@ -1,8 +1,32 @@ #!/bin/bash # Add your QT path here by setting MY_QT_PATH variable -# MY_QT_PATH=/YOUR_PATH_HERE/Qt/5.X/gcc_64/bin/ -MY_QT_PATH=/opt/Qt5.9.0/5.9/gcc_64/bin/ +# MY_QT_PATH=/YOUR_PATH_HERE/Qt/5.X/gcc_64/bin +# MY_QT_PATH=/opt/Qt5.9.0/5.9/gcc_64/bin +if [ "x$MY_QT_PATH" = "x" ]; then + MY_QT_PATH=/usr/bin +fi +if [ "x$MY_QMAKE" = "x" ]; then + MY_QMAKE=qmake-qt5 +fi +if [ ! -f "$MY_QT_PATH/$MY_QMAKE" ]; then + >&2 cat <&2 cat <&2 cat < Date: Tue, 10 Jan 2023 23:26:26 -0500 Subject: [PATCH 2/6] Fix the usage message to say the correct package names and specify the necessary export commands. --- unixBuildScript.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/unixBuildScript.sh b/unixBuildScript.sh index 62696b8..ce20bb5 100755 --- a/unixBuildScript.sh +++ b/unixBuildScript.sh @@ -9,20 +9,30 @@ fi if [ "x$MY_QMAKE" = "x" ]; then MY_QMAKE=qmake-qt5 fi +me="`basename $0`" if [ ! -f "$MY_QT_PATH/$MY_QMAKE" ]; then >&2 cat <&2 cat <&2 cat < Date: Tue, 10 Jan 2023 23:28:18 -0500 Subject: [PATCH 3/6] Ignore moc files. --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ab1675c..25af504 100644 --- a/.gitignore +++ b/.gitignore @@ -181,4 +181,6 @@ Sources/AwesomeBump.pro.user.d869918 Sources/AwesomeBump.pro.user.1ac2611 build-* -workdir +workdir +/Sources/main.moc +/Sources/moc_* From a34cadc2db16423ebde54c652a1a3b6d22c6b479 Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Wed, 11 Jan 2023 00:08:31 -0500 Subject: [PATCH 4/6] Add an install option that installs a generated XDG desktop shortcut. --- .gitignore | 1 + unixBuildScript.sh | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) diff --git a/.gitignore b/.gitignore index 25af504..3a73d2c 100644 --- a/.gitignore +++ b/.gitignore @@ -184,3 +184,4 @@ build-* workdir /Sources/main.moc /Sources/moc_* +/Bin/AwesomeBump.desktop diff --git a/unixBuildScript.sh b/unixBuildScript.sh index ce20bb5..f38f81c 100755 --- a/unixBuildScript.sh +++ b/unixBuildScript.sh @@ -9,6 +9,14 @@ fi if [ "x$MY_QMAKE" = "x" ]; then MY_QMAKE=qmake-qt5 fi +_DO_INSTALL=false +for var in "$@" +do + # Each preceding x in this file is to prevent script injection. + if [ "x$var" = "xinstall" ]; then + _DO_INSTALL=true + fi +done me="`basename $0`" if [ ! -f "$MY_QT_PATH/$MY_QMAKE" ]; then >&2 cat <$SC_TMP < Date: Wed, 11 Jan 2023 00:26:12 -0500 Subject: [PATCH 5/6] Detect qmake-qt5 if it is in the path. --- unixBuildScript.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/unixBuildScript.sh b/unixBuildScript.sh index f38f81c..4526ae2 100755 --- a/unixBuildScript.sh +++ b/unixBuildScript.sh @@ -3,11 +3,28 @@ # Add your QT path here by setting MY_QT_PATH variable # MY_QT_PATH=/YOUR_PATH_HERE/Qt/5.X/gcc_64/bin # MY_QT_PATH=/opt/Qt5.9.0/5.9/gcc_64/bin +_QMAKE_PATH=`which qmake-qt5` + if [ "x$MY_QT_PATH" = "x" ]; then + # It was not set using `export MY_QT_PATH` before running this script, + # so use the default: MY_QT_PATH=/usr/bin + # ...or detected path if present: + if [ -f "$_QMAKE_PATH" ]; then + # Get the parent directory path only: + MY_QT_PATH="`dirname $_QMAKE_PATH`" + fi fi + if [ "x$MY_QMAKE" = "x" ]; then + # It was not set using `export MY_QMAKE` before running this script, + # so use the default: MY_QMAKE=qmake-qt5 + # ...or detected path if present: + if [ -f "$_QMAKE_PATH" ]; then + # Get the filename only (not path): + MY_QMAKE="`basename $_QMAKE_PATH`" + fi fi _DO_INSTALL=false for var in "$@" From e7786e2b76d6fadb99e996567c3aeb355f33a75d Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Wed, 11 Jan 2023 00:36:39 -0500 Subject: [PATCH 6/6] Note the origin of the values of environment variables. --- unixBuildScript.sh | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/unixBuildScript.sh b/unixBuildScript.sh index 4526ae2..e15b22f 100755 --- a/unixBuildScript.sh +++ b/unixBuildScript.sh @@ -3,28 +3,40 @@ # Add your QT path here by setting MY_QT_PATH variable # MY_QT_PATH=/YOUR_PATH_HERE/Qt/5.X/gcc_64/bin # MY_QT_PATH=/opt/Qt5.9.0/5.9/gcc_64/bin -_QMAKE_PATH=`which qmake-qt5` +_SYSTEM_QMAKE=`which qmake-qt5` if [ "x$MY_QT_PATH" = "x" ]; then + >&2 echo "MY_QT_PATH was not set..." # It was not set using `export MY_QT_PATH` before running this script, # so use the default: MY_QT_PATH=/usr/bin # ...or detected path if present: - if [ -f "$_QMAKE_PATH" ]; then + if [ -f "$_SYSTEM_QMAKE" ]; then # Get the parent directory path only: - MY_QT_PATH="`dirname $_QMAKE_PATH`" + MY_QT_PATH="`dirname $_SYSTEM_QMAKE`" + echo "MY_QT_PATH=$MY_QT_PATH (detected `basename $_SYSTEM_QMAKE` in the PATH)" + else + echo "MY_QT_PATH=$MY_QT_PATH (default)" fi +else + echo "MY_QT_PATH=$MY_QT_PATH (was set in environment)" fi if [ "x$MY_QMAKE" = "x" ]; then + >&2 echo "MY_QMAKE was not set..." # It was not set using `export MY_QMAKE` before running this script, # so use the default: MY_QMAKE=qmake-qt5 # ...or detected path if present: - if [ -f "$_QMAKE_PATH" ]; then + if [ -f "$_SYSTEM_QMAKE" ]; then # Get the filename only (not path): - MY_QMAKE="`basename $_QMAKE_PATH`" + MY_QMAKE="`basename $_SYSTEM_QMAKE`" + echo "MY_QMAKE=$MY_QMAKE (detected `basename $_SYSTEM_QMAKE` in the PATH)" + else + echo "MY_QMAKE=$MY_QMAKE (default)" fi +else + echo "MY_QMAKE=$MY_QMAKE (was set in environment)" fi _DO_INSTALL=false for var in "$@" @@ -75,7 +87,6 @@ SC_NAME=AwesomeBump.desktop SC_TMP="$Path/$SC_NAME" # ^ use SC_NAME since that is also used to detect the destination. - BUILD_WITH_OPENGL_330_SUPPORT=$1 MAKE_NUM_THREADS='-j 8'