| 1 | #!/bin/bash |
| 2 | |
| 3 | set -eo pipefail |
| 4 | |
| 5 | PYTHON=python3 |
| 6 | |
| 7 | sudo apt-get remove python3-pip |
| 8 | sudo add-apt-repository -y ppa:deadsnakes/ppa && sudo apt-get update -y |
| 9 | sudo apt-get install -y autoconf automake libtool gcc g++ gettext \ |
| 10 | libjpeg-dev libtiff5-dev libpng-dev libfreetype-dev libgif-dev \ |
| 11 | libx11-dev libgtk-3-dev libxml2-dev libpango1.0-dev libcairo2-dev \ |
| 12 | libgtkmm-3.0-dev \ |
| 13 | libbrotli-dev libwoff-dev ninja-build cmake lcov $PYTHON-dev $PYTHON-venv |
| 14 | curl https://bootstrap.pypa.io/get-pip.py | sudo $PYTHON |
| 15 | |
| 16 | PREFIX=$GITHUB_WORKSPACE/target |
| 17 | DEPSPREFIX=$GITHUB_WORKSPACE/deps/install |
| 18 | echo "PREFIX=$PREFIX" >> $GITHUB_ENV |
| 19 | echo "DEPSPREFIX=$DEPSPREFIX" >> $GITHUB_ENV |
| 20 | echo "PATH=$PATH:$DEPSPREFIX/bin:$PREFIX/bin:~/.local/bin" >> $GITHUB_ENV |
| 21 | echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DEPSPREFIX/lib:$PREFIX/lib" >> $GITHUB_ENV |
| 22 | echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$DEPSPREFIX/lib/pkgconfig" >> $GITHUB_ENV |
| 23 | echo "PYTHONPATH=$PYTHONPATH:$PREFIX/$($PYTHON "$GITHUB_WORKSPACE/repo/pyhook/get_pyhook_install_dir.py" "${DESTDIR}${PREFIX}")" >> $GITHUB_ENV |
| 24 | |
| 25 | if [ ! -d deps/install ]; then |
| 26 | echo "Custom dependencies not present - will build them" |
| 27 | rm -rf deps && mkdir deps && cd deps |
| 28 | |
| 29 | FTVER=`dpkg -s libfreetype-dev | perl -ne 'print $1 if /^Version: (\d+(?:\.\d+)+)/'` |
| 30 | SFFTVER=`echo $FTVER | perl -ne 'print $1 if /^(\d+(?:\.\d+){1,2})/'` |
| 31 | |
| 32 | git clone --depth 1 https://github.com/fontforge/libspiro |
| 33 | git clone --depth 1 https://github.com/fontforge/libuninameslist |
| 34 | git clone --depth 1 --branch v1.0.2 https://github.com/google/woff2 |
| 35 | wget --tries 1 "http://download.savannah.gnu.org/releases/freetype/freetype-$FTVER.tar.gz" || \ |
| 36 | wget "https://sourceforge.net/projects/freetype/files/freetype2/$SFFTVER/freetype-$FTVER.tar.gz" |
| 37 | wget https://github.com/crowdin/crowdin-cli/releases/latest/download/crowdin-cli.zip |
| 38 | |
| 39 | pushd libspiro && autoreconf -fiv && ./configure --prefix=$DEPSPREFIX && make -j4 && make install && popd |
| 40 | pushd libuninameslist && autoreconf -fiv && ./configure --enable-pscript --prefix=$DEPSPREFIX && make -j4 && make install && popd |
| 41 | pushd woff2 && mkdir build && cd build && cmake -GNinja .. -DCMAKE_INSTALL_PREFIX=$DEPSPREFIX -DCMAKE_INSTALL_LIBDIR=lib && ninja install && popd |
| 42 | tar -zxf freetype-$FTVER.tar.gz && mv freetype-$FTVER $DEPSPREFIX/freetype |
| 43 | mkdir crowdin && pushd crowdin && unzip ../crowdin-cli.zip && mv */* . && mv crowdin-cli.jar $DEPSPREFIX && popd |
| 44 | fi |