ladybird/Meta/CMake/flatpak/skia-install.sh
Andrew Kaster 44d2e22b93 CMake: Add a flatpak build for org.ladybird.Ladybird
This build depends on the KDE Flatpak SDK, and builds any missing
dependencies manually as source modules.

The flatpak can be built with the following command:

```sh
flatpak-builder --user --force-clean --install-deps-from=flathub \
    --ccache --repo=Build/repo --install Build/flatpak \
    Meta/CMake/flatpak/org.ladybird.Ladybird.json
```

After building, the flatpak can be run with:

```sh
flatpak run --user --devel org.ladybird.Ladybird
```

If there are issues launching RequestServer, the .pid and .sock files
under $XDG_RUNTIME_DIR may need removed.

```sh
flatpak run --user --command=sh --devel org.ladybird.Ladybird
rm -f $XDG_RUNTIME_DIR/Ladybird.*
```
2025-07-08 11:45:32 -06:00

41 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
# Libs
mkdir -p "$FLATPAK_DEST/lib"
for path in out/*.a out/*.so; do
install -Dm644 "$path" "$FLATPAK_DEST/lib/$(basename "$path")"
done
# Includes
mkdir -p "$FLATPAK_DEST/include/skia/modules"
pushd include
find . -name '*.h' -exec install -Dm644 {} "$FLATPAK_DEST/include/skia/{}" \;
popd
pushd modules
find . -name '*.h' -exec install -Dm644 {} "$FLATPAK_DEST/include/skia/modules/{}" \;
popd
# Pkg-config
mkdir -p "$FLATPAK_DEST/lib/pkgconfig"
cat > "$FLATPAK_DEST/lib/pkgconfig/skia.pc" <<EOF
prefix=${FLATPAK_DEST}
exec_prefix=\${prefix}
libdir=\${prefix}/lib
includedir=\${prefix}/include/skia
Name: skia
Description: 2D graphic library for drawing text, geometries and images.
URL: https://skia.org/
Version: 129
Libs: -L\${libdir} -lskia -lskcms
Cflags: -I\${includedir}
EOF
# Some skia includes are assumed to be under an include sub directory by
# other includes
# shellcheck disable=SC2013
for file in $(grep -rl '#include "include/' "$FLATPAK_DEST/include/skia"); do
sed -i -e 's|#include "include/|#include "|g' "$file"
done