diff --git a/6.7-gcc-aqt/Dockerfile b/6.7-gcc-aqt/Dockerfile new file mode 100644 index 0000000..7d74b1e --- /dev/null +++ b/6.7-gcc-aqt/Dockerfile @@ -0,0 +1,45 @@ +# Image: stateoftheartio/qt6:6.6-gcc-aqt + +FROM ubuntu:20.04 +MAINTAINER State Of The Art (@stateoftheartio) + +# PIP requirement like "aqtinstall==2.0.6" or url with egg file +ARG AQT_VERSION="aqtinstall==3.1.13" + +ARG QT_VERSION=6.7.0 +# LINUXDEPLOY_COMMIT Jan 3, 2024 +ARG LINUXDEPLOY_COMMIT=2b73a2173f8acfc0269e681bdb28ebf65b0b4b48 +# LINUXDEPLOY_QT_COMMIT Apr 25, 2024 +ARG LINUXDEPLOY_QT_COMMIT=0e7e8ce889c1105373e88e409ea555058673bb1e +ARG QT_PATH=/opt/Qt + +ARG ADDITIONAL_PACKAGES="sudo git openssh-client ca-certificates build-essential curl python3 locales patchelf" + +ENV DEBIAN_FRONTEND=noninteractive \ + DEBCONF_NONINTERACTIVE_SEEN=true \ + QT_VERSION=${QT_VERSION} \ + AQT_VERSION=${AQT_VERSION} \ + QT_PATH=${QT_PATH} \ + QT_GCC=${QT_PATH}/${QT_VERSION}/gcc_64 \ + PATH=${QT_PATH}/Tools/CMake/bin:${QT_PATH}/Tools/Ninja:${QT_PATH}/${QT_VERSION}/gcc_64/bin:$PATH + +COPY get_qt.sh get_linuxdeploy.sh install_packages.sh /tmp/ + +# Get Qt binaries with aqt +RUN /tmp/get_qt.sh + +# Get linuxdeploy and build it +RUN /tmp/get_linuxdeploy.sh + +# Install the required packages +RUN /tmp/install_packages.sh + +# Reconfigure locale +RUN locale-gen en_US.UTF-8 && dpkg-reconfigure locales + +# Add group & user + sudo +RUN groupadd -r user && useradd --create-home --gid user user && echo 'user ALL=NOPASSWD: ALL' > /etc/sudoers.d/user + +USER user +WORKDIR /home/user +ENV HOME /home/user diff --git a/6.7-gcc-aqt/get_linuxdeploy.sh b/6.7-gcc-aqt/get_linuxdeploy.sh new file mode 100755 index 0000000..7f58aef --- /dev/null +++ b/6.7-gcc-aqt/get_linuxdeploy.sh @@ -0,0 +1,55 @@ +#!/bin/sh -xe +# Script to install linuxdeploy with qt plugin + +[ "$LINUXDEPLOY_GIT" ] || LINUXDEPLOY_GIT="https://github.com/linuxdeploy/linuxdeploy.git" +[ "$LINUXDEPLOY_COMMIT" ] || LINUXDEPLOY_COMMIT="17ca786a2523a375617a8b274f70cef9c7189373" # Jul 13, 2023 +[ "$LINUXDEPLOY_QT_GIT" ] || LINUXDEPLOY_QT_GIT="https://github.com/linuxdeploy/linuxdeploy-plugin-qt.git" +[ "$LINUXDEPLOY_QT_COMMIT" ] || LINUXDEPLOY_QT_COMMIT="9a388d32b1e95d8b69e201356f050137eb6c0aa3" # May 25, 2023 + +# Init the package system +apt update + +echo +echo '--> Save the original installed packages list' +echo + +dpkg --get-selections | cut -f 1 > /tmp/packages_orig.lst + +echo +echo '--> Install the required packages to install linuxdeploy' +echo + +apt install -y git libboost-filesystem-dev libboost-regex-dev cimg-dev wget patchelf nlohmann-json3-dev build-essential + +echo +echo '--> Download & install the linuxdeploy' +echo + +git clone "$LINUXDEPLOY_GIT" /tmp/linuxdeploy +git -C /tmp/linuxdeploy checkout "$LINUXDEPLOY_COMMIT" +git -C /tmp/linuxdeploy submodule update --init --recursive +git clone "$LINUXDEPLOY_QT_GIT" /tmp/linuxdeploy-plugin-qt +git -C /tmp/linuxdeploy-plugin-qt checkout "$LINUXDEPLOY_QT_COMMIT" +git -C /tmp/linuxdeploy-plugin-qt submodule update --init --recursive + +cmake /tmp/linuxdeploy -B /tmp/linuxdeploy-build -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DUSE_CCACHE=OFF +cmake --build /tmp/linuxdeploy-build + +cmake /tmp/linuxdeploy-plugin-qt -B /tmp/linuxdeploy-plugin-qt-build -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DUSE_CCACHE=OFF +cmake --build /tmp/linuxdeploy-plugin-qt-build + +mkdir -p /usr/local/bin +mv /tmp/linuxdeploy-build/bin/linuxdeploy /usr/local/bin +mv /tmp/linuxdeploy-plugin-qt-build/bin/linuxdeploy-plugin-qt /usr/local/bin + +echo +echo '--> Restore the packages list to the original state' +echo + +dpkg --get-selections | cut -f 1 > /tmp/packages_curr.lst +grep -Fxv -f /tmp/packages_orig.lst /tmp/packages_curr.lst | xargs apt remove -y --purge + +# Complete the cleaning + +apt -qq clean +rm -rf /var/lib/apt/lists/* /tmp/linuxdeploy* diff --git a/6.7-gcc-aqt/get_qt.sh b/6.7-gcc-aqt/get_qt.sh new file mode 100755 index 0000000..7f1e588 --- /dev/null +++ b/6.7-gcc-aqt/get_qt.sh @@ -0,0 +1,48 @@ +#!/bin/sh -xe +# Script to install Qt 6 in docker container + +[ "$AQT_VERSION" ] || AQT_VERSION=aqtinstall +[ "$QT_VERSION" ] || exit 1 + +[ "$QT_PATH" ] || QT_PATH=/opt/Qt + +root_dir=$PWD +[ "$root_dir" != '/' ] || root_dir="" + +# Init the package system +apt update + +echo +echo '--> Save the original installed packages list' +echo + +dpkg --get-selections | cut -f 1 > /tmp/packages_orig.lst + +echo +echo '--> Install the required packages to install Qt' +echo + +apt install -y git python3-pip libglib2.0-0 +pip3 install --no-cache-dir "$AQT_VERSION" + +echo +echo '--> Download & install the Qt library using aqt' +echo + +aqt install-qt -O "$QT_PATH" linux desktop "$QT_VERSION" linux_gcc_64 +aqt install-tool -O "$QT_PATH" linux desktop tools_cmake +aqt install-tool -O "$QT_PATH" linux desktop tools_ninja + +pip3 freeze | xargs pip3 uninstall -y + +echo +echo '--> Restore the packages list to the original state' +echo + +dpkg --get-selections | cut -f 1 > /tmp/packages_curr.lst +grep -Fxv -f /tmp/packages_orig.lst /tmp/packages_curr.lst | xargs apt remove -y --purge + +# Complete the cleaning + +apt -qq clean +rm -rf /var/lib/apt/lists/* diff --git a/6.7-gcc-aqt/install_packages.sh b/6.7-gcc-aqt/install_packages.sh new file mode 100755 index 0000000..c2f54e6 --- /dev/null +++ b/6.7-gcc-aqt/install_packages.sh @@ -0,0 +1,39 @@ +#!/bin/sh -xe + +[ "$QT_PATH" ] || QT_PATH=/opt/Qt + +[ "$ADDITIONAL_PACKAGES" ] || ADDITIONAL_PACKAGES='build-essential ninja-build' + +# Init package system +apt update + +echo +echo '--> Locating the shared libs required for the installed tools' +echo + +find "$QT_PATH" /usr/local -executable -type f -o -name '*.so' | xargs ldd 2>/dev/null | \ + grep -F '=> not found' | tr '\t' ' ' | cut -d' ' -f2 | sort -u | tee /tmp/not_found_libs.lst + +echo +echo '--> Locating packages to provide the required shared libs' +echo + +apt install -y apt-file +apt-file update + +while read line ; do apt-file find $line | grep '^lib' | head -1; done < /tmp/not_found_libs.lst | tee /tmp/to_install_libs.lst + +# TODO: Clean apt-file cache + +apt autoremove -y --purge apt-file + +echo +echo '--> Install the found libraries' +echo + +cat /tmp/to_install_libs.lst | cut -d: -f 1 | xargs apt install -y --no-install-suggests --no-install-recommends $ADDITIONAL_PACKAGES + +# Complete the cleaning + +apt -qq clean +rm -rf /var/lib/apt/lists/* diff --git a/6.7-macos-aqt/Dockerfile b/6.7-macos-aqt/Dockerfile new file mode 100644 index 0000000..92c9665 --- /dev/null +++ b/6.7-macos-aqt/Dockerfile @@ -0,0 +1,45 @@ +# Image: stateoftheartio/qt6:6.6-macos-aqt + +FROM ubuntu:20.04 +MAINTAINER State Of The Art (@stateoftheartio) + +# PIP requirement like "aqtinstall==2.0.6" or url with egg file +ARG AQT_VERSION="aqtinstall==3.1.13" +ARG OSXCROSS_URL=https://github.com/tpoechtrager/osxcross/archive/ff8d100f3f026b4ffbe4ce96d8aac4ce06f1278b.tar.gz +ARG OSXCROSS_SHA256=fe2880db44d0cd0fea9fd37b77743c32297f2832eb8bcbf49ea16182f1634ace +ARG SDK_URL=https://github.com/alexey-lysiuk/macos-sdk/releases/download/12.3/MacOSX12.3.tar.xz +ARG SDK_SHA256=91c03be5399be04d8f6b773da13045525e01298c1dfff273b4e1f1e904ee5484 + +ARG QT_VERSION=6.7.0 +ARG QT_PATH=/opt/Qt + +ARG ADDITIONAL_PACKAGES="sudo git openssh-client ca-certificates curl python3 locales clang genisoimage" + +ENV DEBIAN_FRONTEND=noninteractive \ + DEBCONF_NONINTERACTIVE_SEEN=true \ + QT_VERSION=${QT_VERSION} \ + AQT_VERSION=${AQT_VERSION} \ + QT_PATH=${QT_PATH} \ + QT_MACOS=${QT_PATH}/${QT_VERSION}/macos \ + PATH=$PATH:${QT_PATH}/Tools/CMake/bin:${QT_PATH}/Tools/Ninja:${QT_PATH}/${QT_VERSION}/macos/bin:/opt/osxcross/bin + +COPY get_qt.sh get_osxcross.sh install_packages.sh /tmp/ + +# Get Qt binaries with aqt +RUN /tmp/get_qt.sh + +# Get osxcross +RUN /tmp/get_osxcross.sh + +# Install the required packages +RUN /tmp/install_packages.sh + +# Reconfigure locale +RUN locale-gen en_US.UTF-8 && dpkg-reconfigure locales + +# Add group & user + sudo +RUN groupadd -r user && useradd --create-home --gid user user && echo 'user ALL=NOPASSWD: ALL' > /etc/sudoers.d/user + +USER user +WORKDIR /home/user +ENV HOME /home/user diff --git a/6.7-macos-aqt/get_osxcross.sh b/6.7-macos-aqt/get_osxcross.sh new file mode 100755 index 0000000..cc03e3a --- /dev/null +++ b/6.7-macos-aqt/get_osxcross.sh @@ -0,0 +1,76 @@ +#!/bin/sh -xe +# Script to install osxcross with SDK + +[ "$OSXCROSS_URL" ] || OSXCROSS_URL="https://github.com/tpoechtrager/osxcross/archive/5e1b71fcceb23952f3229995edca1b6231525b5b.tar.gz" # Sep 22, 2023 +[ "$OSXCROSS_SHA256" ] || OSXCROSS_SHA256=d3f771bbc20612fea577b18a71be3af2eb5ad2dd44624196cf55de866d008647 +[ "$SDK_URL" ] || SDK_URL="https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz" +[ "$SDK_SHA256" ] || SDK_SHA256=cd4f08a75577145b8f05245a2975f7c81401d75e9535dcffbb879ee1deefcbf4 + +root_dir=$PWD +[ "$root_dir" != '/' ] || root_dir="" + +# Init the package system +apt update + +echo +echo '--> Save the original installed packages list' +echo + +dpkg --get-selections | cut -f 1 > /tmp/packages_orig.lst + +echo +echo '--> Install the required packages to install osxcross' +echo + +apt install -y curl ca-certificates clang llvm-dev libxml2-dev uuid-dev libssl-dev cpio libbz2-dev make patch git zlib1g-dev + +echo +echo '--> Download & install the osxcross and sdk' +echo + +mkdir /tmp/osxcross +cd /tmp/osxcross + +echo "$OSXCROSS_SHA256 -" > sum.txt && curl -fLs "$OSXCROSS_URL" | tee /tmp/osxcross.tar.gz | sha256sum -c sum.txt +tar xf /tmp/osxcross.tar.gz --strip-components=1 +echo "$SDK_SHA256 -" > sum.txt && curl -fLs "$SDK_URL" | tee /tmp/osxcross/tarballs/$(basename "$SDK_URL") | sha256sum -c sum.txt + +# Build and place the osxcross +export OUT_DIR=/opt/osxcross +UNATTENDED=1 TARGET_DIR=$OUT_DIR ./build.sh + +# Create helper files +mkdir -p /usr/local/bin +cat - < /usr/local/bin/qt-cmake +#!/bin/sh +set -e + +# Set arch to "x86_64" or "aarch64" to build it +[ "\$BUILD_ARCH" ] || BUILD_ARCH=x86_64 + +eval "\$($OUT_DIR/bin/\$BUILD_ARCH-apple-*-osxcross-conf)" +export OSXCROSS_HOST="\$BUILD_ARCH-apple-\$OSXCROSS_TARGET" +export OSXCROSS_TOOLCHAIN_FILE="\$OSXCROSS_TARGET_DIR"/toolchain.cmake +export CMAKE_TOOLCHAIN_FILE=\$QT_MACOS/lib/cmake/Qt6/qt.toolchain.cmake + +exec cmake -DQT_CHAINLOAD_TOOLCHAIN_FILE=\$OSXCROSS_TOOLCHAIN_FILE "\$@" +EOF + +chmod +x /usr/local/bin/* + +# Required tools for macdeployqt, they will work for both architectures +ln -s $OUT_DIR/bin/x86_64-apple-*-otool /usr/local/bin/otool +ln -s $OUT_DIR/bin/x86_64-apple-*-install_name_tool /usr/local/bin/install_name_tool +ln -s $OUT_DIR/bin/x86_64-apple-*-strip /usr/local/bin/strip + +echo +echo '--> Restore the packages list to the original state' +echo + +dpkg --get-selections | cut -f 1 > /tmp/packages_curr.lst +grep -Fxv -f /tmp/packages_orig.lst /tmp/packages_curr.lst | xargs apt remove -y --purge + +# Complete the cleaning + +apt -qq clean +rm -rf /var/lib/apt/lists/* /tmp/osxcross* diff --git a/6.7-macos-aqt/get_qt.sh b/6.7-macos-aqt/get_qt.sh new file mode 100755 index 0000000..2915aec --- /dev/null +++ b/6.7-macos-aqt/get_qt.sh @@ -0,0 +1,139 @@ +#!/bin/sh -xe +# Script to install Qt 6 in docker container + +[ "$AQT_VERSION" ] || AQT_VERSION=aqtinstall +[ "$QT_VERSION" ] || exit 1 + +[ "$QT_PATH" ] || QT_PATH=/opt/Qt + +root_dir=$PWD +[ "$root_dir" != '/' ] || root_dir="" + +# Init the package system +apt update + +echo +echo '--> Save the original installed packages list' +echo + +dpkg --get-selections | cut -f 1 > /tmp/packages_orig.lst + +echo +echo '--> Install the required packages to install Qt' +echo + +apt install -y git python3-pip libglib2.0-0 +pip3 install --no-cache-dir "$AQT_VERSION" + +echo +echo '--> Download & install the Qt library using aqt' +echo + +aqt install-qt -O "$QT_PATH" mac desktop "$QT_VERSION" + +# Installing tools to execute cross-platform +aqt install-qt -O "$QT_PATH" linux desktop "$QT_VERSION" linux_gcc_64 +aqt install-tool -O "$QT_PATH" linux desktop tools_cmake +aqt install-tool -O "$QT_PATH" linux desktop tools_ninja + +pip3 freeze | xargs pip3 uninstall -y + +echo +echo '--> Preparing cross-tools' +echo + +apt install -y libclang-dev curl + +# Download & unpack sources to build macdeployqt +curl -Lo /tmp/qtbase-src.tar.xz "https://download.qt.io/official_releases/qt/$(echo $QT_VERSION | cut -d. -f 1-2)/${QT_VERSION}/submodules/qtbase-everywhere-src-${QT_VERSION}.tar.xz" +tar -C /tmp -xf /tmp/qtbase-src.tar.xz +rm -f /tmp/qtbase-src.tar.xz + +# Patch the macdeployqt tool +cat - <<\EOF | patch -p 1 "/tmp/qtbase-everywhere-src-${QT_VERSION}/src/tools/macdeployqt/shared/shared.cpp" +--- a/src/tools/macdeployqt/shared/shared.cpp ++++ b/src/tools/macdeployqt/shared/shared.cpp +@@ -414,6 +414,10 @@ + CFRelease(bundle); + } + CFRelease(bundleURL); ++#else ++ // Cross-compilation on other systems uses static path to the binary ++ QString binName = QFileInfo(appBundlePath).completeBaseName(); ++ binaryPath = QDir(appBundlePath).filePath(QString("Contents/MacOS/").append(binName)); + #endif + + if (QFile::exists(binaryPath)) +EOF + +# Building macdeployqt tool +cmake -S "/tmp/qtbase-everywhere-src-${QT_VERSION}" -G Ninja -B /tmp/macdeployqt-build \ + -DQT_FEATURE_macdeployqt=ON -DQT_FEATURE_network=OFF -DQT_FEATURE_gui=OFF \ + -DQT_FEATURE_concurrent=OFF -DQT_FEATURE_sql=OFF -DQT_FEATURE_dbus=OFF \ + -DQT_FEATURE_testlib=OFF -DQT_FEATURE_printsupport=OFF -DQT_FEATURE_androiddeployqt=OFF \ + -DBUILD_SHARED_LIBS=OFF +cmake --build /tmp/macdeployqt-build + +# Copy macdeployqt to the qt macos bin directory +cp -a /tmp/macdeployqt-build/bin/macdeployqt "$QT_MACOS/bin" +rm -rf /tmp/macdeployqt-build /tmp/qtbase-everywhere-src-${QT_VERSION} + +# Creating the required scripts for macdeployqt +mkdir -p /usr/local/bin +cat - <<\EOF > /usr/local/bin/hdiutil +#!/bin/sh -e +# Tool to use in macdeployqt +# Will just pack the srcdir to the ISO 9660 dmg archive + +OPERATION=$1 +OUTPUT=$2 +SRCFOLDER=unset +VOLNAME=unset + +[ "x$OPERATION" = "xcreate" ] || exit 1 + +PARSED_ARGUMENTS=$(getopt -a -n hdiutil --long srcfolder:,volname:,format:,fs: -- "$@") +eval set -- "$PARSED_ARGUMENTS" +while : +do + case "$1" in + --srcfolder) SRCFOLDER="$2" ; shift 2 ;; + --volname) VOLNAME="$2" ; shift 2 ;; + --format) echo "WARN: format parameter '$2' is not supported, will use UDRO" ; shift 2 ;; + --fs) echo "WARN: fs parameter '$2' is not supported, will use ISO 9660" ; shift 2 ;; + --) shift; break ;; + *) echo "Unexpected option: $1 - not supported." ;; + esac +done + +mkdir -p "$SRCFOLDER.iso" +mv "$SRCFOLDER" "$SRCFOLDER.iso" +genisoimage -D -V "$VOLNAME" -no-pad -r -apple -o "$OUTPUT" "$SRCFOLDER.iso" +mv "$SRCFOLDER.iso"/$(basename "$SRCFOLDER") "$SRCFOLDER" +rmdir "$SRCFOLDER.iso" +EOF + +chmod +x /usr/local/bin/* + +# Copying bin and libexec to macos directory to use Qt UI and other compilers +cp -a "$QT_MACOS/../gcc_64/bin" "$QT_MACOS/" +cp -a "$QT_MACOS/../gcc_64/libexec" "$QT_MACOS/" +# Libs required by libexec +cp -a "$QT_MACOS/../gcc_64/lib"/libQt6Core.so* "$QT_MACOS/../gcc_64/lib"/libQt6Qml.so* \ + "$QT_MACOS/../gcc_64/lib"/libQt6QmlCompiler.so* \ + "$QT_MACOS/../gcc_64/lib"/libQt6Network.so* "$QT_MACOS/../gcc_64/lib"/libicu* /usr/local/lib/ + +# Cleaning not needed anymore qt gcc & src +rm -rf "$QT_MACOS/../gcc_64" "$QT_MACOS/../Src" + +echo +echo '--> Restore the packages list to the original state' +echo + +dpkg --get-selections | cut -f 1 > /tmp/packages_curr.lst +grep -Fxv -f /tmp/packages_orig.lst /tmp/packages_curr.lst | xargs apt remove -y --purge + +# Complete the cleaning + +apt -qq clean +rm -rf /var/lib/apt/lists/* diff --git a/6.7-macos-aqt/install_packages.sh b/6.7-macos-aqt/install_packages.sh new file mode 100755 index 0000000..4a86fd0 --- /dev/null +++ b/6.7-macos-aqt/install_packages.sh @@ -0,0 +1,39 @@ +#!/bin/sh -xe + +[ "$QT_PATH" ] || QT_PATH=/opt/Qt + +[ "$ADDITIONAL_PACKAGES" ] || ADDITIONAL_PACKAGES='build-essential ninja-build' + +# Init package system +apt update + +echo +echo '--> Locating the shared libs required for the installed tools' +echo + +find "$QT_PATH" /usr/local /opt -executable -type f -o -name '*.so' | xargs ldd 2>/dev/null | \ + grep -F '=> not found' | tr '\t' ' ' | cut -d' ' -f2 | sort -u | tee /tmp/not_found_libs.lst + +echo +echo '--> Locating packages to provide the required shared libs' +echo + +apt install -y apt-file +apt-file update + +while read line ; do apt-file find $line | grep '^lib' | head -1; done < /tmp/not_found_libs.lst | tee /tmp/to_install_libs.lst + +# TODO: Clean apt-file cache + +apt autoremove -y --purge apt-file + +echo +echo '--> Install the found libraries' +echo + +cat /tmp/to_install_libs.lst | cut -d: -f 1 | xargs apt install -y --no-install-suggests --no-install-recommends $ADDITIONAL_PACKAGES + +# Complete the cleaning + +apt -qq clean +rm -rf /var/lib/apt/lists/* diff --git a/6.7-mingw-aqt/Dockerfile b/6.7-mingw-aqt/Dockerfile new file mode 100644 index 0000000..d85f739 --- /dev/null +++ b/6.7-mingw-aqt/Dockerfile @@ -0,0 +1,42 @@ +# Image: stateoftheartio/qt6:6.6-mingw-aqt + +FROM ubuntu:20.04 +MAINTAINER State Of The Art (@stateoftheartio) + +# Just version "2.0.6" for example +ARG AQT_VERSION=3.1.14 +ARG AQT_SHA256=6c2d9dd85925b003b01990f781a7ead30945610a9048755e1f87496fff642df6 + +ARG QT_VERSION=6.7.0 +ARG QT_PATH=C:\\Qt + +ARG ADDITIONAL_PACKAGES="git openssh-client curl ca-certificates wine64" + +ENV DEBIAN_FRONTEND=noninteractive \ + DEBCONF_NONINTERACTIVE_SEEN=true \ + QT_VERSION=${QT_VERSION} \ + AQT_VERSION=${AQT_VERSION} \ + AQT_SHA256=${AQT_SHA256} \ + QT_PATH=${QT_PATH} \ + WINEDEBUG=-all + +COPY get_qt.sh install_packages.sh /tmp/ + +# Install required packages, add group & user + sudo +RUN apt update && apt install -y --no-install-suggests --no-install-recommends locales sudo && \ + sudo apt -qq clean && rm -rf /var/lib/apt/lists/* && \ + groupadd -r user && useradd -m -g user user && \ + echo 'user ALL=NOPASSWD: ALL' > /etc/sudoers.d/user + +# Reconfigure locale +RUN locale-gen en_US.UTF-8 && dpkg-reconfigure locales + +USER user +WORKDIR /home/user +ENV HOME /home/user + +# Get Qt binaries with aqt +RUN /tmp/get_qt.sh + +# Install the required packages +RUN /tmp/install_packages.sh diff --git a/6.7-mingw-aqt/get_qt.sh b/6.7-mingw-aqt/get_qt.sh new file mode 100755 index 0000000..8a0483d --- /dev/null +++ b/6.7-mingw-aqt/get_qt.sh @@ -0,0 +1,92 @@ +#!/bin/sh -xe +# Script to install Qt 6 in docker container + +[ "$AQT_VERSION" ] || AQT_VERSION=2.0.5 +[ "$AQT_URL" ] || AQT_URL="https://github.com/miurahr/aqtinstall/releases/download/v$AQT_VERSION/aqt.exe" +[ "$AQT_SHA256" ] || AQT_SHA256=5f618c6f7938523a75299226d34e02b17874859185c117e36895835f68590822 +[ "$QT_VERSION" ] || exit 1 + +[ "$QT_PATH" ] || QT_PATH=C:\\Qt + +root_dir=$PWD +[ "$root_dir" != '/' ] || root_dir="" + +# Init the package system +sudo apt update + +echo +echo '--> Save the original installed packages list' +echo + +dpkg --get-selections | cut -f 1 > /tmp/packages_orig.lst + +echo +echo '--> Install the required packages to install Qt' +echo + +sudo -E apt install -y --no-install-suggests --no-install-recommends curl ca-certificates wine64 +echo "$AQT_SHA256 -" > sum.txt && curl -fLs "$AQT_URL" | tee /tmp/aqt.exe | sha256sum -c sum.txt + +echo +echo '--> Download & install the Qt library using aqt' +echo + +sudo -E ln -s /usr/bin/wine64-stable /usr/local/bin/wine + +wine /tmp/aqt.exe install-qt -O "$QT_PATH" windows desktop "$QT_VERSION" win64_mingw +wine /tmp/aqt.exe install-tool -O "$QT_PATH" windows desktop tools_mingw90 +wine /tmp/aqt.exe install-tool -O "$QT_PATH" windows desktop tools_cmake +wine /tmp/aqt.exe install-tool -O "$QT_PATH" windows desktop tools_ninja +wine /tmp/aqt.exe install-tool -O "$QT_PATH" windows desktop tools_opensslv3_x64 +wine /tmp/aqt.exe install-tool -O "$QT_PATH" windows desktop tools_vcredist + +echo +echo '--> Set Qt and Tools PATH for wine' +echo + +cat - < /tmp/path.reg +Windows Registry Editor Version 5.00 + +[HKEY_CURRENT_USER\\Environment] +"Path"="$(find "/home/user/.wine/drive_c/Qt" -type d -name bin -o -name Ninja | sed "s|/home/user/.wine/drive_c|C:|" | sed 's|/|\\\\|g' | tr '\n' ';')" +EOF + +wine regedit /tmp/path.reg + +echo +echo '--> Create helper functions' +echo + +cat - <<\EOF | sudo -E tee /usr/local/bin/qt-cmake +#!/bin/sh +wine cmd /c qt-cmake "$@" +EOF + +cat - <<\EOF | sudo -E tee /usr/local/bin/cmake +#!/bin/sh +wine cmake "$@" +EOF + +cat - <<\EOF | sudo -E tee /usr/local/bin/ninja +#!/bin/sh +wine ninja "$@" +EOF + +cat - <<\EOF | sudo -E tee /usr/local/bin/windeployqt +#!/bin/sh +wine windeployqt "$@" +EOF + +sudo -E chmod +x /usr/local/bin/* + +echo +echo '--> Restore the packages list to the original state' +echo + +dpkg --get-selections | cut -f 1 > /tmp/packages_curr.lst +grep -Fxv -f /tmp/packages_orig.lst /tmp/packages_curr.lst | xargs sudo -E apt remove -y --purge + +# Complete the cleaning + +sudo -E apt -qq clean +sudo -E rm -rf /var/lib/apt/lists/* /tmp/wine-* diff --git a/6.7-mingw-aqt/install_packages.sh b/6.7-mingw-aqt/install_packages.sh new file mode 100755 index 0000000..1bf462c --- /dev/null +++ b/6.7-mingw-aqt/install_packages.sh @@ -0,0 +1,17 @@ +#!/bin/sh -xe + +[ "$ADDITIONAL_PACKAGES" ] || ADDITIONAL_PACKAGES='wine64' + +# Init package system +sudo -E apt update + +echo +echo '--> Install the additional packages' +echo + +sudo -E apt install -y --no-install-suggests --no-install-recommends $ADDITIONAL_PACKAGES + +# Complete the cleaning + +sudo -E apt -qq clean +sudo -E rm -rf /var/lib/apt/lists/* /tmp/* diff --git a/README.md b/README.md index eb4974b..071691c 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,10 @@ Uses great AQT tool to simplify the installation process of Qt libs: https://git Dockerhub: https://hub.docker.com/r/stateoftheartio/qt6 +* [6.7-gcc-aqt](https://hub.docker.com/r/stateoftheartio/qt6/tags?page=1&name=6.7-gcc-aqt) - Linux GCC 64 +* [6.7-mingw-aqt](https://hub.docker.com/r/stateoftheartio/qt6/tags?page=1&name=6.7-mingw-aqt) - Windows (wine) 64 MinGW toolchain +* [6.7-macos-aqt](https://hub.docker.com/r/stateoftheartio/qt6/tags?page=1&name=6.7-macos-aqt) - MacOS X osxcross toolchain for x86_64, aarch64 + * [6.6-gcc-aqt](https://hub.docker.com/r/stateoftheartio/qt6/tags?page=1&name=6.6-gcc-aqt) - Linux GCC 64 * [6.6-android-aqt](https://hub.docker.com/r/stateoftheartio/qt6/tags?page=1&name=6.6-android-aqt) - Android Clang multiarch toolkit for x86_64, x86, armv7 and arm64_v8a arch * [6.6-wasm-aqt](https://hub.docker.com/r/stateoftheartio/qt6/tags?page=1&name=6.6-wasm-aqt) - WebAssembly toolchain