diff --git a/setup.py b/setup.py index 80104342..95d94e20 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ from src.version import softwareVersion EXTRAS_REQUIRE = { 'gir': ['pygobject'], 'notify2': ['notify2'], - 'pyopencl': ['pyopencl', 'numpy'], + 'opencl': ['pyopencl', 'numpy'], 'prctl': ['python_prctl'], # Named threads 'qrcode': ['qrcode'], 'sound;platform_system=="Windows"': ['winsound'], @@ -50,6 +50,15 @@ if __name__ == "__main__": with open(os.path.join(here, 'README.md')) as f: README = f.read() + libfastsolver = Extension( + 'pybitmessage.workprover.fastsolver.libfastsolver', + sources=[ + 'src/workprover/fastsolver/common.c', + 'src/workprover/fastsolver/pthread.c'], + include_dirs=['src/workprover/fastsolver'], + libraries=['pthread', 'crypto'], + ) + installRequires = [] packages = [ 'pybitmessage', @@ -116,6 +125,7 @@ if __name__ == "__main__": ('share/icons/hicolor/24x24/apps/', ['desktop/icons/24x24/pybitmessage.png']) ], + ext_modules=[libfastsolver], zip_safe=False, entry_points={ 'bitmessage.gui.menu': [ diff --git a/src/workprover/fastsolver.py b/src/workprover/fastsolver.py index 4fe26fc7..2a8bcc9d 100644 --- a/src/workprover/fastsolver.py +++ b/src/workprover/fastsolver.py @@ -21,6 +21,17 @@ def loadFastSolver(codePath): except: raise FastSolverError() + # dh_python renames so + if platform.dist()[0] in ('debian', 'ubuntu'): + import glob + try: + return ctypes.CDLL(glob.glob(os.path.join( + codePath, "fastsolver", + "libfastsolver.{}*.so".format(platform.machine()) + ))[0]) + except (OSError, IndexError): + pass + makePath = os.path.join(codePath, "fastsolver") path = os.path.join(codePath, "fastsolver/libfastsolver.so")