Compare commits
4 Commits
1b63ed59b7
...
15aef59573
Author | SHA1 | Date |
---|---|---|
|
15aef59573 | |
|
22a8cb03cb | |
|
8d266dfb74 | |
|
f2087e6d10 |
|
@ -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"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -26,6 +26,8 @@ def init():
|
||||||
config_parser.add_argument('--mpi', help='Select compiler (hpcx, intelmpi, openmpi) [hpcx]', default='hpcx')
|
config_parser.add_argument('--mpi', help='Select compiler (hpcx, intelmpi, openmpi) [hpcx]', default='hpcx')
|
||||||
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('--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())
|
||||||
|
@ -36,6 +38,8 @@ def init():
|
||||||
parser.add_argument('--mpi', help='Select compiler (hpcx, intelmpi, openmpi) [hpcx]', default='hpcx')
|
parser.add_argument('--mpi', help='Select compiler (hpcx, intelmpi, openmpi) [hpcx]', default='hpcx')
|
||||||
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('--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
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -21,6 +21,10 @@ def topological_sort(source):
|
||||||
|
|
||||||
|
|
||||||
def sort_libs_by_dependencies(selected_libs):
|
def sort_libs_by_dependencies(selected_libs):
|
||||||
|
# no need for sorting in case of only one lib
|
||||||
|
if len(selected_libs) < 2:
|
||||||
|
return selected_libs
|
||||||
|
|
||||||
deplist = []
|
deplist = []
|
||||||
for lib in selected_libs:
|
for lib in selected_libs:
|
||||||
name = lib['name']
|
name = lib['name']
|
||||||
|
|
|
@ -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:"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import shutil
|
import shutil
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import glob
|
||||||
from lib.ui import progressbar, bordered, underlined, print_welcome
|
from lib.ui import progressbar, bordered, underlined, print_welcome
|
||||||
from lib.shell import get_from_command
|
from lib.shell import get_from_command
|
||||||
from lib.toolchain import get_compiler_version, get_mpi_version, set_toolchain
|
from lib.toolchain import get_compiler_version, get_mpi_version, set_toolchain
|
||||||
|
@ -9,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.4"
|
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()
|
||||||
|
@ -27,10 +28,12 @@ compiler = arg_namespace.compiler
|
||||||
mpi = arg_namespace.mpi
|
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
|
||||||
|
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)
|
||||||
|
@ -55,16 +58,26 @@ 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")
|
||||||
|
|
||||||
|
# create symbolic links
|
||||||
|
if not separate_lib64:
|
||||||
|
lib_dir = inst_dir + "/lib"
|
||||||
|
lib64_dir = inst_dir + "/lib64"
|
||||||
|
if os.path.exists(lib_dir) and os.path.exists(lib64_dir):
|
||||||
|
print("Creating symbolic links...")
|
||||||
|
for file in glob.glob(lib64_dir+"/*.*"):
|
||||||
|
if not os.path.exists(file.replace("lib64","lib")):
|
||||||
|
os.symlink(file, file.replace("lib64","lib"))
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
if (not keep_work and os.path.exists(work_dir)):
|
if (not keep_work and os.path.exists(work_dir)):
|
||||||
print("Cleaning up work directory...")
|
print("Cleaning up work directory...")
|
Loading…
Reference in New Issue