diff --git a/config/hdf5.json b/config/hdf5.json index ac8c731..889fd2a 100644 --- a/config/hdf5.json +++ b/config/hdf5.json @@ -3,7 +3,7 @@ "dependencies" : "zlib,szip", "default version" : "1.13.2", "download" : "git clone --depth 1 --branch hdf5-$VERSION_UNDERSCORE https://github.com/HDFGroup/hdf5.git hdf5-$VERSION", - "configure" : "./configure --enable-fortran --enable-parallel --with-zlib=$PREFIX --with-szip=$PREFIX --prefix=$PREFIX", + "configure" : "./configure --enable-fortran --enable-parallel --with-zlib=$PREFIX --with-szip=$PREFIX --prefix=$PREFIX $SHARED", "build" : "make -j $BUILDTHREADS", "install" : "make install", "object files" : "1136" diff --git a/config/szip.json b/config/szip.json index e6af536..ba88f50 100644 --- a/config/szip.json +++ b/config/szip.json @@ -3,7 +3,7 @@ "dependencies" : "", "default version" : "2.1.1", "download" : "git clone https://github.com/erdc/szip.git szip-$VERSION", - "configure" : "./configure --prefix=$PREFIX", + "configure" : "./configure --prefix=$PREFIX $SHARED", "build" : "make -j $BUILDTHREADS", "install" : "make install", "object files" : "7" diff --git a/lib/init.py b/lib/init.py index 49ac3b2..105a4c6 100644 --- a/lib/init.py +++ b/lib/init.py @@ -27,6 +27,7 @@ def init(): config_parser.add_argument('--threads', help='Number of threads used for make [8]', default='8') config_parser.add_argument('--verbose', help='Print build output to screen instead piping it to logile', action='store_true') config_parser.add_argument('--separate-lib64', help='Do not create symbolic links of files from lib64 in lib', action='store_true') + config_parser.add_argument('--disable-shared', help='Disable building of shared libraries', action='store_true') parser.add_argument('--config', help='Path to config directory [$pwd/config]', default=os.getcwd()+"/config") parser.add_argument('--prefix', help='Path where install directory should be generated [$pwd]', default=os.getcwd()) @@ -38,6 +39,7 @@ def init(): parser.add_argument('--threads', help='Number of threads used for make [8]', default='8') parser.add_argument('--verbose', help='Print build output to screen instead piping it to logile', action='store_true') parser.add_argument('--separate-lib64', help='Do not create symbolic links of files from lib64 in lib', action='store_true') + parser.add_argument('--disable-shared', help='Disable building of shared libraries', action='store_true') # run config parser and search config/*.json to add a build and version argument for it to the full parser config_dir = config_parser.parse_known_args()[0].config diff --git a/lib/installer.py b/lib/installer.py index 98e3f6d..8307832 100644 --- a/lib/installer.py +++ b/lib/installer.py @@ -7,7 +7,7 @@ import shutil from lib.ui import bordered, underlined, progressbar -def install_lib(lib, src_dir, work_dir, inst_dir, comp_cc, comp_cxx, comp_fc, build_threads, verbose): +def install_lib(lib, src_dir, work_dir, inst_dir, comp_cc, comp_cxx, comp_fc, build_threads, disable_shared_libs, verbose): print(bordered("Installing " + lib['name'] + " v." + lib['version'])) if not os.path.exists(src_dir): os.makedirs(src_dir) @@ -46,7 +46,12 @@ def install_lib(lib, src_dir, work_dir, inst_dir, comp_cc, comp_cxx, comp_fc, bu shutil.copytree(src_dir+"/"+lib_name+"-"+lib_version, work_dir+"/"+lib_name+"-"+lib_version) os.chdir(work_dir+"/"+lib_name+"-"+lib_version) - config_command = lib['configure'].replace("$PREFIX", inst_dir) + if disable_shared_libs: + shared_option = "--disable-shared" + else: + shared_option = "" + config_command = lib['configure'].replace("$PREFIX", inst_dir).replace("$SHARED",shared_option) + if verbose: print(underlined("\nConfiguring Library")) else: diff --git a/lib/ui.py b/lib/ui.py index a4ecdef..28fd930 100644 --- a/lib/ui.py +++ b/lib/ui.py @@ -36,10 +36,17 @@ def underlined(text): return '\n'.join(res) -def print_welcome(script_version, compiler, compiler_version, mpi, mpi_version, instDir, installs): +def print_welcome(script_version, compiler, compiler_version, mpi, mpi_version, build_threads, disable_shared_libs, instDir, installs): + if not disable_shared_libs: + shared_str = "Yes" + else: + shared_str = "No" + out = underlined("Patricks Simple Library Installer " + script_version) out = out + "\n" + "Compiler: " + compiler.upper() + ", Version: " + compiler_version out = out + "\n" + "MPI: " + mpi.upper() + ", Version: " + mpi_version + out = out + "\n" + "Number of threads to use: " + build_threads + out = out + "\n" + "Building of shared libraries: " + shared_str out = out + "\n" + "Install Directory: "+instDir out = out + "\n" out = out + "\n" + "The following Libraries will be installed:" diff --git a/libinstaller b/libinstaller index d1bb3c1..d803959 100755 --- a/libinstaller +++ b/libinstaller @@ -10,7 +10,7 @@ from lib.sort import sort_libs_by_dependencies from lib.installer import install_lib from lib.init import init, check_python_version -SCRIPT_VERSION = "v0.5" +SCRIPT_VERSION = "v0.6" # check if Python >=3.3.0 is used check_python_version() @@ -29,10 +29,11 @@ mpi = arg_namespace.mpi build_threads = arg_namespace.threads verbose = arg_namespace.verbose separate_lib64 = arg_namespace.separate_lib64 +disable_shared = arg_namespace.disable_shared # extract libraries and versions selected for installation selected_libs = [] -ignore_names = ["config", "mpi", "compiler", "prefix", "src", "work", "threads", "verbose", "version"] +ignore_names = ["config", "mpi", "compiler", "prefix", "src", "work", "threads", "verbose", "version", "disable_shared"] for lib_name in args: if lib_name not in ignore_names and "version" not in lib_name: install = getattr(arg_namespace, lib_name) @@ -57,12 +58,12 @@ cc, cxx, fc = set_toolchain(compiler, mpi) sorted_libs = sort_libs_by_dependencies(selected_libs) # print welcome screen -print_welcome(SCRIPT_VERSION, compiler, compiler_version, mpi, mpi_version, inst_dir, sorted_libs) +print_welcome(SCRIPT_VERSION, compiler, compiler_version, mpi, mpi_version, build_threads, disable_shared, inst_dir, sorted_libs) # install selected libraries if len(sorted_libs) > 0: for lib in sorted_libs: - install_lib(lib, src_dir, work_dir, inst_dir, cc, cxx, fc, build_threads, verbose) + install_lib(lib, src_dir, work_dir, inst_dir, cc, cxx, fc, build_threads, disable_shared, verbose) print(bordered("ALL INSTALLS COMPLETED SUCCESSFULLY\nPlease add "+inst_dir+" to your environment")) else: print("NO LIBRARIES SELECTED FOR INSTALLATION")