v0.6 - added support of building only static libraries

This commit is contained in:
Patrick Lipka 2022-09-25 02:01:31 +02:00
parent 22a8cb03cb
commit 15aef59573
6 changed files with 24 additions and 9 deletions

View File

@ -3,7 +3,7 @@
"dependencies" : "zlib,szip", "dependencies" : "zlib,szip",
"default version" : "1.13.2", "default version" : "1.13.2",
"download" : "git clone --depth 1 --branch hdf5-$VERSION_UNDERSCORE https://github.com/HDFGroup/hdf5.git hdf5-$VERSION", "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", "build" : "make -j $BUILDTHREADS",
"install" : "make install", "install" : "make install",
"object files" : "1136" "object files" : "1136"

View File

@ -3,7 +3,7 @@
"dependencies" : "", "dependencies" : "",
"default version" : "2.1.1", "default version" : "2.1.1",
"download" : "git clone https://github.com/erdc/szip.git szip-$VERSION", "download" : "git clone https://github.com/erdc/szip.git szip-$VERSION",
"configure" : "./configure --prefix=$PREFIX", "configure" : "./configure --prefix=$PREFIX $SHARED",
"build" : "make -j $BUILDTHREADS", "build" : "make -j $BUILDTHREADS",
"install" : "make install", "install" : "make install",
"object files" : "7" "object files" : "7"

View File

@ -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('--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('--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('--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('--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()) 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('--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('--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('--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 # 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 config_dir = config_parser.parse_known_args()[0].config

View File

@ -7,7 +7,7 @@ import shutil
from lib.ui import bordered, underlined, progressbar 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'])) print(bordered("Installing " + lib['name'] + " v." + lib['version']))
if not os.path.exists(src_dir): if not os.path.exists(src_dir):
os.makedirs(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) shutil.copytree(src_dir+"/"+lib_name+"-"+lib_version, work_dir+"/"+lib_name+"-"+lib_version)
os.chdir(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: if verbose:
print(underlined("\nConfiguring Library")) print(underlined("\nConfiguring Library"))
else: else:

View File

@ -36,10 +36,17 @@ def underlined(text):
return '\n'.join(res) 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 = underlined("Patricks Simple Library Installer " + script_version)
out = out + "\n" + "Compiler: " + compiler.upper() + ", Version: " + compiler_version out = out + "\n" + "Compiler: " + compiler.upper() + ", Version: " + compiler_version
out = out + "\n" + "MPI: " + mpi.upper() + ", Version: " + mpi_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" + "Install Directory: "+instDir
out = out + "\n" out = out + "\n"
out = out + "\n" + "The following Libraries will be installed:" out = out + "\n" + "The following Libraries will be installed:"

View File

@ -10,7 +10,7 @@ from lib.sort import sort_libs_by_dependencies
from lib.installer import install_lib from lib.installer import install_lib
from lib.init import init, check_python_version 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 if Python >=3.3.0 is used
check_python_version() check_python_version()
@ -29,10 +29,11 @@ mpi = arg_namespace.mpi
build_threads = arg_namespace.threads build_threads = arg_namespace.threads
verbose = arg_namespace.verbose verbose = arg_namespace.verbose
separate_lib64 = arg_namespace.separate_lib64 separate_lib64 = arg_namespace.separate_lib64
disable_shared = arg_namespace.disable_shared
# extract libraries and versions selected for installation # extract libraries and versions selected for installation
selected_libs = [] 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: for lib_name in args:
if lib_name not in ignore_names and "version" not in lib_name: if lib_name not in ignore_names and "version" not in lib_name:
install = getattr(arg_namespace, 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) sorted_libs = sort_libs_by_dependencies(selected_libs)
# print welcome screen # 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 # install selected libraries
if len(sorted_libs) > 0: if len(sorted_libs) > 0:
for lib in sorted_libs: 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")) print(bordered("ALL INSTALLS COMPLETED SUCCESSFULLY\nPlease add "+inst_dir+" to your environment"))
else: else:
print("NO LIBRARIES SELECTED FOR INSTALLATION") print("NO LIBRARIES SELECTED FOR INSTALLATION")