From d4564f1bc3971575f2d2f4e8057e693d4b887133 Mon Sep 17 00:00:00 2001 From: David Macek Date: Tue, 8 Mar 2016 23:19:46 +0100 Subject: [PATCH] mingw-w64-scite-git: New development-only package --- mingw-w64-scite-git/.gitignore | 2 + .../0001-Use-POSIX-tools-in-makefiles.patch | 82 +++++++++++++ .../0002-Prefix-library-names.patch | 90 +++++++++++++++ mingw-w64-scite-git/0003-Use-FHS.patch | 76 ++++++++++++ mingw-w64-scite-git/PKGBUILD | 109 ++++++++++++++++++ 5 files changed, 359 insertions(+) create mode 100644 mingw-w64-scite-git/.gitignore create mode 100644 mingw-w64-scite-git/0001-Use-POSIX-tools-in-makefiles.patch create mode 100644 mingw-w64-scite-git/0002-Prefix-library-names.patch create mode 100644 mingw-w64-scite-git/0003-Use-FHS.patch create mode 100644 mingw-w64-scite-git/PKGBUILD diff --git a/mingw-w64-scite-git/.gitignore b/mingw-w64-scite-git/.gitignore new file mode 100644 index 0000000000..735f6ac011 --- /dev/null +++ b/mingw-w64-scite-git/.gitignore @@ -0,0 +1,2 @@ +scintilla/ +scite/ diff --git a/mingw-w64-scite-git/0001-Use-POSIX-tools-in-makefiles.patch b/mingw-w64-scite-git/0001-Use-POSIX-tools-in-makefiles.patch new file mode 100644 index 0000000000..dd1e15678f --- /dev/null +++ b/mingw-w64-scite-git/0001-Use-POSIX-tools-in-makefiles.patch @@ -0,0 +1,82 @@ +From 4591a15982077c8a1d4c9505aeb1025722129562 Mon Sep 17 00:00:00 2001 +From: David Macek +Date: Thu, 12 Feb 2015 12:57:31 +0100 +Subject: [PATCH 1/3] Use POSIX tools in makefiles + +--- + scintilla/gtk/makefile | 2 +- + scite/win32/makefile | 24 +++--------------------- + 2 files changed, 4 insertions(+), 22 deletions(-) + +diff --git a/scintilla/gtk/makefile b/scintilla/gtk/makefile +index cdf1aa1..0d4397e 100644 +--- a/scintilla/gtk/makefile ++++ b/scintilla/gtk/makefile +@@ -32,8 +32,8 @@ endif + endif + + ifdef windir + CC = gcc +-DEL = del /q ++DEL = rm -f + COMPLIB=..\bin\scintilla.a + else + DEL = rm -f +diff --git a/scite/win32/makefile b/scite/win32/makefile +index daffb70..e5ccb62 100644 +--- a/scite/win32/makefile ++++ b/scite/win32/makefile +@@ -10,24 +10,6 @@ WINDRES ?= windres + ifeq ($(OS),Windows_NT) + CC = gcc + DEL = $(if $(wildcard $(dir $(SHELL))rm.exe), $(dir $(SHELL))rm.exe -f, del) +- COPY = xcopy /Y +- VER = cmd /c ver +- # Discover Windows version by running 'VER' command and parsing output +- # For Windows 2000 looks like:Microsoft Windows 2000 [Version 5.00.2195] +- WINVERWORDS:=$(wordlist 1,2,$(subst ., ,$(lastword $(shell $(VER))))) +- WINVER:=$(firstword $(WINVERWORDS)).$(lastword $(WINVERWORDS)) +- # Windows NT 4 and Windows 2000 do not support themes so turn off +-ifeq '$(WINVER)' '4.0' +- VERSION_DEFINES:=-DDISABLE_THEMES -DWIN_TARGET=0x0400 +-else +-ifeq '$(WINVER)' '5.00' +- VERSION_DEFINES:=-DDISABLE_THEMES +-else +- UXLIB:=-luxtheme +-endif +-endif +-else +- DEL = rm -f + COPY = cp -a + UXLIB:=-luxtheme + endif +@@ -163,14 +145,14 @@ embedded: ../src/Embedded.properties + + ../bin/Scintilla.dll: ../../scintilla/bin/Scintilla.dll + ifeq ($(OS),Windows_NT) +- $(COPY) $(subst /,\, $< $(@D)) ++ $(COPY) $^ $(@D) + else + $(COPY) $^ $(@D) + endif + + ../bin/SciLexer.dll: ../../scintilla/bin/SciLexer.dll + ifeq ($(OS),Windows_NT) +- $(COPY) $(subst /,\, $< $(@D)) ++ $(COPY) $^ $(@D) + else + $(COPY) $^ $(@D) + endif +@@ -178,7 +160,7 @@ endif + # Using '/' rather than '\' as that allows make to match the next rule + ../bin/%.properties: ../src/%.properties + ifeq ($(OS),Windows_NT) +- $(COPY) $(subst /,\, $< $(@D)) ++ $(COPY) $^ $(@D) + else + $(COPY) $^ $(@D) + endif +-- +2.3.0 + diff --git a/mingw-w64-scite-git/0002-Prefix-library-names.patch b/mingw-w64-scite-git/0002-Prefix-library-names.patch new file mode 100644 index 0000000000..9b8efd29d1 --- /dev/null +++ b/mingw-w64-scite-git/0002-Prefix-library-names.patch @@ -0,0 +1,90 @@ +From b65e62d86dd1d7f054dd6604d76dac1660d66027 Mon Sep 17 00:00:00 2001 +From: David Macek +Date: Thu, 12 Feb 2015 13:03:03 +0100 +Subject: [PATCH 2/3] Prefix library names + +--- + scintilla/gtk/makefile | 4 ++-- + scintilla/win32/makefile | 4 ++-- + scite/win32/SciTEWin.cxx | 2 +- + scite/win32/makefile | 6 +++--- + 4 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/scintilla/gtk/makefile b/scintilla/gtk/makefile +index 0d4397e..026f358 100644 +--- a/scintilla/gtk/makefile ++++ b/scintilla/gtk/makefile +@@ -33,10 +33,10 @@ endif + + ifdef windir + DEL = rm -f +-COMPLIB=..\bin\scintilla.a ++COMPLIB=..\bin\libScintillaGtk.a + else + DEL = rm -f +-COMPLIB=../bin/scintilla.a ++COMPLIB=../bin/libScintillaGtk.a + endif + + vpath %.h ../src ../include ../lexlib +diff --git a/scintilla/win32/makefile b/scintilla/win32/makefile +index 806e585..7550b4a 100644 +--- a/scintilla/win32/makefile ++++ b/scintilla/win32/makefile +@@ -13,8 +13,8 @@ endif + RANLIB ?= ranlib + WINDRES ?= windres + +-COMPONENT = ../bin/Scintilla.dll +-LEXCOMPONENT = ../bin/SciLexer.dll ++COMPONENT = ../bin/libScintilla.dll ++LEXCOMPONENT = ../bin/libSciLexer.dll + LEXLIB = Lexers.a + + vpath %.h ../src ../include ../lexlib +diff --git a/scite/win32/SciTEWin.cxx b/scite/win32/SciTEWin.cxx +index 22959cb..16c21a8 100644 +--- a/scite/win32/SciTEWin.cxx ++++ b/scite/win32/SciTEWin.cxx +@@ -2166,7 +2166,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) { + Scintilla_RegisterClasses(hInstance); + #else + +- HMODULE hmod = ::LoadLibrary(TEXT("SciLexer.DLL")); ++ HMODULE hmod = ::LoadLibrary(TEXT("libSciLexer.dll")); + if (hmod == NULL) + ::MessageBox(NULL, TEXT("The Scintilla DLL could not be loaded. SciTE will now close"), + TEXT("Error loading Scintilla"), MB_OK | MB_ICONERROR); +diff --git a/scite/win32/makefile b/scite/win32/makefile +index e5ccb62..5125190 100644 +--- a/scite/win32/makefile ++++ b/scite/win32/makefile +@@ -95,7 +95,7 @@ OTHER_OBJS = $(SHAREDOBJS) $(LUA_OBJS) SciTERes.o SciTEWin.o + + OBJS = Credits.o $(OTHER_OBJS) + +-DLLS=../bin/Scintilla.dll ../bin/SciLexer.dll ++DLLS=../bin/libScintilla.dll ../bin/libSciLexer.dll + + #++Autogenerated -- run ../scripts/RegenerateSource.py to regenerate + #**LEXPROPS=\\\n\(../bin/\* \) +@@ -143,14 +143,14 @@ deps: + + embedded: ../src/Embedded.properties + +-../bin/Scintilla.dll: ../../scintilla/bin/Scintilla.dll ++../bin/libScintilla.dll: ../../scintilla/bin/libScintilla.dll + ifeq ($(OS),Windows_NT) + $(COPY) $^ $(@D) + else + $(COPY) $^ $(@D) + endif + +-../bin/SciLexer.dll: ../../scintilla/bin/SciLexer.dll ++../bin/libSciLexer.dll: ../../scintilla/bin/libSciLexer.dll + ifeq ($(OS),Windows_NT) + $(COPY) $^ $(@D) + else +-- +2.3.0 + diff --git a/mingw-w64-scite-git/0003-Use-FHS.patch b/mingw-w64-scite-git/0003-Use-FHS.patch new file mode 100644 index 0000000000..6f6c4f4035 --- /dev/null +++ b/mingw-w64-scite-git/0003-Use-FHS.patch @@ -0,0 +1,76 @@ +From 6c7abcc75da8f667bf769bacff331e19d4a4dff2 Mon Sep 17 00:00:00 2001 +From: David Macek +Date: Thu, 12 Feb 2015 13:04:15 +0100 +Subject: [PATCH 3/3] Use FHS + +--- + scite/src/SciTEIO.cxx | 7 ------- + scite/win32/SciTEWin.cxx | 25 ++++++++++++++++++++++++- + 2 files changed, 24 insertions(+), 8 deletions(-) + +diff --git a/scite/src/SciTEIO.cxx b/scite/src/SciTEIO.cxx +index 34abc6e..5da0040 100644 +--- a/scite/src/SciTEIO.cxx ++++ b/scite/src/SciTEIO.cxx +@@ -42,14 +42,7 @@ + #include "SciTEBase.h" + #include "Utf8_16.h" + +-#if defined(GTK) + const GUI::gui_char propUserFileName[] = GUI_TEXT(".SciTEUser.properties"); +-#elif defined(__APPLE__) +-const GUI::gui_char propUserFileName[] = GUI_TEXT("SciTEUser.properties"); +-#else +-// Windows +-const GUI::gui_char propUserFileName[] = GUI_TEXT("SciTEUser.properties"); +-#endif + const GUI::gui_char propGlobalFileName[] = GUI_TEXT("SciTEGlobal.properties"); + const GUI::gui_char propAbbrevFileName[] = GUI_TEXT("abbrev.properties"); + +diff --git a/scite/win32/SciTEWin.cxx b/scite/win32/SciTEWin.cxx +index 16c21a8..4929de9 100644 +--- a/scite/win32/SciTEWin.cxx ++++ b/scite/win32/SciTEWin.cxx +@@ -413,8 +413,29 @@ static FilePath GetSciTEPath(FilePath home) { + return FilePath(); + // Remove the SciTE.exe + GUI::gui_char *lastSlash = wcsrchr(path, pathSepChar); +- if (lastSlash) ++ if (lastSlash) { + *lastSlash = '\0'; ++ } ++ // MSYS2: go to $(bindir)/../share/scite ++ lastSlash = wcsrchr(path, pathSepChar); ++ if (lastSlash) { ++ if (lastSlash - path + sizeof("share/scite") >= MAX_PATH) { ++ return FilePath(path); // don't risk overflow, return early ++ } ++ *(lastSlash++) = pathSepChar; ++ *(lastSlash++) = 's'; ++ *(lastSlash++) = 'h'; ++ *(lastSlash++) = 'a'; ++ *(lastSlash++) = 'r'; ++ *(lastSlash++) = 'e'; ++ *(lastSlash++) = pathSepChar; ++ *(lastSlash++) = 's'; ++ *(lastSlash++) = 'c'; ++ *(lastSlash++) = 'i'; ++ *(lastSlash++) = 't'; ++ *(lastSlash++) = 'e'; ++ *(lastSlash++) = '\0'; ++ } + return FilePath(path); + } + } +@@ -432,6 +453,8 @@ FilePath SciTEWin::GetSciteDefaultHome() { + FilePath SciTEWin::GetSciteUserHome() { + GUI::gui_char *home = _wgetenv(GUI_TEXT("SciTE_HOME")); + if (!home) ++ home = _wgetenv(GUI_TEXT("HOME")); ++ if (!home) + home = _wgetenv(GUI_TEXT("USERPROFILE")); + return GetSciTEPath(home); + } +-- +2.3.0 + diff --git a/mingw-w64-scite-git/PKGBUILD b/mingw-w64-scite-git/PKGBUILD new file mode 100644 index 0000000000..3dbcec5316 --- /dev/null +++ b/mingw-w64-scite-git/PKGBUILD @@ -0,0 +1,109 @@ +# Maintainer: David Macek + +_realname=scite +pkgbase=mingw-w64-${_realname}-hg +pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}-hg" + "${MINGW_PACKAGE_PREFIX}-${_realname}-defaults-hg") +pkgver=r4649+.a9f6d5a13b70+ +pkgrel=1 +arch=('any') +url='http://www.scintilla.org/SciTE.html' +license=('custom:scite') +makedepends=("mercurial" + "${MINGW_PACKAGE_PREFIX}-gcc" + "${MINGW_PACKAGE_PREFIX}-gtk3" + "${MINGW_PACKAGE_PREFIX}-pkg-config") +source=("scintilla::hg+http://hg.code.sf.net/p/scintilla/code" # hg+https requires auth to SF.net + "scite::hg+http://hg.code.sf.net/p/scintilla/scite" # hg+https requires auth to SF.net + "0001-Use-POSIX-tools-in-makefiles.patch" + "0002-Prefix-library-names.patch" + "0003-Use-FHS.patch") +sha256sums=('SKIP' + 'SKIP' + 'b963a93ed497a599f3a54f07a71148282302f008310824c9a44edc6cb2c33d39' + '30f3617eaa405a4015b2896301dc3b6ddb8cdf22399045cc4a1736cae43104eb' + '40289f6b194ee032fc11c321a4256c45d9243a108f38a232944f57a5db1e5e07') + +pkgver() { + cd "${srcdir}/scite" + printf "r%s.%s" "$(hg identify -n)" "$(hg identify -i)" +} + +prepare() { + cd "${srcdir}" + patch -p1 -i "${srcdir}"/0001-Use-POSIX-tools-in-makefiles.patch + patch -p1 -i "${srcdir}"/0002-Prefix-library-names.patch + patch -p1 -i "${srcdir}"/0003-Use-FHS.patch +} + +build() { + [[ -d "${srcdir}"/build-${MINGW_CHOST} ]] && rm -rf "${srcdir}"/build-${MINGW_CHOST} + mkdir -p "${srcdir}"/build-${MINGW_CHOST} + cp -r "${srcdir}"/{scite,scintilla} "${srcdir}"/build-${MINGW_CHOST} + cd "${srcdir}"/build-${MINGW_CHOST} + + GTK3=1 CC="${MINGW_PREFIX}/bin/gcc" CXX="${MINGW_PREFIX}/bin/g++" make -C scintilla/gtk + CC="${MINGW_PREFIX}/bin/gcc" CXX="${MINGW_PREFIX}/bin/g++" make -C scintilla/win32 + # GTK3=1 make -C scite/gtk + CC="${MINGW_PREFIX}/bin/gcc" CXX="${MINGW_PREFIX}/bin/g++" make -C scite/win32 +} + +package_mingw-w64-scite-hg() { + pkgdesc="Editor with facilities for building and running programs (mingw-w64)" + depends=("${MINGW_PACKAGE_PREFIX}-glib2" + "${MINGW_PACKAGE_PREFIX}-gtk3") + optdepends=("${MINGW_PACKAGE_PREFIX}-${_realname}-defaults: Default language files") + + cd "${srcdir}"/build-${MINGW_CHOST} + + mkdir -p "${pkgdir}"${MINGW_PREFIX}/bin + cp scintilla/bin/lib{Scintilla,SciLexer}.dll "${pkgdir}"${MINGW_PREFIX}/bin + cp scite/bin/SciTE.exe "${pkgdir}"${MINGW_PREFIX}/bin + + mkdir -p "${pkgdir}"${MINGW_PREFIX}/lib + cp scintilla/bin/libScintillaGtk.a "${pkgdir}"${MINGW_PREFIX}/lib + + mkdir -p "${pkgdir}"${MINGW_PREFIX}/include/scintilla + cp scintilla/include/{*.h,*.iface} "${pkgdir}"${MINGW_PREFIX}/include/scintilla + + mkdir -p "${pkgdir}"${MINGW_PREFIX}/share/scite + cp scite/bin/SciTEGlobal.properties "${pkgdir}"${MINGW_PREFIX}/share/scite + + mkdir -p "${pkgdir}"${MINGW_PREFIX}/share/doc/scite + cp scite/doc/{*.png,*.jpg,*.html} "${pkgdir}"${MINGW_PREFIX}/share/doc/scite + + mkdir -p "${pkgdir}"${MINGW_PREFIX}/share/man/man1 + cp scite/doc/scite.1 "${pkgdir}"${MINGW_PREFIX}/share/man/man1/SciTE.1 + + mkdir -p "${pkgdir}"${MINGW_PREFIX}/share/licenses/scite + cp scintilla/License.txt "${pkgdir}"${MINGW_PREFIX}/share/licenses/scite/LICENSE-scintilla + cp scite/License.txt "${pkgdir}"${MINGW_PREFIX}/share/licenses/scite/LICENSE-scite + cp scite/lua/COPYRIGHT "${pkgdir}"${MINGW_PREFIX}/share/licenses/scite/LICENSE-lua +} + +package_mingw-w64-scite-defaults-hg() { + pkgdesc="Default language files for the SciTE editor (mingw-w64)" + depends=("${MINGW_PACKAGE_PREFIX}-${_realname}=${pkgver}") + + cd "${srcdir}"/build-${MINGW_CHOST} + + mkdir -p "${pkgdir}"${MINGW_PREFIX}/share/scite + cp scite/bin/*.properties "${pkgdir}"${MINGW_PREFIX}/share/scite + rm -f "${pkgdir}"${MINGW_PREFIX}/share/scite/SciTEGlobal.properties +} + +package_mingw-w64-i686-scite-hg() { + package_mingw-w64-scite-hg +} + +package_mingw-w64-i686-scite-defaults-hg() { + package_mingw-w64-scite-defaults-hg +} + +package_mingw-w64-x86_64-scite-hg() { + package_mingw-w64-scite-hg +} + +package_mingw-w64-x86_64-scite-defaults-hg() { + package_mingw-w64-scite-defaults-hg +}