nixpkgs/pkgs/development/libraries/libass/default.nix
comex 406de7fdc3 libass: enable CoreText backend on darwin
libass has multiple font rendering backends which are autodetected by
the configure script.  On macOS, there is a CoreText backend, but it
was disabled in Nix's build because the relevant native frameworks
weren't visible to the configure script.  Fix that.
2023-11-11 11:51:46 -08:00

48 lines
1.4 KiB
Nix

{ lib, stdenv, fetchurl, pkg-config, yasm
, freetype, fribidi, harfbuzz
, fontconfigSupport ? true, fontconfig ? null # fontconfig support
, rasterizerSupport ? false # Internal rasterizer
, largeTilesSupport ? false # Use larger tiles in the rasterizer
, libiconv
, darwin
}:
assert fontconfigSupport -> fontconfig != null;
stdenv.mkDerivation rec {
pname = "libass";
version = "0.17.1";
src = fetchurl {
url = "https://github.com/libass/libass/releases/download/${version}/${pname}-${version}.tar.xz";
sha256 = "sha256-8NoLv7pHbBauPhz9hiJW0wkVkR96uqGxbOYu5lMZJ4Q=";
};
outputs = [ "out" "dev" ];
configureFlags = [
(lib.enableFeature fontconfigSupport "fontconfig")
(lib.enableFeature rasterizerSupport "rasterizer")
(lib.enableFeature largeTilesSupport "large-tiles")
];
nativeBuildInputs = [ pkg-config yasm ];
buildInputs = [ freetype fribidi harfbuzz ]
++ lib.optional fontconfigSupport fontconfig
++ lib.optional stdenv.isDarwin [
libiconv
darwin.apple_sdk.frameworks.ApplicationServices
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.CoreText
];
meta = with lib; {
description = "Portable ASS/SSA subtitle renderer";
homepage = "https://github.com/libass/libass";
license = licenses.isc;
platforms = platforms.unix;
maintainers = with maintainers; [ codyopel ];
};
}