Skip to content

Commit 2a2b47b

Browse files
totaamfrozencemetery
authored andcommitted
Add build support for mingw32
[[email protected] squashed commits, rewrote commit message, and added log message when krb5-config isn't found]
1 parent 7018e58 commit 2a2b47b

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

Diff for: gssapi/raw/python_gssapi.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#ifdef OSX_HAS_GSS_FRAMEWORK
22
#include <GSS/GSS.h>
3+
#elif __MINGW32__
4+
#include <gss.h>
35
#else
46
#include <gssapi/gssapi.h>
57
#endif

Diff for: gssapi/raw/python_gssapi_ext.h

+4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#ifdef OSX_HAS_GSS_FRAMEWORK
22
#include <GSS/GSS.h>
33
#else
4+
#ifdef __MINGW32__
5+
#include <gss.h>
6+
#else
47
#ifdef HAS_GSSAPI_EXT_H
58
#include <gssapi/gssapi_ext.h>
69
#else
710
#include <gssapi/gssapi.h>
811
#endif
912
#endif
13+
#endif

Diff for: gssapi/raw/python_gssapi_krb5.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#ifdef OSX_HAS_GSS_FRAMEWORK
22
#include <GSS/gssapi_krb5.h>
3+
#elif __MINGW32__
4+
#include <gss.h>
35
#else
46
#include <gssapi/gssapi_krb5.h>
57
#endif

Diff for: setup.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,29 @@ def _get_output(*args, **kwargs):
5252
if link_args is None:
5353
if osx_has_gss_framework:
5454
link_args = '-framework GSS'
55+
elif os.environ.get('MINGW_PREFIX'):
56+
link_args = '-lgss'
5557
else:
5658
link_args = get_output('krb5-config --libs gssapi')
5759

5860
if compile_args is None:
5961
if osx_has_gss_framework:
6062
compile_args = '-framework GSS -DOSX_HAS_GSS_FRAMEWORK'
63+
elif os.environ.get('MINGW_PREFIX'):
64+
compile_args = '-fPIC'
6165
else:
6266
compile_args = get_output('krb5-config --cflags gssapi')
6367

6468
link_args = link_args.split()
6569
compile_args = compile_args.split()
6670

6771
# add in the extra workarounds for different include structures
68-
prefix = get_output('krb5-config gssapi --prefix')
72+
try:
73+
prefix = get_output('krb5-config gssapi --prefix')
74+
except Exception:
75+
print("WARNING: couldn't find krb5-config; assuming prefix of %s"
76+
% str(sys.prefix))
77+
prefix = sys.prefix
6978
gssapi_ext_h = os.path.join(prefix, 'include/gssapi/gssapi_ext.h')
7079
if os.path.exists(gssapi_ext_h):
7180
compile_args.append("-DHAS_GSSAPI_EXT_H")
@@ -85,6 +94,8 @@ def _get_output(*args, **kwargs):
8594
main_path = ""
8695
if main_lib is None and osx_has_gss_framework:
8796
main_lib = ctypes.util.find_library('GSS')
97+
elif os.environ.get('MINGW_PREFIX'):
98+
main_lib = os.environ.get('MINGW_PREFIX')+'/bin/libgss-3.dll'
8899
elif main_lib is None:
89100
for opt in link_args:
90101
if opt.startswith('-lgssapi'):

0 commit comments

Comments
 (0)