Merge branch 'small-dialogs-cleanup'
[geany-mirror.git] / scripts / update-scintilla.sh
blob734019036bc4448855e197dd0904397cbd720aa3
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 scintilla/src/Catalogue.cxx | tee
60 echo "Make sure to strip the leading a/ and b/!"
61 exit 1
64 #check whether there are new files
65 if git status -unormal -s scintilla | grep '^??'; then
66 cat <<EOF
68 Untracked files above have been introduced by the new Scintilla version and
69 should be added to version control if appropriate, or removed.
71 Don't forget to add new files to the build system.
72 EOF
75 # summary
76 cat << EOF
78 Scintilla update successful!
80 Please check the diff and upgrade the style mappings in
81 src/highlightingmappings.h.
83 Check the diff of scintilla/include/SciLexer.h to see whether and which
84 mapping to add or update (use git diff scintilla/include/SciLexer.h).
85 Don't forget to also update the comment and string styles in
86 src/highlighting.c.
88 Finally, add or update the appropriate line in NEWS.
89 EOF