forked from moinejf/abc2svg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ninja
102 lines (85 loc) · 3.21 KB
/
build.ninja
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
# rules for ninja (ninja-build)
# 'uglifyjs' may be disabled running
# NOMIN=1 ninja -v
MAJOR=1
rule cp
command = cp $in $out
rule cpm
command = sed "s+@MAJOR@+$MAJOR+" $in > $out
rule font
command = fontforge -c 'open("font/abc2svg.sfd").generate("abc2svg.woff")';$
echo "// abc2svg music font" > font.js;$
echo -n "var musicfont = 'url(\"data:application/font-woff;base64," >> font.js;$
base64 -w 0 abc2svg.woff >> font.js;$
echo "\")'" >> font.js
rule jsc
command = if [ -x /usr/bin/git -a -d .git ]; then$
VERSION=`git describe`;$
VERSION=$${VERSION#v};$
DATE=`git log -1 --pretty=format:%ci HEAD | cut -d' ' -f1`;$
else$
VERSION=`grep '"version"' package.json|cut -d'"' -f4`;$
DATE=`stat --printf=%y build.ninja | cut -d' ' -f1`;$
fi;$
cp core/license $out;$
echo "var abc2svg={version:\"$$VERSION\",vdate:\"$$DATE\"}" >> $out;$
if [ "x$$NOMIN" = "x" ]; then$
cat $in | uglifyjs >> $out;$
else$
cat $in >> $out;$
fi
rule jscu
command = if [ -x /usr/bin/git -a -d .git ]; then$
VERSION=`git describe`;$
VERSION=$${VERSION#v};$
DATE=`git log -1 --pretty=format:%ci HEAD | cut -d' ' -f1`;$
else$
VERSION=`grep '"version"' package.json|cut -d'"' -f4`;$
DATE=`stat --printf=%y build.ninja | cut -d' ' -f1`;$
fi;$
cp core/license $out;$
echo "// $out for abc2svg-$$VERSION ($$DATE)" >> $out;$
if [ "x$$NOMIN" = "x" ]; then$
uglifyjs $in >> $out;$
else$
cat $in >> $out;$
fi
rule edit
command = if [ "x$$NOMIN" = "x" ]; then$
sed "s+@MAJOR@+$MAJOR+" $in | uglifyjs > $out;$
else$
sed "s+@MAJOR@+$MAJOR+" $in > $out;$
fi
build font: font | font/abc2svg.sfd
build abc2svg-$MAJOR.js: jsc core/abc2svg.js core/deco.js core/draw.js $
font.js core/format.js core/front.js core/music.js core/parse.js core/subs.js $
core/svg.js core/tune.js core/lyrics.js core/gchord.js core/tail.js | package.json
build psvg-$MAJOR.js: jscu core/wps.js core/psvg.js | package.json
build edit-$MAJOR.css: cp editor/edit.css
build abcdoc-$MAJOR.js: jscu util/abcdoc.js | package.json
build abcemb-$MAJOR.js: jscu util/abcemb.js | package.json
build follow-$MAJOR.js: jscu util/follow.js | package.json
build json-$MAJOR.js: jscu util/json.js | package.json
build midi-$MAJOR.js: jscu util/midi.js | package.json
build play-$MAJOR.js: jscu util/play.js util/toaudio.js util/toaudio5.js | package.json
build toaudio-$MAJOR.js: jscu util/toaudio.js | package.json
build edit-$MAJOR.xhtml: cpm editor/edit.xhtml
build abckbd-$MAJOR.js: edit editor/abckbd.js | package.json
build abckbd2-$MAJOR.js: edit editor/abckbd2.js | package.json
build edit-$MAJOR.js: edit editor/edit.js | package.json
build all: phony abc2svg-$MAJOR.js abcdoc-$MAJOR.js $
abcemb-$MAJOR.js json-$MAJOR.js midi-$MAJOR.js $
play-$MAJOR.js toaudio-$MAJOR.js psvg-$MAJOR.js $
edit-$MAJOR.css edit-$MAJOR.js edit-$MAJOR.xhtml $
abckbd-$MAJOR.js abckbd2-$MAJOR.js follow-$MAJOR.js
default all
# npm/git new release
# (needs 'npm set git-tag-version false')
rule version
command = npm version $out;$
tag=`grep '"version"' package.json|cut -d'"' -f4`;$
git commit -a -m "New release v$$tag";$
git tag -a v$$tag;$
echo "*** Don't forget: git push --follow-tags; ninja build; npm publish"
build minor: version
build patch: version