1{ stdenv, fetchurl, pkgconfig, yasm
2, freetype, fribidi
3, encaSupport ? true, enca ? null # enca support
4, fontconfigSupport ? true, fontconfig ? null # fontconfig support
5, harfbuzzSupport ? true, harfbuzz ? null # harfbuzz support
6, rasterizerSupport ? false # Internal rasterizer
7, largeTilesSupport ? false # Use larger tiles in the rasterizer
8, libiconv
9}:
10
11assert encaSupport -> enca != null;
12assert fontconfigSupport -> fontconfig != null;
13assert harfbuzzSupport -> harfbuzz != null;
14
15let
16 mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
17in
18
19with stdenv.lib;
20stdenv.mkDerivation rec {
21 name = "libass-${version}";
22 version = "0.14.0";
23
24 src = fetchurl {
25 url = "https://github.com/libass/libass/releases/download/${version}/${name}.tar.xz";
26 sha256 = "18iqznl4mabhj9ywfsz4kwvbsplcv1jjxq50nxssvbj8my1267w8";
27 };
28
29 configureFlags = [
30 (mkFlag encaSupport "enca")
31 (mkFlag fontconfigSupport "fontconfig")
32 (mkFlag harfbuzzSupport "harfbuzz")
33 (mkFlag rasterizerSupport "rasterizer")
34 (mkFlag largeTilesSupport "large-tiles")
35 ];
36
37 nativeBuildInputs = [ pkgconfig yasm ];
38
39 buildInputs = [ freetype fribidi ]
40 ++ optional encaSupport enca
41 ++ optional fontconfigSupport fontconfig
42 ++ optional harfbuzzSupport harfbuzz
43 ++ optional stdenv.isDarwin libiconv;
44
45 meta = {
46 description = "Portable ASS/SSA subtitle renderer";
47 homepage = https://github.com/libass/libass;
48 license = licenses.isc;
49 platforms = platforms.unix;
50 maintainers = with maintainers; [ codyopel ];
51 repositories.git = git://github.com/libass/libass.git;
52 };
53}