Bump API version for new plugin entry points (oops)
[geany-mirror.git] / scripts / update-scintilla.sh
blob5efd3eec087b67f558332395549047e6c5390bcc
1 #!/bin/sh
3 # Copyright: 2012, Colomban Wendling
4 # License: GNU GPL v2 or later
6 # Update Geany's bundled Scintilla from a given Scintilla source directory
7 # (e.g. an upstream Mercurial clone or tarball)
10 SCI_SRC=
12 # parse arguments
13 if [ $# -eq 1 ]; then
14 SCI_SRC="$1"
15 else
16 echo "USAGE: $0 SCINTILLA_SOURCE_DIRECTORY" >&2
17 exit 1
20 # check source directory
21 if ! [ -f "$SCI_SRC"/version.txt ]; then
22 echo "'$SCI_SRC' is not a valid Scintilla source directory!" >&2
23 exit 1
25 # check destination directory
26 if ! [ -d .git ] || ! [ -f scintilla/version.txt ]; then
27 echo "Please run this script from Geany's root source directory." >&2
28 exit 1
31 # make sure destination directory is clean
32 if git status -unormal -s scintilla | grep '^??'; then
33 echo "Please clean scintilla directory from untracked files before." >&2
34 exit 1
37 # copy everything from scintilla but lexers
38 cp -v "$SCI_SRC"/src/*.cxx scintilla/src || exit 1
39 cp -v "$SCI_SRC"/src/*.h scintilla/src || exit 1
40 cp -v "$SCI_SRC"/include/*.h scintilla/include || exit 1
41 cp -v "$SCI_SRC"/include/*.iface scintilla/include || exit 1
42 cp -v "$SCI_SRC"/gtk/*.c scintilla/gtk || exit 1
43 cp -v "$SCI_SRC"/gtk/*.cxx scintilla/gtk || exit 1
44 cp -v "$SCI_SRC"/gtk/*.h scintilla/gtk || exit 1
45 cp -v "$SCI_SRC"/gtk/*.list scintilla/gtk || exit 1
46 cp -v "$SCI_SRC"/lexlib/*.cxx scintilla/lexlib || exit 1
47 cp -v "$SCI_SRC"/lexlib/*.h scintilla/lexlib || exit 1
48 cp -v "$SCI_SRC"/License.txt scintilla || exit 1
49 cp -v "$SCI_SRC"/version.txt scintilla || exit 1
50 # now copy the lexers we use
51 git ls-files scintilla/lexers/*.cxx | sed 's%^scintilla/%./%' | while read f; do
52 cp -v "$SCI_SRC/$f" "scintilla/$f" || exit 1
53 done
55 # apply our patch
56 git apply -p0 scintilla/scintilla_changes.patch || {
57 echo "scintilla_changes.patch doesn't apply, please update it and retry."
58 echo "Changes for the catalogue are:"
59 git diff -p -R --src-prefix= --dst-prefix= scintilla/src/Catalogue.cxx | cat
60 exit 1
63 # show a nice success banner
64 echo "Scintilla update successful!" | sed 'h;s/./=/g;p;x;p;x'
66 #check whether there are new files
67 if git status -unormal -s scintilla | grep '^??'; then
68 cat <<EOF
70 Untracked files above have been introduced by the new Scintilla version and
71 should be added to version control if appropriate, or removed.
73 Don't forget to add new files to the build system.
74 EOF
77 # check for possible changes to styles
78 if ! git diff --quiet scintilla/include/SciLexer.h; then
79 cat << EOF
81 Check the diff of scintilla/include/SciLexer.h to see whether and which
82 mapping to add or update in src/highlightingmappings.h
83 (use git diff scintilla/include/SciLexer.h).
84 Don't forget to also update the comment and string styles in
85 src/highlighting.c.
86 EOF
89 # summary
90 cat << EOF
92 Don't forget to add or update the appropriate line in NEWS.
93 EOF