This commit is contained in:
James Walmsley 2022-05-02 17:07:28 +01:00
Родитель 83532f4e00
Коммит 4b4e21e40a
3 изменённых файлов: 50 добавлений и 25 удалений

37
.github/workflows/skiabuild.yml поставляемый
Просмотреть файл

@ -1,11 +1,6 @@
name: Build Skia x-plat
on: [push]
jobs:
# env:
# runs-on: [self-hosted, linux, x64]
# steps:
# - run: printenv
build_wasm:
runs-on: [self-hosted, linux, x64]
container: jameswalmsley/skiabuild:wasm
@ -27,7 +22,6 @@ jobs:
name: libskia-wasm
path: out/skia/wasm/sysroot.tar.gz
build_windows:
runs-on: windows-latest
steps:
@ -50,7 +44,7 @@ jobs:
name: libskia-win_x64
path: skia-win64.zip
build_skia_64:
build_x86_64-linux-gnu:
runs-on: [self-hosted, linux, x64]
container: jameswalmsley/skiabuild:x86_64-linux-gnu
steps:
@ -64,7 +58,7 @@ jobs:
make skia_defconfig
make source-checkout -j$(nproc)
DISTCC_HOSTS="${{ secrets.DISTCC_HOSTS }}" make
- run: echo "🍏 This job's status is ${{ job.status }}."
- uses: actions/upload-artifact@v3
with:
@ -73,7 +67,7 @@ jobs:
test_skia_archlinux:
runs-on: ubuntu-latest
needs: build_skia_64
needs: build_x86_64-linux-gnu
container: jameswalmsley/skiatest:archlinux
steps:
- uses: actions/download-artifact@v3
@ -102,7 +96,7 @@ jobs:
test_skia_debian:
runs-on: ubuntu-latest
needs: build_skia_64
needs: build_x86_64-linux-gnu
container: jameswalmsley/skiatest:debian
steps:
- uses: actions/download-artifact@v3
@ -117,7 +111,7 @@ jobs:
# test_skia_fedora:
# runs-on: ubuntu-latest
# needs: build_skia_64
# needs: build_x86_64-linux-gnu
# container: fedora:latest
# steps:
# - uses: actions/download-artifact@v3
@ -126,14 +120,13 @@ jobs:
# run: |
# mkdir out
# cd out && tar xvf ../libskia-x86_64-linux-gnu/sysroot.tar.gz
# ls -la && pwd
# ls -la ./usr/local/bin
# LD_LIBRARY_PATH=$(pwd)/usr/local/lib64 ./usr/local/bin/testprog
# LD_LIBRARY_PATH=$(pwd)/usr/local/lib64 ./usr/local/bin/avalonia.skia.testprog
# LD_LIBRARY_PATH=$(pwd)/usr/local/lib64 ldd ./usr/local/bin/avalonia.skia.testprog
# md5sum *.png
# test_skia_alpine:
# runs-on: ubuntu-latest
# needs: build_skia_64
# needs: build_x86_64-linux-gnu
# container: alpine:latest
# steps:
# - uses: actions/download-artifact@v3
@ -142,13 +135,12 @@ jobs:
# run: |
# mkdir out
# cd out && tar xvf ../libskia-x86_64-linux-gnu/sysroot.tar.gz
# ls -la && pwd
# ls -la ./usr/local/bin
# LD_LIBRARY_PATH=$(pwd)/usr/local/lib64 ./usr/local/bin/testprog
# LD_LIBRARY_PATH=$(pwd)/usr/local/lib64 ./usr/local/bin/avalonia.skia.testprog
# LD_LIBRARY_PATH=$(pwd)/usr/local/lib64 ldd ./usr/local/bin/avalonia.skia.testprog
# md5sum *.png
release_libskia:
needs: [build_skia_64, build_windows, test_skia_archlinux, test_skia_debian]
needs: [build_x86_64-linux-gnu, build_windows, build_wasm, test_skia_archlinux, test_skia_debian]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
@ -164,6 +156,9 @@ jobs:
- run: mv libskia-x86_64-linux-gnu/sysroot.tar.gz avalonia.skia-${{ steps.get_version.outputs.VERSION }}-linux-x86_64-linux-gnu-sysroot.tar.gz
if: startsWith(github.ref, 'refs/tags/v')
- run: mv libskia-wasm/sysroot.tar.gz avalonia.skia-${{ steps.get_version.outputs.VERSION }}-wasm-sysroot.tar.gz
if: startsWith(github.ref, 'refs/tags/v')
- run: mv libskia-win_x64/skia-win64.zip avalonia.skia-${{ steps.get_version.outputs.VERSION }}-win_x64-sysroot.zip
if: startsWith(github.ref, 'refs/tags/v')

Просмотреть файл

@ -3,6 +3,7 @@ CONFIG_VARIANT:=wasm
CONFIG_SYSROOT:=y
CONFIG_SKIACONFIG:=wasm
CONFIG_SKIA_EMBEDDED_FONTS:=y
DOCKER_SERVICE:=skiabuild-wasm

Просмотреть файл

@ -8,6 +8,10 @@ skia_sync_deps:=$(LSTAMP)/skia_sync_deps
skia_config:=$(LSTAMP)/skia_config
skia_install:=$(LSTAMP)/skia_install
ifeq ($(CONFIG_SKIA_EMBEDDED_FONTS),y)
skia_embedded_fonts:=$(LSTAMP)/skia_embedded_fonts
endif
ifndef WINDOWS
skia_pkgconfig:=$(SYSROOT)/$(PREFIX)/$(LIBDIR)/pkgconfig/skia.pc $(PKGROOT)/$(PREFIX)/$(LIBDIR)/pkgconfig/skia.pc
endif
@ -17,6 +21,9 @@ $(call git_clone, skia, https://github.com/google/skia.git, $(SKIA_GIT_REF))
$(L) += $(skia_sync_deps)
$(L) += $(skia_config)
$(L) += $(skia)
ifeq ($(CONFIG_SKIA_EMBEDDED_FONTS),y)
$(L) += $(skia_embedded_fonts)
endif
$(L) += $(skia_install)
$(L) += $(skia_pkgconfig)
@ -49,20 +56,42 @@ ifdef WINDOWS
GN:=./bin/gn
endif
TC_SOURCE:=
ifeq ($(CONFIG_VARIANT),wasm)
TC_SOURCE=source $(srcdir)/skia/third_party/externals/emsdk/emsdk_env.sh &&
SKIA_TARGET:=libskia.a
endif
$(skia_config): $(skia_sync_deps)
cd $(srcdir)/skia && $(GN) gen $(builddir)/skia --args="$(SKIA_ARGS)"
cd $(srcdir)/skia && $(TC_SOURCE) $(GN) gen $(builddir)/skia --args="$(SKIA_ARGS)"
$(stamp)
$(skia): $(skia_config)
cd $(builddir)/skia && ninja $(BUILD_JOBS)
cd $(builddir)/skia && ninja $(BUILD_JOBS) $(SKIA_TARGET)
$(stamp)
ifeq ($(CONFIG_SKIA_EMBEDDED_FONTS),y)
$(skia_embedded_fonts): $(skia)
mkdir -p $(builddir)/merge-dir
cd $(builddir)/merge-dir && $(TC_SOURCE) for file in $$(ls $(builddir)/skia/*.a) ; do \
$(SKIA_AR) x $$file ; \
done
$(skia_install): $(skia)
cd $(builddir)/skia && $(srcdir)/skia/tools/embed_resources.py --name SK_EMBEDDED_FONTS --input $(srcdir)/skia/modules/canvaskit/fonts/NotoMono-Regular.ttf --output $(builddir)/font.cpp --align 4
cd $(builddir)/merge-dir && $(TC_SOURCE) $(SKIA_CXX) -std=c++17 -I. $(builddir)/font.cpp -r -o $(builddir)/merge-dir/font.o
$(TC_SOURCE) $(SKIA_AR) -crs $(builddir)/skia/libskia.a $(builddir)/merge-dir/*.o
cd $(builddir)/skia && $(TC_SOURCE) ninja skia_c_api_example
$(stamp)
endif
$(skia_install): $(skia) $(skia_embedded_fonts)
ifndef WINDOWS
mkdir -p $(SYSROOT)/$(PREFIX)/include/skia
mkdir -p $(PKGROOT)/$(PREFIX)/include/skia
mkdir -p $(PKGROOT)/$(PREFIX)/$(LIBDIR)
mkdir -p $(SYSROOT)/$(PREFIX)/$(LIBDIR)/pkgconfig
mkdir -p $(PKGROOT)/$(PREFIX)/$(LIBDIR)/pkgconfig
cp -rv $(srcdir)/skia/include $(SYSROOT)/$(PREFIX)/include/skia
cp -rv $(srcdir)/skia/include $(PKGROOT)/$(PREFIX)/include/skia