3 # Copyright: 2012, The Geany contributors
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)
17 echo "USAGE: $0 SCINTILLA_SOURCE_DIRECTORY LEXILLA_SOURCE_DIRECTORY" >&2
21 # check source directory
22 if ! [ -f "$SCI_SRC/src/ScintillaBase.cxx" ]; then
23 echo "'$SCI_SRC' is not a valid Scintilla source directory!" >&2
26 if ! [ -f "$LEX_SRC/src/Lexilla.cxx" ]; then
27 echo "'$LEX_SRC' is not a valid Lexilla source directory!" >&2
30 # check destination directory
31 if ! [ -d .git
] ||
! [ -f scintilla
/version.txt
]; then
32 echo "Please run this script from Geany's root source directory." >&2
36 # make sure destination directory is clean
37 if git status
-unormal -s scintilla |
grep '^??'; then
38 echo "Please clean scintilla directory from untracked files before." >&2
47 if ! [ -e "$dest" ]; then
48 echo "$dest does not exist." >&2;
52 dos2unix
-k -q -n $f $dest/$
(basename $f) ||
(echo "dos2unix $f failed" >&2 ; exit 1)
56 # purge executbale bits
58 # copy everything from scintilla but lexers
59 copy_to scintilla
/README
"$SCI_SRC"/README
60 copy_to scintilla
/src
"$SCI_SRC"/src
/*.cxx
61 copy_to scintilla
/src
"$SCI_SRC"/src
/*.h
62 copy_to scintilla
/include
"$SCI_SRC"/include
/*.h
63 copy_to scintilla
/include
"$SCI_SRC"/include
/*.iface
64 copy_to scintilla
/gtk
"$SCI_SRC"/gtk
/*.c
65 copy_to scintilla
/gtk
"$SCI_SRC"/gtk
/*.cxx
66 copy_to scintilla
/gtk
"$SCI_SRC"/gtk
/*.h
67 copy_to scintilla
/gtk
"$SCI_SRC"/gtk
/*.list
68 copy_to scintilla
"$SCI_SRC"/License.txt
69 copy_to scintilla
"$SCI_SRC"/version.txt
70 copy_to scintilla
/lexilla
/src
"$LEX_SRC"/src
/*.cxx
71 copy_to scintilla
/lexilla
/include
"$LEX_SRC"/include
/*.h
72 copy_to scintilla
/lexilla
/lexlib
"$LEX_SRC"/lexlib
/*.cxx
73 copy_to scintilla
/lexilla
/lexlib
"$LEX_SRC"/lexlib
/*.h
74 copy_to scintilla
/lexilla
/ "$LEX_SRC"/License.txt
75 copy_to scintilla
/lexilla
/ "$LEX_SRC"/version.txt
76 # now copy the lexers we use
77 git
-C scintilla
/lexilla
/lexers
/ ls-files
'*.cxx' |
while read f
; do
78 copy_to
"scintilla/lexilla/lexers" "$LEX_SRC/lexers/$f"
82 git apply
-p0 scintilla
/scintilla_changes.
patch ||
{
83 echo "scintilla_changes.patch doesn't apply, please update it and retry."
87 echo "Upstream lexer catalogue changes:"
88 git
diff -p --src-prefix= --dst-prefix= scintilla
/lexilla
/src
/Lexilla.cxx
90 # show a nice success banner
91 echo "Scintilla update successful!" |
sed 'h;s/./=/g;p;x;p;x'
93 #check whether there are new files
94 if git status
-unormal -s scintilla |
grep '^??'; then
97 Untracked files above have been introduced by the new Scintilla version and
98 should be added to version control if appropriate, or removed.
100 You can add them to Git with the command:
101 $ git add $(git status -unormal -s scintilla | grep '^??' | cut -b4- | sed '$!{s/$/ \\/};1!{s/^/ /}')
103 Don't forget to add new files to the build system (scintilla/Makefile.am).
107 # check for possible changes to styles
108 if ! git
diff --quiet scintilla
/lexilla
/include
/SciLexer.h
; then
111 Check the diff of scintilla/lexilla/include/SciLexer.h to see whether and which
112 mapping to add or update in src/highlightingmappings.h
113 (use git diff scintilla/lexilla/include/SciLexer.h).
114 Don't forget to also update the comment and string styles in
122 Don't forget to add or update the appropriate line in NEWS.