Skip to content

Commit

Permalink
[docker] Support host build (flutter-tizen#181)
Browse files Browse the repository at this point in the history
* [docker] Support host build

- Install EFL 1.51.1 and dependencies. (including xvfb)
- Fix build-engine.sh for buliding host build.

* [docker] Optimize Dockerfile for build-engine
  • Loading branch information
WonyoungChoi authored and swift-kim committed Sep 27, 2021
1 parent 52bdb62 commit e465e2c
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 33 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
- 'DEPS'
workflow_dispatch:


jobs:
build:
runs-on: ubuntu-latest
Expand Down
42 changes: 38 additions & 4 deletions ci/docker/tizen/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
FROM ghcr.io/flutter-tizen/tizen-tools:latest
#
# Stage for build-engine-base
#
FROM ghcr.io/flutter-tizen/tizen-tools:latest AS build-engine-base

RUN apt-get update && \
apt-get install -y git curl ca-certificates python python3 xz-utils pkg-config \
libncurses5 libfreetype6-dev && \
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update
RUN apt-get install -y git curl pkg-config ca-certificates xz-utils python python3 libncurses5 && \
apt-get clean

# Install depot tools.
Expand All @@ -13,3 +17,33 @@ RUN git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_t
# Add engine building tools.
ADD tools/* /engine/tools/
ENV PATH=$PATH:/engine/tools


#
# Stage for build-engine-with-efl
#
FROM build-engine-base AS build-engine-with-efl

# Install dependencies for building EFL.
RUN apt-get install -y build-essential check meson ninja-build && \
apt-get clean
RUN apt-get install -y libssl-dev libsystemd-dev libglib2.0-dev libudev-dev libmount-dev libdbus-1-dev libunwind-dev && \
apt-get clean
RUN apt-get install -y libjpeg-dev libopenjp2-7-dev libgif-dev libtiff5-dev librsvg2-dev libheif-dev libwebp-dev libraw-dev \
libpoppler-dev libpoppler-cpp-dev libspectre-dev libfreetype6-dev libfontconfig1-dev libharfbuzz-dev \
libpulse-dev libsndfile1-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
libibus-1.0-dev libscim-dev libfribidi-dev libinput-dev liblua5.2-dev libluajit-5.1-dev \
libx11-dev libxext-dev libxrender-dev libxcursor-dev libxcomposite-dev libxinerama-dev libxrandr-dev \
libxtst-dev libxss-dev libxdamage-dev libgl1-mesa-dev xvfb && \
apt-get clean

# Build and install EFL for host build.
RUN git clone --depth 1 https://git.enlightenment.org/core/efl.git -b efl-1.25 /tmp/efl && \
meson -Dbuild-examples=false -Dbuild-tests=false /tmp/efl /tmp/efl/build && \
ninja -C /tmp/efl/build && \
ninja -C /tmp/efl/build install && \
rm -fr /tmp/efl
RUN ldconfig

# Start dbus service when running this container.
ENTRYPOINT /etc/init.d/dbus start && /bin/bash
1 change: 0 additions & 1 deletion ci/docker/tizen/build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
IMAGE_NAME=ghcr.io/flutter-tizen/build-engine
IMAGE_TAG=latest

docker pull $IMAGE_NAME:$IMAGE_TAG
docker build --tag $IMAGE_NAME:$IMAGE_TAG .
86 changes: 59 additions & 27 deletions ci/docker/tizen/tools/build-engine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,35 @@

set -e

BUILD_MODE=$1
BUILD_ARCH=$2
BUILD_TRIPLE=$3
BUILD_MODE=debug
BUILD_OS=host

if [[ -z "$BUILD_MODE" || -z "$BUILD_ARCH" || -z "$BUILD_TRIPLE" ]]; then
echo "Usage: $(basename "$0") <mode> <arch> <triple>"
exit 1
fi
while [ $# -ne 0 ]; do
name=$1
case "$name" in
-a | --target-arch)
shift; BUILD_ARCH=$1
;;
-m | --runtime-mode)
shift; BUILD_MODE=$1
;;
-t | --target-triple)
shift; BUILD_TRIPLE=$1
;;
-o | --target-os)
shift; BUILD_OS=$1
;;
--build-target)
shift; BUILD_TARGET=$1
;;
*)
echo "Unknown argument \`$name\`"
exit 1
;;
esac

shift
done

if [[ -z "$TIZEN_TOOLS_PATH" ]]; then
TIZEN_TOOLS_PATH=/tizen_tools
Expand All @@ -22,23 +43,34 @@ if [ ! -d "$TIZEN_TOOLS_PATH" ]; then
exit 1
fi

# FIXME: Remove unsupported options in BUILD.gn.
sed -i 's/"-Wno-non-c-typedef-for-linkage",//g' src/build/config/compiler/BUILD.gn
sed -i 's/"-Wno-psabi",//g' src/build/config/compiler/BUILD.gn

# Run gn.
src/flutter/tools/gn \
--target-os linux \
--linux-cpu $BUILD_ARCH \
--no-goma \
--target-toolchain "$TIZEN_TOOLS_PATH"/toolchains \
--target-sysroot "$TIZEN_TOOLS_PATH"/sysroot/$BUILD_ARCH \
--target-triple $BUILD_TRIPLE \
--runtime-mode $BUILD_MODE \
--enable-fontconfig \
--embedder-for-target \
--disable-desktop-embeddings \
--build-tizen-shell

# Run ninja.
ninja -C src/out/linux_${BUILD_MODE}_${BUILD_ARCH}
if [[ "$BUILD_OS" == "host" ]]; then
src/flutter/tools/gn \
--no-goma \
--runtime-mode $BUILD_MODE \
--enable-fontconfig \
--build-tizen-shell
ninja -C src/out/${BUILD_OS}_${BUILD_MODE} ${BUILD_TARGET}
else
if [[ -z "$BUILD_ARCH" || -z "$BUILD_TRIPLE" ]]; then
echo "required arguments are missing."
exit 1
fi

# FIXME: Remove unsupported options of tizen toolchains from BUILD.gn.
sed -i 's/"-Wno-non-c-typedef-for-linkage",//g' src/build/config/compiler/BUILD.gn
sed -i 's/"-Wno-psabi",//g' src/build/config/compiler/BUILD.gn

src/flutter/tools/gn \
--target-os $BUILD_OS \
--linux-cpu $BUILD_ARCH \
--no-goma \
--target-toolchain "$TIZEN_TOOLS_PATH"/toolchains \
--target-sysroot "$TIZEN_TOOLS_PATH"/sysroot/$BUILD_ARCH \
--target-triple $BUILD_TRIPLE \
--runtime-mode $BUILD_MODE \
--enable-fontconfig \
--embedder-for-target \
--disable-desktop-embeddings \
--build-tizen-shell
ninja -C src/out/${BUILD_OS}_${BUILD_MODE}_${BUILD_ARCH} ${BUILD_TARGET}
fi

0 comments on commit e465e2c

Please sign in to comment.