diff options
author | Casey Deccio <casey@deccio.net> | 2016-01-19 21:35:23 +0300 |
---|---|---|
committer | Casey Deccio <casey@deccio.net> | 2016-01-19 21:35:23 +0300 |
commit | 56eb76104e1382d12619b21d03e82f1a49660c46 (patch) | |
tree | 9ced88a4e60bf3058c987640dfcdfcbe274bb996 /setup.py | |
parent | 17fedf19c7072931dfaa4aaadfb1191be0d6a04f (diff) |
Use pkg-config to detect location of openssl lib
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -3,6 +3,7 @@ import glob import os import stat +import subprocess import sys from distutils.core import setup @@ -14,7 +15,7 @@ JQUERY_UI_PATH = "'http://code.jquery.com/ui/1.11.4/jquery-ui.min.js'" JQUERY_UI_CSS_PATH = "'http://code.jquery.com/ui/1.11.4/themes/redmond/jquery-ui.css'" JQUERY_PATH = "'http://code.jquery.com/jquery-1.11.3.min.js'" RAPHAEL_PATH = "'http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.4/raphael-min.js'" -OPENSSL_LIB_DIR = "'/usr/lib/x86_64-linux-gnu'" +OPENSSL_LIB_DIR = None def apply_substitutions(filename, install_prefix): assert filename.endswith('.in'), 'Filename supplied for customization must end with \'.in\': %s' % (filename) @@ -45,6 +46,20 @@ def make_documentation(): finally: os.chdir('..') +def set_openssl_lib_path(): + global OPENSSL_LIB_DIR + + msg = '' + try: + libdir = subprocess.check_output(['pkg-config', '--variable=libdir', 'openssl']).strip() + except (subprocess.CalledProcessError, OSError), e: + libdir = None + msg = str(e) + if not libdir or not os.path.exists(libdir): + sys.stderr.write('Warning: Unable to identify the lib directory for openssl: %s\nProceeding without support for dynamically loaded engines.\n' % msg) + else: + OPENSSL_LIB_DIR = "'%s'" % libdir + class MyBuild(build): def run(self): make_documentation() @@ -52,6 +67,7 @@ class MyBuild(build): class MyInstall(install): def run(self): + set_openssl_lib_path() # if this an alternate root is specified, then embed the install_data # path relative to that alternate root if self.root is not None: |