From b022ea558f912b9237455e3b3db31a3c53e12be9 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 18 Jun 2015 05:27:45 +0000 Subject: Update build system: - Remove unused make variables VERSION, BRANCH - Move first make all target below all variable definitions - Move "Executable targets" as well as "LIBNAME" from header.in into gmake.in and nmake.in. Those variables differ more than they share and are getting too abstract. - Use new variable names: LIB_BASENAME, LIB_FILENAME. Drop LIBNAME and BOTAN_LIB - Write libs to out_dir now, which enables out-of-tree builds GH #110, replaces #70 #106 #107 fixes #85 --- src/scripts/install.py | 77 +++++++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 35 deletions(-) (limited to 'src/scripts/install.py') diff --git a/src/scripts/install.py b/src/scripts/install.py index 6f6a9fecc..84d97ea53 100755 --- a/src/scripts/install.py +++ b/src/scripts/install.py @@ -119,18 +119,18 @@ def main(args = None): bin_dir = os.path.join(options.destdir, options.bindir) lib_dir = os.path.join(options.destdir, options.libdir) - doc_dir = os.path.join(options.destdir, options.docdir) - include_dir = os.path.join(options.destdir, options.includedir) - botan_doc_dir = os.path.join(doc_dir, 'botan-%d.%d.%d' % (ver_major, ver_minor, ver_patch)) - - versioned_include_dir = os.path.join(include_dir, 'botan-%d.%d' % (ver_major, ver_minor)) - - botan_include_dir = os.path.join(versioned_include_dir, 'botan') + target_doc_dir = os.path.join(options.destdir, + options.docdir, + 'botan-%d.%d.%d' % (ver_major, ver_minor, ver_patch)) + target_include_dir = os.path.join(options.destdir, + options.includedir, + 'botan-%d.%d' % (ver_major, ver_minor), + 'botan') out_dir = process_template('%{out_dir}') app_exe = process_template('botan%{program_suffix}') - for d in [options.destdir, lib_dir, bin_dir, doc_dir, botan_include_dir]: + for d in [options.destdir, lib_dir, bin_dir, target_doc_dir, target_include_dir]: makedirs(d) build_include_dir = os.path.join(options.build_dir, 'include', 'botan') @@ -139,39 +139,46 @@ def main(args = None): if include == 'internal': continue copy_file(os.path.join(build_include_dir, include), - os.path.join(botan_include_dir, include)) + os.path.join(target_include_dir, include)) static_lib = process_template('%{lib_prefix}%{libname}.%{static_suffix}') - copy_file(static_lib, os.path.join(lib_dir, os.path.basename(static_lib))) + copy_file(os.path.join(out_dir, static_lib), + os.path.join(lib_dir, os.path.basename(static_lib))) if bool(cfg['with_shared_lib']): - shared_lib = process_template('%{lib_prefix}%{libname}.%{so_suffix}.%{so_abi_rev}.%{version_patch}') - soname = process_template('%{lib_prefix}%{libname}.%{so_suffix}.%{so_abi_rev}') - baselib = process_template('%{lib_prefix}%{libname}.%{so_suffix}') - - copy_executable(shared_lib, os.path.join(lib_dir, os.path.basename(shared_lib))) + if str(cfg['os']) == "windows": + shared_lib = process_template('%{lib_prefix}%{libname}.%{so_suffix}') # botan.dll + copy_executable(os.path.join(out_dir, shared_lib), + os.path.join(lib_dir, os.path.basename(shared_lib))) + else: + shared_lib = process_template('%{lib_prefix}%{libname}.%{so_suffix}.%{so_abi_rev}.%{version_patch}') + soname = process_template('%{lib_prefix}%{libname}.%{so_suffix}.%{so_abi_rev}') + baselib = process_template('%{lib_prefix}%{libname}.%{so_suffix}') - prev_cwd = os.getcwd() + copy_executable(os.path.join(out_dir, shared_lib), + os.path.join(lib_dir, os.path.basename(shared_lib))) - try: - os.chdir(lib_dir) + prev_cwd = os.getcwd() try: - os.unlink(soname) - except OSError as e: - if e.errno != errno.ENOENT: - raise e + os.chdir(lib_dir) - try: - os.unlink(baselib) - except OSError as e: - if e.errno != errno.ENOENT: - raise e + try: + os.unlink(soname) + except OSError as e: + if e.errno != errno.ENOENT: + raise e + + try: + os.unlink(baselib) + except OSError as e: + if e.errno != errno.ENOENT: + raise e - os.symlink(shared_lib, soname) - os.symlink(soname, baselib) - finally: - os.chdir(prev_cwd) + os.symlink(shared_lib, soname) + os.symlink(soname, baselib) + finally: + os.chdir(prev_cwd) copy_executable(os.path.join(out_dir, app_exe), os.path.join(bin_dir, app_exe)) @@ -188,13 +195,13 @@ def main(args = None): for py in ['botan.py']: copy_file(os.path.join(cfg['python_dir'], py), os.path.join(py_lib_path, py)) - shutil.rmtree(botan_doc_dir, True) - shutil.copytree(cfg['doc_output_dir'], botan_doc_dir) + shutil.rmtree(target_doc_dir, True) + shutil.copytree(cfg['doc_output_dir'], target_doc_dir) for f in [f for f in os.listdir(cfg['doc_dir']) if f.endswith('.txt')]: - copy_file(os.path.join(cfg['doc_dir'], f), os.path.join(botan_doc_dir, f)) + copy_file(os.path.join(cfg['doc_dir'], f), os.path.join(target_doc_dir, f)) - with combine_relnotes.open_for_utf8(os.path.join(botan_doc_dir, 'news.txt'), 'w+') as news: + with combine_relnotes.open_for_utf8(os.path.join(target_doc_dir, 'news.txt'), 'w+') as news: news.write(combine_relnotes.combine_relnotes('doc/relnotes', False)) logging.info('Botan %s installation complete', cfg['version']) -- cgit v1.2.3