2
0
Эх сурвалжийг харах

Fixed crypto library name for windows

Jürg Rast 5 жил өмнө
parent
commit
7203a8bbb9
1 өөрчлөгдсөн 12 нэмэгдсэн , 2 устгасан
  1. 12 2
      setup_crypto.py

+ 12 - 2
setup_crypto.py

@@ -1,6 +1,9 @@
 # Support code for building a C extension with crypto code
 
 import os
+import sys
+
+is_win32 = sys.platform.startswith('win32')
 
 
 def multi_join(paths, *path_segments):
@@ -11,9 +14,16 @@ def multi_join(paths, *path_segments):
 def crypto_ext_kwargs(pc, system_prefix):
     if system_prefix:
         print('Detected OpenSSL [via BORG_OPENSSL_PREFIX]')
+        if is_win32:
+            lib_dir = system_prefix
+            lib_name = 'libcrypto'
+        else:
+            lib_dir = os.path.join(system_prefix, 'lib')
+            lib_name = 'crypto'
+
         return dict(include_dirs=[os.path.join(system_prefix, 'include')],
-                    library_dirs=[os.path.join(system_prefix, 'lib')],
-                    libraries=['crypto'])
+                    library_dirs=[lib_dir],
+                    libraries=[lib_name])
 
     if pc and pc.exists('libcrypto'):
         print('Detected OpenSSL [via pkg-config]')