-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsqlsrv-cygwin.patch
77 lines (70 loc) · 3.41 KB
/
sqlsrv-cygwin.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
diff -ur sqlsrv-5.3.0-1.i686/origsrc/sqlsrv-5.3.0/shared/StringFunctions.h sqlsrv-5.3.0-1.i686/src/sqlsrv-5.3.0/shared/StringFunctions.h
--- sqlsrv-5.3.0-1.i686/origsrc/sqlsrv-5.3.0/shared/StringFunctions.h 2018-07-20 09:58:46.000000000 +0200
+++ sqlsrv-5.3.0-1.i686/src/sqlsrv-5.3.0/shared/StringFunctions.h 2018-09-29 22:33:27.258045300 +0200
@@ -27,7 +27,11 @@
// Only the functions implemented are declared here
// Copy
+#ifdef __CYGWIN__
+int mplat_memcpy_s(void *_S1, size_t _N1, const void *_S2, size_t _N2);
+#else
int mplat_memcpy_s(void *_S1, size_t _N1, const void *_S2, size_t _N);
+#endif
int mplat_strcat_s( char *strDestination, size_t numberOfElements, const char *strSource );
int mplat_strcpy_s(char * _Dst, size_t _SizeInBytes, const char * _Src);
diff -ur sqlsrv-5.3.0-1.i686/origsrc/sqlsrv-5.3.0/shared/xplat.h sqlsrv-5.3.0-1.i686/src/sqlsrv-5.3.0/shared/xplat.h
--- sqlsrv-5.3.0-1.i686/origsrc/sqlsrv-5.3.0/shared/xplat.h 2018-07-20 09:58:46.000000000 +0200
+++ sqlsrv-5.3.0-1.i686/src/sqlsrv-5.3.0/shared/xplat.h 2018-09-29 23:54:20.090613300 +0200
@@ -46,6 +46,9 @@
#define __declspec__noinline __attribute__((noinline))
#define __declspec__selectany
+#ifdef __CYGWIN__
+# define __declspec__dllimport
+#endif
#define __declspec(a) __declspec__##a
#define __FUNCTION__ __func__
diff -bur sqlsrv-5.3.0-1.x86_64/origsrc/sqlsrv-5.3.0/shared/localization.hpp sqlsrv-5.3.0-1.x86_64/src/sqlsrv-5.3.0/shared/localization.hpp
--- sqlsrv-5.3.0-1.x86_64/origsrc/sqlsrv-5.3.0/shared/localization.hpp 2018-07-20 09:58:46.000000000 +0200
+++ sqlsrv-5.3.0-1.x86_64/src/sqlsrv-5.3.0/shared/localization.hpp 2018-10-04 15:29:48.575380300 +0200
@@ -197,7 +197,14 @@
static UINT ExpandSpecialCP( UINT codepage )
{
// skip SQLSRV_ENCODING_CHAR
+ #ifdef __CYGWIN__
+ // Getting >>sqlsrv_query: unknown exception<< if "Singleton().m_uAnsiCP" gets returned.
+ // This either CYGWIN related or iODBC related. I'm not sure.
+ // ToDo: Just a lazy workaround. This needs to be reviewed by someone who knows how all of this is working.
+ return (codepage <= 3 ? CP_UTF8 : codepage);
+ #else
return (codepage <= 3 ? Singleton().m_uAnsiCP : codepage);
+ #endif
}
// Returns the number of bytes this UTF8 code point expects
diff -bur sqlsrv-5.3.0-1.x86_64/origsrc/sqlsrv-5.3.0/config.m4 sqlsrv-5.3.0-1.x86_64/src/sqlsrv-5.3.0/config.m4
--- sqlsrv-5.3.0-1.x86_64/origsrc/sqlsrv-5.3.0/shared/localizationimpl.cpp 2018-10-04 13:15:14.880282500 +0200
+++ sqlsrv-5.3.0-1.x86_64/src/sqlsrv-5.3.0/shared/localizationimpl.cpp 2018-10-04 13:16:37.054991200 +0200
@@ -24,6 +24,10 @@
#include "globalization.h"
#include "StringFunctions.h"
+#ifdef __CYGWIN__
+#include <strings.h>
+#endif
+
struct cp_iconv
{
UINT CodePage;
--- sqlsrv-5.3.0-1.x86_64/origsrc/sqlsrv-5.3.0/config.m4 2018-07-20 09:58:46.000000000 +0200
+++ sqlsrv-5.3.0-1.x86_64/src/sqlsrv-5.3.0/config.m4 2018-10-02 18:09:07.057230400 +0200
@@ -58,7 +58,13 @@
SQLSRV_SHARED_LIBADD="$SQLSRV_SHARED_LIBADD -Wl,-bind_at_load"
MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion`
else
- SQLSRV_SHARED_LIBADD="$SQLSRV_SHARED_LIBADD -Wl,-z,now"
+ HOST_OS=`uname -o`
+ if test "${HOST_OS}" == "Cygwin"; then
+ SQLSRV_SHARED_LIBADD="$SQLSRV_SHARED_LIBADD"
+ CXXFLAGS="$CXXFLAGS -D_POSIX_C_SOURCE=200809L"
+ else
+ SQLSRV_SHARED_LIBADD="$SQLSRV_SHARED_LIBADD -Wl,-z,now"
+ fi
fi
PHP_REQUIRE_CXX()