summaryrefslogtreecommitdiffstats
path: root/external/firebird/firebird-cygwin-msvc.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /external/firebird/firebird-cygwin-msvc.patch
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'external/firebird/firebird-cygwin-msvc.patch')
-rw-r--r--external/firebird/firebird-cygwin-msvc.patch686
1 files changed, 686 insertions, 0 deletions
diff --git a/external/firebird/firebird-cygwin-msvc.patch b/external/firebird/firebird-cygwin-msvc.patch
new file mode 100644
index 000000000..c59c614ba
--- /dev/null
+++ b/external/firebird/firebird-cygwin-msvc.patch
@@ -0,0 +1,686 @@
+--- src/include/firebird.h 2016-07-15 11:31:27.151443500 +0200
++++ src/include/firebird.h 2016-07-17 14:50:04.043792400 +0200
+@@ -32,11 +32,7 @@
+ #ifndef INCLUDE_Firebird_H
+ #define INCLUDE_Firebird_H
+
+-#ifdef _MSC_VER
+-#include "gen/autoconfig_msvc.h"
+-#else
+ #include "gen/autoconfig.h"
+-#endif
+
+ #if defined __clang__
+ //#if __has_feature(address_sanitizer)
+--- src/misc/writeBuildNum.sh 2016-07-07 15:57:04.538983200 +0200
++++ src/misc/writeBuildNum.sh 2016-07-13 11:31:18.132820200 +0200
+@@ -95,9 +95,9 @@
+ createMakeVersion() {
+
+ OdsH="${Root}/src/jrd/ods.h"
+-Mini="/tmp/miniods.h"
+-TestCpp="/tmp/test.cpp"
+-AOut="/tmp/a.out"
++Mini=$(cygpath -m "/tmp/miniods.h")
++TestCpp=$(cygpath -m "/tmp/test.cpp")
++AOut=$(cygpath -m "/tmp/a.out")
+
+ grep ODS_VERSION $OdsH | grep -v ENCODE_ODS >$Mini
+
+--- configure 2016-07-07 15:57:04.538983200 +0200
++++ configure 2016-07-13 11:31:18.132820200 +0200
+@@ -21490,13 +21490,12 @@
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+ #include <stdlib.h>
+-#include <semaphore.h>
+ int main () {
+ struct s {
+ char a;
+- union { long long x; sem_t y; } b;
++ long long b;
+ };
+ exit((int)&((struct s*)1024)->b - 1024);
+ }
+ _ACEOF
+ if ac_fn_c_try_run "$LINENO"; then :
+--- builds/make.new/config/config.h.in 2016-07-07 15:55:55.693112800 +0200
++++ builds/make.new/config/config.h.in 2016-07-08 13:38:49.994986400 +0200
+@@ -211,7 +211,7 @@
+ #undef HAVE_GETMNTENT
+
+ /* Define to 1 if you have the `getpagesize' function. */
+-#undef HAVE_GETPAGESIZE
++#define HAVE_GETPAGESIZE 1
+
+ /* Define to 1 if you have the `getrlimit' function. */
+ #undef HAVE_GETRLIMIT
+@@ -396,7 +396,7 @@
+ #undef HAVE_SIGSET
+
+ /* Define to 1 if you have the `snprintf' function. */
+-#undef HAVE_SNPRINTF
++#define HAVE_SNPRINTF
+
+ /* Define to 1 if you have the <socket.h> header file. */
+ #undef HAVE_SOCKET_H
+@@ -551,7 +551,7 @@
+ #undef HAVE_VFORK_H
+
+ /* Define to 1 if you have the `vsnprintf' function. */
+-#undef HAVE_VSNPRINTF
++#define HAVE_VSNPRINTF
+
+ /* Define to 1 if you have the <winsock2.h> header file. */
+ #undef HAVE_WINSOCK2_H
+@@ -646,7 +646,7 @@
+ #undef TIME_WITH_SYS_TIME
+
+ /* Define this if OS is Windows NT */
+-#undef WIN_NT
++#define WIN_NT
+
+ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+@@ -703,3 +703,20 @@
+ #ifndef HAVE_SOCKLEN_T
+ typedef int socklen_t;
+ #endif
++
++/* taken from src/include/gen/autoconfig_msvc.h */
++#ifndef WIN32_LEAN_AND_MEAN
++#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
++#endif
++/* target architecture */
++#if defined(_M_AMD64)
++#define AMD64
++#endif
++
++#define HAVE_IO_H
++#define HAVE_CTIME_S
++
++#if defined _MSC_VER
++#define isnan _isnan
++#endif
++
+--- src/common/common.h 2016-07-15 11:31:26.366735500 +0200
++++ src/common/common.h 2016-07-17 16:18:39.121579400 +0200
+@@ -551,15 +551,6 @@
+ #endif /* WIN_NT */
+
+
+-#ifndef FB_CPU
+-#error Define FB_CPU for your platform
+-#endif
+-#ifndef FB_OS
+-#error Define FB_OS for your platform
+-#endif
+-#ifndef FB_CC
+-#error Define FB_CC for your platform
+-#endif
+
+
+ /*****************************************************
+diff -ur builds/posix/make.defaults builds/posix/make.defaults
+--- builds/posix/make.defaults 2016-07-07 13:56:13.036235166 +0200
++++ builds/posix/make.defaults 2016-07-07 14:29:52.368289242 +0200
+@@ -56,7 +56,7 @@
+ else
+ FIREBIRD=$(FB_BUILD)
+ endif
+-FIREBIRD_LOCK=$(FIREBIRD)
++FIREBIRD_LOCK=$(shell cygpath -w $(FIREBIRD))
+
+ export FIREBIRD
+ export FIREBIRD_LOCK
+@@ -153,7 +153,7 @@
+ CD= cd
+ CAT= cat
+ AR= ar @AR_OPTIONS@
+-LN= @LN_S@
++LN= cp
+ RANLIB= @RANLIB@
+ BTYACC=$(ROOT)/extern/btyacc/btyacc
+ CLOOP=$(GEN_ROOT)/$(TARGET)/cloop/release/bin/cloop
+@@ -175,10 +175,10 @@
+
+ # Default extensions
+
+-ARCH_EXT= .a
++ARCH_EXT= .lib
+ EXEC_EXT= @EXEEXT@
+ SHRLIB_EXT=@SHRLIB_EXT@
+-LIB_PREFIX= lib
++LIB_PREFIX=
+ SHRLIB_FOREIGN_EXT= $(SHRLIB_EXT)
+
+ #_____________________________________________________________________________
+@@ -201,9 +202,8 @@
+
+ # Search path for libraries
+
+-vpath %.so $(LIB)
+-vpath %.a $(LIB)
+ vpath %.dll $(LIB)
++vpath %.lib $(LIB)
+
+ #_____________________________________________________________________________
+
+@@ -217,9 +217,9 @@
+ #
+
+ #LibraryFileName=libfbclient
+-LibraryFileName=libfbclient
+-LibraryFullName=$(LibraryFileName).${SHRLIB_EXT}.${FirebirdVersion}
+-LibrarySoName=$(LibraryFileName).${SHRLIB_EXT}.2
++LibraryFileName=ifbclient
++LibraryFullName=$(LibraryFileName).${SHRLIB_EXT}
++LibrarySoName=$(LibraryFileName).${SHRLIB_EXT}
+ LibraryBaseName=$(LibraryFileName).${SHRLIB_EXT}
+
+ LIBFIREBIRD_FULLNAME = $(LIB)/$(LibraryFullName)
+@@ -228,7 +228,7 @@
+
+ # The firebird engine library name
+
+-EngineFileName=libEngine${OdsVersion}
++EngineFileName=Engine12
+ EngineSoName=$(EngineFileName).${SHRLIB_EXT}
+ ENGINE_SONAME = $(PLUGINS)/$(EngineSoName)
+
+@@ -242,7 +242,7 @@
+ ifeq ($(STD_EDITLINE), true)
+ LIBEDITLINE := -l$(READLINE)
+ else
+- LIBEDITLINE := $(LIB)/libedit.a
++ LIBEDITLINE := $(LIB)/$(LIB_PREFIX)edit$(ARCH_EXT)
+ endif
+ endif
+
+@@ -313,7 +313,7 @@
+
+ LIB_LINK_SONAME= -Wl,-soname,$(1)
+ LIB_LINK_MAPFILE= -Wl,--version-script,$(1)
+-FIREBIRD_LIBRARY_LINK= -L$(LIB) -lfbclient $(MATHLIB)
++FIREBIRD_LIBRARY_LINK= -L$(LIB) -lifbclient $(MATHLIB)
+
+ EXE_LINK_OPTIONS= $(LDFLAGS) $(THR_FLAGS) $(UNDEF_FLAGS) $(LIB_PATH_OPTS) $(LINK_EMPTY_SYMBOLS)
+ LIB_LINK_OPTIONS= $(LDFLAGS) $(THR_FLAGS) -shared
+@@ -355,7 +355,7 @@
+
+ # Pay attention - we place common library into obj, not lib dir
+ # It's just a set of object files, prepared to be used by ld, not an output library
+-COMMON_LIB = $(OBJ)/common.a
++COMMON_LIB = $(OBJ)/$(LIB_PREFIX)common$(ARCH_EXT)
+
+ # From utilities
+ CREATE_DB = $(RBIN)/create_db$(EXEC_EXT)
+--- builds/posix/Makefile.in 2016-07-07 15:56:06.459221300 +0200
++++ builds/posix/Makefile.in 2016-07-13 12:44:57.134217200 +0200
+@@ -33,7 +33,7 @@
+ # Alex Peshkoff - created single makefile based on Mark's files
+ #
+
+-ROOT=$(shell cd ..; pwd)
++ROOT=$(shell cygpath -m '$(shell cd ..; pwd)')
+
+ include make.defaults
+ ifeq ($(CROSS_OUT), Y)
+@@ -178,7 +178,7 @@
+ .PHONY: cross1 cross2 boot yvalve engine fbintl gpre utilities plugins rest codes ids examples cross_rest preliminaryCheck
+
+ master_process:
+- ln -sf $(SRC_ROOT)/include/gen/autoconfig.auto $(SRC_ROOT)/include/gen/autoconfig.h
++ cp -f $(SRC_ROOT)/include/gen/autoconfig.auto $(SRC_ROOT)/include/gen/autoconfig.h
+ $(MAKE) updateBuildNum
+ $(MAKE) export_lists
+ $(MAKE) extern
+@@ -214,7 +215,7 @@
+ $(MAKE) CROSS_OUT=Y cross2
+
+ cross1:
+- ln -sf $(SRC_ROOT)/include/gen/autoconfig.auto $(SRC_ROOT)/include/gen/autoconfig.h
++ cp -f $(SRC_ROOT)/include/gen/autoconfig.auto $(SRC_ROOT)/include/gen/autoconfig.h
+ $(MAKE) updateBuildNum
+ $(MAKE) export_lists
+ $(MAKE) extern
+@@ -239,7 +240,7 @@
+ $(MAKE) -f Makefile.examples -C $(GEN_ROOT)/examples/
+
+ cross2:
+- ln -sf $(SRC_ROOT)/include/cross/$(CROSS_CONFIG) $(SRC_ROOT)/include/gen/autoconfig.h
++ cp -f $(SRC_ROOT)/include/cross/$(CROSS_CONFIG) $(SRC_ROOT)/include/gen/autoconfig.h
+ $(MAKE) prerequisites
+ $(MAKE) tommath
+ $(MAKE) yvalve
+@@ -310,7 +311,7 @@
+
+ # remote redirector is statically linked in main FB library
+ $(LIBFIREBIRD_FULLNAME): $(YValve_Objects) $(Remote_Client_Objects) $(COMMON_LIB)
+- $(LINK_FIREBIRD) -o $@ $^ $(LINK_FIREBIRD_LIBS) $(call LIB_LINK_DARWIN_INSTALL_NAME,lib/libfbclient.$(SHRLIB_EXT))
++ $(LINK_FIREBIRD) $(CPPFLAGS) -o $@ $^ $(LINK_FIREBIRD_LIBS) $(call LIB_LINK_DARWIN_INSTALL_NAME,lib/libfbclient.$(SHRLIB_EXT))
+
+
+ #___________________________________________________________________________
+@@ -320,8 +321,8 @@
+
+ engine: $(ENGINE_SONAME)
+
+-$(ENGINE_SONAME): $(Engine_Objects) $(SVC_Objects) $(COMMON_LIB)
+- $(LINK_ENGINE) -o $@ $^ $(LINK_ENGINE_LIBS) $(call LIB_LINK_DARWIN_INSTALL_NAME,plugins/$(EngineSoName))
++$(ENGINE_SONAME): $(Engine_Objects) $(SVC_Objects) $(YValve_Objects) $(Remote_Client_Objects) $(COMMON_LIB)
++ $(LINK_ENGINE) $(CPPFLAGS) -o $@ $^ $(LINK_ENGINE_LIBS) $(call LIB_LINK_DARWIN_INSTALL_NAME,plugins/$(EngineSoName))
+
+
+ #___________________________________________________________________________
+@@ -330,8 +331,8 @@
+
+ fbintl: $(LIBFBINTL_SO)
+
+-$(LIBFBINTL_SO): $(INTL_Objects) $(COMMON_LIB)
+- $(LINK_INTL) -o $@ $^ $(LINK_INTL_LIBS) $(call LIB_LINK_DARWIN_INSTALL_NAME,intl/libfbintl.$(SHRLIB_EXT))
++$(LIBFBINTL_SO): $(INTL_Objects) $(YValve_Objects) $(Remote_Client_Objects) $(COMMON_LIB)
++ $(LINK_INTL) $(CPPFLAGS) -o $@ $^ $(LINK_INTL_LIBS) $(call LIB_LINK_DARWIN_INSTALL_NAME,intl/libfbintl.$(SHRLIB_EXT))
+
+
+ #___________________________________________________________________________
+@@ -427,12 +429,13 @@
+
+ .PHONY: firebird_server fb_lock_print fbguard fbsvcmgr fbtracemgr gbak gfix gsec gsplit gstat isql nbackup
+
+-utilities: firebird_server fb_lock_print fbguard fbsvcmgr fbtracemgr gbak gfix gsec gsplit gstat isql nbackup udfsupport
++# fbguard currently fails to link, with missing fork etc, in util.cpp
++utilities: firebird_server fb_lock_print fbsvcmgr fbtracemgr gbak gfix gsec gsplit gstat isql nbackup udfsupport
+
+ firebird_server: $(FB_DAEMON)
+
+-$(FB_DAEMON): $(Remote_Server_Objects) $(COMMON_LIB)
+- $(EXE_LINK) $(EXE_LINK_OPTIONS) $^ -o $@ $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS) $(call LINK_DARWIN_RPATH,..)
++$(FB_DAEMON): $(Remote_Server_Objects) $(Remote_Client_Objects) $(COMMON_LIB)
++ $(EXE_LINK) $(EXE_LINK_OPTIONS) $^ -o $@ $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS) $(LIB_GUI) $(call LINK_DARWIN_RPATH,..)
+
+ fb_lock_print: $(LOCKPRINT)
+
+@@ -633,7 +635,7 @@
+ IBASE_ExtraFiles = include/types_pub.h include/consts_pub.h dsql/sqlda_pub.h common/dsc_pub.h jrd/ibase.h jrd/inf_pub.h jrd/blr.h include/gen/iberror.h
+ SRC_IBASE_ExtraFiles = $(addprefix $(SRC_ROOT)/, $(IBASE_ExtraFiles))
+ MAKE_HEADER_Src = $(addprefix $(SRC_ROOT)/, misc/makeHeader.cpp)
+-MAKE_HEADER_Bin = ./makeHeader
++MAKE_HEADER_Bin = ./makeHeader$(EXEC_EXT)
+
+ $(INCLUDE_DEST)/ibase.h: $(SRC_IBASE_ExtraFiles)
+ $(STATICEXE_LINK) -o $(MAKE_HEADER_Bin) $(MAKE_HEADER_Src)
+diff -ur builds/posix/make.rules builds/posix/make.rules
+--- builds/posix/make.rules 2016-07-07 13:56:13.036235166 +0200
++++ builds/posix/make.rules 2016-07-07 14:31:16.116291485 +0200
+@@ -92,26 +92,23 @@
+
+ $(OBJ)/%.o: $(SRC_ROOT)/%.c
+ $(CC) $(WCFLAGS) -c $(firstword $<) -o $@
+- @sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
+
+ $(OBJ)/%.o: $(OBJ)/%.cpp
+ $(CXX) $(WCXXFLAGS) -c $(firstword $<) -o $@
+- @sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
+
+ $(OBJ)/%.o: $(SRC_ROOT)/%.cpp
+ $(CXX) $(WCXXFLAGS) -c $(firstword $<) -o $@
+- @sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
+
+ $(OBJ)/%.o: $(ROOT)/%.cpp
+ $(CC) $(WCFLAGS) -c $(firstword $<) -o $@
+- @sed $(INLINE_EDIT_SED) -e "1,2s/:/: \$$(wildcard/" -e "\$$s/\(.*\)/\\1)/" $(patsubst %.o,%.d,$@)
+
+ .SUFFIXES: .epp .e
+
+ # Rules for making resource files
+
+ $(GEN_ROOT)/%.res: $(SRC_ROOT)/%.rc
+- windres --output-format=coff --include-dir=$(<D) $< $@
++ mkdir -p $(@D)
++ rc.exe $(SOLARINC) /fo $@ $<
+
+ # Rule for making gbak files when cross-compiling
+
+--- src/common/utils.cpp 2016-07-15 11:31:26.746871100 +0200
++++ src/common/utils.cpp 2016-07-19 19:14:45.370689300 +0200
+@@ -880,15 +880,15 @@
+ FILETIME utime, stime, dummy;
+ if (GetProcessTimes(GetCurrentProcess(), &dummy, &dummy, &stime, &utime))
+ {
+- LARGE_INTEGER lint;
++ LARGE_INTEGER myLargeInt;
+
+- lint.HighPart = stime.dwHighDateTime;
+- lint.LowPart = stime.dwLowDateTime;
+- sysTime = lint.QuadPart / 10000;
+-
+- lint.HighPart = utime.dwHighDateTime;
+- lint.LowPart = utime.dwLowDateTime;
+- userTime = lint.QuadPart / 10000;
++ myLargeInt.HighPart = stime.dwHighDateTime;
++ myLargeInt.LowPart = stime.dwLowDateTime;
++ sysTime = myLargeInt.QuadPart / 10000;
++
++ myLargeInt.HighPart = utime.dwHighDateTime;
++ myLargeInt.LowPart = utime.dwLowDateTime;
++ userTime = myLargeInt.QuadPart / 10000;
+ }
+ else
+ {
+diff -ur builds/posix/prefix.mingw builds/posix/prefix.mingw
+--- builds/posix/prefix.mingw 2016-07-07 13:56:13.048235166 +0200
++++ builds/posix/prefix.mingw 2016-07-07 14:50:54.704323046 +0200
+@@ -20,8 +20,8 @@
+ #
+
+ # -Wno-unused-variable is used due to unused gpre generated variables
+-PROD_FLAGS=-O2 -DMINGW -Wall -Wshadow -Wundef -Wno-long-long -Wno-unused-variable -Wno-sign-compare -Wno-parentheses -Wno-switch -fmessage-length=0 -Dlint -DWIN32_LEAN_AND_MEAN -MMD -mthreads -Wno-non-virtual-dtor
+-DEV_FLAGS=-ggdb -DMINGW -Wall -Wshadow -Wundef -Wno-long-long -Wno-unused-variable -Wno-sign-compare -Wno-parentheses -Wno-switch -fmessage-length=0 -Dlint -DWIN32_LEAN_AND_MEAN -MMD -mthreads -Wno-non-virtual-dtor
++PROD_FLAGS=-O2 -DMINGW -Dlint -DWIN32_LEAN_AND_MEAN
++DEV_FLAGS=-ggdb -DMINGW -Dlint -DWIN32_LEAN_AND_MEAN
+
+ PLATFORM_PATH=os/win32
+
+@@ -29,6 +29,7 @@
+ LIB_LINK=$(LD)
+
+ LIB_LINK_OPTIONS+=-Wl,--enable-stdcall-fixup
++LIB_PLATFORM_RPATH=
+
+ # Strip symbols from release versions to decrease size
+ ifeq ($(IsProdTypeBuild),Y)
+@@ -36,6 +37,9 @@
+ LIB_LINK_OPTIONS+=-Wl,-s
+ endif
+
++LIB_LINK_OPTIONS=
++LINK_OPTS=
++
+ # Generation of fbclient_ms.lib
+ LIB_LINK_IMPLIB:=-Wl,--out-implib,firebird/lib/fbclient_ms.lib
+ LIB_GUI:= -mwindows -lcomctl32 -lgdi32
+@@ -55,7 +59,9 @@
+ ClientLibrarySoName := $(ClientLibraryName)
+
+ # Looks like MinGW 3 does not support version scripts but support def-files
+-LINK_FIREBIRD_SYMBOLS = $(BLD_ROOT)/win32/defs/fbclient_s.def $(BLD_ROOT)/win32/defs/fbclient.def
++LINK_FIREBIRD_SYMBOLS = /def:$(BLD_ROOT)/win32/defs/fbclient_s.def /def:$(BLD_ROOT)/win32/defs/firebird.def
++LINK_PLUGIN_SYMBOLS = /def:$(BLD_ROOT)/win32/defs/plugin.def
++LINK_IBUTIL_SYMBOLS = /def:$(BLD_ROOT)/win32/defs/ib_util.def
+
+ # This is required for newly built executable to find newly built shared
+ # libraries because on Win32 there is no such thing as LD_LIBRARY_PATH
+--- builds/posix/make.shared.variables 2016-07-22 17:07:46.650672300 +0200
++++ builds/posix/make.shared.variables 2016-07-23 10:44:41.311454600 +0200
+@@ -62,6 +62,7 @@
+ $(SecDbCache)
+ Remote_Client:= $(call dirObjects,remote/client) $(call dirObjects,auth/SecureRemotePassword/client) \
+ $(call makeObjects,auth/SecurityDatabase,LegacyClient.cpp) \
++ $(call dirObjects,auth/trusted) \
+ $(call dirObjects,plugins/crypt/arc4)
+ Remote_Server_Objects:= $(Remote_Common) $(Remote_Server)
+ Remote_Client_Objects:= $(Remote_Common) $(Remote_Client)
+diff -ur configure configure
+--- configure 2016-07-07 13:55:54.976234682 +0200
++++ configure 2016-07-07 14:54:30.012328812 +0200
+@@ -3337,6 +3337,14 @@
+ SHRLIB_EXT=dll
+ ;;
+
++ *-*-cygwin*)
++ MAKEFILE_PREFIX=mingw
++ PLATFORM=win32
++ EDITLINE_FLG=N
++ RAW_DEVICES_FLG=N
++ SHRLIB_EXT=dll
++ ;;
++
+ *)
+ as_fn_error $? "unsupported platform ${build}" "$LINENO" 5
+ ;;
+@@ -8432,6 +8432,9 @@
+ mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
++cygwin*)
++ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
++ ;;
+ esac
+
+ # Try without a prefix underscore, then with it.
+diff -ur extern/btyacc/main.c extern/btyacc/main.c
+--- extern/btyacc/main.c 2016-07-07 13:55:55.448234695 +0200
++++ extern/btyacc/main.c 2016-07-07 14:56:03.560331317 +0200
+@@ -2,7 +2,7 @@
+ #include <signal.h>
+ #include <stdio.h>
+
+-#if defined(WIN32)
++#if defined(WIN32) || defined(_WIN32)
+ #include <io.h>
+ #else
+ #include <unistd.h>
+diff -ur extern/btyacc/Makefile extern/btyacc/Makefile
+--- extern/btyacc/Makefile 2016-07-07 13:55:55.448234695 +0200
++++ extern/btyacc/Makefile 2016-07-07 14:57:42.284333961 +0200
+@@ -30,7 +30,7 @@
+
+ PRINT = pr -f -l88
+
+-PROGRAM = btyacc
++PROGRAM = btyacc.exe
+
+ SRCS = closure.c error.c lalr.c lr0.c main.c mkpar.c output.c \
+ mstring.c reader.c readskel.c skeleton.c symtab.c verbose.c warshall.c
+@@ -58,7 +58,7 @@
+ index:; ctags -wx $(HDRS) $(SRCS)
+
+ install: $(PROGRAM)
+- cp $(PROGRAM).exe /bin
++ cp $(PROGRAM) /bin
+
+ oldinstall: $(PROGRAM)
+ @echo Installing $(PROGRAM) in $(DEST)
+--- extern/cloop/src/tests/test1/CppTest.cpp 2016-07-07 15:56:27.948015300 +0200
++++ extern/cloop/src/tests/test1/CppTest.cpp 2016-07-13 18:58:48.529822600 +0200
+@@ -24,6 +24,7 @@
+ #include <stdio.h>
+ #include <assert.h>
+
++#define WIN32
+ #ifdef WIN32
+ #include <windows.h>
+ #define DLL_EXPORT __declspec(dllexport)
+--- extern/cloop/src/tests/test1/CTest.c 2016-07-07 15:56:27.611791300 +0200
++++ extern/cloop/src/tests/test1/CTest.c 2016-07-13 17:04:22.805090300 +0200
+@@ -23,6 +23,7 @@
+ #include <stdlib.h>
+ #include <stdio.h>
+
++#define WIN32
+ #ifdef WIN32
+ #include <windows.h>
+ #define DLL_EXPORT __declspec(dllexport)
+--- extern/cloop/Makefile 2016-07-07 15:56:28.279136300 +0200
++++ extern/cloop/Makefile 2016-07-13 16:22:38.493479800 +0200
+@@ -11,8 +11,8 @@
+ SRC_DIR := src
+ BUILD_DIR := build
+ OUT_DIR := output
+-SHRLIB_EXT := .so
+-EXE_EXT :=
++SHRLIB_EXT := .dll
++EXE_EXT := .exe
+
+ OBJ_DIR := $(BUILD_DIR)/$(TARGET)
+ BIN_DIR := $(OUT_DIR)/$(TARGET)/bin
+@@ -27,7 +27,7 @@
+ OBJS_C := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRCS_C))
+ OBJS_CPP := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRCS_CPP))
+
+-C_FLAGS := -ggdb -fPIC -MMD -MP -W -Wall -Wno-unused-parameter
++C_FLAGS := -fPIC
+ CXX_FLAGS := $(C_FLAGS)
+ FPC_FLAGS := -Mdelphi
+
+@@ -53,7 +53,7 @@
+ .PHONY: all mkdirs clean
+
+ all: mkdirs \
+- $(BIN_DIR)/cloop \
++ $(BIN_DIR)/cloop$(EXE_EXT) \
+ $(BIN_DIR)/test1-c$(SHRLIB_EXT) \
+ $(BIN_DIR)/test1-c$(EXE_EXT) \
+ $(BIN_DIR)/test1-cpp$(SHRLIB_EXT) \
+@@ -63,6 +63,10 @@
+
+ mkdirs: $(OBJ_DIRS) $(BIN_DIR) $(LIB_DIR)
+
++# These files have the same basename, so various conflicting intermediate files break the build
++$(BIN_DIR)/test1-c$(EXE_EXT): | $(BIN_DIR)/test1-c$(SHRLIB_EXT)
++$(BIN_DIR)/test1-cpp$(EXE_EXT): | $(BIN_DIR)/test1-cpp$(SHRLIB_EXT)
++
+ $(OBJ_DIRS) $(BIN_DIR) $(LIB_DIR):
+ @mkdir -p $@
+
+@@ -74,7 +74,7 @@
+ -include $(addsuffix .d,$(basename $(OBJS_C)))
+ -include $(addsuffix .d,$(basename $(OBJS_CPP)))
+
+-$(BIN_DIR)/cloop: \
++$(BIN_DIR)/cloop$(EXE_EXT): \
+ $(OBJ_DIR)/cloop/Expr.o \
+ $(OBJ_DIR)/cloop/Generator.o \
+ $(OBJ_DIR)/cloop/Lexer.o \
+@@ -83,20 +83,20 @@
+
+ $(LD) $^ -o $@
+
+-$(SRC_DIR)/tests/test1/CalcCApi.h: $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl
+- $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl c-header $@ CALC_C_API_H CALC_I
++$(SRC_DIR)/tests/test1/CalcCApi.h: $(BIN_DIR)/cloop$(EXE_EXT) $(SRC_DIR)/tests/test1/Interface.idl
++ $(BIN_DIR)/cloop$(EXE_EXT) $(SRC_DIR)/tests/test1/Interface.idl c-header $@ CALC_C_API_H CALC_I
+
+-$(SRC_DIR)/tests/test1/CalcCApi.c: $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl $(SRC_DIR)/tests/test1/CalcCApi.h
+- $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl c-impl $@ CalcCApi.h CALC_I
++$(SRC_DIR)/tests/test1/CalcCApi.c: $(BIN_DIR)/cloop$(EXE_EXT) $(SRC_DIR)/tests/test1/Interface.idl $(SRC_DIR)/tests/test1/CalcCApi.h
++ $(BIN_DIR)/cloop$(EXE_EXT) $(SRC_DIR)/tests/test1/Interface.idl c-impl $@ CalcCApi.h CALC_I
+
+-$(SRC_DIR)/tests/test1/CalcCppApi.h: $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl
+- $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl c++ $@ CALC_CPP_API_H calc I
++$(SRC_DIR)/tests/test1/CalcCppApi.h: $(BIN_DIR)/cloop$(EXE_EXT) $(SRC_DIR)/tests/test1/Interface.idl
++ $(BIN_DIR)/cloop$(EXE_EXT) $(SRC_DIR)/tests/test1/Interface.idl c++ $@ CALC_CPP_API_H calc I
+
+-$(SRC_DIR)/tests/test1/CalcPascalApi.pas: $(BIN_DIR)/cloop \
++$(SRC_DIR)/tests/test1/CalcPascalApi.pas: $(BIN_DIR)/cloop$(EXE_EXT) \
+ $(SRC_DIR)/tests/test1/Interface.idl \
+ $(SRC_DIR)/tests/test1/CalcPascalApi.interface.pas \
+ $(SRC_DIR)/tests/test1/CalcPascalApi.implementation.pas
+- $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl pascal $@ CalcPascalApi \
++ $(BIN_DIR)/cloop$(EXE_EXT) $(SRC_DIR)/tests/test1/Interface.idl pascal $@ CalcPascalApi \
+ --uses "SysUtils" \
+ --interfaceFile $(SRC_DIR)/tests/test1/CalcPascalApi.interface.pas \
+ --implementationFile $(SRC_DIR)/tests/test1/CalcPascalApi.implementation.pas \
+@@ -108,23 +108,23 @@
+ $(OBJ_DIR)/tests/test1/CalcCApi.o \
+ $(OBJ_DIR)/tests/test1/CTest.o \
+
+- $(LD) $^ -shared -ldl -o $@
++ $(LD) $^ -o $@
+
+ $(BIN_DIR)/test1-c$(EXE_EXT): \
+ $(OBJ_DIR)/tests/test1/CalcCApi.o \
+ $(OBJ_DIR)/tests/test1/CTest.o \
+
+- $(LD) $^ -ldl -o $@
++ $(LD) $^ -o $@
+
+ $(BIN_DIR)/test1-cpp$(SHRLIB_EXT): \
+ $(OBJ_DIR)/tests/test1/CppTest.o \
+
+- $(LD) $^ -shared -ldl -o $@
++ $(LD) $^ -o $@
+
+ $(BIN_DIR)/test1-cpp$(EXE_EXT): \
+ $(OBJ_DIR)/tests/test1/CppTest.o \
+
+- $(LD) $^ -ldl -o $@
++ $(LD) $^ -o $@
+
+ $(BIN_DIR)/test1-pascal$(SHRLIB_EXT): \
+ $(SRC_DIR)/tests/test1/PascalClasses.pas \
+diff -ur src/common/classes/fb_string.cpp src/common/classes/fb_string.cpp
+--- src/common/classes/fb_string.cpp 2016-07-07 13:55:56.064234711 +0200
++++ src/common/classes/fb_string.cpp 2016-07-07 14:59:01.516336083 +0200
+@@ -32,6 +32,12 @@
+ #include <ctype.h>
+ #include <stdarg.h>
+
++#ifdef WIN_NT
++#pragma comment(lib, "User32.lib")
++#pragma comment(lib, "advapi32")
++#pragma comment(lib, "shell32.lib")
++#endif
++
+ #ifdef HAVE_STRCASECMP
+ #define STRNCASECMP strncasecmp
+ #else
+diff -ur src/misc/makeHeader.cpp src/misc/makeHeader.cpp
+--- src/misc/makeHeader.cpp 2016-07-07 13:56:00.100234819 +0200
++++ src/misc/makeHeader.cpp 2016-07-07 15:00:14.780338045 +0200
+@@ -1,9 +1,9 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <errno.h>
+-//#ifdef HAVE_UNISTD_H
++#ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+-//#endif
++#endif
+
+
+
+--- builds/posix/Makefile.in.plugins_examples.orig 2020-11-13 18:07:52.515550600 +0100
++++ builds/posix/Makefile.in.plugins_examples 2020-11-13 18:08:33.218626500 +0100
+@@ -28,7 +28,7 @@
+ # Adriano dos Santos Fernandes
+ #
+
+-ROOT=$(shell cd ..; pwd)
++ROOT=$(shell cygpath -m '$(shell cd ..; pwd)')
+
+ ifeq ($(IsDeveloper), Y)
+ DefaultTarget := Debug
+--- examples/dbcrypt/CryptApplication.cpp.orig 2020-11-13 20:57:11.222938900 +0100
++++ examples/dbcrypt/CryptApplication.cpp 2020-11-13 21:01:19.332316100 +0100
+@@ -27,6 +27,13 @@
+ #include "../interfaces/ifaceExamples.h"
+ #include <firebird/Message.h>
+
++#include "gen/autoconfig.h"
++
++#ifdef WIN_NT
++#include <windows.h>
++#include <winbase.h>
++#endif
++
+ using namespace Firebird;
+
+ class CryptKey : public ICryptKeyCallbackImpl<CryptKey, CheckStatusWrapper>
+@@ -238,8 +238,15 @@
+ av++;
+ }
+
++#ifdef WIN_NT
++ if (!getenv("ISC_USER"))
++ SetEnvironmentVariable("ISC_USER", "sysdba");
++ if (!getenv("ISC_PASSWORD"))
++ SetEnvironmentVariable("ISC_PASSWORD", "masterkey");
++#else
+ setenv("ISC_USER", "sysdba", 0);
+ setenv("ISC_PASSWORD", "masterkey", 0);
++#endif
+
+ App app;
+ try