Skip to content

Commit

Permalink
clean up build scripts to no longer require install or build type
Browse files Browse the repository at this point in the history
  • Loading branch information
jmckisson committed Apr 27, 2024
1 parent 3748458 commit 79e04d4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 254 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/build-mudlet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,17 @@ jobs:
- name: (Windows) Build Environment Setup
if: matrix.os == 'windows-2019'
shell: msys2 {0}
run: $GITHUB_WORKSPACE/CI/setup-windows-sdk.sh base
run: $GITHUB_WORKSPACE/CI/setup-windows-sdk.sh

- name: (Windows) Build
if: matrix.os == 'windows-2019'
shell: msys2 {0}
run: |
export BUILD_CONFIG=release
$GITHUB_WORKSPACE/CI/build-mudlet-for-windows.sh
run: $GITHUB_WORKSPACE/CI/build-mudlet-for-windows.sh

- name: (Windows) Package
if: matrix.os == 'windows-2019'
shell: msys2 {0}
run: |
export BUILD_CONFIG=release
$GITHUB_WORKSPACE/CI/package-mudlet-for-windows.sh
run: $GITHUB_WORKSPACE/CI/package-mudlet-for-windows.sh

- name: (Windows) Deploy
if: matrix.os == 'windows-2019'
Expand Down
50 changes: 1 addition & 49 deletions CI/build-mudlet-for-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@
# 2 - Unsupported MSYS2/MINGGW shell type
# 3 - Unsupported build type

if [ "${BUILD_CONFIG}" != "release" ] && [ "${BUILD_CONFIG}" != "debug" ]; then
echo "Please set the environmental variable BUILD_CONFIG to one of \"release\" or"
echo "\"debug\" to specify which type of build you wish this to be."
exit 3
fi

if [ "${MSYSTEM}" = "MSYS" ]; then
echo "Please run this script from an MINGW32 or MINGW64 type bash terminal appropriate"
echo "to the bitness you want to work on. You may do this once for each of them should"
Expand All @@ -64,8 +58,6 @@ else
exit 2
fi

MINGW_BASE_DIR="C:/msys64/mingw${BUILD_BITNESS}"
export MINGW_BASE_DIR
MINGW_INTERNAL_BASE_DIR="/mingw${BUILD_BITNESS}"
export MINGW_INTERNAL_BASE_DIR
PATH="${MINGW_INTERNAL_BASE_DIR}/usr/local/bin:${MINGW_INTERNAL_BASE_DIR}/bin:/usr/bin:${PATH}"
Expand All @@ -76,24 +68,6 @@ echo "PATH is now:"
echo "${PATH}"
echo ""

#### Qt Creator note ####
# It doesn't seem possible to configure ccache to work like this in a direct
# call of qmake - though it does inside the Qt Creator qmake additional
# arguments field:
echo "Checking for ccache..."
echo ""
if [ -f "${MINGW_INTERNAL_BASE_DIR}/bin/ccache" ]; then
echo " ... ccache has been found and it will try to be used for this build by"
echo " adjusting the Makefile."
WITH_CCACHE="true"
# QMAKE_OPTIONS="QMAKE_CC=\"ccache gcc\" QMAKE_CXX=\"ccache g++\" \"CONFIG-=qml_debug\" \"CONFIG-=qtquickcompiler\""
else
echo " ... ccache NOT found."
WITH_CCACHE="false"
# QMAKE_OPTIONS="\"CONFIG-=qml_debug\" \"CONFIG-=qtquickcompiler\""
fi
echo ""

cd $GITHUB_WORKSPACE || exit 1
mkdir -p "build-${MSYSTEM}"

Expand Down Expand Up @@ -133,32 +107,10 @@ export WITH_MAIN_BUILD_SYSTEM="NO"

echo "Running qmake to make MAKEFILE ..."
echo ""

# We do not use QtQuick so there is no need for those features:
if [ "${BUILD_CONFIG}" = "debug" ]; then
# qmake ../src/mudlet.pro -spec win32-g++ "${QMAKE_OPTIONS}" "CONFIG+=debug" "CONFIG+=separate_debug_info"
qmake6 ../src/mudlet.pro -spec win32-g++ "CONFIG-=qml_debug" "CONFIG-=qtquickcompiler" "CONFIG+=debug" "CONFIG+=separate_debug_info"
else
# qmake ../src/mudlet.pro -spec win32-g++ "${QMAKE_OPTIONS}"
qmake6 ../src/mudlet.pro -spec win32-g++ "CONFIG-=qml_debug" "CONFIG-=qtquickcompiler"
fi
qmake6 ../src/mudlet.pro -spec win32-g++ "CONFIG-=qml_debug" "CONFIG-=qtquickcompiler"

echo " ... qmake done."
echo ""

if [ "${WITH_CCACHE}" = "true" ]; then
if [ "${BUILD_CONFIG}" = "debug" ]; then
echo " Tweaking Makefile.Debug to use ccache..."
sed -i "s/CC = gcc/CC = ccache gcc/" ./Makefile.Debug
sed -i "s/CXX = g++/CXX = ccache g++/" ./Makefile.Debug
else
echo " Tweaking Makefile.Release to use ccache..."
sed -i "s/CC = gcc/CC = ccache gcc/" ./Makefile.Release
sed -i "s/CXX = g++/CXX = ccache g++/" ./Makefile.Release
fi
echo ""
fi

echo "Running make to build project ..."
echo ""

Expand Down
90 changes: 3 additions & 87 deletions CI/package-mudlet-for-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@
# 4 - Directory to be used to assemble the package is NOT empty
# 6 - No Mudlet.exe file found to work with

if [ "${BUILD_CONFIG}" != "release" ] && [ "${BUILD_CONFIG}" != "debug" ]; then
echo "Please set the environmental variable BUILD_CONFIG to one of \"release\" or"
echo "\"debug\" to specify which type of build you wish this to be."
exit 3
fi

if [ "${MSYSTEM}" = "MSYS" ]; then
echo "Please run this script from an MINGW32 or MINGW64 type bash terminal appropriate"
echo "to the bitness you want to work on. You may do this once for each of them should"
Expand All @@ -67,8 +61,6 @@ else
exit 2
fi

MINGW_BASE_DIR="C:/msys64/mingw${BUILD_BITNESS}"
export MINGW_BASE_DIR
MINGW_INTERNAL_BASE_DIR="/mingw${BUILD_BITNESS}"
export MINGW_INTERNAL_BASE_DIR
PATH="${MINGW_INTERNAL_BASE_DIR}/usr/local/bin:${MINGW_INTERNAL_BASE_DIR}/bin:/usr/bin:${PATH}"
Expand Down Expand Up @@ -118,82 +110,9 @@ if [ -f "${GITHUB_WORKSPACE_UNIX_PATH}/build-${MSYSTEM}/${BUILD_CONFIG}/mudlet.e
cp "${GITHUB_WORKSPACE_UNIX_PATH}/build-${MSYSTEM}/${BUILD_CONFIG}/mudlet.exe.debug" "${PACKAGE_DIR}/"
fi

# Since Qt 5.14 using the --release switch is broken (it now seems to be
# assumed), --debug still seems to work - sort of - it doesn't copy the
# MINGW .debug files for the Qt libraries.
# https://bugreports.qt.io/browse/QTBUG-80806 seems relevant.
echo "Running windeployqt..."
if [ "${BUILD_CONFIG}" = "debug" ]; then
"${MINGW_INTERNAL_BASE_DIR}/bin/windeployqt" --debug --no-virtualkeyboard ./mudlet.exe
ZIP_FILE_NAME="Mudlet-${MSYSTEM}-debug"
# Stupidly windeployqt does not copy the .debug files that actually contains
# the debug information for the Qt library files - so copy them manually:
# They have been deduced by looking for matching 'Xxxx.dll.debug' files for
# each 'Xxxx.dll' one so A) they may not be complete and B) are only for
# the Qt libraries - other third party ones are not necessarily covered
# so far:
libnames_core=("Qt5Core.dll" "Qt5Gui.dll" "Qt5Multimedia.dll" "Qt5Network.dll" "Qt5Svg.dll" "Qt5Widgets.dll" "Qt5TextToSpeech.dll")
libnames_plugins_audio=("qtaudio_windows.dll")
libnames_plugins_bearer=("qgenericbearer.dll")
libnames_plugins_iconengines=("qsvgicon.dll")
if [ "${MSYSTEM}" = "MINGW64" ]; then
libnames_plugins_imageformats=("qgif.dll" "qicns.dll" "qico.dll" "qjp2.dll" "qjpeg.dll" "qmng.dll" "qsvg.dll" "qtga.dll" "qtiff.dll" "qwbmp.dll" "qwebp.dll")
elif [ "${MSYSTEM}" = "MINGW32" ]; then
# The library for the "multiple network graphics" file format is not
# included in the MINGW32 environment!
libnames_plugins_imageformats=("qgif.dll" "qicns.dll" "qico.dll" "qjp2.dll" "qjpeg.dll" "qsvg.dll" "qtga.dll" "qtiff.dll" "qwbmp.dll" "qwebp.dll")
fi
libnames_plugins_mediaservice=("dsengine.dll" "qtmedia_audioengine.dll" "wmfengine.dll")
libnames_plugins_platforms=("qwindows.dll")
libnames_plugins_playlistformats=("qtmultimedia_m3u.dll")
libnames_plugins_styles=("qwindowsvistastyle.dll")
libnames_plugins_texttospeech=("qtexttospeech_sapi.dll")

# The core library files are located in a bin directory rather than a Qt
# share one:
for libname in "${libnames_core[@]}"; do
cp -v -p "${MINGW_BASE_DIR}/bin/${libname}.debug" .
done

for libname in "${libnames_plugins_audio[@]}"; do
cp -v -p "${MINGW_BASE_DIR}/share/qt5/plugins/audio/${libname}.debug" ./audio/
done

for libname in "${libnames_plugins_bearer[@]}"; do
cp -v -p "${MINGW_BASE_DIR}/share/qt5/plugins/bearer/${libname}.debug" ./bearer/
done

for libname in "${libnames_plugins_iconengines[@]}"; do
cp -v -p "${MINGW_BASE_DIR}/share/qt5/plugins/iconengines/${libname}.debug" ./iconengines/
done

for libname in "${libnames_plugins_imageformats[@]}"; do
cp -v -p "${MINGW_BASE_DIR}/share/qt5/plugins/imageformats/${libname}.debug" ./imageformats/
done

for libname in "${libnames_plugins_mediaservice[@]}"; do
cp -v -p "${MINGW_BASE_DIR}/share/qt5/plugins/mediaservice/${libname}.debug" ./mediaservice/
done

for libname in "${libnames_plugins_platforms[@]}"; do
cp -v -p "${MINGW_BASE_DIR}/share/qt5/plugins/platforms/${libname}.debug" ./platforms/
done

for libname in "${libnames_plugins_playlistformats[@]}"; do
cp -v -p "${MINGW_BASE_DIR}/share/qt5/plugins/playlistformats/${libname}.debug" ./playlistformats/
done

for libname in "${libnames_plugins_styles[@]}"; do
cp -v -p "${MINGW_BASE_DIR}/share/qt5/plugins/styles/${libname}.debug" ./styles/
done

for libname in "${libnames_plugins_texttospeech[@]}"; do
cp -v -p "${MINGW_BASE_DIR}/share/qt5/plugins/texttospeech/${libname}.debug" ./texttospeech/
done
else
"${MINGW_INTERNAL_BASE_DIR}/bin/windeployqt6" ./mudlet.exe
ZIP_FILE_NAME="Mudlet-${MSYSTEM}"
fi
"${MINGW_INTERNAL_BASE_DIR}/bin/windeployqt6" ./mudlet.exe
ZIP_FILE_NAME="Mudlet-${MSYSTEM}"



# To determine which system libraries have to be copied in it requires
Expand Down Expand Up @@ -320,9 +239,6 @@ echo "${FINAL_DIR} should contain everything needed to run Mudlet!"
echo ""
echo " ... package-mudlet-for-windows.sh shell script finished."
echo ""
echo " You may now run the mudlet.exe file in ${FINAL_DIR} or take the file"
echo " there: ${ZIP_FILE_NAME}.zip to somewhere else - even a different PC - unzip"
echo " everything and run the mudlet.exe file extracted from it..."
cd ~ || exit 1

exit 0
137 changes: 26 additions & 111 deletions CI/setup-windows-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,6 @@
# 5 - Invalid command line argument
# 6 - One or more Luarocks could not be installed

if [ $# -lt 1 ]; then
echo "Usage: $0 base|full"
echo ""
echo "base = install sufficient packages to build Mudlet"
echo "full = install additional packages to also work on code and develop it"
echo ""
exit 5
fi

if [ "$1" = "base" -o "$1" = "full" ]; then
LEVEL=$1
else
echo "Please provide either base or full as a command line option"
exit 5
fi

if [ "${MSYSTEM}" = "MINGW64" ]; then
export BUILD_BITNESS="64"
Expand Down Expand Up @@ -103,90 +88,36 @@ echo ""
echo " This could take a long time if it is needed to fetch everything, so feel free"
echo " to go and have a cup of tea (other beverages are available) in the meantime...!"
echo ""
if [ "${LEVEL}" = "full" ]; then
/usr/bin/pacman -S --needed --noconfirm \
git \
man \
rsync \
"mingw-w64-${BUILDCOMPONENT}-toolchain" \
"mingw-w64-${BUILDCOMPONENT}-qt5" \
"mingw-w64-${BUILDCOMPONENT}-qt5-base-debug" \
"mingw-w64-${BUILDCOMPONENT}-qt5-multimedia-debug" \
"mingw-w64-${BUILDCOMPONENT}-qt5-svg-debug" \
"mingw-w64-${BUILDCOMPONENT}-qt5-speech-debug" \
"mingw-w64-${BUILDCOMPONENT}-qt5-imageformats-debug" \
"mingw-w64-${BUILDCOMPONENT}-qt5-winextras-debug" \
"mingw-w64-${BUILDCOMPONENT}-pcre" \
"mingw-w64-${BUILDCOMPONENT}-libzip" \
"mingw-w64-${BUILDCOMPONENT}-ntldd" \
"mingw-w64-${BUILDCOMPONENT}-pugixml" \
"mingw-w64-${BUILDCOMPONENT}-lua51" \
"mingw-w64-${BUILDCOMPONENT}-lua51-lpeg" \
"mingw-w64-${BUILDCOMPONENT}-lua51-lsqlite3" \
"mingw-w64-${BUILDCOMPONENT}-hunspell" \
"mingw-w64-${BUILDCOMPONENT}-zlib" \
"mingw-w64-${BUILDCOMPONENT}-boost" \
"mingw-w64-${BUILDCOMPONENT}-yajl" \
"mingw-w64-${BUILDCOMPONENT}-lua-luarocks" \
"mingw-w64-${BUILDCOMPONENT}-ccache" \
"mingw-w64-${BUILDCOMPONENT}-qt5-doc" \
"mingw-w64-${BUILDCOMPONENT}-cmake" \
"mingw-w64-${BUILDCOMPONENT}-clang" \
"mingw-w64-${BUILDCOMPONENT}-ninja"
else
/usr/bin/pacman -S --needed --noconfirm --noprogressbar git
/usr/bin/pacman -S --needed --noconfirm --noprogressbar man
/usr/bin/pacman -S --needed --noconfirm --noprogressbar rsync
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-toolchain
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-qt6-base
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-qt6-multimedia
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-qt6-svg
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-qt6-speech
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-qt6-imageformats
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-qt6-tools
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-qt6-5compat
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-pcre
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-libzip
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-ntldd
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-pugixml
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-lua51
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-lua51-lpeg
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-lua51-lsqlite3
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-hunspell
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-zlib
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-boost
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-yajl
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-lua-luarocks
fi

/usr/bin/pacman -S --needed --noconfirm --noprogressbar git
/usr/bin/pacman -S --needed --noconfirm --noprogressbar man
/usr/bin/pacman -S --needed --noconfirm --noprogressbar rsync
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-toolchain
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-qt6-base
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-qt6-multimedia
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-qt6-svg
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-qt6-speech
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-qt6-imageformats
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-qt6-tools
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-qt6-5compat
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-qtkeychain-qt6
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-pcre
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-libzip
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-ntldd
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-pugixml
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-lua51
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-lua51-lpeg
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-lua51-lsqlite3
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-hunspell
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-zlib
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-boost
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-yajl
/usr/bin/pacman -S --needed --noconfirm --noprogressbar mingw-w64-${BUILDCOMPONENT}-lua-luarocks


echo ""
echo " Completed"
echo ""
# This package is not available for the 32-bit case:
echo " Additional packages specifically for ${MSYSTEM}:"
if [ "${MSYSTEM}" = "MINGW64" ]; then
if [ "${LEVEL}" = "full" ]; then
# Qt creator is only available to be run in a MINGW64 environment but it
# can be used to run the MINGW32 components - which are needed to do that
/usr/bin/pacman -S --needed --noconfirm \
"mingw-w64-${BUILDCOMPONENT}-qtkeychain-qt6" \
"mingw-w64-${BUILDCOMPONENT}-qt-creator"
else
/usr/bin/pacman -S --needed --noconfirm \
"mingw-w64-${BUILDCOMPONENT}-qtkeychain-qt6"
fi
echo " Completed"
else
if [ "${LEVEL}" = "full" ]; then
# Qt creator is only available to be run in a MINGW64 environment but it
# can be used to run the MINGW32 components - which are needed to do that
echo " You WILL need have also run the full setup mode for the MINGW64 case"
echo " in order to have the Qt Creator IDE to develop MINGW32 builds as well"
else
echo " None"
fi
fi
echo ""


if [ $(grep -c "/.luarocks-${MSYSTEM}" ${MINGW_INTERNAL_BASE_DIR}/etc/luarocks/config-5.1.lua) -eq 0 ]; then
Expand Down Expand Up @@ -281,22 +212,6 @@ done
echo ""
echo " ... luarocks installation completed"
echo ""
#echo " Making a ${HOME}/src directory (if it does not exist)"
#echo " - so there is a place to put a local Mudlet git repository for"
#echo " you to build and work on the project..."
#echo ""
#mkdir -p ~/src
#cd ~/src || exit 1
#if [ ! -d "./mudlet" ]; then
# echo " Cloning the Mudlet project's source code..."
# echo ""
# git clone https://github.com/Mudlet/Mudlet.git mudlet
#else
# echo " There is already a ${HOME}/src/mudlet"
# echo " directory so it seems that there is no need to clone the Mudlet"
# echo " project's source code..."
#fi
echo ""
if [ "${success}" = "true" ]; then
echo " ... Completed, all rocks installed."
echo ""
Expand Down

0 comments on commit 79e04d4

Please sign in to comment.