diff --git a/pkgs/applications/networking/browsers/ladybird/LibWeb-use-system-skia.patch b/pkgs/applications/networking/browsers/ladybird/LibWeb-use-system-skia.patch new file mode 100644 index 0000000000000..1e8d25098d747 --- /dev/null +++ b/pkgs/applications/networking/browsers/ladybird/LibWeb-use-system-skia.patch @@ -0,0 +1,34 @@ +From 4a9bee1c322af60ed0f492af7e859b9e038690e7 Mon Sep 17 00:00:00 2001 +From: Francesco Gazzetta +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 + diff --git a/pkgs/applications/networking/browsers/ladybird/default.nix b/pkgs/applications/networking/browsers/ladybird/default.nix index f4e935abd7cbb..1df67218af9f1 100644 --- a/pkgs/applications/networking/browsers/ladybird/default.nix +++ b/pkgs/applications/networking/browsers/ladybird/default.nix @@ -15,6 +15,8 @@ , python3 , qt6Packages , woff2 +, ffmpeg +, skia , nixosTests , AppKit , Cocoa @@ -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 @@ -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 @@ -116,9 +122,11 @@ stdenv.mkDerivation (finalAttrs: { ]; buildInputs = with qt6Packages; [ + ffmpeg libxcrypt qtbase qtmultimedia + skia woff2 ] ++ lib.optionals stdenv.isDarwin [ AppKit diff --git a/pkgs/by-name/sk/skia/package.nix b/pkgs/by-name/sk/skia/package.nix new file mode 100644 index 0000000000000..f6b4b8e3f1eea --- /dev/null +++ b/pkgs/by-name/sk/skia/package.nix @@ -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; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e6e318517ce82..49fec84df02e7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21312,7 +21312,7 @@ with pkgs; icu74 ; - icu = icu73; + icu = icu74; id3lib = callPackage ../development/libraries/id3lib { };