about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/editors/aseprite
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/editors/aseprite')
-rw-r--r--nixpkgs/pkgs/applications/editors/aseprite/allegro-glibc-2.30.patch8
-rw-r--r--nixpkgs/pkgs/applications/editors/aseprite/default.nix126
-rw-r--r--nixpkgs/pkgs/applications/editors/aseprite/skia-deps.nix23
-rwxr-xr-xnixpkgs/pkgs/applications/editors/aseprite/skia-make-deps.sh37
-rw-r--r--nixpkgs/pkgs/applications/editors/aseprite/skia.nix76
5 files changed, 270 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/editors/aseprite/allegro-glibc-2.30.patch b/nixpkgs/pkgs/applications/editors/aseprite/allegro-glibc-2.30.patch
new file mode 100644
index 000000000000..94c70da276c9
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/aseprite/allegro-glibc-2.30.patch
@@ -0,0 +1,8 @@
+diff --git a/src/she/CMakeLists.txt b/src/she/CMakeLists.txt
+index 4909ff1..02fa145 100644
+--- a/src/she/CMakeLists.txt
++++ b/src/she/CMakeLists.txt
+@@ -23,2 +23,3 @@ if(USE_ALLEG4_BACKEND)
+     add_definitions(-DUSE_MOUSE_POLLER)

++    add_definitions(-DALLEGRO_NO_FIX_ALIASES)

+   endif()

diff --git a/nixpkgs/pkgs/applications/editors/aseprite/default.nix b/nixpkgs/pkgs/applications/editors/aseprite/default.nix
new file mode 100644
index 000000000000..58342ab1393a
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/aseprite/default.nix
@@ -0,0 +1,126 @@
+{ stdenv, lib, callPackage, fetchFromGitHub, fetchpatch, cmake, ninja, pkg-config
+, curl, freetype, giflib, libjpeg, libpng, libwebp, pixman, tinyxml, zlib
+, harfbuzzFull, glib, fontconfig, pcre
+, libX11, libXext, libXcursor, libXxf86vm, libGL
+, unfree ? false
+, cmark
+}:
+
+# Unfree version is not redistributable:
+# https://dev.aseprite.org/2016/09/01/new-source-code-license/
+# Consider supporting the developer: https://aseprite.org/#buy
+
+let
+  skia = callPackage ./skia.nix {};
+in
+stdenv.mkDerivation rec {
+  pname = "aseprite";
+  version = if unfree then "1.2.16.3" else "1.1.7";
+
+  src = fetchFromGitHub {
+    owner = "aseprite";
+    repo = "aseprite";
+    rev = "v${version}";
+    fetchSubmodules = true;
+    sha256 = if unfree
+      then "16yn7y9xdc5jd50cq7bmsm320gv23pp71lr8hg2nmynzc8ibyda8"
+      else "0gd49lns2bpzbkwax5jf9x1xmg1j8ij997kcxr2596cwiswnw4di";
+  };
+
+  nativeBuildInputs = [
+    cmake pkg-config
+  ] ++ lib.optionals unfree [ ninja ];
+
+  buildInputs = [
+    curl freetype giflib libjpeg libpng libwebp pixman tinyxml zlib
+    libX11 libXext libXcursor libXxf86vm
+  ] ++ lib.optionals unfree [
+    cmark
+    harfbuzzFull glib fontconfig pcre
+    skia libGL
+  ];
+
+  patches = if !unfree then [
+    ./allegro-glibc-2.30.patch
+  ] else [
+    (fetchpatch {
+      url = "https://github.com/lfont/aseprite/commit/f1ebc47012d3fed52306ed5922787b4b98cc0a7b.patch";
+      sha256 = "03xg7x6b9iv7z18vzlqxhcfphmx4v3qhs9f5rgf38ppyklca5jyw";
+    })
+    (fetchpatch {
+      url = "https://github.com/orivej/aseprite/commit/ea87e65b357ad0bd65467af5529183b5a48a8c17.patch";
+      sha256 = "1vwn8ivap1pzdh444sdvvkndp55iz146nhmd80xbm8cyzn3qmg91";
+    })
+  ];
+
+  postPatch = ''
+    sed -i src/config.h -e "s-\\(#define VERSION\\) .*-\\1 \"$version\"-"
+  '';
+
+  cmakeFlags = [
+    "-DENABLE_UPDATER=OFF"
+    "-DUSE_SHARED_CURL=ON"
+    "-DUSE_SHARED_FREETYPE=ON"
+    "-DUSE_SHARED_GIFLIB=ON"
+    "-DUSE_SHARED_JPEGLIB=ON"
+    "-DUSE_SHARED_LIBPNG=ON"
+    "-DUSE_SHARED_LIBWEBP=ON"
+    "-DUSE_SHARED_PIXMAN=ON"
+    "-DUSE_SHARED_TINYXML=ON"
+    "-DUSE_SHARED_ZLIB=ON"
+    "-DWITH_DESKTOP_INTEGRATION=ON"
+    "-DWITH_WEBP_SUPPORT=ON"
+  ] ++ lib.optionals unfree [
+    "-DUSE_SHARED_CMARK=ON"
+    "-DUSE_SHARED_HARFBUZZ=ON"
+    # Aseprite needs internal freetype headers.
+    "-DUSE_SHARED_FREETYPE=OFF"
+    # Disable libarchive programs.
+    "-DENABLE_CAT=OFF"
+    "-DENABLE_CPIO=OFF"
+    "-DENABLE_TAR=OFF"
+    # UI backend.
+    "-DLAF_OS_BACKEND=skia"
+    "-DSKIA_DIR=${skia}"
+  ];
+
+  postInstall = ''
+    # Install desktop icons.
+    src="$out/share/aseprite/data/icons"
+    for size in 16 32 48 64; do
+      dst="$out"/share/icons/hicolor/"$size"x"$size"
+      install -Dm644 "$src"/ase"$size".png "$dst"/apps/aseprite.png
+      install -Dm644 "$src"/doc"$size".png "$dst"/mimetypes/aseprite.png
+    done
+    # Delete unneeded artifacts of bundled libraries.
+    rm -rf "$out"/include "$out"/lib
+  '';
+
+  passthru = { inherit skia; };
+
+  meta = with lib; {
+    homepage = "https://www.aseprite.org/";
+    description = "Animated sprite editor & pixel art tool";
+    license = if unfree then licenses.unfree else licenses.gpl2;
+    longDescription =
+      ''Aseprite is a program to create animated sprites. Its main features are:
+
+          - Sprites are composed by layers & frames (as separated concepts).
+          - Supported color modes: RGBA, Indexed (palettes up to 256 colors), and Grayscale.
+          - Load/save sequence of PNG files and GIF animations (and FLC, FLI, JPG, BMP, PCX, TGA).
+          - Export/import animations to/from Sprite Sheets.
+          - Tiled drawing mode, useful to draw patterns and textures.
+          - Undo/Redo for every operation.
+          - Real-time animation preview.
+          - Multiple editors support.
+          - Pixel-art specific tools like filled Contour, Polygon, Shading mode, etc.
+          - Onion skinning.
+      '' + lib.optionalString unfree
+      ''
+        This version is not redistributable: https://dev.aseprite.org/2016/09/01/new-source-code-license/
+        Consider supporting the developer: https://aseprite.org/#buy
+      '';
+    maintainers = with maintainers; [ orivej ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/editors/aseprite/skia-deps.nix b/nixpkgs/pkgs/applications/editors/aseprite/skia-deps.nix
new file mode 100644
index 000000000000..e5655ca8315d
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/aseprite/skia-deps.nix
@@ -0,0 +1,23 @@
+{ fetchgit }:
+{
+  angle2 = fetchgit {
+    url = "https://chromium.googlesource.com/angle/angle.git";
+    rev = "956ab4d9fab36be9929e63829475d4d69b2c681c";
+    sha256 = "0fcw04wwkn3ixr9l9k0d32n78r9g72p31ii9i5spsq2d0wlylr38";
+  };
+  dng_sdk = fetchgit {
+    url = "https://android.googlesource.com/platform/external/dng_sdk.git";
+    rev = "96443b262250c390b0caefbf3eed8463ba35ecae";
+    sha256 = "1rsr7njhj7c5p87hfznj069fdc3qqhvvnq9sa2rb8c4q849rlzx6";
+  };
+  piex = fetchgit {
+    url = "https://android.googlesource.com/platform/external/piex.git";
+    rev = "bb217acdca1cc0c16b704669dd6f91a1b509c406";
+    sha256 = "05ipmag6k55jmidbyvg5mkqm69zfw03gfkqhi9jnjlmlbg31y412";
+  };
+  sfntly = fetchgit {
+    url = "https://chromium.googlesource.com/external/github.com/googlei18n/sfntly.git";
+    rev = "b18b09b6114b9b7fe6fc2f96d8b15e8a72f66916";
+    sha256 = "0zf1h0dibmm38ldypccg4faacvskmd42vsk6zbxlfcfwjlqm6pp4";
+  };
+}
diff --git a/nixpkgs/pkgs/applications/editors/aseprite/skia-make-deps.sh b/nixpkgs/pkgs/applications/editors/aseprite/skia-make-deps.sh
new file mode 100755
index 000000000000..5e12c4f5c858
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/aseprite/skia-make-deps.sh
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+
+FILTER=$1
+OUT=skia-deps.nix
+REVISION=89e4ca4352d05adc892f5983b108433f29b2c0c2
+DEPS=$(curl -s https://raw.githubusercontent.com/aseprite/skia/$REVISION/DEPS)
+THIRD_PARTY_DEPS=$(echo "$DEPS" | grep third_party | grep "#" -v | sed 's/"//g')
+
+function write_fetch_defs ()
+{
+  while read -r DEP; do
+    NAME=$(echo "$DEP" | cut -d: -f1 | cut -d/ -f3 | sed 's/ //g')
+    URL=$(echo "$DEP" | cut -d: -f2- | cut -d@ -f1 | sed 's/ //g')
+    REV=$(echo "$DEP" | cut -d: -f2- | cut -d@ -f2 | sed 's/[ ,]//g')
+
+    echo "Fetching $NAME@$REV"
+    PREFETCH=$(nix-prefetch-git --rev "$REV" "$URL")
+
+(
+cat <<EOF
+  $NAME = fetchgit {
+    url = "$URL";
+    rev = "$REV";
+    sha256 = $(echo $PREFETCH | jq '.sha256');
+  };
+EOF
+) >> "$OUT"
+
+  echo "----------"
+  echo
+  done <<< "$1"
+}
+
+echo "{ fetchgit }:" > "$OUT"
+echo "{" >> "$OUT"
+write_fetch_defs "$(echo "$THIRD_PARTY_DEPS" | grep -E "$FILTER")"
+echo "}" >> "$OUT"
diff --git a/nixpkgs/pkgs/applications/editors/aseprite/skia.nix b/nixpkgs/pkgs/applications/editors/aseprite/skia.nix
new file mode 100644
index 000000000000..141d51bed0f8
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/aseprite/skia.nix
@@ -0,0 +1,76 @@
+{ stdenv, lib, fetchFromGitHub, fetchgit, python2, gn, ninja
+, fontconfig, expat, icu58, libglvnd, libjpeg, libpng, libwebp, zlib
+, mesa, libX11
+}:
+
+let
+  # skia-deps.nix is generated by: ./skia-make-deps.sh 'angle2|dng_sdk|piex|sfntly'
+  depSrcs = import ./skia-deps.nix { inherit fetchgit; };
+  gnOld = gn.overrideAttrs (oldAttrs: rec {
+    version = "20190403";
+    src = fetchgit {
+      url = "https://gn.googlesource.com/gn";
+      rev = "64b846c96daeb3eaf08e26d8a84d8451c6cb712b";
+      sha256 = "1v2kzsshhxn0ck6gd5w16gi2m3higwd9vkyylmsczxfxnw8skgpy";
+    };
+  });
+in
+stdenv.mkDerivation {
+  name = "skia-aseprite-m71";
+
+  src = fetchFromGitHub {
+    owner = "aseprite";
+    repo = "skia";
+    # latest commit from aseprite-m71 branch
+    rev = "89e4ca4352d05adc892f5983b108433f29b2c0c2"; # TODO: Remove the gnOld override
+    sha256 = "0n3vrkswvi6rib9zv2pzi18h3j5wm7flmgkgaikcm6q7iw4l2c7x";
+  };
+
+  nativeBuildInputs = [ python2 gnOld ninja ];
+
+  buildInputs = [
+    fontconfig expat icu58 libglvnd libjpeg libpng libwebp zlib
+    mesa libX11
+  ];
+
+  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 out/Release --args="is_debug=false is_official_build=true"
+    runHook postConfigure
+  '';
+
+  buildPhase = ''
+    runHook preBuild
+    ninja -C out/Release skia
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    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 \
+      out/Release/*.a \
+      src/gpu/**/*.h \
+      third_party/externals/angle2/include \
+      third_party/skcms/**/*.h
+  '';
+}