Compare commits

...

4 Commits

7 changed files with 44 additions and 11 deletions

View File

@ -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"

View File

@ -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"

View File

@ -26,7 +26,9 @@ def init():
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('--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())
parser.add_argument('--src', help='Path where to download source code to [$pwd/src]', default=os.getcwd()+"/src")
@ -36,7 +38,9 @@ def init():
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('--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
for cf in glob.glob(config_dir+"/*.json"):

View File

@ -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:

View File

@ -21,6 +21,10 @@ def topological_sort(source):
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 = []
for lib in selected_libs:
name = lib['name']

View File

@ -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:"

View File

@ -2,6 +2,7 @@
import shutil
import json
import os
import glob
from lib.ui import progressbar, bordered, underlined, print_welcome
from lib.shell import get_from_command
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.init import init, check_python_version
SCRIPT_VERSION = "v0.4"
SCRIPT_VERSION = "v0.6"
# check if Python >=3.3.0 is used
check_python_version()
@ -27,10 +28,12 @@ compiler = arg_namespace.compiler
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)
@ -55,16 +58,26 @@ 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")
# 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
if (not keep_work and os.path.exists(work_dir)):
print("Cleaning up work directory...")