From e40c32b5e264cf3a545b7aa453715196e3921d10 Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Thu, 13 Apr 2023 19:22:03 +0200 Subject: [PATCH 01/13] A couple of C++11 compatibility fixes --- Plugins/SqlEnterpriseFormatter/formatstatement.cpp | 3 ++- SQLiteStudio3/coreSQLiteStudio/services/impl/configimpl.cpp | 2 +- SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Plugins/SqlEnterpriseFormatter/formatstatement.cpp b/Plugins/SqlEnterpriseFormatter/formatstatement.cpp index 250fde402b..6239885fa5 100644 --- a/Plugins/SqlEnterpriseFormatter/formatstatement.cpp +++ b/Plugins/SqlEnterpriseFormatter/formatstatement.cpp @@ -66,6 +66,7 @@ #include "common/global.h" #include #include +#include #define FORMATTER_FACTORY_ENTRY(query, Type, FormatType) \ if (dynamic_cast(query)) \ @@ -580,7 +581,7 @@ QString FormatStatement::detokenize() { // No 'break', so we go to next case, the regular KEYWORD } - __attribute__((__fallthrough__)); + Q_FALLTHROUGH(); } case FormatToken::KEYWORD: { diff --git a/SQLiteStudio3/coreSQLiteStudio/services/impl/configimpl.cpp b/SQLiteStudio3/coreSQLiteStudio/services/impl/configimpl.cpp index a7f8d2b7cb..9829ab64e3 100644 --- a/SQLiteStudio3/coreSQLiteStudio/services/impl/configimpl.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/services/impl/configimpl.cpp @@ -1122,7 +1122,7 @@ void ConfigImpl::updateConfigDb() // 1->2 db->exec("UPDATE settings SET [key] = 'DataUncommittedError' WHERE [key] = 'DataUncommitedError'"); db->exec("UPDATE settings SET [key] = 'DataUncommitted' WHERE [key] = 'DataUncommited'"); - __attribute__((__fallthrough__)); + Q_FALLTHROUGH(); } case 2: { diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.cpp b/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.cpp index 23cb65113a..e12c12989f 100644 --- a/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.cpp +++ b/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.cpp @@ -437,7 +437,7 @@ void EditorWindow::selectCurrentQuery(bool fallBackToPreviousIfNecessary) int pos = cursor.position(); QString contents = ui->sqlEdit->toPlainText(); - QPair boundries = getQueryBoundriesForPosition(contents, pos, fallBackToPreviousIfNecessary); + QPair boundries = getQueryBoundriesForPosition(contents, pos, fallBackToPreviousIfNecessary); if (boundries.second < 0) { From b083e3ea0b27d131f9906fd01f462fb881a8b416 Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Wed, 12 Apr 2023 21:41:34 +0200 Subject: [PATCH 02/13] Parametrize Python version --- .github/workflows/lin_release.yml | 2 +- .github/workflows/mac_release.yml | 2 +- .github/workflows/win32_release.yml | 2 +- .github/workflows/win64_release.yml | 2 +- Plugins/ScriptingPython/ScriptingPython.pro | 10 +++++++--- SQLiteStudio3/create_macosx_bundle.sh | 4 +++- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/lin_release.yml b/.github/workflows/lin_release.yml index 2f6145a3a6..adc00c5c77 100644 --- a/.github/workflows/lin_release.yml +++ b/.github/workflows/lin_release.yml @@ -152,7 +152,7 @@ jobs: qmake \ $([ ${{ inputs.use_ccache || false }} = false ] || echo "CONFIG+=ccache") \ CONFIG+=portable \ - "INCLUDEPATH+=$pythonLocation/include/python$PYTHON_VERSION" "LIBS += -L$pythonLocation/lib" \ + PYTHON_VERSION=$PYTHON_VERSION "INCLUDEPATH+=$pythonLocation/include/python$PYTHON_VERSION" "LIBS += -L$pythonLocation/lib" \ ../../../Plugins make -j 1 diff --git a/.github/workflows/mac_release.yml b/.github/workflows/mac_release.yml index 3ba4f25183..cd024dc8b3 100644 --- a/.github/workflows/mac_release.yml +++ b/.github/workflows/mac_release.yml @@ -170,7 +170,7 @@ jobs: qmake \ $([ ${{ inputs.use_ccache || false }} = false ] || echo "CONFIG+=ccache") \ CONFIG+=portable \ - "INCLUDEPATH+=$pythonLocation/include/python$PYTHON_VERSION" "LIBS += -L$pythonLocation/lib" \ + PYTHON_VERSION=$PYTHON_VERSION "INCLUDEPATH+=$pythonLocation/include/python$PYTHON_VERSION" "LIBS += -L$pythonLocation/lib" \ ../../../Plugins make -j 1 diff --git a/.github/workflows/win32_release.yml b/.github/workflows/win32_release.yml index a522d3c397..b723be9ef4 100644 --- a/.github/workflows/win32_release.yml +++ b/.github/workflows/win32_release.yml @@ -161,7 +161,7 @@ jobs: qmake.exe ` "QMAKE_CXX=${{ env.GXX_COMMAND }}" ` CONFIG+=portable ` - "INCLUDEPATH+=${{ env.pythonLocation }}/include" "LIBS += -L${{ env.pythonLocation }}" ` + PYTHON_VERSION=${{ env.PYTHON_VERSION }} "INCLUDEPATH+=${{ env.pythonLocation }}/include" "LIBS += -L${{ env.pythonLocation }}" ` "QMAKE_CXXFLAGS+=-m32" ` ..\..\..\Plugins mingw32-make.exe -j 1 diff --git a/.github/workflows/win64_release.yml b/.github/workflows/win64_release.yml index 2f44835f29..6b26b2a787 100644 --- a/.github/workflows/win64_release.yml +++ b/.github/workflows/win64_release.yml @@ -163,7 +163,7 @@ jobs: qmake.exe ` "QMAKE_CXX=${{ env.GXX_COMMAND }}" ` CONFIG+=portable ` - "INCLUDEPATH+=${{ env.pythonLocation }}/include" "LIBS += -L${{ env.pythonLocation }}" ` + PYTHON_VERSION=${{ env.PYTHON_VERSION }} "INCLUDEPATH+=${{ env.pythonLocation }}/include" "LIBS += -L${{ env.pythonLocation }}" ` ..\..\..\Plugins mingw32-make.exe -j 1 diff --git a/Plugins/ScriptingPython/ScriptingPython.pro b/Plugins/ScriptingPython/ScriptingPython.pro index 02fb5d3ad5..ee0f26b45a 100644 --- a/Plugins/ScriptingPython/ScriptingPython.pro +++ b/Plugins/ScriptingPython/ScriptingPython.pro @@ -17,17 +17,21 @@ HEADERS += scriptingpython.h\ OTHER_FILES += \ scriptingpython.json +isEmpty(PYTHON_VERSION) { + PYTHON_VERSION = 3.9 +} + linux: { - LIBS += -lpython3.9 + LIBS += -lpython$$PYTHON_VERSION } macx: { - LIBS += -lpython3.9 + LIBS += -lpython$$PYTHON_VERSION } win32: { INCLUDEPATH += $$PWD/../../../include/python - LIBS += -lpython39 -L$$PWD/../../../lib/python + LIBS += -lpython$$replace(PYTHON_VERSION, \., ) -L$$PWD/../../../lib/python } RESOURCES += \ diff --git a/SQLiteStudio3/create_macosx_bundle.sh b/SQLiteStudio3/create_macosx_bundle.sh index e1a8683e19..5ed4c5d38e 100755 --- a/SQLiteStudio3/create_macosx_bundle.sh +++ b/SQLiteStudio3/create_macosx_bundle.sh @@ -14,6 +14,8 @@ if [ "$#" -eq 3 ] && [ "$3" != "dmg" ] && [ "$3" != "dist" ] && [ "$3" != "dist_ exit 1 fi +PYTHON_VERSION="${PYTHON_VERSION:-3.9}" + qt_deploy_bin="${2/qmake/macdeployqt}" ls $qt_deploy_bin >/dev/null 2>&1 if [ "$?" -ne 0 ]; then @@ -132,7 +134,7 @@ elif [ "$3" == "dist" ]; then # Fix python dependencies in the image rm -f /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/Frameworks/libpython* rm -f /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/Frameworks/libint* - install_name_tool -change "@loader_path/../Frameworks/libpython3.9.dylib" libpython3.9.dylib /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/PlugIns/libScriptingPython.dylib + install_name_tool -change "@loader_path/../Frameworks/libpython$PYTHON_VERSION.dylib" libpython$PYTHON_VERSION.dylib /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/PlugIns/libScriptingPython.dylib # Detach RW image hdiutil detach /Volumes/SQLiteStudio From c2a49bb53bf1e414671df7d4d61c2283ef9cfaca Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Tue, 11 Apr 2023 23:54:39 +0200 Subject: [PATCH 03/13] Add Linux runner container image with prebuilt ICU, OpenSSL and Tcl --- .github/workflows/lin_runner.yml | 75 ++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/lin_runner.yml diff --git a/.github/workflows/lin_runner.yml b/.github/workflows/lin_runner.yml new file mode 100644 index 0000000000..a9372055ec --- /dev/null +++ b/.github/workflows/lin_runner.yml @@ -0,0 +1,75 @@ +name: "Linux build runner image" + +env: + icu_version: "72.1" + openssl_version: "1.1.1t" + tcl_version: "8.6.13" + +on: + workflow_dispatch: + inputs: + repository_dispatch: + types: + - lin_runner + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + release: + - xenial + - bionic + #- focal + include: + - release: xenial + container: ubuntu:xenial + python_repo: ppa:savoury1/python + - release: bionic + container: ubuntu:bionic + python_repo: ppa:deadsnakes/ppa + #- release: focal + # container: ubuntu:focal + # python_repo: ppa:deadsnakes/ppa + steps: + - name: Prepare Dockerfile + run: | + v=${{ env.icu_version }} + icu_url="https://github.com/unicode-org/icu/releases/download/release-${v%.*}-${v#*.}/icu4c-${v%.*}_${v#*.}-src.tgz" + openssl_url="https://github.com/openssl/openssl/releases/download/OpenSSL_$(echo ${{ env.openssl_version }} | tr . _)/openssl-${{ env.openssl_version }}.tar.gz" + tcl_url="https://downloads.sourceforge.net/project/tcl/Tcl/${{ env.tcl_version }}/tcl${{ env.tcl_version }}-src.tar.gz" + + tee Dockerfile < /etc/timezone \ + && yes | { export DEBIAN_FRONTEND=noninteractive; apt-get -y update; apt-get -yqq upgrade; apt-get -yqq dist-upgrade; apt-get -yqq install keyboard-configuration; } \ + && apt-get -y install sudo build-essential g++ git pkg-config unzip wget zstd \ + && echo 'ALL ALL = (ALL) NOPASSWD: ALL' >>/etc/sudoers + RUN curl -L $tcl_url | tar -xz \ + && cd tcl${{ env.tcl_version }}/unix && ./configure --prefix=/usr/local && make -j$(nproc) && make install \ + && ln -sf tclsh${tcl_version%.*} /usr/local/bin/tclsh \ + && cd ../.. && rm -fr tcl${{ env.tcl_version }} + RUN curl -L $icu_url | tar -xz \ + && cd icu/source && ./configure --prefix=/usr/local --enable-rpath && make -j$(nproc) && make install \ + && cd ../.. && rm -fr icu + RUN curl -L $openssl_url | tar -xz \ + && cd openssl-${{ env.openssl_version }} && ./config --prefix=/usr/local --openssldir=/usr/local/ssl && make -j$(nproc) && make install \ + && cd ../.. && rm -fr openssl-${{ env.openssl_version }} + EOF_Dockerfile + + - name: Build and publish + uses: VaultVulp/gp-docker-action@1.6.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages + image-name: gha-build-runner-${{ matrix.release }} # Provide Docker image name + image-tag: latest From 9ce3859b56168fe536065264e23fe075f6a84101 Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Sat, 8 Apr 2023 17:21:22 +0200 Subject: [PATCH 04/13] Add Linux Qt build workflow --- .github/workflows/lin_qt.yml | 180 +++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 .github/workflows/lin_qt.yml diff --git a/.github/workflows/lin_qt.yml b/.github/workflows/lin_qt.yml new file mode 100644 index 0000000000..887c881d30 --- /dev/null +++ b/.github/workflows/lin_qt.yml @@ -0,0 +1,180 @@ +name: "Linux dependencies: Qt" + +env: + workflow_name: lin_qt + openssl_version: "1.1.1t" + icu_version: "72.1" + submodules: qtdeclarative qtimageformats qtsvg qttools qtx11extras + TARGET_ARCH: "x86_64" + +on: + workflow_dispatch: + inputs: + use_ccache: + description: 'Use ccache (for workflow debugging only!)' + required: false + type: boolean + schedule: + - cron: '30 1 * * 1' # run at 1:30 AM UTC every Monday + repository_dispatch: + types: [lin_release] + +jobs: + build: + runs-on: ubuntu-latest + container: ${{ matrix.container }} + + strategy: + fail-fast: false + matrix: + binary_compatibility: + - "glibc_2.23" # Ubuntu 16.04 + #- "glibc_2.27" # Ubuntu 18.04 + #- "glibc_2.31" # Ubuntu 20.04, Debian 11 + version: + - "5.15.9" + include: + - binary_compatibility: glibc_2.23 + container: ghcr.io/${{ github.repository }}/gha-build-runner-xenial + #- binary_compatibility: glibc_2.27 + # container: ghcr.io/${{ github.repository }}/gha-build-runner-bionic + #- binary_compatibility: glibc_2.31 + # container: ghcr.io/${{ github.repository }}/gha-build-runner-focal + + steps: + - name: Prepare ccache + if: inputs.use_ccache || false + uses: hendrikmuhs/ccache-action@v1.2.8 + with: + key: ${{ env.workflow_name }}-${{ matrix.version }}-${{ matrix.binary_compatibility }} + max-size: "712M" + + - name: Configure ccache + if: inputs.use_ccache || false + run: | + echo "PATH=/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" >> $GITHUB_ENV + + - name: Install software build dependencies + run: | + sudo apt-get -y install \ + libatspi2.0-dev \ + libcups2-dev \ + libegl1-mesa-dev \ + libfontconfig1-dev \ + libfreetype6-dev \ + libgl1-mesa-dev \ + libgles2-mesa-dev \ + libglu1-mesa-dev \ + libgtk-3-dev \ + libsqlite3-dev \ + libsm-dev \ + libssl-dev \ + libx11-dev \ + libx11-xcb-dev \ + libxext-dev \ + libxfixes-dev \ + libxi-dev \ + libxrender-dev \ + libxcb1-dev \ + libxcb-glx0-dev \ + libxcb-keysyms1-dev \ + libxcb-image0-dev \ + libxcb-shm0-dev \ + libxcb-icccm4-dev \ + libxcb-sync0-dev \ + libxcb-xfixes0-dev \ + libxcb-shape0-dev \ + libxcb-randr0-dev \ + libxcb-render-util0-dev \ + libxcb-xinerama0-dev \ + libxkbcommon-dev \ + libxkbcommon-x11-dev \ + unixodbc-dev + + - name: Download software source + run: | + set -x + for _m in qtbase $submodules; do + curl -L https://download.qt.io/official_releases/qt/5.15/${{ matrix.version }}/submodules/$_m-everywhere-opensource-src-${{ matrix.version }}.tar.xz \ + | xzcat \ + | tar -x + done + + - name: Apply patches + run: | + set -x + cd qtbase-everywhere-src-${{ matrix.version }} + case ${{ matrix.version }} in 5.15.9) + curl -L https://download.qt.io/official_releases/qt/5.15/CVE-2022-27404-27405-27406-qtbase-5.15.diff | patch -p1 + curl -L https://download.qt.io/official_releases/qt/5.15/CVE-2022-37434-qtbase-5.15.patch | patch -p1 + curl -L https://download.qt.io/official_releases/qt/5.15/CVE-2023-24607-qtbase-5.15.diff | patch -p1 + ;; + esac + + - name: Configure qtbase + run: | + cd qtbase-everywhere-src-${{ matrix.version }} + OPENSSL_LIBS="-L/usr/local/lib -lssl -lcrypto" ./configure \ + -I /usr/local/include \ + -L /usr/local/lib \ + -appstore-compliant \ + -bundled-xcb-xinput \ + -ccache \ + -confirm-license \ + -dbus-runtime \ + -fontconfig \ + -icu \ + -no-iconv \ + -nomake examples \ + -nomake tests \ + -opensource \ + -openssl-linked \ + -platform linux-g++ \ + -prefix /usr/local \ + -qt-doubleconversion \ + -qt-harfbuzz \ + -qt-libjpeg \ + -qt-libpng \ + -qt-pcre \ + -qt-zlib \ + -release \ + -rpath \ + -sql-odbc \ + -sql-sqlite \ + -system-sqlite \ + -system-freetype \ + -v \ + -xcb \ + -xkbcommon + + - name: Build qtbase + run: | + set -x + cd qtbase-everywhere-src-${{ matrix.version }} + make -j$(nproc) + sudo make INSTALL_ROOT=/tmp/stage install # for package + sudo make install # for submodules build + + - name: Build submodules + run: | + set -x + for _m in $submodules; do + cd $_m-everywhere-src-${{ matrix.version }} + qmake + make -j$(nproc) + sudo make INSTALL_ROOT=/tmp/stage install + cd .. + done + + - name: Create package + run: | + set -x + _pkgfile="qt5-${{ matrix.version }}-${{ matrix.binary_compatibility }}.$TARGET_ARCH.tar.zst" + (cd /tmp/stage; tar -c *) | zstd -9 > $_pkgfile + echo "SOFTWARE_PACKAGE_FILE=$_pkgfile" >> $GITHUB_ENV + + - name: Upload package artifact + uses: actions/upload-artifact@v1 + with: + name: ${{ env.SOFTWARE_PACKAGE_FILE }} + path: ${{ env.SOFTWARE_PACKAGE_FILE }} From 065dce8fdd2c4ecc2362a3c493d8e0ac2eeefbcd Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Tue, 11 Apr 2023 21:16:56 +0200 Subject: [PATCH 05/13] Added Linux builds compatible with glibc 2.23+ (Ubuntu 16.04+), with bundled Qt 5.15.9 and ICU 72.1 --- .github/workflows/lin_release.yml | 183 ++++++++++++++++++++++++------ 1 file changed, 150 insertions(+), 33 deletions(-) diff --git a/.github/workflows/lin_release.yml b/.github/workflows/lin_release.yml index adc00c5c77..59051b25b8 100644 --- a/.github/workflows/lin_release.yml +++ b/.github/workflows/lin_release.yml @@ -1,9 +1,11 @@ env: - QT_VERSION: '5.15.2' - TCL_VERSION: '8.6' + TARGET_ARCH: 'x86_64' + TCL_VERSION: '8.6.13' SQLITE_VERSION: '3410200' SQLITE_RELEASE_YEAR: '2023' PYTHON_VERSION: '3.9' + ICU_VERSION: '72.1' + OPENSSL_VERSION: '1.1.1t' PORTABLE_DIR: ${{ github.workspace }}/output/portable/SQLiteStudio INSTALLBUILDER_DIR: ../ib INSTALLBUILDER_URL: https://releases.bitrock.com/installbuilder/installbuilder-enterprise-23.1.0-linux-x64-installer.run @@ -24,29 +26,102 @@ on: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest + container: ${{ matrix.container }} + + strategy: + fail-fast: false + matrix: + binary_compatibility: + - "glibc_2.23" # Ubuntu 16.04 + - "glibc_2.27" # Ubuntu 18.04 + #- "glibc_2.31" # Ubuntu 20.04, Debian 11 + qt_version: + - "5.15.2" + - "5.15.9" + exclude: + - binary_compatibility: glibc_2.23 + qt_version: "5.15.2" + - binary_compatibility: glibc_2.27 + qt_version: "5.15.9" + include: + - binary_compatibility: glibc_2.23 + container: ghcr.io/${{ github.repository }}/gha-build-runner-xenial + icu_version_short: 66 + - binary_compatibility: glibc_2.27 + container: ghcr.io/${{ github.repository }}/gha-build-runner-bionic + icu_version_short: 60 + #- binary_compatibility: glibc_2.31 + # container: ghcr.io/${{ github.repository }}/gha-build-runner-focal + # icu_version_short: 66 steps: - - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - architecture: 'x64' + - name: Configure environment + run: | + { + case ${{ matrix.binary_compatibility }},${{ matrix.qt_version }} in + *,5.15.2) echo USE_PREBUILT_QT=0; echo ICU_VERSION_SHORT=56 ;; + *) echo USE_PREBUILT_QT=1; echo ICU_VERSION_SHORT=${ICU_VERSION%%.*} ;; + esac + echo TCL_VERSION_SHORT="${TCL_VERSION%.*}" + echo TARGET_ARCH=x86_64 + } >> $GITHUB_ENV + + - name: Install python${{ env.PYTHON_VERSION }} + run: | + set -ex + default_python="$(ls /usr/bin/python3.* | head -1)" + export DEBIAN_FRONTEND=noninteractive + yes | case "$default_python" in + *"$PYTHON_VERSION") sudo apt-get -qqy install python3-dev python3-distutils ;; + *) sudo apt-get -qqy install python$PYTHON_VERSION python$PYTHON_VERSION-dev python$PYTHON_VERSION-distutils + sudo update-alternatives --install /usr/bin/python3 python3 "$default_python" 1 + sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python$PYTHON_VERSION 2 + sudo update-alternatives --set python3 /usr/bin/python$PYTHON_VERSION + ;; + esac + curl https://bootstrap.pypa.io/get-pip.py | sudo python$PYTHON_VERSION + echo "pythonLocation=/usr" >> $GITHUB_ENV - name: Qt installation dir + if: env.USE_PREBUILT_QT == 0 id: qt-installation-dir run: echo "DIR=$(readlink -f ${{ github.workspace }}/..)" >> $GITHUB_OUTPUT - - name: Install Qt + - name: Install Qt with aqtinstall + if: env.USE_PREBUILT_QT == 0 uses: jurplel/install-qt-action@v3 with: cache: true - version: ${{ env.QT_VERSION }} + version: ${{ matrix.qt_version }} host: 'linux' - dir: '${{ steps.qt-installation-dir.DIR }}' + dir: '${{ steps.qt-installation-dir.outputs.DIR }}' aqtversion: '==3.0.*' py7zrversion: '==0.20.*' setup-python: 'false' - extra: '--external 7z' + + - name: Install apt dependencies for prebuilt Qt + if: env.USE_PREBUILT_QT == 1 + run: | + sudo apt-get -y install \ + libgl1-mesa-dev \ + libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 \ + libxcb-render-util0 libxcb-xinerama0 libxcb-xkb1 \ + libxkbcommon0 libxkbcommon-x11-0 + + - name: Download prebuilt Qt + if: env.USE_PREBUILT_QT == 1 + uses: dawidd6/action-download-artifact@v2 + with: + workflow: lin_qt.yml + workflow_conclusion: success + name: qt5-${{ matrix.qt_version }}-${{ matrix.binary_compatibility }}.${{ env.TARGET_ARCH }}.tar.zst + + - name: Install prebuilt Qt + if: env.USE_PREBUILT_QT == 1 + run: | + zstdcat qt5-*.tar.zst | tar -C / -xv + echo "Qt5_Dir=/usr/local" >> $GITHUB_ENV - name: Install the InstalBuilder shell: bash @@ -73,7 +148,7 @@ jobs: if: inputs.use_ccache || false uses: hendrikmuhs/ccache-action@v1.2.8 with: - key: lin_release + key: lin_release-${{ matrix.binary_compatibility }} max-size: "24M" - name: Configure ccache @@ -83,7 +158,7 @@ jobs: - name: Install SQLite3 run: | - sudo rm -f /usr/lib/libsqlite* /usr/local/lib/libsqlite* /usr/include/sqlite* /usr/local/include/sqlite* /usr/lib/x86_64-linux-gnu/libsqlite* + sudo rm -f /usr/lib/libsqlite* /usr/local/lib/libsqlite* /usr/include/sqlite* /usr/local/include/sqlite* /usr/lib/$TARGET_ARCH-linux-gnu/libsqlite* wget http://sqlite.org/$SQLITE_RELEASE_YEAR/sqlite-amalgamation-$SQLITE_VERSION.zip unzip sqlite-amalgamation-$SQLITE_VERSION.zip cd sqlite-amalgamation-$SQLITE_VERSION @@ -104,12 +179,19 @@ jobs: sudo cp -P libsqlite3.so* /usr/local/lib/ sudo cp *.h /usr/local/include/ + - name: Install extension dependencies + run: | + if [ "$USE_PREBUILT_QT" = 0 ]; then + sudo apt-get -y install libicu-dev libicu${{ matrix.icu_version_short }} + fi + sudo apt-get -y install zlib1g-dev + - name: Compile additional SQLite3 extensions shell: bash run: | cd .. mkdir ext - unzip sqlite-src-$SQLITE_VERSION.zip + unzip sqlite-src-$SQLITE_VERSION.zip -x '*.test' cd sqlite-src-$SQLITE_VERSION/ext FLAGS="-ldl -Os -fpic -shared -Imisc -I/usr/local/include -L/usr/local/lib -lsqlite3" for f in compress; do @@ -126,13 +208,12 @@ jobs: done ls -l ../../ext/ - - name: Install Tcl - run: sudo apt-get install -qq libtcl$TCL_VERSION tcl$TCL_VERSION-dev - - name: Install other tools/dependencies run: | - sudo apt install libreadline-dev libncurses5-dev patchelf chrpath - echo "${{ github.workspace }}/../Qt/${{ env.QT_VERSION }}/gcc_64/bin" >> $GITHUB_PATH + sudo apt install -y libreadline-dev libncurses5-dev libssl-dev patchelf chrpath + if [ $USE_PREBUILT_QT = 0 ]; then + echo "${{ github.workspace }}/../Qt/${{ matrix.qt_version }}/gcc_64/bin" >> $GITHUB_PATH + fi - name: Prepare output dir run: mkdir output output/build output/build/Plugins @@ -144,7 +225,7 @@ jobs: $([ ${{ inputs.use_ccache || false }} = false ] || echo "CONFIG+=ccache") \ CONFIG+=portable \ ../../SQLiteStudio3 - make -j 2 + make -j $(nproc) - name: Compile Plugins working-directory: output/build/Plugins @@ -154,7 +235,7 @@ jobs: CONFIG+=portable \ PYTHON_VERSION=$PYTHON_VERSION "INCLUDEPATH+=$pythonLocation/include/python$PYTHON_VERSION" "LIBS += -L$pythonLocation/lib" \ ../../../Plugins - make -j 1 + make -j 1 # Parallel plugin build crashes randomly - name: Copy SQLite extensions to output dir shell: bash @@ -167,6 +248,9 @@ jobs: mkdir portable cp -R SQLiteStudio portable/ + # Update PORTABLE_DIR since we're in a container + echo "PORTABLE_DIR=$(cd portable/SQLiteStudio; pwd -P)" >> $GITHUB_ENV + - name: Copy SQLite3 to portable dir working-directory: ${{ env.PORTABLE_DIR }} run: cp -P /usr/local/lib/libsqlite3.so* lib/ @@ -178,12 +262,19 @@ jobs: REAL_LIBCRYPTO=$(readlink -e $LIBCRYPTO) cp -P $REAL_LIBCRYPTO lib/$(basename -- $LIBCRYPTO) + - name: Copy prebuilt OpenSSL to portable dir + if: env.USE_PREBUILT_QT == 1 + working-directory: /usr/local/lib + run: | + cp libssl.so.1.1 libcrypto.so.1.1 $PORTABLE_DIR/lib/ + - name: Copy Qt's libcrypto and libssl to portable dir (#4577) + if: env.USE_PREBUILT_QT == 0 run: | wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb dpkg-deb -xv libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb . - cp ./usr/lib/x86_64-linux-gnu/libssl.so.1.1 ${{ env.PORTABLE_DIR }}/lib/ - cp ./usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 ${{ env.PORTABLE_DIR }}/lib/ + cp ./usr/lib/$TARGET_ARCH-linux-gnu/libssl.so.1.1 ${{ env.PORTABLE_DIR }}/lib/ + cp ./usr/lib/$TARGET_ARCH-linux-gnu/libcrypto.so.1.1 ${{ env.PORTABLE_DIR }}/lib/ - name: Copy Qt to portable dir working-directory: ${{ env.PORTABLE_DIR }} @@ -199,9 +290,9 @@ jobs: cp -P ${{ env.Qt5_Dir }}/lib/libQt5Xml.so* lib/ cp -P ${{ env.Qt5_Dir }}/lib/libQt5Svg.so* lib/ cp -P ${{ env.Qt5_Dir }}/lib/libQt5XcbQpa.so* lib/ - cp -P ${{ env.Qt5_Dir }}/lib/libicui18n.so* lib/ - cp -P ${{ env.Qt5_Dir }}/lib/libicuuc.so* lib/ - cp -P ${{ env.Qt5_Dir }}/lib/libicudata.so* lib/ + cp -P ${{ env.Qt5_Dir }}/lib/libicui18n.so.$ICU_VERSION_SHORT* lib/ + cp -P ${{ env.Qt5_Dir }}/lib/libicuuc.so.$ICU_VERSION_SHORT* lib/ + cp -P ${{ env.Qt5_Dir }}/lib/libicudata.so.$ICU_VERSION_SHORT* lib/ - name: Copy Qt plugins to portable dir working-directory: ${{ env.PORTABLE_DIR }} @@ -220,6 +311,25 @@ jobs: cp -P ${{ env.Qt5_Dir }}/plugins/platformthemes/libqgtk3.so platformthemes/libqgtk3.so cp -P ${{ env.Qt5_Dir }}/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so platforminputcontexts/libcomposeplatforminputcontextplugin.so + - name: Copy extra Qt dependencies to portable dir + working-directory: ${{ env.PORTABLE_DIR }} + run: | + libdir=/usr/lib/$TARGET_ARCH-linux-gnu + if ldd lib/libQt5XcbQpa.so | grep -q libxcb-; then + # These are not installed by default on my Xubuntu 16.04: + cp -P $libdir/libxcb-icccm.so* lib/ + cp -P $libdir/libxcb-image.so* lib/ + cp -P $libdir/libxcb-keysyms.so* lib/ + cp -P $libdir/libxcb-randr.so* lib/ + cp -P $libdir/libxcb-render-util.so* lib/ + cp -P $libdir/libxcb-xinerama.so* lib/ + # These are not installed by default on my Xubuntu 22.04: + if [ "$USE_PREBUILT_QT" = 0 ]; then apt-get install -y libxkbcommon-x11-0; fi + cp -P $libdir/libxcb-xkb.so* lib/ + cp -P $libdir/libxkbcommon.so* lib/ # libxkbcommon _is_ installed by default but must match the version of + cp -P $libdir/libxkbcommon-x11.so* lib/ # libxkbcommon-x11 which is not + fi + - name: Fix dependency paths working-directory: ${{ env.PORTABLE_DIR }} run: | @@ -243,19 +353,24 @@ jobs: run: | cp `ldd sqlitestudiocli | grep readline | awk '{print $3}'` lib/ cp `ldd lib/libreadline* | grep tinfo | awk '{print $3}'` lib/ + + # strip does not like binaries processed by patchelf, so strip first strip lib/*.so sqlitestudio sqlitestudiocli platforms/*.so imageformats/*.so iconengines/*.so printsupport/*.so platformthemes/*.so plugins/*.so patchelf --set-rpath '$ORIGIN' lib/libreadline* - name: Determine SQLiteStudio version working-directory: ${{ env.PORTABLE_DIR }} - run: echo "SQLITESTUDIO_VERSION=$(./sqlitestudiocli --version | cut -f 2 -d ' ')" >> $GITHUB_ENV + run: | + SQLITESTUDIO_VERSION="$(./sqlitestudiocli --version | cut -f 2 -d ' ')" + [ -n "$SQLITESTUDIO_VERSION" ] || exit 1 + echo "SQLITESTUDIO_VERSION=$SQLITESTUDIO_VERSION" >> $GITHUB_ENV + echo "PACKAGE_VERSION=$SQLITESTUDIO_VERSION-qt${{ matrix.qt_version }}-linux_${{ matrix.binary_compatibility }}.$TARGET_ARCH" >> $GITHUB_ENV - name: Assemble portable package shell: bash working-directory: ${{ env.PORTABLE_DIR }}/.. run: | - tar cf sqlitestudio-$SQLITESTUDIO_VERSION.tar SQLiteStudio - xz -z sqlitestudio-$SQLITESTUDIO_VERSION.tar + tar cf - SQLiteStudio | xz > sqlitestudio-$PACKAGE_VERSION.tar.xz pwd ls -l @@ -270,15 +385,17 @@ jobs: --setvars project.outputDirectory=$(pwd) \ --setvars project.version=$SQLITESTUDIO_VERSION ls -l + mv SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-linux-x64-installer.run \ + SQLiteStudio-$PACKAGE_VERSION-installer.run - name: Upload package artifact uses: actions/upload-artifact@v1 with: - name: sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.tar.xz - path: output/portable/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.tar.xz + name: sqlitestudio-${{ env.PACKAGE_VERSION }}.tar.xz + path: output/portable/sqlitestudio-${{ env.PACKAGE_VERSION }}.tar.xz - name: Upload installer artifact uses: actions/upload-artifact@v1 with: - name: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-linux-x64-installer.run - path: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-linux-x64-installer.run + name: SQLiteStudio-${{ env.PACKAGE_VERSION }}-installer.run + path: SQLiteStudio-${{ env.PACKAGE_VERSION }}-installer.run From 5c28dd8266e483df6435ec69d0941f6d57543632 Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Fri, 14 Apr 2023 19:47:59 +0200 Subject: [PATCH 06/13] Linux installer fixes for Xubuntu 16.04 --- SQLiteStudio-installer.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SQLiteStudio-installer.xml b/SQLiteStudio-installer.xml index 609a38ff9e..4e2dc94242 100644 --- a/SQLiteStudio-installer.xml +++ b/SQLiteStudio-installer.xml @@ -188,7 +188,8 @@ running_user - logname + /bin/sh + -c 'logname 2>/dev/null || basename "$HOME"' @@ -219,6 +220,9 @@ Linux + + ${desktop_prefix} + utf-8 ${desktop_prefix}/SQLiteStudio.desktop @@ -411,4 +415,3 @@ MimeType=application/vnd.sqlite3 - From 8b47324d834149fed4570d248f1f54dff3c40102 Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Mon, 17 Apr 2023 15:06:09 +0200 Subject: [PATCH 07/13] DbSqliteCipher: link to OpenSSL 3 when MinGW Qt is used --- Plugins/DbSqliteCipher/DbSqliteCipher.pro | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/Plugins/DbSqliteCipher/DbSqliteCipher.pro b/Plugins/DbSqliteCipher/DbSqliteCipher.pro index 33cd7c633d..b02b315c83 100644 --- a/Plugins/DbSqliteCipher/DbSqliteCipher.pro +++ b/Plugins/DbSqliteCipher/DbSqliteCipher.pro @@ -36,13 +36,15 @@ mac: { LIBS += -L/usr/local/opt/openssl/lib } } -!macx: { - LIBS += -L$${PWD}/../deps/lib/$${PLATFORM}/ -} win32: { - INCLUDEPATH += $${PWD}/../deps/include/$${PLATFORM}/ - DEPENDPATH += $${PWD}/../deps/include/$${PLATFORM}/ - LIBS += -leay32 -lcoreSQLiteStudio + LIBS += -lcoreSQLiteStudio + !exists( ${{PWD}}/../../../../lib/libeay32.dll ): { + LIBS += -lcrypto + } + exists( ${{PWD}}/../../../../lib/libeay32.dll ): { + INCLUDEPATH += $${PWD}/../../../../include + LIBS += -leay32 + } } !win32:isEmpty(SQLCIPHER_LIB) { @@ -87,12 +89,3 @@ QMAKE_CFLAGS_WARN_ON = -Wall -Wno-unused-parameter -Wno-sign-compare -Wno-unused DISTFILES += \ openssl_lic.txt - - - - - - - - - From d8d4b70fe0a78feb60bc0a49aa52cddafd597be3 Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Sat, 8 Apr 2023 22:19:31 +0200 Subject: [PATCH 08/13] Added win32 and win64 builds with bundled Qt 5.15.9. --- .github/workflows/win32_release.yml | 189 ++++++++++++++++++++++------ .github/workflows/win64_release.yml | 182 +++++++++++++++++++++------ 2 files changed, 298 insertions(+), 73 deletions(-) diff --git a/.github/workflows/win32_release.yml b/.github/workflows/win32_release.yml index b723be9ef4..73149c0db0 100644 --- a/.github/workflows/win32_release.yml +++ b/.github/workflows/win32_release.yml @@ -1,12 +1,9 @@ env: - QT_VERSION: '5.15.2' SQLITE_VERSION: '3410200' SQLITE_RELEASE_YEAR: '2023' - QT_ARCH: 'win32_mingw81' PYTHON_VERSION: '3.9' ICU_VER: '72' ICU_URL: https://mirror.msys2.org/mingw/mingw32/mingw-w64-i686-icu-72.1-1-any.pkg.tar.zst - QT_BIN_DIR: ../Qt/5.15.2/mingw81_32/bin PORTABLE_DIR: output/portable/SQLiteStudio INSTALLBUILDER_DIR: ../ib MINGW_URL: https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/tools_mingw/qt.tools.win32_mingw810/8.1.0-1-202004170606i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z @@ -30,25 +27,86 @@ jobs: build: runs-on: windows-2019 + strategy: + fail-fast: false + matrix: + qt_version: + - "5.15.2" + - "5.15.9" + steps: + - name: Configure environment + shell: bash + run: | + { + case ${{ matrix.qt_version }} in + 5.15.2) echo QT_FROM_PACKAGES=0 + echo QT_ARCH=win32_mingw81 ;; + *) echo QT_FROM_PACKAGES=1 ;; + esac + echo TARGET_ARCH=i686 + echo MINGWxx=mingw32 + } >> $GITHUB_ENV + + - uses: msys2/setup-msys2@v2 + if: env.QT_FROM_PACKAGES == 1 + with: + msystem: MINGW32 + location: d:/ + install: > + mingw-w64-${{ env.TARGET_ARCH }}-gcc + mingw-w64-${{ env.TARGET_ARCH }}-qt5-base + mingw-w64-${{ env.TARGET_ARCH }}-qt5-declarative + mingw-w64-${{ env.TARGET_ARCH }}-qt5-imageformats + mingw-w64-${{ env.TARGET_ARCH }}-qt5-script + mingw-w64-${{ env.TARGET_ARCH }}-qt5-svg + mingw-w64-${{ env.TARGET_ARCH }}-qt5-tools + mingw-w64-${{ env.TARGET_ARCH }}-qt5-winextras + mingw-w64-${{ env.TARGET_ARCH }}-wineditline + unzip + update: ${{ env.QT_FROM_PACKAGES == 1 }} + + - name: Configure Qt from packages + if: env.QT_FROM_PACKAGES == 1 + shell: msys2 {0} + run: | + set -x + qt_version_local="$(pacman -Si mingw-w64-$TARGET_ARCH-qt5-base | awk '/Version/ {print $3}')" + case "$qt_version_local" in + ${{ matrix.qt_version }}*) ;; + *) echo "Repos have $qt_version_local, can't install ${{ matrix.qt_version }} from repos"; exit 1 ;; + esac + echo 'd:\msys64\$MINGWxx\bin' >> $GITHUB_PATH + tee -a $GITHUB_ENV <> $GITHUB_ENV + SQLITESTUDIO_VERSION="$(./sqlitestudiocli.exe --version | cut -f 2 -d ' ')" + [ -n "$SQLITESTUDIO_VERSION" ] || exit 1 + echo "SQLITESTUDIO_VERSION=$SQLITESTUDIO_VERSION" >> $GITHUB_ENV + echo "PACKAGE_VERSION=$SQLITESTUDIO_VERSION-qt${{ matrix.qt_version }}" >> $GITHUB_ENV - name: Assemble portable package shell: bash run: | cd $ABSOLUTE_PORTABLE_DIR/.. - 7z a -r sqlitestudio-$SQLITESTUDIO_VERSION.zip SQLiteStudio + 7z a -r sqlitestudio-$PACKAGE_VERSION.zip SQLiteStudio - name: Install the InstalBuilder shell: bash @@ -250,15 +361,17 @@ jobs: --setvars project.outputDirectory=$(pwd) \ --setvars project.version=$SQLITESTUDIO_VERSION ls -l + mv SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-windows-installer.exe \ + SQLiteStudio-$PACKAGE_VERSION-windows-installer.exe \ - name: Upload package artifact uses: actions/upload-artifact@v1 with: - name: sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.zip - path: output/portable/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.zip + name: sqlitestudio-${{ env.PACKAGE_VERSION }}.zip + path: output/portable/sqlitestudio-${{ env.PACKAGE_VERSION }}.zip - name: Upload installer artifact uses: actions/upload-artifact@v1 with: - name: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-windows-installer.exe - path: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-windows-installer.exe + name: SQLiteStudio-${{ env.PACKAGE_VERSION }}-windows-installer.exe + path: SQLiteStudio-${{ env.PACKAGE_VERSION }}-windows-installer.exe diff --git a/.github/workflows/win64_release.yml b/.github/workflows/win64_release.yml index 6b26b2a787..e538b82e8c 100644 --- a/.github/workflows/win64_release.yml +++ b/.github/workflows/win64_release.yml @@ -1,13 +1,10 @@ env: - QT_VERSION: '5.15.2' SQLITE_VERSION: '3410200' SQLITE_RELEASE_YEAR: '2023' - QT_ARCH: 'win64_mingw81' PYTHON_VERSION: '3.9' ICU_VER: '72' ICU_URL: https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-icu-72.1-1-any.pkg.tar.zst MINGW_DIR: ../Qt/Tools/mingw810_64 - QT_BIN_DIR: ../Qt/5.15.2/mingw81_64/bin PORTABLE_DIR: output/portable/SQLiteStudio INSTALLBUILDER_DIR: ../ib MINGW_URL: https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/tools_mingw/qt.tools.win64_mingw810/8.1.0-1-202004170606x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z @@ -31,19 +28,79 @@ jobs: build: runs-on: windows-2019 + strategy: + fail-fast: false + matrix: + qt_version: + - "5.15.2" + - "5.15.9" + steps: + - name: Configure environment + shell: bash + run: | + { + case ${{ matrix.qt_version }} in + 5.15.2) echo QT_FROM_PACKAGES=0 + echo QT_ARCH=win64_mingw81 ;; + *) echo QT_FROM_PACKAGES=1 ;; + esac + echo TARGET_ARCH=x86_64 + echo MINGWxx=mingw64 + } >> $GITHUB_ENV + + - uses: msys2/setup-msys2@v2 + if: env.QT_FROM_PACKAGES == 1 + with: + msystem: MINGW64 + location: d:/ + install: > + mingw-w64-${{ env.TARGET_ARCH }}-gcc + mingw-w64-${{ env.TARGET_ARCH }}-qt5-base + mingw-w64-${{ env.TARGET_ARCH }}-qt5-declarative + mingw-w64-${{ env.TARGET_ARCH }}-qt5-imageformats + mingw-w64-${{ env.TARGET_ARCH }}-qt5-script + mingw-w64-${{ env.TARGET_ARCH }}-qt5-svg + mingw-w64-${{ env.TARGET_ARCH }}-qt5-tools + mingw-w64-${{ env.TARGET_ARCH }}-qt5-winextras + mingw-w64-${{ env.TARGET_ARCH }}-wineditline + unzip + update: ${{ env.QT_FROM_PACKAGES == 1 }} + + - name: Configure Qt from packages + if: env.QT_FROM_PACKAGES == 1 + shell: msys2 {0} + run: | + set -x + qt_version_local="$(pacman -Si mingw-w64-$TARGET_ARCH-qt5-base | awk '/Version/ {print $3}')" + case "$qt_version_local" in + ${{ matrix.qt_version }}*) ;; + *) echo "Repos have $qt_version_local, can't install ${{ matrix.qt_version }} from repos"; exit 1 ;; + esac + echo 'd:\msys64\$MINGWxx\bin' >> $GITHUB_PATH + tee -a $GITHUB_ENV <> $GITHUB_ENV + SQLITESTUDIO_VERSION="$(./sqlitestudiocli.exe --version | cut -f 2 -d ' ')" + [ -n "$SQLITESTUDIO_VERSION" ] || exit 1 + echo "SQLITESTUDIO_VERSION=$SQLITESTUDIO_VERSION" >> $GITHUB_ENV + echo "PACKAGE_VERSION=$SQLITESTUDIO_VERSION-qt${{ matrix.qt_version }}" >> $GITHUB_ENV - name: Assemble portable package shell: bash run: | cd $ABSOLUTE_PORTABLE_DIR/.. - 7z a -r sqlitestudio-$SQLITESTUDIO_VERSION.zip SQLiteStudio + 7z a -r sqlitestudio-$PACKAGE_VERSION.zip SQLiteStudio - name: Install the InstalBuilder shell: bash @@ -251,15 +361,17 @@ jobs: --setvars project.outputDirectory=$(pwd) \ --setvars project.version=$SQLITESTUDIO_VERSION ls -l + mv SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-windows-x64-installer.exe \ + SQLiteStudio-$PACKAGE_VERSION-windows-x64-installer.exe \ - name: Upload package artifact uses: actions/upload-artifact@v1 with: - name: sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.zip - path: output/portable/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.zip + name: sqlitestudio-${{ env.PACKAGE_VERSION }}.zip + path: output/portable/sqlitestudio-${{ env.PACKAGE_VERSION }}.zip - name: Upload installer artifact uses: actions/upload-artifact@v1 with: - name: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-windows-x64-installer.exe - path: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-windows-x64-installer.exe + name: SQLiteStudio-${{ env.PACKAGE_VERSION }}-windows-x64-installer.exe + path: SQLiteStudio-${{ env.PACKAGE_VERSION }}-windows-x64-installer.exe From 3395158c2bc9e8a57f9ee534f8b9188c6ff333e8 Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Wed, 12 Apr 2023 22:51:25 +0200 Subject: [PATCH 09/13] create_macosx_bundle.sh: some shellcheck fixes and output quietness flag --- SQLiteStudio3/create_macosx_bundle.sh | 115 +++++++++++++------------- 1 file changed, 59 insertions(+), 56 deletions(-) diff --git a/SQLiteStudio3/create_macosx_bundle.sh b/SQLiteStudio3/create_macosx_bundle.sh index 5ed4c5d38e..bb171eebb0 100755 --- a/SQLiteStudio3/create_macosx_bundle.sh +++ b/SQLiteStudio3/create_macosx_bundle.sh @@ -1,9 +1,20 @@ #!/bin/sh +# shellcheck shell=dash disable=SC2006,SC3003 +set -e printUsage() { - echo "$0 [dmg|dist|dist_full]" + echo "$0 [-q]... [dmg|dist|dist_full]" } +quiet=0 +while getopts q _flag; do + case "$_flag" in + q) : $(( quiet += 1 )) ;; + *) printUsage; exit 1 ;; + esac +done +shift $(( OPTIND - 1 )) + if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then printUsage exit 1 @@ -14,16 +25,19 @@ if [ "$#" -eq 3 ] && [ "$3" != "dmg" ] && [ "$3" != "dist" ] && [ "$3" != "dist_ exit 1 fi +abort() { printf "ERROR: %s\n" "$@" 1>&2; exit 1; } +debug() { [ "$quiet" -gt 0 ] || printf "DEBUG: %s\n" "$@" 1>&2; } +info() { [ "$quiet" -gt 1 ] || printf "INFO: %s\n" "$@" 1>&2; } +run() { [ "$quiet" -gt 2 ] || { printf 'RUN: '; printf "'%s' " "$@"; printf '\n'; } 1>&2; "$@"; } + PYTHON_VERSION="${PYTHON_VERSION:-3.9}" -qt_deploy_bin="${2/qmake/macdeployqt}" -ls $qt_deploy_bin >/dev/null 2>&1 -if [ "$?" -ne 0 ]; then - echo "macdeployqt program missing!" - exit 1 +qt_deploy_bin="$(echo "$2" | sed 's/qmake$/macdeployqt/')" +if [ ! -x "$qt_deploy_bin" ]; then + abort "macdeployqt program missing!" fi -cd "$1/SQLiteStudio" +cd "$1/SQLiteStudio" || abort "Could not chdir to $1/SQLiteStudio!" rm -rf SQLiteStudio.app/Contents/Frameworks rm -rf SQLiteStudio.app/Contents/PlugIns @@ -40,13 +54,17 @@ cp -RP styles/* SQLiteStudio.app/Contents/PlugIns/styles cp -RP lib*SQLiteStudio*.dylib SQLiteStudio.app/Contents/Frameworks +# Determine our version before any patching, while we have a presumably working binary +VERSION="$(./sqlitestudiocli -v | awk '{print $2}')" +[ -n "$VERSION" ] || abort "could not determine SQLiteStudio version" + # CLI paths qtcore_path=`otool -L sqlitestudiocli | awk '/QtCore/ {print $1;}'` new_qtcore_path="@rpath/QtCore.framework/Versions/5/QtCore" cp -P sqlitestudiocli SQLiteStudio.app/Contents/MacOS install_name_tool -change libcoreSQLiteStudio.1.dylib "@rpath/libcoreSQLiteStudio.1.dylib" SQLiteStudio.app/Contents/MacOS/sqlitestudiocli -install_name_tool -change $qtcore_path $new_qtcore_path SQLiteStudio.app/Contents/MacOS/sqlitestudiocli +install_name_tool -change "$qtcore_path" "$new_qtcore_path" SQLiteStudio.app/Contents/MacOS/sqlitestudiocli # SQLiteStudio binary paths install_name_tool -change libcoreSQLiteStudio.1.dylib "@rpath/libcoreSQLiteStudio.1.dylib" SQLiteStudio.app/Contents/MacOS/SQLiteStudio @@ -56,32 +74,23 @@ install_name_tool -change libguiSQLiteStudio.1.dylib "@rpath/libguiSQLiteStudio. install_name_tool -change libcoreSQLiteStudio.1.dylib "@rpath/libcoreSQLiteStudio.1.dylib" SQLiteStudio.app/Contents/Frameworks/libguiSQLiteStudio.1.dylib install_name_tool -change libsqlite3.0.dylib "@rpath/libsqlite3.0.dylib" SQLiteStudio.app/Contents/Frameworks/libcoreSQLiteStudio.1.dylib -cdir=`pwd` -cd ../../../lib/ -libdir=`pwd` -cd "$cdir" - -echo "lib:" -ls -l ../../../lib/ +libdir=$(cd ../../../lib/ && pwd) +debug "lib:" "$(ls -l "$libdir")" -echo "in frameworks - 1:" -ls -l SQLiteStudio.app/Contents/Frameworks +debug "in frameworks - 1:" "$(ls -l SQLiteStudio.app/Contents/Frameworks)" cp -RP ../../../lib/libsqlite3.0.dylib SQLiteStudio.app/Contents/Frameworks cd SQLiteStudio.app/Contents/Frameworks ln -s libsqlite3.0.dylib libsqlite3.dylib cd ../../.. -echo "in frameworks - 2:" -ls -l SQLiteStudio.app/Contents/Frameworks +debug "in frameworks - 2:" "$(ls -l SQLiteStudio.app/Contents/Frameworks)" # Plugin paths -function fixPluginPaths() { - for f in `ls "$1"` - do - PLUGIN_FILE="$1/$f" +fixPluginPaths() { + for PLUGIN_FILE in "$1"/*; do if [ -f "$PLUGIN_FILE" ]; then - echo "Fixing paths for plugin $PLUGIN_FILE" + info "Fixing paths for plugin $PLUGIN_FILE" install_name_tool -change libcoreSQLiteStudio.1.dylib "@rpath/libcoreSQLiteStudio.1.dylib" "$PLUGIN_FILE" install_name_tool -change libguiSQLiteStudio.1.dylib "@rpath/libguiSQLiteStudio.1.dylib" "$PLUGIN_FILE" fi @@ -92,65 +101,59 @@ function fixPluginPaths() { } fixPluginPaths SQLiteStudio.app/Contents/PlugIns -function replaceInfo() { - cdir=`pwd` - echo Replacing Info.plist - cd "$1/SQLiteStudio" - VERSION=`SQLiteStudio.app/Contents/MacOS/sqlitestudiocli -v | awk '{print $2}'` +replaceInfo() { + local _contents="$1/SQLiteStudio/SQLiteStudio.app/Contents" + info "Replacing Info.plist" YEAR=`date '+%Y'` - cd SQLiteStudio.app/Contents - sed "s/%VERSION%/$VERSION/g" Info.plist | sed "s/%YEAR%/$YEAR/g" > Info.plist.new - echo "New plist:" - cat Info.plist.new - mv Info.plist.new Info.plist - cd "$cdir" + run sed -e "s/%VERSION%/$VERSION/g" -e "s/%YEAR%/$YEAR/g" "$_contents/Info.plist" > "$_contents/Info.plist.new" + debug "New plist:" "$(cat "$_contents/Info.plist.new")" + run mv "$_contents/Info.plist.new" "$_contents/Info.plist" } -if [ "$3" == "dmg" ]; then +if [ "$3" = "dmg" ]; then replaceInfo "$1" "$qt_deploy_bin" SQLiteStudio.app -dmg -elif [ "$3" == "dist" ]; then - replaceInfo "$1" - - "$qt_deploy_bin" SQLiteStudio.app -dmg -executable=SQLiteStudio.app/Contents/MacOS/SQLiteStudio -always-overwrite -verbose=3 +elif [ "$3" = "dist" ]; then + replaceInfo "$1" + + run "$qt_deploy_bin" SQLiteStudio.app -dmg -executable=SQLiteStudio.app/Contents/MacOS/SQLiteStudio -verbose=$((2 - quiet)) cd "$1/SQLiteStudio" - VERSION=`SQLiteStudio.app/Contents/MacOS/sqlitestudiocli -v | awk '{print $2}'` - mv SQLiteStudio.dmg sqlitestudio-$VERSION.dmg - hdiutil attach sqlitestudio-$VERSION.dmg - + mv SQLiteStudio.dmg "sqlitestudio-$VERSION.dmg" + hdiutil attach "sqlitestudio-$VERSION.dmg" + hdiutil detach /Volumes/SQLiteStudio # Convert image to RW and attach - hdiutil convert sqlitestudio-$VERSION.dmg -format UDRW -o sqlitestudio-rw-$VERSION.dmg - hdiutil attach -readwrite sqlitestudio-rw-$VERSION.dmg + hdiutil convert "sqlitestudio-$VERSION.dmg" -format UDRW -o "sqlitestudio-rw-$VERSION.dmg" + hdiutil attach -readwrite "sqlitestudio-rw-$VERSION.dmg" # Fix sqlite3 file in the image cp -RPf "$libdir/libsqlite3.0.dylib" /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/Frameworks/ - # Fix python dependencies in the image - rm -f /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/Frameworks/libpython* - rm -f /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/Frameworks/libint* - install_name_tool -change "@loader_path/../Frameworks/libpython$PYTHON_VERSION.dylib" libpython$PYTHON_VERSION.dylib /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/PlugIns/libScriptingPython.dylib + # Fix python dependencies in the image + run rm -f /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/Frameworks/libpython* + run rm -f /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/Frameworks/libint* + run install_name_tool -change "@loader_path/../Frameworks/libpython$PYTHON_VERSION.dylib" "libpython$PYTHON_VERSION.dylib" /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/PlugIns/libScriptingPython.dylib # Detach RW image hdiutil detach /Volumes/SQLiteStudio - hdiutil compact sqlitestudio-rw-$VERSION.dmg + hdiutil compact "sqlitestudio-rw-$VERSION.dmg" # Convert image back to RO and compressed - rm -f sqlitestudio-$VERSION.dmg - hdiutil convert sqlitestudio-rw-$VERSION.dmg -format UDZO -o sqlitestudio-$VERSION.dmg - rm -f sqlitestudio-rw-$VERSION.dmg + rm -f "sqlitestudio-$VERSION.dmg" + hdiutil convert "sqlitestudio-rw-$VERSION.dmg" -format UDZO -o "sqlitestudio-$VERSION.dmg" + rm -f "sqlitestudio-rw-$VERSION.dmg" echo "Verifying contents of new image:" - hdiutil attach sqlitestudio-$VERSION.dmg + hdiutil attach "sqlitestudio-$VERSION.dmg" ls -l /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/Frameworks hdiutil detach /Volumes/SQLiteStudio - echo "Done." + info "Done." else "$qt_deploy_bin" SQLiteStudio.app replaceInfo "$1" From 54dc207cfe26c292cb1f385628b8c2d3056d2713 Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Wed, 12 Apr 2023 23:03:45 +0200 Subject: [PATCH 10/13] create_macosx_bundle.sh: MacPorts compatibility fixes --- SQLiteStudio3/create_macosx_bundle.sh | 48 +++++++++++++++++++++------ 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/SQLiteStudio3/create_macosx_bundle.sh b/SQLiteStudio3/create_macosx_bundle.sh index bb171eebb0..8922afad4c 100755 --- a/SQLiteStudio3/create_macosx_bundle.sh +++ b/SQLiteStudio3/create_macosx_bundle.sh @@ -79,10 +79,19 @@ debug "lib:" "$(ls -l "$libdir")" debug "in frameworks - 1:" "$(ls -l SQLiteStudio.app/Contents/Frameworks)" -cp -RP ../../../lib/libsqlite3.0.dylib SQLiteStudio.app/Contents/Frameworks -cd SQLiteStudio.app/Contents/Frameworks -ln -s libsqlite3.0.dylib libsqlite3.dylib -cd ../../.. +embed_libsqlite3() { + cp -RPf "$libdir/libsqlite3.0.dylib" "$1/Contents/Frameworks" + libsqlite3_in_bundle="$1/Contents/Frameworks/libsqlite3.0.dylib" + ln -sf libsqlite3.0.dylib "$1/Contents/Frameworks/libsqlite3.dylib" + if otool -L "$libsqlite3_in_bundle" | grep -q /opt/local; then + info "MacPorts libsqlite3.0.dylib detected! Fixing dylib references" + run install_name_tool \ + -change /opt/local/lib/libz.1.dylib "@rpath/libz.1.dylib" \ + -id "@executable_path/../Frameworks/libsqlite3.0.dylib" \ + "$libsqlite3_in_bundle" + fi +} +embed_libsqlite3 SQLiteStudio.app debug "in frameworks - 2:" "$(ls -l SQLiteStudio.app/Contents/Frameworks)" @@ -111,6 +120,11 @@ replaceInfo() { run mv "$_contents/Info.plist.new" "$_contents/Info.plist" } +find_local_dependencies() { + find "$1" -type f -perm +111 -print0 | xargs -0 otool -L \ + | awk '/:$/ { sub(/:$/, ""); f = $1 } /\/(opt|usr)\/local\// { print f, $1 }' +} + if [ "$3" = "dmg" ]; then replaceInfo "$1" @@ -130,14 +144,28 @@ elif [ "$3" = "dist" ]; then # Convert image to RW and attach hdiutil convert "sqlitestudio-$VERSION.dmg" -format UDRW -o "sqlitestudio-rw-$VERSION.dmg" hdiutil attach -readwrite "sqlitestudio-rw-$VERSION.dmg" - - # Fix sqlite3 file in the image - cp -RPf "$libdir/libsqlite3.0.dylib" /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/Frameworks/ + cd /Volumes/SQLiteStudio + + # Fix sqlite3 file in the image + embed_libsqlite3 SQLiteStudio.app # Fix python dependencies in the image - run rm -f /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/Frameworks/libpython* - run rm -f /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/Frameworks/libint* - run install_name_tool -change "@loader_path/../Frameworks/libpython$PYTHON_VERSION.dylib" "libpython$PYTHON_VERSION.dylib" /Volumes/SQLiteStudio/SQLiteStudio.app/Contents/PlugIns/libScriptingPython.dylib + python_plugin_lib="SQLiteStudio.app/Contents/PlugIns/libScriptingPython.dylib" + if otool -L "$python_plugin_lib" | grep -q /opt/local/Library/Frameworks/Python.framework; then + python_from_macports="yes" + _ref="/opt/local/Library/Frameworks/Python.framework/Versions/$PYTHON_VERSION/Python" + else + run rm -f SQLiteStudio.app/Contents/Frameworks/libpython* SQLiteStudio.app/Contents/Frameworks/libint* + _ref="@loader_path/../Frameworks/libpython$PYTHON_VERSION.dylib" + fi + run install_name_tool -change "$_ref" "libpython$PYTHON_VERSION.dylib" "$python_plugin_lib" + + # Fix other dependencies which can be supplied by system + find_local_dependencies SQLiteStudio.app | while read -r _binary _ref; do + case "$_ref" in + */libbz2.1.0.dylib | */libexpat.1.dylib | */liblzma.5.dylib | */libz.1.dylib) ls -l "$_binary"; run install_name_tool -change "$_ref" "${_ref##*/}" "$_binary" ;; + esac + done # Detach RW image hdiutil detach /Volumes/SQLiteStudio From f1842bf7b64c58a4e9ee0aa91c9db7af8925f036 Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Wed, 12 Apr 2023 23:08:48 +0200 Subject: [PATCH 11/13] MacOS portable package: Added traditional /Applications symlink and coloured background --- SQLiteStudio3/create_macosx_bundle.sh | 99 +++++++++++++++++++-------- 1 file changed, 72 insertions(+), 27 deletions(-) diff --git a/SQLiteStudio3/create_macosx_bundle.sh b/SQLiteStudio3/create_macosx_bundle.sh index 8922afad4c..00ee98d878 100755 --- a/SQLiteStudio3/create_macosx_bundle.sh +++ b/SQLiteStudio3/create_macosx_bundle.sh @@ -120,6 +120,65 @@ replaceInfo() { run mv "$_contents/Info.plist.new" "$_contents/Info.plist" } +hdiutil_create() { + run hdiutil create \ + -fs HFS+ -fsargs '-c c=64,a=16,e=16' \ + -scrub \ + "$@" +} + +pretty_dmg() { + local _appname="${1%.app}" _volname="$2" _image_path="$3" _rgb_16bit + [ -z "$6" ] || _rgb_16bit="{$(( $4 * 257 )), $(( $5 * 257 )), $(( $6 * 257 ))}" + local _rw_image="$_volname-rw.dmg.sparseimage" _device + [ ! -f "$_rw_image" ] || run rm -f "$_rw_image" + hdiutil_create \ + -format UDSP \ + -srcfolder "$_appname.app" \ + -size "$(du -ms "$_appname.app" | awk '{ print (2 ^ int(log($1) / log(2) + 2.5)) "m" }')" \ + -volname "$_volname" \ + "$_rw_image" + + # detach any images with the same name + mount \ + | awk '/\/Volumes\/'"$_volname"' / {match($1, /disk[0-9]+/); print substr($1, RSTART, RLENGTH)}' \ + | run xargs -tn1 hdiutil detach + + _device="$(run hdiutil attach "$_rw_image" | awk '/\/dev\// { print $1; exit }')" + sleep 1 + if [ -n "$_image_path" ]; then + run mkdir "/Volumes/$_volname/.background" + run cp "$_image_path" "/Volumes/$_volname/.background/" + fi + run osascript < Date: Wed, 12 Apr 2023 23:12:54 +0200 Subject: [PATCH 12/13] Added MacOS portable DMG with bundled Python 3.9 for ScriptingPython, no installer. --- SQLiteStudio3/create_macosx_bundle.sh | 72 +++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/SQLiteStudio3/create_macosx_bundle.sh b/SQLiteStudio3/create_macosx_bundle.sh index 00ee98d878..81dcca1115 100755 --- a/SQLiteStudio3/create_macosx_bundle.sh +++ b/SQLiteStudio3/create_macosx_bundle.sh @@ -179,11 +179,63 @@ EOF run rm "$_rw_image" } +propose_dylib_changes() { + local _changes _dest _ref + otool -L "$1" | awk '{print $1}' | while read -r _ref; do + case "$_ref" in + /opt/local/Library/Frameworks/*) _dest="${_ref#/opt/local/Library/Frameworks/}" ;; + /opt/local/libexec/openssl3/lib/*) _dest="${_ref#/opt/local/libexec/openssl3/lib/}" ;; + */libbz2.1.0.dylib | */libexpat.1.dylib | */liblzma.5.dylib | */libz.1.dylib) printf -- "-change %s %s\n" "$_ref" "${_ref##*/}"; continue ;; + /opt/local/lib/*) _dest="${_ref#/opt/local/lib/}" ;; + *) continue ;; + esac + if [ ! -e "$2/$_dest" ]; then + run cp -pLR "$_ref" "$2/$_dest" || abort "Could not copy $2/$_dest to bundle!"; + run install_name_tool -id "${_dest##/}" "$2/$_dest" + _changes="$(propose_dylib_changes "$2/$_dest" "$2")" + # shellcheck disable=SC2086 + [ -z "$_changes" ] || run install_name_tool $_changes "$2/$_dest" + fi + printf -- "-change %s @rpath/%s\n" "$_ref" "$_dest" + done +} + +embed_python_framework() ( + local _src_framework="$1" _ver="$2" _app="$3" + local _dest_framework="$_app/Contents/Frameworks/Python.framework" + run mkdir -p "$_dest_framework/Versions" + run cd "$_dest_framework" + run cp -RP "$_src_framework/Versions/$PYTHON_VERSION" Versions/ + run rm -fr "Versions/$PYTHON_VERSION/lib/python$PYTHON_VERSION/idlelib" + run rm -fr "Versions/$PYTHON_VERSION/lib/python$PYTHON_VERSION/test" + run ln -s "$PYTHON_VERSION" Versions/Current + run ln -s Versions/Current/Headers Versions/Current/Python Versions/Current/Resources . + run install_name_tool -id "@executable_path/../Frameworks/Python.framework/Versions/$PYTHON_VERSION/Python" "Versions/$PYTHON_VERSION/Python" + + # In each executable, apply /opt/local/lib changes + find "Versions/$PYTHON_VERSION" -type f -perm +111 | while read -r _filename; do + if [ "$_filename" = "Versions/$PYTHON_VERSION/Resources/Python.app/Contents/MacOS/Python" ]; then + _changes="-change /opt/local/lib/libintl.8.dylib @loader_path/../../../../../../../libintl.8.dylib +-change $_src_framework/Versions/$PYTHON_VERSION/Python @loader_path/../../../../Python" + else + _changes="$(propose_dylib_changes "$_filename" ..)" + fi + # shellcheck disable=SC2086 + [ -z "$_changes" ] || run install_name_tool $_changes "$_filename" + done +) + find_local_dependencies() { find "$1" -type f -perm +111 -print0 | xargs -0 otool -L \ | awk '/:$/ { sub(/:$/, ""); f = $1 } /\/(opt|usr)\/local\// { print f, $1 }' } +assert_no_dylib_problems() { + local _problems + _problems="$(find_local_dependencies "$1")" + # shellcheck disable=SC2086 + [ -z "$_problems" ] || abort 'Unresolved local/ library references:' $_problems +} if [ "$3" = "dmg" ]; then replaceInfo "$1" @@ -202,6 +254,7 @@ elif [ "$3" = "dist" ]; then python_from_macports="yes" _ref="/opt/local/Library/Frameworks/Python.framework/Versions/$PYTHON_VERSION/Python" else + python_from_macports="no" run rm -f SQLiteStudio.app/Contents/Frameworks/libpython* SQLiteStudio.app/Contents/Frameworks/libint* _ref="@loader_path/../Frameworks/libpython$PYTHON_VERSION.dylib" fi @@ -225,6 +278,25 @@ elif [ "$3" = "dist" ]; then # shellcheck disable=SC2086 pretty_dmg "SQLiteStudio.app" "SQLiteStudio-$VERSION" "$_background_img" $_background_rgb + if [ "$python_from_macports" = "yes" ]; then + info "MacPorts Python detected. Making an image with bundled Python" + + embed_python_framework /opt/local/Library/Frameworks/Python.framework "$PYTHON_VERSION" SQLiteStudio.app + + run install_name_tool \ + -change "libpython$PYTHON_VERSION.dylib" "@loader_path/../Frameworks/Python.framework/Versions/$PYTHON_VERSION/Python" \ + "$python_plugin_lib" + + assert_no_dylib_problems SQLiteStudio.app + + # shellcheck disable=SC2086 + pretty_dmg "SQLiteStudio.app" "SQLiteStudio-$VERSION-py$PYTHON_VERSION" "$_background_img" $_background_rgb + + run rm -fr SQLiteStudio.app/Contents/Frameworks/Python.framework + run install_name_tool \ + -change "@loader_path/../Frameworks/Python.framework/Versions/$PYTHON_VERSION/Python" "libpython$PYTHON_VERSION.dylib" \ + "$python_plugin_lib" + fi ls -l -- *.dmg info "Done." else From a2fec16960259636f773a3dac07cabd6bcd2df4c Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Wed, 12 Apr 2023 23:14:42 +0200 Subject: [PATCH 13/13] Replaced macOS 11+ compatible image and installer with Qt 5.15.2 by a macOS 10.13+ compatible image and installer with Qt 5.15.8. Added macOS 10.12 compatible image and installer with Qt 5.13.2. Added DMGs with bundled Python to the release workflow. This fixes DbSqliteCipher, ScriptingTcl on a good portion of macOS installs. Their dependencies were incompatible with macOS 10.13 since version 3.3.0 and with macOS 10.14-10.15 since commit 3183669. Fixes: #3991, #4234. --- .github/workflows/mac_release.yml | 186 ++++++++++++++++++++++-------- 1 file changed, 136 insertions(+), 50 deletions(-) diff --git a/.github/workflows/mac_release.yml b/.github/workflows/mac_release.yml index cd024dc8b3..48591db9e2 100644 --- a/.github/workflows/mac_release.yml +++ b/.github/workflows/mac_release.yml @@ -27,32 +27,72 @@ jobs: build: runs-on: macos-11 + strategy: + fail-fast: false + matrix: + binary_compatibility: + - "darwin_16.x86_64" # macOS 10.12, the earliest version supported by QT 5.13 + - "darwin_17.x86_64" # macOS 10.13, the earliest version supported by QT 5.15 + #- "darwin_18.x86_64" # macOS 10.14, the earliest version supported by QT 6.4 + #- "darwin_20.x86_64" # macOS 11, the earliest version supported by QT 6.5 + include: + - common_pkgs: + - brotli 1.0.9_2 + - dbus 1.14.6_0 + - double-conversion 3.2.1_0 + - freetype 2.12.1_0 + - gettext-runtime 0.21.1_0 + - glib2 2.70.5_1+x11 + - graphite2 1.3.14_0 + - harfbuzz 6.0.0_0 + - icu 72.1_0 + - jasper 4.0.0_0 + - lcms2 2.14_0 + - lerc 4.0.0_1 + - libedit 20221030-3.1_0 + - libffi 3.4.4_0 + - libiconv 1.17_0 + - libjpeg-turbo 2.1.5.1_0 + - libmng 2.0.3_1 + - libpng 1.6.39_0 + - ncurses 6.4_0 + - openssl3 3.1.0_2 + - pcre 8.45_0 + - pcre2 10.42_0 + - python39 3.9.16_0+lto+optimizations + - tcl 8.6.13_0+corefoundation+threads + - tiff 4.5.0_0 + - webp 1.3.0_0 + - xz 5.4.2_0 + - zstd 1.5.4_1 + - binary_compatibility: darwin_17.x86_64 + cflags: -arch x86_64 + dmg_postfix: "" + qmake_flags: "" + pkgs: + - qt5-qtbase 5.15.8_0+openssl + - qt5-qtdeclarative 5.15.8_0 + - qt5-qtimageformats 5.15.8_0 + - qt5-qtscript 5.15.8_0 + - qt5-qtsvg 5.15.8_0 + - qt5-qttools 5.15.8_0 + - binary_compatibility: darwin_16.x86_64 + cflags: -arch x86_64 + dmg_postfix: "-macos10.12" + qmake_flags: "" + pkgs: + - legacy-support 1.0.9_0 + - lerc 3.0_0 + - qt513-qtbase 5.13.2_8+openssl + - qt513-qtdeclarative 5.13.2_0 + - qt513-qtimageformats 5.13.2_2 + - qt513-qtscript 5.13.2_0 + - qt513-qtsvg 5.13.2_0 + - qt513-qttools 5.13.2_0 + - tiff 4.4.0_2 + steps: - # - name: Debug - # run: | - # ls -l /usr/local/ - # ls -l /usr/local/include - # ls -l /usr/local/opt/ - # ls -l /usr/local/opt/openssl/include/ - # ls -l /usr/local/opt/expat/include - - - name: Qt installation dir - id: qt-installation-dir - run: echo "DIR=$(readlink -f ${{ github.workspace }}/..)" >> $GITHUB_OUTPUT - - - name: Install Qt - uses: jurplel/install-qt-action@v3 - with: - cache: true - version: ${{ env.QT_VERSION }} - host: 'mac' - dir: '${{ steps.qt-installation-dir.DIR }}' - aqtversion: '==3.0.*' - py7zrversion: '==0.20.*' - setup-python: 'false' - extra: '--external 7z' - - - name: Install the InstalBuilder + - name: Install the InstallBuilder shell: bash run: | curl -L ${{ env.INSTALLBUILDER_URL }} --output ib.dmg @@ -62,11 +102,6 @@ jobs: echo "INSTALLER_SRC_PREFIX=$(pwd)" >> $GITHUB_ENV echo "INSTALLER_BIN_PREFIX=/Volumes/SQLiteStudio" >> $GITHUB_ENV - - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - architecture: 'x64' - - name: Clone repo uses: actions/checkout@v3 with: @@ -76,7 +111,7 @@ jobs: if: inputs.use_ccache || false uses: hendrikmuhs/ccache-action@v1.2.8 with: - key: mac_release + key: ${{ matrix.binary_compatibility }} max-size: "24M" - name: Configure ccache @@ -89,7 +124,7 @@ jobs: wget http://sqlite.org/$SQLITE_RELEASE_YEAR/sqlite-amalgamation-$SQLITE_VERSION.zip unzip sqlite-amalgamation-$SQLITE_VERSION.zip cd sqlite-amalgamation-$SQLITE_VERSION - gcc sqlite3.c -lpthread -ldl -lm -Os -fpic -shared -o libsqlite3.0.dylib \ + gcc sqlite3.c ${{ matrix.cflags }} -lpthread -ldl -lm -Os -fpic -shared -o libsqlite3.0.dylib \ -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \ -DSQLITE_ENABLE_DBSTAT_VTAB \ -DSQLITE_ENABLE_BYTECODE_VTAB \ @@ -107,13 +142,61 @@ jobs: sudo cp *.h /usr/local/include/ echo "DYLD_LIBRARY_PATH=/usr/local/lib" >> $GITHUB_ENV - - name: Install extension dependencies + - name: Restore distfiles packages cache + id: cache-distfiles + uses: actions/cache/restore@v3 + with: + path: distfiles + key: distfiles-${{ matrix.binary_compatibility }}-${{ github.sha }} + restore-keys: distfiles-${{ matrix.binary_compatibility }}- + + - name: Fetch distfiles run: | - brew tap-new $USER/local-tap - brew extract --version=$ICU_VERSION icu4c $USER/local-tap - brew install icu4c@$ICU_VERSION - echo ICU_FLAGS="$(PKG_CONFIG_PATH="/usr/local/opt/icu4c@$ICU_VERSION/lib/pkgconfig" pkg-config --libs --cflags icu-uc icu-io)" \ - >> $GITHUB_ENV + mkdir -p distfiles + fetch_binpkg() { + _any="no" + while [ -n "$1" ]; do + _url="https://packages.macports.org/$1/$1-$2.${{ matrix.binary_compatibility }}.tbz2" + _name="$1" + shift 2 + case " $*" in *" $_name "*_) echo "$_name: Skipping as an override follows"; continue ;; esac + _file="distfiles/$(basename "$_url")" + if [ ! -e "$_file" ]; then + echo "Fetching $_url" + if curl -fsL -o "$_file" "$_url"; then _any="yes" + else echo "Could not fetch, skipping"; rm -f "$_file"; fi + fi + done + echo "UPDATE_DISTFILES_CACHE=$_any" >> $GITHUB_ENV + } + fetch_binpkg ${{ join(matrix.common_pkgs, ' ') }} ${{ join(matrix.pkgs, ' ') }} + + - name: Save distfiles cache + if: env.UPDATE_DISTFILES_CACHE == 'yes' + uses: actions/cache/save@v3 + with: + path: distfiles + key: ${{ steps.cache-distfiles.outputs.cache-primary-key }} + + - name: Install MacPorts packages + run: | + mkdir macports + install_binpkg() { + while [ -n "$1" ]; do + _pkg="distfiles/$1-$2.${{ matrix.binary_compatibility }}.tbz2" + echo "Installing $_pkg" + tar -C macports -xjf "$_pkg" + shift 2 + done + } + install_binpkg ${{ join(matrix.common_pkgs, ' ') }} ${{ join(matrix.pkgs, ' ') }} + + - name: Configure MacPorts packages + run: | + cd macports + sudo ln -s $(pwd)/opt/local /opt/ + echo "PATH=/opt/local/libexec/qt5/bin:/opt/local/bin:$PATH" >> $GITHUB_ENV + echo "pythonLocation=/opt/local/Library/Frameworks/Python.framework/Versions/$PYTHON_VERSION" >> $GITHUB_ENV - name: Compile additional SQLite3 extensions shell: bash @@ -122,11 +205,11 @@ jobs: mkdir ext curl -L http://sqlite.org/$SQLITE_RELEASE_YEAR/sqlite-src-$SQLITE_VERSION.zip --output sqlite-src-$SQLITE_VERSION.zip ls -l - unzip sqlite-src-$SQLITE_VERSION.zip + unzip sqlite-src-$SQLITE_VERSION.zip -x '*.test' ls -l cd sqlite-src-$SQLITE_VERSION/ext ls -l - FLAGS="-ldl -Os -fpic -shared -I/usr/local/include -L/usr/local/lib -lsqlite3" + FLAGS="${{ matrix.cflags }} -ldl -Os -fpic -shared -I/usr/local/include -L/usr/local/lib -lsqlite3" for f in compress sqlar; do echo "gcc misc/$f.c -Imisc $FLAGS -lz -o ../../ext/$f.dylib" gcc misc/$f.c -Imisc $FLAGS -lz -o ../../ext/$f.dylib @@ -136,16 +219,12 @@ jobs: gcc misc/$f.c -Imisc $FLAGS -o ../../ext/$f.dylib done for f in icu; do + ICU_FLAGS="-I/opt/local/include -L/opt/local/lib -licuio -licui18n -licuuc -licudata" echo "gcc icu/$f.c -Iicu $ICU_FLAGS $FLAGS -o ../../ext/$f.dylib" gcc icu/$f.c -Iicu $ICU_FLAGS $FLAGS -o ../../ext/$f.dylib done ls -l ../../ext/ - - name: Install Tcl - run: | - brew install tcl-tk - echo "PATH=/usr/local/opt/tcl-tk/bin:$PATH" >> $GITHUB_ENV - - name: Prepare deps run: | mkdir ../lib ../include @@ -158,7 +237,7 @@ jobs: - name: Compile SQLiteStudio3 working-directory: output/build run: | - qmake \ + qmake ${{ matrix.qmake_flags }} \ $([ ${{ inputs.use_ccache || false }} = false ] || echo "CONFIG+=ccache") \ CONFIG+=portable \ ../../SQLiteStudio3 @@ -167,7 +246,7 @@ jobs: - name: Compile Plugins working-directory: output/build/Plugins run: | - qmake \ + qmake ${{ matrix.qmake_flags }} \ $([ ${{ inputs.use_ccache || false }} = false ] || echo "CONFIG+=ccache") \ CONFIG+=portable \ PYTHON_VERSION=$PYTHON_VERSION "INCLUDEPATH+=$pythonLocation/include/python$PYTHON_VERSION" "LIBS += -L$pythonLocation/lib" \ @@ -195,7 +274,8 @@ jobs: IB_LICENSE: ${{ secrets.INSTALLER_LICENSE }} run: | echo "$IB_LICENSE" > lic.xml - hdiutil attach output/SQLiteStudio/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.dmg + hdiutil attach output/SQLiteStudio/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.dmg \ + -mountpoint /Volumes/SQLiteStudio ${{ env.INSTALLBUILDER_DIR }}/bin/builder build SQLiteStudio-installer.xml \ --license lic.xml \ --setvars project.outputDirectory=$(pwd) \ @@ -205,11 +285,17 @@ jobs: - name: Upload package artifact uses: actions/upload-artifact@v1 with: - name: sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.dmg + name: sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}${{ matrix.dmg_postfix }}.dmg path: output/SQLiteStudio/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}.dmg + - name: Upload package artifact with Python + uses: actions/upload-artifact@v1 + with: + name: sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}-py${{ env.PYTHON_VERSION }}${{ matrix.dmg_postfix }}.dmg + path: output/SQLiteStudio/sqlitestudio-${{ env.SQLITESTUDIO_VERSION }}-py${{ env.PYTHON_VERSION }}.dmg + - name: Upload installer artifact uses: actions/upload-artifact@v1 with: - name: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-osx-installer.dmg + name: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-osx-installer${{ matrix.dmg_postfix }}.dmg path: SQLiteStudio-${{ env.SQLITESTUDIO_VERSION }}-osx-installer.dmg