diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6d4be47 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM ubuntu:20.04 + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt update +RUN sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list && \ + apt-get update && apt-get build-dep -y qt5-default && \ + apt-get install -y git build-essential python \ + libxcb-xinerama0-dev libxcb-util-dev flex bison gperf libicu-dev libxslt-dev ruby \ + libssl-dev libxcursor-dev libxcomposite-dev libxdamage-dev \ + libxrandr-dev libdbus-1-dev libfontconfig1-dev libcap-dev libxtst-dev \ + libpulse-dev libudev-dev libpci-dev libnss3-dev libasound2-dev \ + libxss-dev libegl1-mesa-dev gperf bison libasound2-dev \ + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libx11-xcb-dev \ + libicu-dev libelf-dev libdw-dev libzstd-dev wget p7zip-full vim +ADD ./build.sh /root/build.sh +RUN chmod +x /root/build.sh + +WORKDIR /root +ENTRYPOINT /bin/bash /root/build.sh diff --git a/README.md b/README.md index de43ccf..8e6221d 100644 --- a/README.md +++ b/README.md @@ -1 +1,10 @@ -# qt-creator-build \ No newline at end of file +# qt-creator-build + +Dockerfile that builds [Qt-Creator](https://code.qt.io/cgit/qt-creator/qt-creator.git/) from sources with all necessary dependencies. + +```sh +mkdir ./install +docker build -t qtc-build . +docker run --rm -ti -v `realpath ./install`:/root/install qtc-build +``` +Archive with Qt-Creator will be appeared at install directory. diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..cb277ae --- /dev/null +++ b/build.sh @@ -0,0 +1,98 @@ +#!/bin/bash + +set -e +set -x + +QT_VERSION=6.2.2 +QT_CREATOR_VERSION=8.0.0 +LLVM_VERSION=release/14.x +CLAZY_VERSION=1.10 + +INSTALL_PREFIX=/opt/qt-creator/$QT_CREATOR_VERSION +WORKDIR=/tmp/workdir + +SCRIPT=`realpath $0` +SCRIPTPATH=`dirname $SCRIPT` + +mkdir -p $WORKDIR +cd $WORKDIR + +# CMake checkout and build +git clone https://gitlab.kitware.com/cmake/cmake.git --depth 1 +cd cmake +./bootstrap && make -j7 && make install && make clean + +# LLVM download and extract +echo "Build LLVM" +cd $WORKDIR +git clone https://github.com/llvm/llvm-project.git -b $LLVM_VERSION --depth 1 +mkdir llvm-project/build && cd llvm-project/build +cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt" \ + ../llvm +make -j7 && make install && make clean +export PATH=$PATH:$INSTALL_PREFIX/bin + +echo "Build clazy" +cd $WORKDIR +git clone https://github.com/KDE/clazy.git -b $CLAZY_VERSION +cd clazy && cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX . && make -j4 && make install + +# Download and build Qt +echo "Checkout Qt sources" +cd $WORKDIR +git clone https://code.qt.io/qt/qt5.git -b $QT_VERSION --depth 1 +cd qt5 && ./init-repository + +echo "Configure Qt" +cd $WORKDIR && mkdir -p build && cd build +../qt5/configure \ + -prefix $INSTALL_PREFIX \ + -opensource \ + -confirm-license \ + -skip qtwebengine -skip qt3d -skip qtspeech -skip wayland -skip qtquick3d \ + -nomake examples -nomake tests \ + -silent + +echo "Building Qt ..." +make -j4 + +echo "Installing Qt ..." +make install +make clean + +# Download and build Qt-Creator +echo "Checkout Qt-Creator sources" +cd $WORKDIR +git clone https://code.qt.io/qt-creator/qt-creator.git -b v$QT_CREATOR_VERSION --depth 1 + +cd qt-creator +git submodule update --init --recursive + +mkdir ../build-creator +cd ../build-creator + +cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH=$INSTALL_PREFIX \ + -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \ + -DCMAKE_INSTALL_RPATH=$INSTALL_PREFIX/lib \ + -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=On \ + -DPYTHON_EXECUTABLE=`which python3` ../qt-creator + +#read -p "Press enter to continue" + +echo "Building Qt-Creator ..." +make -j4 + +echo "Installing Qt-Creator ..." +make install + +# Collect artifacts +mkdir -p /root/install +cd /root/install +tar -zcf qt-creator-$QT_CREATOR_VERSION.tar.gz $INSTALL_PREFIX + +echo "Done"