Commit 85ca8584 authored by Nikunj Arora's avatar Nikunj Arora
Browse files

Added Dockerfile and build script

parent 3888dc6d
FROM ubuntu:latest
ARG DEBIAN_FRONTEND=noninteractive
# Enable "deb-src" in sources.list
RUN sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list &&\
apt update
# Install CMake from source
RUN apt install -y build-essential libssl-dev wget curl &&\
cd /tmp &&\
wget https://github.com/Kitware/CMake/releases/download/v3.22.3/cmake-3.22.3.tar.gz &&\
tar -xzvf cmake-3.22.3.tar.gz &&\
cd cmake-3.22.3 &&\
./bootstrap &&\
make &&\
make install &&\
cd / &&\
rm -rf /tmp/*
# Install nodejs
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - &&\
apt update &&\
apt install -y nodejs
# Install other dependencies
RUN apt install -y \
git \
ninja-build \
perl \
python2 \
python3 \
bison \
flex \
gperf \
libgl-dev \
openjdk-11-jdk
COPY build.sh /home
CMD ["./home/build.sh"]
#!/bin/bash
# Mount installation directory to /mnt/qt
if [ -d "/mnt/qt" ]; then
cd /mnt/qt
fi
git clone git://code.qt.io/qt/qt5.git qt-src
cd qt-src
perl init-repository --module-subset=${REPOS} # Eg. REPOS=qtbase,qtmultimedia,qttools
cd ..
mkdir qt-build && cd qt-build
../qt-src/configure -prefix ../qt-build-install
ninja
cmake --install .
# Set BUILD_ANDROID if building for android
if [[ -z "${BUILD_ANDROID}" ]]; then
echo "Build Complete"
exit 0
fi
# Mount android sdk to /mnt/android-sdk and android ndk to /mnt/android-ndk
if [ ! -d "/mnt/android-sdk"] || [! -d "/mnt/android-ndk" ]; then
echo "Android SDK/NDK not found"
exit 1
fi
# Set ANDROID_ABI like this: ANDROID_ABI=armeabi-v7a;arm64-v8a;x86;x86_64
export IFS=";"
for abi in ${ANDROID_ABI}; do
echo "Building Android for ABI ${abi}"
cd ..
mkdir qt-build-android-${abi} && cd qt-build-android-${abi}
../qt-src/configure -xplatform android-clang -android-abis ${abi} -qt-host-path ../qt-build-install -android-ndk /mnt/android-ndk/ -android-sdk /mnt/android-sdk -prefix ../qt-build-android-install-${abi}
ninja
cmake --install .
done
# Set BUILD_QAA if building QAA
if [[ -z "${BUILD_QAA}" ]]; then
echo "Build Complete"
exit 0
fi
# Mount ssh keys folder (~/.ssh) to /mnt/ssh
if [ ! -d "/mnt/ssh"]; then
echo "SSH keys not found"
exit 1
fi
# Set GERRIT_USER for gerrit username
cd ..
eval $(ssh-agent -s)
ssh-add /mnt/ssh/id_rsa
mkdir /root/.ssh
ssh-keyscan -t rsa git.qt.io >> /root/.ssh/known_hosts
# QTIF
git clone "ssh://${GERRIT_USER}@codereview.qt-project.org:29418/qt/qtinterfaceframework"
cd qtinterfaceframework
git submodule init && git submodule update
cd ..
./qt-build-install/bin/qt-cmake -GNinja -S qtinterfaceframework -B qtinterfaceframework-build/
cd qtinterfaceframework-build
cmake --build . && cmake --install .
cd ..
for abi in ${ANDROID_ABI}; do
./qt-build-android-install-${abi}/bin/qt-cmake -GNinja -DANDROID_NDK_ROOT=/mnt/android-ndk -DANDROID_SDK_ROOT=/mnt/android-sdk -S qtinterfaceframework -B qtinterfaceframework-build-android-${abi}/
cd qtinterfaceframework-build-android-${abi}
cmake --build . && cmake --install .
done
# QAA
for abi in ${ANDROID_ABI}; do
qt-build-android-install-${abi}/bin/qt-cmake -GNinja -DANDROID_NDK_ROOT=/mnt/android-ndk -DANDROID_SDK_ROOT=/mnt/android-sdk -S tqtc-android-automotive -B tqtc-android-automotive_cmake-build-${abi}/
cd tqtc-android-automotive_cmake-build-${abi}
cmake --build . && cmake --install .
done
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment