aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2020-01-26 08:15:50 +1100
committerNeil <nyamatongwe@gmail.com>2020-01-26 08:15:50 +1100
commita89841e67888a43625c91e9bf8d6a1ef2ac4f2c4 (patch)
treefaebc8e3ffacf12e5d0a5890cb7c5f6cd8d85d2d
parentb6706ed7be03e06a9c2cce349ff19eb95055c6bd (diff)
downloadscintilla-mirror-a89841e67888a43625c91e9bf8d6a1ef2ac4f2c4.tar.gz
Add version information resource to Lexilla.DLL on Win32.
Lexilla and Scintilla currently share a version number but they may diverge in the future.
-rw-r--r--lexilla/scripts/LexillaGen.py21
-rw-r--r--lexilla/src/LexillaVersion.rc37
-rw-r--r--lexilla/src/lexilla.mak5
-rw-r--r--lexilla/src/makefile7
-rw-r--r--lexilla/version.txt1
5 files changed, 65 insertions, 6 deletions
diff --git a/lexilla/scripts/LexillaGen.py b/lexilla/scripts/LexillaGen.py
index 569f043ac..b0f3fae02 100644
--- a/lexilla/scripts/LexillaGen.py
+++ b/lexilla/scripts/LexillaGen.py
@@ -22,11 +22,24 @@ def RegenerateAll(root):
scintillaBase = os.path.abspath(root)
sci = ScintillaData.ScintillaData(root + os.sep)
-
- src = os.path.join(root, "lexilla", "src")
- Regenerate(os.path.join(src, "Lexilla.cxx"), "//", sci.lexerModules)
- Regenerate(os.path.join(src, "lexilla.mak"), "#", sci.lexFiles)
+ lexillaDir = os.path.join(root, "lexilla")
+ srcDir = os.path.join(lexillaDir, "src")
+
+ Regenerate(os.path.join(srcDir, "Lexilla.cxx"), "//", sci.lexerModules)
+ Regenerate(os.path.join(srcDir, "lexilla.mak"), "#", sci.lexFiles)
+
+ # Discover version information
+ with open(os.path.join(lexillaDir, "version.txt")) as f:
+ version = f.read().strip()
+ versionDotted = version[0] + '.' + version[1] + '.' + version[2]
+ versionCommad = versionDotted.replace(".", ", ") + ', 0'
+
+ rcPath = os.path.join(srcDir, "LexillaVersion.rc")
+ UpdateLineInFile(rcPath, "#define VERSION_LEXILLA",
+ "#define VERSION_LEXILLA \"" + versionDotted + "\"")
+ UpdateLineInFile(rcPath, "#define VERSION_WORDS",
+ "#define VERSION_WORDS " + versionCommad)
#~ startDir = os.getcwd()
#~ os.chdir(os.path.join(scintillaBase, "win32"))
diff --git a/lexilla/src/LexillaVersion.rc b/lexilla/src/LexillaVersion.rc
new file mode 100644
index 000000000..47a60b731
--- /dev/null
+++ b/lexilla/src/LexillaVersion.rc
@@ -0,0 +1,37 @@
+// Resource file for Lexilla - provides a version number
+// Copyright 2020 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <windows.h>
+
+#define VERSION_LEXILLA "4.3.0"
+#define VERSION_WORDS 4, 3, 0, 0
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION VERSION_WORDS
+PRODUCTVERSION VERSION_WORDS
+FILEFLAGSMASK 0x3fL
+FILEFLAGS 0
+FILEOS VOS_NT_WINDOWS32
+FILETYPE VFT_APP
+FILESUBTYPE VFT2_UNKNOWN
+BEGIN
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Neil Hodgson neilh@scintilla.org\0"
+ VALUE "FileDescription", "Lexilla.DLL - a Lexical Analysis Component\0"
+ VALUE "FileVersion", VERSION_LEXILLA "\0"
+ VALUE "InternalName", "Lexilla\0"
+ VALUE "LegalCopyright", "Copyright 2019 by Neil Hodgson\0"
+ VALUE "OriginalFilename", "Lexilla.DLL\0"
+ VALUE "ProductName", "Lexilla\0"
+ VALUE "ProductVersion", VERSION_LEXILLA "\0"
+ END
+ END
+END
diff --git a/lexilla/src/lexilla.mak b/lexilla/src/lexilla.mak
index 2a7a839c8..93b71cdc3 100644
--- a/lexilla/src/lexilla.mak
+++ b/lexilla/src/lexilla.mak
@@ -193,7 +193,7 @@ LEXILLA_OBJS=\
$(LEXLIB_OBJS) \
$(LEX_OBJS)
-$(LEXILLA): $(LEXILLA_OBJS)
+$(LEXILLA): $(LEXILLA_OBJS) LexillaVersion.res
$(LD) $(LDFLAGS) -DLL -OUT:$@ $** $(LIBS)
$(LIBLEXILLA): $(LEXILLA_OBJS)
@@ -210,6 +210,9 @@ $(LIBLEXILLA): $(LEXILLA_OBJS)
{.}.cxx{$(DIR_O)}.obj::
$(CXX) $(CXXFLAGS) -c $(NAME)$(DIR_O)\ $<
+.rc.res:
+ $(RC) -fo$@ $**
+
# Dependencies
!IF EXISTS(nmdeps.mak)
diff --git a/lexilla/src/makefile b/lexilla/src/makefile
index 86699dbb6..a8edfc1cb 100644
--- a/lexilla/src/makefile
+++ b/lexilla/src/makefile
@@ -20,6 +20,8 @@ WARNINGS = -Wpedantic -Wall -Wextra
ifdef windir
SHAREDEXTENSION = dll
+ WINDRES ?= windres
+ VERSION_RESOURCE = LexillaVersion.o
else
ifeq ($(shell uname),Darwin)
CLANG := 1
@@ -80,6 +82,9 @@ clean:
%.o: %.cxx
$(CXX) $(DEFINES) $(INCLUDES) $(BASE_FLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
+%.o: %.rc
+ $(WINDRES) $< $@
+
analyze:
$(CXX) --analyze $(DEFINES) $(INCLUDES) $(BASE_FLAGS) $(CXXFLAGS) *.cxx ../../lexlib/*.cxx ../../lexers/*.cxx
@@ -109,7 +114,7 @@ LEXILLA_OBJS=\
$(LEXLIB_OBJS) \
$(LEXERS:.cxx=.o)
-$(LEXILLA): $(LEXILLA_OBJS)
+$(LEXILLA): $(LEXILLA_OBJS) $(VERSION_RESOURCE)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@
$(LIBLEXILLA): $(LEXILLA_OBJS)
diff --git a/lexilla/version.txt b/lexilla/version.txt
new file mode 100644
index 000000000..c15fb930d
--- /dev/null
+++ b/lexilla/version.txt
@@ -0,0 +1 @@
+430