about summary refs log tree commit diff
path: root/pkgs/by-name/sk/skia-aseprite/package.nix
blob: 3b34ad631862fb4763c6924a7f084ca45765c42c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{
  aseprite,
  clangStdenv,
  expat,
  fetchFromGitHub,
  fetchgit,
  fontconfig,
  gn,
  harfbuzzFull,
  icu,
  lib,
  libglvnd,
  libjpeg,
  libpng,
  libwebp,
  libX11,
  mesa,
  ninja,
  python3,
  zlib,
}:

let
  # deps.nix is generated by ./update.sh
  depSrcs = import ./deps.nix { inherit fetchgit; };
in
clangStdenv.mkDerivation (finalAttrs: {
  pname = "skia-aseprite";
  version = "m102-861e4743af";

  src = fetchFromGitHub {
    owner = "aseprite";
    repo = "skia";
    rev = finalAttrs.version;
    hash = "sha256-IlZbalmHl549uDUfPG8hlzub8TLWhG0EsV6HVAPdsl0=";
  };

  nativeBuildInputs = [
    gn
    ninja
    python3
  ];

  preConfigure = with depSrcs; ''
    mkdir -p third_party/externals
    ln -s ${angle2} third_party/externals/angle2
    ln -s ${dng_sdk} third_party/externals/dng_sdk
    ln -s ${piex} third_party/externals/piex
    ln -s ${sfntly} third_party/externals/sfntly
  '';

  configurePhase = ''
    runHook preConfigure
    gn gen lib --args="is_debug=false is_official_build=true extra_cflags=[\"-I${harfbuzzFull.dev}/include/harfbuzz\"]"
    runHook postConfigure
  '';

  buildInputs = [
    expat
    fontconfig
    harfbuzzFull
    icu
    libglvnd
    libjpeg
    libpng
    libwebp
    libX11
    mesa
    zlib
  ];

  buildPhase = ''
    runHook preBuild
    ninja -C lib skia modules
    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall
    mkdir -p $out

    # Glob will match all subdirs.
    shopt -s globstar

    # All these paths are used in some way when building Aseprite.
    cp -r --parents -t $out/ \
      include/codec \
      include/config \
      include/core \
      include/effects \
      include/gpu \
      include/private \
      include/utils \
      include/third_party/skcms/*.h \
      lib/*.a \
      modules/skshaper/include/*.h \
      src/core/*.h \
      src/gpu/**/*.h \
      third_party/externals/angle2/include \
      third_party/skcms/**/*.h

    runHook postInstall
  '';

  passthru.updateScript = [ ./update.sh ] ++ builtins.attrNames depSrcs;

  meta = {
    description = "Complete 2D graphic library for drawing Text, Geometries, and Images (Aseprite's fork)";
    homepage = "https://skia.org/";
    downloadPage = "https://github.com/aseprite/skia";
    license = lib.licenses.bsd3;
    inherit (aseprite.meta) maintainers;
    platforms = lib.platforms.all;
  };
})