Skip to content

Commit

Permalink
Swith QtIFW to 3.2 for Linux and make common crypts for multiple plat…
Browse files Browse the repository at this point in the history
…forms
  • Loading branch information
MinyazevR committed Dec 28, 2024
1 parent 1281f48 commit 4d5f348
Show file tree
Hide file tree
Showing 16 changed files with 243 additions and 240 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/common_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,6 @@ jobs:
os: ubuntu-latest
artifact_name: linux-installer

install-ubuntu-installer-1-concurrency:
needs: [build-rockylinux-installer]
uses: ./.github/workflows/installer.yml
with:
os: ubuntu-latest
artifact_name: linux-installer
concurrency: 1

install-rockylinux-installer:
needs: [build-rockylinux-installer]
uses: ./.github/workflows/installer.yml
Expand Down
15 changes: 2 additions & 13 deletions .github/workflows/installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ on:
artifact_name:
required: true
type: string
concurrency:
required: false
type: number
default: 0
shell:
required: false
type: string
Expand Down Expand Up @@ -82,9 +78,7 @@ jobs:
export UNINSTALL_SCRIPT_PATH=$GITHUB_WORKSPACE/trik_studio_uninstallscript.qs
export INSTALLER_EXT_NAME=$(ls -1d *-installer-* | head -n 1)
export INSTALLER_NAME="${INSTALLER_EXT_NAME%.*}"
buildScripts/github/install_installer_${{ runner.os }}.sh
env:
CONCURRENCY: ${{ inputs.concurrency }}
buildScripts/github/install_installer.sh
- name: Push zip archive to dl
if: ${{ inputs.deploy_archive && github.event_name != 'pull_request' && github.repository_owner == 'trikset' && startsWith(inputs.os, 'windows') }}
Expand All @@ -101,9 +95,7 @@ jobs:
export UNINSTALL_SCRIPT_PATH=$GITHUB_WORKSPACE/trik_studio_uninstallscript.qs
export INSTALLER_EXT_NAME=$(ls -1d *-installer-* | head -n 1)
export INSTALLER_NAME="${INSTALLER_EXT_NAME%.*}"
buildScripts/github/install_installer_${{ runner.os }}.sh
env:
CONCURRENCY: ${{ inputs.concurrency }}
buildScripts/github/install_installer.sh
- name: Downloads minimal tests for Diagram mode
run: |
Expand All @@ -113,9 +105,6 @@ jobs:
- name: Prepare environment variable
run: |
echo "QT_QPA_PLATFORM=offscreen" >> $GITHUB_ENV
echo "QT_DEBUG_PLUGINS=1" >> $GITHUB_ENV
TWOD_EXEC_NAME=$(ls -1d "$BIN_DIR"/2D-model* | head -n 1) && echo "TWOD_EXEC_NAME=$TWOD_EXEC_NAME" >> $GITHUB_ENV
PATCHER_NAME=$(ls -1d "$BIN_DIR"/patcher* | head -n 1) && echo "PATCHER_NAME=$PATCHER_NAME" >> $GITHUB_ENV
if [[ "$RUNNER_OS" != "Windows" ]]; then
TRIK_PYTHONPATH_BUNDLE_DIR="$LIB_DIR"/python-runtime
TRIK_PYTHONPATH=.:"${TRIK_PYTHONPATH_BUNDLE_DIR}/base_library.zip:${TRIK_PYTHONPATH_BUNDLE_DIR}/lib-dynload:${TRIK_PYTHONPATH_BUNDLE_DIR}"
Expand Down
18 changes: 5 additions & 13 deletions .github/workflows/setup_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:
trik_qt_version:
required: false
type: string
default: '5.12'
default: '5.15'
trik_python3_version_minor:
required: false
type: string
Expand Down Expand Up @@ -98,24 +98,16 @@ jobs:
fetch-depth: 0

- name: Set up environment
run: buildScripts/github/install_${{ runner.os }}.sh
run: buildScripts/github/install.sh
env:
TRIK_QT_VERSION: ${{ inputs.trik_qt_version }}
TRIK_PYTHON3_VERSION_MINOR: ${{ inputs.trik_python3_version_minor }}
QTIFW_VERSION: ${{ inputs.qtifw_version }}
XCODE_VERSION: ${{ inputs.xcode_version }}
BUILD_INSTALLER: ${{ inputs.build_installer }}
GCC_VERSION: ${{ inputs.gcc_version }}
if: ${{ inputs.build && !inputs.linux_installer_environment }}

- name: Set up installer environment
run: buildScripts/github/install_installer_environment.sh
env:
TRIK_QT_VERSION: ${{ inputs.trik_qt_version }}
TRIK_PYTHON3_VERSION_MINOR: ${{ inputs.trik_python3_version_minor }}
GCC_VERSION: ${{ inputs.gcc_version }}
BUILD_INSTALLER: ${{ inputs.build_installer }}
if: ${{ inputs.linux_installer_environment }}
INSTALL_INSTALLER_ENVIRONMENT: ${{ inputs.linux_installer_environment }}
if: ${{ inputs.build }}

- name: Lint
run: |
Expand Down Expand Up @@ -155,7 +147,7 @@ jobs:
if: ${{ inputs.build }}

- name: Run tests
run: ${{ inputs.executor }} buildScripts/github/run_tests.sh && ${{ inputs.executor }} buildScripts/github/test.sh
run: ${{ inputs.executor }} buildScripts/github/run_tests.sh
env:
TRIK_PYTHON3_VERSION_MINOR: ${{ inputs.trik_python3_version_minor }}
TESTS: ${{ inputs.tests }}
Expand Down
2 changes: 1 addition & 1 deletion buildScripts/github/build_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ case $RUNNER_OS in
TSNAME="trik-studio-installer-mac-$BRANCH_NAME.dmg"
;;
Linux)
QTIFWBIN=$(find "$HOME"/Qt/Tools -name "bin" | head -n 1)
QTIFWBIN="${QTIFWBIN:-$(find "$HOME"/Qt/Tools -name "bin" | head -n 1)}"
TSNAME="trik-studio-installer-linux-$BRANCH_NAME.run"
;;
*) exit 1 ;;
Expand Down
79 changes: 79 additions & 0 deletions buildScripts/github/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash
set -euxo pipefail
TRIK_PYTHON=python3.${TRIK_PYTHON3_VERSION_MINOR}

install_qt(){
# Usage: install_qt <os> <platform-type> <qt-version> <path-to-install-qt> <modules> <archives>
# TODO: add <addittional-options>
"$TRIK_PYTHON" -m venv venv
. ./venv/bin/activate
"$TRIK_PYTHON" -m pip install -U pip
"$TRIK_PYTHON" -m pip install aqtinstall
if [ -z "${6+x}" ]; then
"$TRIK_PYTHON" -m aqt install-qt "$1" "$2" "$3" -O "$4" -m "${modules[@]}"
else
"$TRIK_PYTHON" -m aqt install-qt "$1" "$2" "$3" -O "$4" -m "${modules[@]}" --archives "${archives[@]}"
fi
if [ "$BUILD_INSTALLER" = "true" ]; then
[ -d $HOME/qtifw ] || env TRIK_QTIFW_INSTALL_DIR="$HOME/qtifw" "$(dirname $(realpath ${BASH_SOURCE[0]}))"/install_qtifw.sh
fi
deactivate
}

case "`uname`" in
Darwin)
export HOMEBREW_NO_INSTALL_CLEANUP=1
export HOMEBREW_NO_AUTO_UPDATE=1
brew tap "hudochenkov/sshpass"
TRIK_BREW_PACKAGES="ccache coreutils libusb pkg-config gnu-sed sshpass p7zip python@3.${TRIK_PYTHON3_VERSION_MINOR}"
for pkg in $TRIK_BREW_PACKAGES ; do
p="${pkg##*/}"
p="${p%.*}"
brew install --quiet "$pkg" || brew upgrade "$pkg" || brew link --force "$pkg" || echo "Failed to install/upgrade $pkg"
done
modules=("qtscript")
install_qt mac desktop "${TRIK_QT_VERSION}" "$HOME/Qt" $modules
sudo xcode-select -s /Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer
xcodebuild -showsdks
xcrun -sdk macosx --show-sdk-path
;;
Linux)
ID=$(grep '^ID=' /etc/os-release | cut -d'=' -f2)

if [ "$ID" = "altlinux" ]; then
sudo apt-get update && sudo apt-get install -y gcc-c++ curl xz p7zip-standalone rsync libusb-devel \
libudev-devel libGL-devel libGLX-mesa python3-dev zlib-devel make ccache python3-module-pip time \
qt5-multimedia-devel qt5-svg-devel qt5-script-devel qt5-tools qt5-serialport-devel
elif [ "$ID" = "ubuntu" ]; then
sudo apt-get update && sudo apt-get install -y --no-install-recommends ccache curl libusb-1.0-0-dev \
make qtscript5-dev qttools5-dev-tools qtmultimedia5-dev libqt5serialport5-dev libqt5svg5-dev \
libudev-dev "$TRIK_PYTHON"-dev qtbase5-private-dev qtwayland5
elif [[ "$ID" = "rocky" || "$ID" = '"rocky"' ]]; then
GCC_VERSION=${GCC_VERSION:-13}
sudo yum update -y && sudo yum install -y --setopt=install_weak_deps=False epel-release
sudo yum install --allowerasing -y --setopt=install_weak_deps=False sudo which libusbx-devel curl \
wget make gcc-toolset-"$GCC_VERSION"-{gcc-c++,libasan-devel,libubsan-devel,gdb} git-core ccache \
zlib-devel rsync "$TRIK_PYTHON"-{devel,pip,urllib3} mesa-libGL-devel systemd-devel fontconfig p7zip xz time findutils

#no desire to enumerate all required libraries for QtIFw
# pulseaudio-libs-glib2 to run TS and 2D-model even with `minimal` platform
sudo yum install -y --setopt=install_weak_deps=False pulseaudio-libs-glib2 libxkbcommon-x11 qt5-qtbase-gui libwayland-{server,client,cursor}

echo $INSTALL_INSTALLER_ENVIRONMENT
if [ "$INSTALL_INSTALLER_ENVIRONMENT" != "true" ]; then
sudo yum install -y --setopt=install_weak_deps=False qt5-qtscript-devel qt5-qttools-devel qt5-qtmultimedia-devel qt5-qtserialport-devel \
qt5-qtsvg-devel qt5-qtbase-devel qt5-qtbase-private-devel qt5-qtwayland
else
sudo yum install -y --setopt=install_weak_deps=False libX11-xcb libXext libxkbcommon-x11 fontconfig freetype libXrender
#libQt5WaylandCompositor.so.5.15: libQt5Quick.so.5 libQt5Qml.so.5 libQt5QmlModels.so.5
modules=("qtscript" "qtwaylandcompositor")
archives=("qtbase" "qtmultimedia" "qtsvg" "qtscript" "qttools" "qtserialport" "qtimageformats" "icu" "qtwayland" "qtdeclarative")
install_qt linux desktop "$TRIK_QT_VERSION" "$HOME/Qt" $modules $archives
QT_ROOT_DIR=$(ls -1d "$HOME"/Qt/$TRIK_QT_VERSION*/gcc_64 | head -n 1)
echo "$QT_ROOT_DIR/bin" >> $GITHUB_PATH
fi
echo "source scl_source enable gcc-toolset-$GCC_VERSION" >> ~/.bash_profile
fi
;;
*) exit 1 ;;
esac
24 changes: 0 additions & 24 deletions buildScripts/github/install_Linux.sh

This file was deleted.

116 changes: 116 additions & 0 deletions buildScripts/github/install_installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/bin/bash
set -eux

prepare_environment(){
case "`uname`" in
Linux)
ID=$(grep '^ID=' /etc/os-release | cut -d'=' -f2)
if [ "$ID" = "altlinux" ]; then
sudo apt-get update && sudo apt-get install -y fontconfig libdbus libX11 libXrender libXext libxkbcommon-x11
elif [ "$ID" = "ubuntu" ]; then
sudo apt-get update && sudo apt-get install -y --no-install-recommends fontconfig libdbus-1-3 libx11-xcb1 libxkbcommon-x11-0
elif [ "$ID" = "arch" ]; then
sudo pacman -Sy && sudo pacman -S fontconfig libx11 libxrender libxext libxkbcommon-x11 --noconfirm
elif [[ "$ID" = "rocky" || "$ID" = '"rocky"' ]]; then
sudo yum install -y --setopt=install_weak_deps=False libX11-xcb libXext libxkbcommon-x11 fontconfig freetype libXrender
fi
return 0 ;;
Darwin) return 0 ;;
MINGW64*) return 0 ;;
*) exit 1 ;;
esac
}

install_installer(){
case "`uname`" in
Darwin)
sudo hdiutil attach "$INSTALLER_EXT_NAME"
sudo cp -rf "/Volumes/$INSTALLER_NAME/$INSTALLER_NAME.app" $GITHUB_WORKSPACE
sudo hdiutil detach /Volumes/"$INSTALLER_NAME"
./"$INSTALLER_NAME".app/Contents/MacOS/$INSTALLER_NAME --verbose --script trik_studio_installscript.qs
sudo rm -rf "$INSTALLER_NAME".app
return 0 ;;
Linux)
INSTALLER_NAME="$INSTALLER_NAME.run"
chmod +x "$INSTALLER_NAME"
./"$INSTALLER_NAME" --verbose --script trik_studio_installscript.qs --platform minimal
return 0 ;;
MINGW64*)
./"$INSTALLER_NAME" --verbose --script trik_studio_installscript.qs
return 0 ;;
*) exit 1 ;;
esac
}

prepare_environment_variable_and_check_tools(){
EXT=""
case "`uname`" in
Darwin)
PREFIX="/Applications"
LIB_DIR="$PREFIX/TRIKStudio/TRIK Studio.app/Contents/Lib"
export DYLD_LIBRARY_PATH="$LIB_DIR"
;;
Linux)
ID=$(grep '^ID=' /etc/os-release | cut -d'=' -f2)
if [[ $ID = ubuntu ]]; then PREFIX="$HOME"; else PREFIX="/opt"; fi
LIB_DIR="$PREFIX/TRIKStudio/lib"
export LD_LIBRARY_PATH="$LIB_DIR"
export QT_QPA_PLATFORM=minimal
;;
MINGW64*)
PREFIX="/C"
LIB_DIR="$PREFIX/TRIKStudio"
export LD_LIBRARY_PATH="LIB_DIR"
EXT=".exe"
;;
*) exit 1 ;;
esac

APP_DIR="$PREFIX/TRIKStudio"

TWOD_EXEC_NAME=$(find "$APP_DIR" -name "2D-model$EXT" -print -quit)
PATCHER_NAME=$(find "$APP_DIR" -name "patcher$EXT" -print -quit)
TRIK_STUDIO_NAME=$(find "$APP_DIR" -name "trik-studio$EXT" -print -quit)
MAINTENANCE=$(find "$APP_DIR" -name "maintenance$EXT" -print -quit)

"$TWOD_EXEC_NAME" --version
"$PATCHER_NAME" --version
"$TRIK_STUDIO_NAME" --version
"$MAINTENANCE" --version

echo "TWOD_EXEC_NAME=$TWOD_EXEC_NAME" >> $GITHUB_ENV
echo "PATCHER_NAME=$PATCHER_NAME" >> $GITHUB_ENV
echo "LIB_DIR=$LIB_DIR" >> $GITHUB_ENV
echo "APP_DIR=$APP_DIR" >> $GITHUB_ENV
}

dll_search(){
cd "$LIB_DIR"
case "`uname`" in
Darwin)
ls -- *.dylib | xargs otool -L | grep "not found" || exit 0
;;
Linux)
# Find dependencies that have not been packaged, but are still in the system
ls -- *.so* | xargs ldd | grep -Ev "not found$" | grep so | sed -e '/^[^\t]/ d' | sed -e 's/\t//' \
| sed -e 's/.*=..//' | sed -e 's/ (0.*)//' | grep -Ev "lib(c|dl|m|pthread|rt)\.so.*" \
| grep -Ev "$LD_LIBRARY_PATH" | grep -Ev "ld|linux-vdso"
ls -- *.so* | xargs ldd | grep "not found" || exit 0
;;
MINGW64*)
# Find dependencies that have not been packaged, but are still in the system
ls -- *.dll* | xargs ldd | grep -Ev "not found$" | grep dll | sed -e '/^[^\t]/ d' | sed -e 's/\t//' \
| sed -e 's/.*=..//' | sed -e 's/ (0.*)//' | grep -Ev "lib(System|SYSTEM)32.*dll" \
| grep -Ev "$LD_LIBRARY_PATH"

ls -- *.dll* | xargs ldd | grep "not found" || exit 0
;;
*) exit 1 ;;
esac
exit 1
}

prepare_environment
install_installer
prepare_environment_variable_and_check_tools
dll_search
50 changes: 0 additions & 50 deletions buildScripts/github/install_installer_Linux.sh

This file was deleted.

Loading

0 comments on commit 4d5f348

Please sign in to comment.