mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-30 17:00:26 +00:00
Search for correct versioned lib .5 suffix
Always use the major version instead of requiring manual updates to the file names.
This commit is contained in:
parent
68c8943e32
commit
d75c37b872
@ -342,10 +342,10 @@ def _load_lib(path):
|
||||
if os.path.exists(lib_file):
|
||||
return ctypes.cdll.LoadLibrary(lib_file)
|
||||
else:
|
||||
# if we're on linux, try again with .so.4 extension
|
||||
# if we're on linux, try again with .so.5 extension
|
||||
if lib_file.endswith('.so'):
|
||||
if os.path.exists(lib_file + '.4'):
|
||||
return ctypes.cdll.LoadLibrary(lib_file + '.4')
|
||||
if os.path.exists(lib_file + '.{}'.format(CS_VERSION_MAJOR)):
|
||||
return ctypes.cdll.LoadLibrary(lib_file + '.{}'.format(CS_VERSION_MAJOR))
|
||||
return None
|
||||
|
||||
_cs = None
|
||||
|
@ -10,6 +10,7 @@ from Cython.Distutils import build_ext
|
||||
|
||||
SYSTEM = sys.platform
|
||||
VERSION = '5.0.0'
|
||||
VERSION_PARTS = VERSION.split(".")
|
||||
|
||||
# adapted from commit e504b81 of Nguyen Tan Cong
|
||||
# Reference: https://docs.python.org/2/library/platform.html#cross-platform
|
||||
@ -25,7 +26,7 @@ PYPACKAGE_DIR = os.path.join(ROOT_DIR, 'capstone')
|
||||
CYPACKAGE_DIR = os.path.join(ROOT_DIR, 'pyx')
|
||||
|
||||
if SYSTEM == 'darwin':
|
||||
VERSIONED_LIBRARY_FILE = "libcapstone.4.dylib"
|
||||
VERSIONED_LIBRARY_FILE = "libcapstone.{}.dylib".format(VERSION_PARTS[0])
|
||||
LIBRARY_FILE = "libcapstone.dylib"
|
||||
STATIC_LIBRARY_FILE = 'libcapstone.a'
|
||||
elif SYSTEM in ('win32', 'cygwin'):
|
||||
@ -33,7 +34,7 @@ elif SYSTEM in ('win32', 'cygwin'):
|
||||
LIBRARY_FILE = "capstone.dll"
|
||||
STATIC_LIBRARY_FILE = None
|
||||
else:
|
||||
VERSIONED_LIBRARY_FILE = "libcapstone.so.4"
|
||||
VERSIONED_LIBRARY_FILE = "libcapstone.so.{}".format(VERSION_PARTS[0])
|
||||
LIBRARY_FILE = "libcapstone.so"
|
||||
STATIC_LIBRARY_FILE = 'libcapstone.a'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user