Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skia: init, ladybird: 0-unstable-2024-06-08 -> 0-unstable-2024-07-01 #324050

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From 4a9bee1c322af60ed0f492af7e859b9e038690e7 Mon Sep 17 00:00:00 2001
From: Francesco Gazzetta <fgaz@fgaz.me>
Date: Tue, 2 Jul 2024 10:31:50 +0200
Subject: [PATCH] LibWeb: use system skia

---
Userland/Libraries/LibWeb/CMakeLists.txt | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt
index e0595537e5..b16b4d897a 100644
--- a/Userland/Libraries/LibWeb/CMakeLists.txt
+++ b/Userland/Libraries/LibWeb/CMakeLists.txt
@@ -753,11 +753,15 @@ set(GENERATED_SOURCES
Worker/WebWorkerServerEndpoint.h
)

-find_package(unofficial-skia CONFIG REQUIRED)
+find_package(PkgConfig)
+pkg_check_modules(SKIA skia)

serenity_lib(LibWeb web)

-target_link_libraries(LibWeb PRIVATE LibCore LibCrypto LibJS LibHTTP LibGfx LibIPC LibRegex LibSyntax LibTextCodec LibUnicode LibAudio LibMedia LibWasm LibXML LibIDL LibURL LibTLS unofficial::skia::skia)
+target_link_libraries(LibWeb PRIVATE LibCore LibCrypto LibJS LibHTTP LibGfx LibIPC LibRegex LibSyntax LibTextCodec LibUnicode LibAudio LibMedia LibWasm LibXML LibIDL LibURL LibTLS ${SKIA_LIBRARIES})
+
+target_include_directories(LibWeb PRIVATE ${SKIA_INCLUDE_DIRS})
+target_link_directories(LibWeb PRIVATE ${SKIA_LIBRARY_DIRS})

if (HAS_ACCELERATED_GRAPHICS)
target_link_libraries(LibWeb PRIVATE ${ACCEL_GFX_LIBS})
--
2.44.1

18 changes: 13 additions & 5 deletions pkgs/applications/networking/browsers/ladybird/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
, python3
, qt6Packages
, woff2
, ffmpeg
, skia
, nixosTests
, AppKit
, Cocoa
Expand Down Expand Up @@ -52,15 +54,19 @@ let
in
stdenv.mkDerivation (finalAttrs: {
pname = "ladybird";
version = "0-unstable-2024-06-08";
version = "0-unstable-2024-07-01";

src = fetchFromGitHub {
owner = "LadybirdWebBrowser";
repo = "ladybird";
rev = "2f68e361370040d8cdc75a8ed8af4239134ae481";
hash = "sha256-EQZTsui4lGThSi+8a6KSyL5lJnO0A8fJ8HWY4jgkpUA=";
rev = "bff6c0680aff5862e05c68af03a653f2250328b4";
hash = "sha256-uzh88o7TnAeI6EGNq4MrEYVa37wz39cr8W4KPi+/eQs=";
};

patches = [
./LibWeb-use-system-skia.patch
];

postPatch = ''
sed -i '/iconutil/d' Ladybird/CMakeLists.txt

Expand All @@ -76,8 +82,8 @@ stdenv.mkDerivation (finalAttrs: {
# expected version in the package's CMake.

# Check that the versions match
grep -F 'set(CLDR_VERSION "${cldr_version}")' Meta/CMake/locale_data.cmake || (echo cldr_version mismatch && exit 1)
grep -F 'set(TZDB_VERSION "${tzdata.version}")' Meta/CMake/time_zone_data.cmake || (echo tzdata.version mismatch && exit 1)
grep -F 'locale_version = "${cldr_version}"' Meta/gn/secondary/Userland/Libraries/LibLocale/BUILD.gn || (echo cldr_version mismatch && exit 1)
grep -F 'tzdb_version = "${tzdata.version}"' Meta/gn/secondary/Userland/Libraries/LibTimeZone/BUILD.gn || (echo tzdata.version mismatch && exit 1)
grep -F 'set(CACERT_VERSION "${cacert_version}")' Meta/CMake/ca_certificates_data.cmake || (echo cacert_version mismatch && exit 1)

mkdir -p build/Caches
Expand Down Expand Up @@ -116,9 +122,11 @@ stdenv.mkDerivation (finalAttrs: {
];

buildInputs = with qt6Packages; [
ffmpeg
libxcrypt
qtbase
qtmultimedia
skia
woff2
] ++ lib.optionals stdenv.isDarwin [
AppKit
Expand Down
125 changes: 125 additions & 0 deletions pkgs/by-name/sk/skia/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{ lib
, stdenv
, fetchgit
, expat
, fontconfig
, freetype
, harfbuzzFull
, icu
, gn
, libGL
, libjpeg
, libwebp
, libX11
, ninja
, python3
}:

stdenv.mkDerivation (finalAttrs: {
pname = "skia";
# Version from https://skia.googlesource.com/skia/+/refs/heads/main/RELEASE_NOTES.md
# plus date of the tip of the corresponding chrome/m* branch
version = "127-unstable-2024-06-11";

src = fetchgit {
url = "https://skia.googlesource.com/skia.git";
rev = "1c8089adffdabe3790cc4ca4fb36e24c2f6ab792";
hash = "sha256-02g5X3eNlCDB3K1OWzevDbYMR+k+9FhhyDe5GJbhqT0=";
};

postPatch = ''
# System zlib detection bug workaround
substituteInPlace BUILD.gn \
--replace-fail 'deps = [ "//third_party/zlib" ]' 'deps = []'
'';

nativeBuildInputs = [
gn
ninja
python3
];

buildInputs = [
expat
fontconfig
freetype
harfbuzzFull
icu
libGL
libjpeg
libwebp
libX11
];

configurePhase = ''
runHook preConfigure
gn gen build --args='${toString ([
# Build in release mode
"is_official_build=true"
"is_component_build=true"
# Don't use missing tools
"skia_use_dng_sdk=false"
"skia_use_wuffs=false"
# Use system dependencies
"extra_cflags=[\"-I${harfbuzzFull.dev}/include/harfbuzz\"]"
] ++ map (lib: "skia_use_system_${lib}=true") [
"zlib"
"harfbuzz"
"libpng"
"libwebp"
])}'
cd build
runHook postConfigure
'';

# Somewhat arbitrary, but similar to what other distros are doing
installPhase = ''
runHook preInstall

# Libraries
mkdir -p $out/lib
cp *.so *.a $out/lib

# Includes
pushd ../include
find . -name '*.h' -exec install -Dm644 {} $out/include/skia/{} \;
popd
pushd ../modules
find . -name '*.h' -exec install -Dm644 {} $out/include/skia/modules/{} \;
popd

# Pkg-config
mkdir -p $out/lib/pkgconfig
cat > $out/lib/pkgconfig/skia.pc <<'EOF'
prefix=${placeholder "out"}
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: ${lib.versions.major finalAttrs.version}
Libs: -L''${libdir} -lskia
Cflags: -I''${includedir}
EOF

runHook postInstall
'';

preFixup = ''
# Some skia includes are assumed to be under an include sub directory by
# other includes
for file in $(grep -rl '#include "include/' $out/include); do
substituteInPlace "$file" \
--replace-fail '#include "include/' '#include "'
done
'';

meta = {
description = "2D graphic library for drawing text, geometries and images";
homepage = "https://skia.org/";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ fgaz ];
platforms = lib.platforms.all;
};
})
2 changes: 1 addition & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21312,7 +21312,7 @@ with pkgs;
icu74
;

icu = icu73;
icu = icu74;

id3lib = callPackage ../development/libraries/id3lib { };

Expand Down