|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# HOW TO START: |
| 4 | +# TMPDIR=/PATH_TO_TMP_DIR buildah unshare ./podman-rpi-flutter-engine.sh |
| 5 | + |
| 6 | +set -e |
| 7 | + |
| 8 | +container=$(buildah from ubuntu:bionic) |
| 9 | + |
| 10 | +buildah run ${container} sh <<EOM |
| 11 | + export DEBIAN_FRONTEND=noninteractive \ |
| 12 | + && export TZ=Asia/Yekaterinburg \ |
| 13 | + && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \ |
| 14 | + && echo $TZ > /etc/timezone \ |
| 15 | + && export TERM=dumb \ |
| 16 | + && apt-get update \ |
| 17 | + && apt-get install -yq --no-install-recommends \ |
| 18 | + lsb-core lsb-release sudo nano vim wget \ |
| 19 | + dialog qemu-user-static \ |
| 20 | + bison cdbs curl devscripts \ |
| 21 | + dpkg-dev elfutils fakeroot \ |
| 22 | + flex g++ git-core git-svn \ |
| 23 | + gperf libasound2 libasound2-dev libatk1.0-0 \ |
| 24 | + libbrlapi-dev libbrlapi0.6 libbz2-dev libc6 \ |
| 25 | + libcairo2 libcairo2-dev libcap-dev libcap2 \ |
| 26 | + libcups2 libcups2-dev libcurl4-gnutls-dev \ |
| 27 | + libdrm-dev libelf-dev libexif-dev libexif12 \ |
| 28 | + libexpat1 libfontconfig1 libfreetype6 libgbm-dev \ |
| 29 | + libgconf2-dev libgl1-mesa-dev libgles2-mesa-dev \ |
| 30 | + libglib2.0-0 libglib2.0-dev libglu1-mesa-dev \ |
| 31 | + libgnome-keyring-dev libgnome-keyring0 libgtk2.0-0 \ |
| 32 | + libgtk2.0-dev libjpeg-dev libkrb5-dev libnspr4 \ |
| 33 | + libnspr4-dev libnss3 libnss3-dev libpam0g libpam0g-dev \ |
| 34 | + libpango1.0-0 libpci-dev libpci3 libpcre3 libpixman-1-0 \ |
| 35 | + libpng16-16 libpulse-dev libsctp-dev libspeechd-dev \ |
| 36 | + libspeechd2 libsqlite3-0 libsqlite3-dev libssl-dev \ |
| 37 | + libstdc++6 libudev-dev libudev1 libwww-perl libx11-6 \ |
| 38 | + libxau6 libxcb1 libxcomposite1 libxcursor1 libxdamage1 \ |
| 39 | + libxdmcp6 libxext6 libxfixes3 libxi6 libxinerama1 libxrandr2 \ |
| 40 | + libxrender1 libxslt1-dev libxss-dev libxt-dev libxtst-dev \ |
| 41 | + libxtst6 mesa-common-dev patch perl pkg-config python \ |
| 42 | + python-cherrypy3 python-crypto python-dev python-numpy \ |
| 43 | + python-opencv python-openssl python-psutil python-yaml \ |
| 44 | + rpm ruby subversion wdiff zip zlib1g \ |
| 45 | + build-essential cmake git python3-dev libncurses5-dev libxml2-dev \ |
| 46 | + libedit-dev swig doxygen graphviz xz-utils ninja-build ssh \ |
| 47 | + openjdk-8-jre openjdk-8-jdk \ |
| 48 | + libgtk-3-dev \ |
| 49 | + && sudo update-java-alternatives -s java-1.8.0-openjdk-amd64 \ |
| 50 | + && apt-get install -yq --no-install-recommends ant \ |
| 51 | + && mkdir "/src" |
| 52 | +EOM |
| 53 | + |
| 54 | +mntPoint=$(buildah mount ${container}) |
| 55 | +echo "mounted container" |
| 56 | +cp -R $PWD/src/engine ${mntPoint}/src/ |
| 57 | +cp -R $PWD/src/sysroot ${mntPoint}/src/ |
| 58 | +cp -R $PWD/src/cross_armhf_clang_11.0.0-rc2 ${mntPoint}/src/ |
| 59 | +cp -R $PWD/compile-flutter-engine.sh ${mntPoint}/src/engine/src |
| 60 | + |
| 61 | +echo "compile engine" |
| 62 | +buildah run ${container} sh <<EOM |
| 63 | + set -eux; \ |
| 64 | + cd /src/engine/src/build \ |
| 65 | + && sudo ./install-build-deps-android.sh --no-arm \ |
| 66 | + && cd /src/engine/src/flutter/build \ |
| 67 | + && sudo ./install-build-deps-linux-desktop.sh \ |
| 68 | + && export PKG_CONFIG_PATH=/src/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig/:/src/sysroot/usr/share/pkgconfig/ \ |
| 69 | + && cd /src/engine/src \ |
| 70 | + && ./compile-flutter-engine.sh \ |
| 71 | + && cd out/ \ |
| 72 | + && find . -mindepth 1 -maxdepth 1 -type d | xargs -n 1 sh -c 'ninja -C linux_debug_arm || exit 255' \ |
| 73 | + && cd linux_debug_arm/ \ |
| 74 | + && ls -la \ |
| 75 | + && cp flutter_embedder.h libflutter_engine.so icudtl.dat $PWD/compile-flutter-engine.sh |
| 76 | +EOM |
| 77 | + |
| 78 | +cp ${mntPoint}/src/engine/src/out/linux_debug_arm/flutter_embedder.h $PWD/src |
| 79 | +cp ${mntPoint}/src/engine/src/out/linux_debug_arm/libflutter_engine.so $PWD/src |
| 80 | +cp ${mntPoint}/src/engine/src/out/linux_debug_arm/icudtl.dat $PWD/src |
| 81 | +buildah unmount ${container} |
| 82 | + |
| 83 | +buildah rm ${container} |
| 84 | +# && ./install-build-deps.sh --no-arm \ |
| 85 | +# - packages installed above or need to automatic NO for question about install debug symbols |
| 86 | + |
| 87 | +# buildah commit ${container} flutter-ubuntu-dev |
| 88 | + |
| 89 | +# |
| 90 | +#podman run --rm --mount type=bind,src=/$PWD/src,target=/src localhost/flutter-ubuntu-dev <<EOM |
| 91 | +# export PKG_CONFIG_PATH=/src/sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig/:/src/sysroot/usr/share/pkgconfig/ \ |
| 92 | +# && cd /src/engine/src \ |
| 93 | +# && ./compile-flutter-engine.sh \ |
| 94 | +# && cd out/ \ |
| 95 | +# && find . -mindepth 1 -maxdepth 1 -type d | xargs -n 1 sh -c 'ninja -C $0 || exit 255' \ |
| 96 | +# && cp flutter_embedder.h libflutter_engine.so icudtl.dat /src/ |
| 97 | +#EOM |
0 commit comments