Skip to content

Commit

Permalink
Add build support for mingw32
Browse files Browse the repository at this point in the history
[rharwood@redhat.com squashed commits, rewrote commit message, and added log
message when krb5-config isn't found]
  • Loading branch information
totaam authored and frozencemetery committed Mar 21, 2018
1 parent 7018e58 commit 2a2b47b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions gssapi/raw/python_gssapi.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#ifdef OSX_HAS_GSS_FRAMEWORK
#include <GSS/GSS.h>
#elif __MINGW32__
#include <gss.h>
#else
#include <gssapi/gssapi.h>
#endif
4 changes: 4 additions & 0 deletions gssapi/raw/python_gssapi_ext.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#ifdef OSX_HAS_GSS_FRAMEWORK
#include <GSS/GSS.h>
#else
#ifdef __MINGW32__
#include <gss.h>
#else
#ifdef HAS_GSSAPI_EXT_H
#include <gssapi/gssapi_ext.h>
#else
#include <gssapi/gssapi.h>
#endif
#endif
#endif
2 changes: 2 additions & 0 deletions gssapi/raw/python_gssapi_krb5.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#ifdef OSX_HAS_GSS_FRAMEWORK
#include <GSS/gssapi_krb5.h>
#elif __MINGW32__
#include <gss.h>
#else
#include <gssapi/gssapi_krb5.h>
#endif
13 changes: 12 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,29 @@ def _get_output(*args, **kwargs):
if link_args is None:
if osx_has_gss_framework:
link_args = '-framework GSS'
elif os.environ.get('MINGW_PREFIX'):
link_args = '-lgss'
else:
link_args = get_output('krb5-config --libs gssapi')

if compile_args is None:
if osx_has_gss_framework:
compile_args = '-framework GSS -DOSX_HAS_GSS_FRAMEWORK'
elif os.environ.get('MINGW_PREFIX'):
compile_args = '-fPIC'
else:
compile_args = get_output('krb5-config --cflags gssapi')

link_args = link_args.split()
compile_args = compile_args.split()

# add in the extra workarounds for different include structures
prefix = get_output('krb5-config gssapi --prefix')
try:
prefix = get_output('krb5-config gssapi --prefix')
except Exception:
print("WARNING: couldn't find krb5-config; assuming prefix of %s"
% str(sys.prefix))
prefix = sys.prefix
gssapi_ext_h = os.path.join(prefix, 'include/gssapi/gssapi_ext.h')
if os.path.exists(gssapi_ext_h):
compile_args.append("-DHAS_GSSAPI_EXT_H")
Expand All @@ -85,6 +94,8 @@ def _get_output(*args, **kwargs):
main_path = ""
if main_lib is None and osx_has_gss_framework:
main_lib = ctypes.util.find_library('GSS')
elif os.environ.get('MINGW_PREFIX'):
main_lib = os.environ.get('MINGW_PREFIX')+'/bin/libgss-3.dll'
elif main_lib is None:
for opt in link_args:
if opt.startswith('-lgssapi'):
Expand Down

0 comments on commit 2a2b47b

Please sign in to comment.