tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
skia-aseprite: init at m102-861e4743af
vigress8
2 years ago
e329e660
099266ab
+190
-121
5 changed files
expand all
collapse all
unified
split
pkgs
applications
editors
aseprite
skia-make-deps.sh
skia.nix
by-name
sk
skia-aseprite
deps.nix
package.nix
update.sh
+4
-4
pkgs/applications/editors/aseprite/skia-deps.nix
pkgs/by-name/sk/skia-aseprite/deps.nix
···
3
3
angle2 = fetchgit {
4
4
url = "https://chromium.googlesource.com/angle/angle.git";
5
5
rev = "8718783526307a3fbb35d4c1ad4e8101262a0d73";
6
6
-
sha256 = "0c90q8f4syvwcayw58743sa332dcpkmblwh3ffkjqn5ygym04xji";
6
6
+
hash = "sha256-UXYCqn++WCyncwNyuuq8rIkxlB7koMK9Ynx7TRzCIDE=";
7
7
};
8
8
dng_sdk = fetchgit {
9
9
url = "https://android.googlesource.com/platform/external/dng_sdk.git";
10
10
rev = "c8d0c9b1d16bfda56f15165d39e0ffa360a11123";
11
11
-
sha256 = "1nlq082aij7q197i5646bi4vd2il7fww6sdwhqisv2cs842nyfwm";
11
11
+
hash = "sha256-lTtvBUGaia0jhrxpw7k7NIq2SVyGmBJPCvjIqAQCmNo=";
12
12
};
13
13
piex = fetchgit {
14
14
url = "https://android.googlesource.com/platform/external/piex.git";
15
15
rev = "bb217acdca1cc0c16b704669dd6f91a1b509c406";
16
16
-
sha256 = "05ipmag6k55jmidbyvg5mkqm69zfw03gfkqhi9jnjlmlbg31y412";
16
16
+
hash = "sha256-IhAfxlu0UmllihBP9wbg7idT8azlbb9arLKUaZ6qNxY=";
17
17
};
18
18
sfntly = fetchgit {
19
19
url = "https://chromium.googlesource.com/external/github.com/googlei18n/sfntly.git";
20
20
rev = "b55ff303ea2f9e26702b514cf6a3196a2e3e2974";
21
21
-
sha256 = "1qi5rfzmwfrji46x95g6dsb03i1v26700kifl2hpgm3pqhr7afpz";
21
21
+
hash = "sha256-/zp1MsR31HehoC5OAI4RO8QBlm7mldQNiTI7Xr/LJeI=";
22
22
};
23
23
}
-37
pkgs/applications/editors/aseprite/skia-make-deps.sh
···
1
1
-
#!/usr/bin/env bash
2
2
-
3
3
-
FILTER=$1
4
4
-
OUT=skia-deps.nix
5
5
-
REVISION=861e4743af6d9bf6077ae6dda7274e5a136ee4e2
6
6
-
DEPS=$(curl -s https://raw.githubusercontent.com/aseprite/skia/$REVISION/DEPS)
7
7
-
THIRD_PARTY_DEPS=$(echo "$DEPS" | grep third_party | grep "#" -v | sed 's/"//g')
8
8
-
9
9
-
function write_fetch_defs ()
10
10
-
{
11
11
-
while read -r DEP; do
12
12
-
NAME=$(echo "$DEP" | cut -d: -f1 | cut -d/ -f3 | sed 's/ //g')
13
13
-
URL=$(echo "$DEP" | cut -d: -f2- | cut -d@ -f1 | sed 's/ //g')
14
14
-
REV=$(echo "$DEP" | cut -d: -f2- | cut -d@ -f2 | sed 's/[ ,]//g')
15
15
-
16
16
-
echo "Fetching $NAME@$REV"
17
17
-
PREFETCH=$(nix-prefetch-git --rev "$REV" "$URL")
18
18
-
19
19
-
(
20
20
-
cat <<EOF
21
21
-
$NAME = fetchgit {
22
22
-
url = "$URL";
23
23
-
rev = "$REV";
24
24
-
sha256 = $(echo $PREFETCH | jq '.sha256');
25
25
-
};
26
26
-
EOF
27
27
-
) >> "$OUT"
28
28
-
29
29
-
echo "----------"
30
30
-
echo
31
31
-
done <<< "$1"
32
32
-
}
33
33
-
34
34
-
echo "{ fetchgit }:" > "$OUT"
35
35
-
echo "{" >> "$OUT"
36
36
-
write_fetch_defs "$(echo "$THIRD_PARTY_DEPS" | grep -E "$FILTER")"
37
37
-
echo "}" >> "$OUT"
-80
pkgs/applications/editors/aseprite/skia.nix
···
1
1
-
{ stdenv, lib, fetchFromGitHub, fetchgit, python3, gn, ninja
2
2
-
, fontconfig, expat, icu, libglvnd, libjpeg, libpng, libwebp, zlib
3
3
-
, mesa, libX11, harfbuzzFull
4
4
-
}:
5
5
-
6
6
-
let
7
7
-
# skia-deps.nix is generated by: ./skia-make-deps.sh 'angle2|dng_sdk|piex|sfntly'
8
8
-
depSrcs = import ./skia-deps.nix { inherit fetchgit; };
9
9
-
in
10
10
-
stdenv.mkDerivation {
11
11
-
pname = "skia";
12
12
-
version = "aseprite-m102";
13
13
-
14
14
-
src = fetchFromGitHub {
15
15
-
owner = "aseprite";
16
16
-
repo = "skia";
17
17
-
# latest commit from aseprite-m102 branch
18
18
-
rev = "861e4743af6d9bf6077ae6dda7274e5a136ee4e2";
19
19
-
hash = "sha256-IlZbalmHl549uDUfPG8hlzub8TLWhG0EsV6HVAPdsl0=";
20
20
-
};
21
21
-
22
22
-
nativeBuildInputs = [ python3 gn ninja ];
23
23
-
24
24
-
buildInputs = [
25
25
-
fontconfig expat icu libglvnd libjpeg libpng libwebp zlib
26
26
-
mesa libX11 harfbuzzFull
27
27
-
];
28
28
-
29
29
-
preConfigure = with depSrcs; ''
30
30
-
mkdir -p third_party/externals
31
31
-
ln -s ${angle2} third_party/externals/angle2
32
32
-
ln -s ${dng_sdk} third_party/externals/dng_sdk
33
33
-
ln -s ${piex} third_party/externals/piex
34
34
-
ln -s ${sfntly} third_party/externals/sfntly
35
35
-
'';
36
36
-
37
37
-
configurePhase = ''
38
38
-
runHook preConfigure
39
39
-
gn gen out/Release --args="is_debug=false is_official_build=true extra_cflags=[\"-I${harfbuzzFull.dev}/include/harfbuzz\"]"
40
40
-
runHook postConfigure
41
41
-
'';
42
42
-
43
43
-
buildPhase = ''
44
44
-
runHook preBuild
45
45
-
ninja -C out/Release skia modules
46
46
-
runHook postBuild
47
47
-
'';
48
48
-
49
49
-
installPhase = ''
50
50
-
mkdir -p $out
51
51
-
52
52
-
# Glob will match all subdirs.
53
53
-
shopt -s globstar
54
54
-
55
55
-
# All these paths are used in some way when building aseprite.
56
56
-
cp -r --parents -t $out/ \
57
57
-
include/codec \
58
58
-
include/config \
59
59
-
include/core \
60
60
-
include/effects \
61
61
-
include/gpu \
62
62
-
include/private \
63
63
-
include/utils \
64
64
-
include/third_party/skcms/*.h \
65
65
-
out/Release/*.a \
66
66
-
src/gpu/**/*.h \
67
67
-
src/core/*.h \
68
68
-
modules/skshaper/include/*.h \
69
69
-
third_party/externals/angle2/include \
70
70
-
third_party/skcms/**/*.h
71
71
-
'';
72
72
-
73
73
-
meta = with lib; {
74
74
-
description = "Skia is a complete 2D graphic library for drawing Text, Geometries, and Images";
75
75
-
homepage = "https://skia.org/";
76
76
-
license = licenses.bsd3;
77
77
-
maintainers = with maintainers; [ ];
78
78
-
platforms = platforms.all;
79
79
-
};
80
80
-
}
+115
pkgs/by-name/sk/skia-aseprite/package.nix
···
1
1
+
{
2
2
+
aseprite,
3
3
+
clangStdenv,
4
4
+
expat,
5
5
+
fetchFromGitHub,
6
6
+
fetchgit,
7
7
+
fontconfig,
8
8
+
gn,
9
9
+
harfbuzzFull,
10
10
+
icu,
11
11
+
lib,
12
12
+
libglvnd,
13
13
+
libjpeg,
14
14
+
libpng,
15
15
+
libwebp,
16
16
+
libX11,
17
17
+
mesa,
18
18
+
ninja,
19
19
+
python3,
20
20
+
zlib,
21
21
+
}:
22
22
+
23
23
+
let
24
24
+
# deps.nix is generated by ./update.sh
25
25
+
depSrcs = import ./deps.nix { inherit fetchgit; };
26
26
+
in
27
27
+
clangStdenv.mkDerivation (finalAttrs: {
28
28
+
pname = "skia-aseprite";
29
29
+
version = "m102-861e4743af";
30
30
+
31
31
+
src = fetchFromGitHub {
32
32
+
owner = "aseprite";
33
33
+
repo = "skia";
34
34
+
rev = finalAttrs.version;
35
35
+
hash = "sha256-IlZbalmHl549uDUfPG8hlzub8TLWhG0EsV6HVAPdsl0=";
36
36
+
};
37
37
+
38
38
+
nativeBuildInputs = [
39
39
+
gn
40
40
+
ninja
41
41
+
python3
42
42
+
];
43
43
+
44
44
+
preConfigure = with depSrcs; ''
45
45
+
mkdir -p third_party/externals
46
46
+
ln -s ${angle2} third_party/externals/angle2
47
47
+
ln -s ${dng_sdk} third_party/externals/dng_sdk
48
48
+
ln -s ${piex} third_party/externals/piex
49
49
+
ln -s ${sfntly} third_party/externals/sfntly
50
50
+
'';
51
51
+
52
52
+
configurePhase = ''
53
53
+
runHook preConfigure
54
54
+
gn gen lib --args="is_debug=false is_official_build=true extra_cflags=[\"-I${harfbuzzFull.dev}/include/harfbuzz\"]"
55
55
+
runHook postConfigure
56
56
+
'';
57
57
+
58
58
+
buildInputs = [
59
59
+
expat
60
60
+
fontconfig
61
61
+
harfbuzzFull
62
62
+
icu
63
63
+
libglvnd
64
64
+
libjpeg
65
65
+
libpng
66
66
+
libwebp
67
67
+
libX11
68
68
+
mesa
69
69
+
zlib
70
70
+
];
71
71
+
72
72
+
buildPhase = ''
73
73
+
runHook preBuild
74
74
+
ninja -C lib skia modules
75
75
+
runHook postBuild
76
76
+
'';
77
77
+
78
78
+
installPhase = ''
79
79
+
runHook preInstall
80
80
+
mkdir -p $out
81
81
+
82
82
+
# Glob will match all subdirs.
83
83
+
shopt -s globstar
84
84
+
85
85
+
# All these paths are used in some way when building Aseprite.
86
86
+
cp -r --parents -t $out/ \
87
87
+
include/codec \
88
88
+
include/config \
89
89
+
include/core \
90
90
+
include/effects \
91
91
+
include/gpu \
92
92
+
include/private \
93
93
+
include/utils \
94
94
+
include/third_party/skcms/*.h \
95
95
+
lib/*.a \
96
96
+
modules/skshaper/include/*.h \
97
97
+
src/core/*.h \
98
98
+
src/gpu/**/*.h \
99
99
+
third_party/externals/angle2/include \
100
100
+
third_party/skcms/**/*.h
101
101
+
102
102
+
runHook postInstall
103
103
+
'';
104
104
+
105
105
+
passthru.updateScript = [ ./update.sh ] ++ builtins.attrNames depSrcs;
106
106
+
107
107
+
meta = {
108
108
+
description = "Complete 2D graphic library for drawing Text, Geometries, and Images (Aseprite's fork)";
109
109
+
homepage = "https://skia.org/";
110
110
+
downloadPage = "https://github.com/aseprite/skia";
111
111
+
license = lib.licenses.bsd3;
112
112
+
inherit (aseprite.meta) maintainers;
113
113
+
platforms = lib.platforms.all;
114
114
+
};
115
115
+
})
+71
pkgs/by-name/sk/skia-aseprite/update.sh
···
1
1
+
#!/usr/bin/env nix-shell
2
2
+
#!nix-shell --pure -i bash
3
3
+
#!nix-shell -p cacert curl git jq nix-prefetch-git
4
4
+
# shellcheck shell=bash
5
5
+
# vim: set tabstop=2 shiftwidth=2 expandtab:
6
6
+
set -euo pipefail
7
7
+
shopt -s inherit_errexit
8
8
+
9
9
+
[ $# -gt 0 ] || {
10
10
+
printf >&2 'usage: %s <deps>' "$0"
11
11
+
exit 1
12
12
+
}
13
13
+
14
14
+
pkgpath=$(git rev-parse --show-toplevel)/pkgs/by-name/sk/skia-aseprite
15
15
+
depfilter=$(tr ' ' '|' <<< "$*")
16
16
+
depfile=$pkgpath/deps.nix
17
17
+
pkgfile=$pkgpath/package.nix
18
18
+
19
19
+
update_deps() {
20
20
+
local deps third_party_deps name url rev hash prefetch
21
21
+
22
22
+
version=$(sed -n 's|.*version = "\(.*\)".*|\1|p' < "$pkgfile")
23
23
+
deps=$(curl -fsS https://raw.githubusercontent.com/aseprite/skia/$version/DEPS)
24
24
+
third_party_deps=$(sed -n 's|[ ",]||g; s|:| |; s|@| |; s|^third_party/externals/||p' <<< "$deps")
25
25
+
filtered=$(grep -E -- "$depfilter" <<< "$third_party_deps")
26
26
+
if [[ -z $filtered ]]; then
27
27
+
printf >&2 '%s: error: filter "%s" matched nothing' "$0" "$depfilter"
28
28
+
return 1
29
29
+
fi
30
30
+
31
31
+
printf '{ fetchgit }:\n{\n'
32
32
+
while read -r name url rev; do
33
33
+
printf >&2 'Fetching %s@%s\n' "$name" "$rev"
34
34
+
prefetch=$(nix-prefetch-git --quiet --rev "$rev" "$url")
35
35
+
hash=$(jq -r '.hash' <<< "$prefetch")
36
36
+
37
37
+
cat << EOF
38
38
+
$name = fetchgit {
39
39
+
url = "$url";
40
40
+
rev = "$rev";
41
41
+
hash = "$hash";
42
42
+
};
43
43
+
EOF
44
44
+
# `read` could exit with a non-zero code without a newline at the end
45
45
+
done < <(printf '%s\n' "$filtered")
46
46
+
printf '}\n'
47
47
+
}
48
48
+
49
49
+
update_version() {
50
50
+
local newver newrev
51
51
+
newver=$(
52
52
+
curl --fail \
53
53
+
--header 'Accept: application/vnd.github+json' \
54
54
+
--location --show-error --silent \
55
55
+
${GITHUB_TOKEN:+ --user \":$GITHUB_TOKEN\"} \
56
56
+
https://api.github.com/repos/aseprite/skia/releases/latest \
57
57
+
| jq -r .tag_name
58
58
+
)
59
59
+
newhash=$(nix-prefetch-git --quiet --rev "$newver" https://github.com/aseprite/skia.git | jq -r '.hash')
60
60
+
sed \
61
61
+
-e 's|version = ".*"|version = "'$newver'"|' \
62
62
+
-e 's|hash = ".*"|hash = "'$newhash'"|' \
63
63
+
-- "$pkgfile"
64
64
+
}
65
65
+
66
66
+
temp=$(mktemp)
67
67
+
trap 'ret=$?; rm -rf -- "$temp"; exit $ret' EXIT
68
68
+
update_version > "$temp"
69
69
+
cp "$temp" "$pkgfile"
70
70
+
update_deps > "$temp"
71
71
+
cp "$temp" "$depfile"