From 96e9dccf3e50e3c6ac0d20b3092d460ee8523103 Mon Sep 17 00:00:00 2001 From: lrknox Date: Fri, 2 Sep 2016 11:02:10 -0500 Subject: dd bin/pkgscrpts directory with scripts to package deployed unix binaries into tarfiles. --- bin/pkgscrpts/h5rmflags | 167 +++++++++++++++ bin/pkgscrpts/makeHDF5BinaryTarfiles.pl | 368 ++++++++++++++++++++++++++++++++ bin/pkgscrpts/makeInternalREADME.pl | 215 +++++++++++++++++++ bin/pkgscrpts/makeOuterREADME.pl | 182 ++++++++++++++++ 4 files changed, 932 insertions(+) create mode 100755 bin/pkgscrpts/h5rmflags create mode 100755 bin/pkgscrpts/makeHDF5BinaryTarfiles.pl create mode 100755 bin/pkgscrpts/makeInternalREADME.pl create mode 100755 bin/pkgscrpts/makeOuterREADME.pl diff --git a/bin/pkgscrpts/h5rmflags b/bin/pkgscrpts/h5rmflags new file mode 100755 index 0000000..32b8090 --- /dev/null +++ b/bin/pkgscrpts/h5rmflags @@ -0,0 +1,167 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# + +## Remove paths to libraries used to build HDF5 when packaging HDF5 +## binaries. +## For help page, use "h5rmflags -help" + +# Constants definitions +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +# Function definitions + +# show help page +usage() { + # A wonderfully informative "usage" message. + echo "usage: $prog_name [OPTIONS]" + echo " OPTIONS:" + echo " -help|help This help message" + echo " -echo Show all the shell commands executed" + echo " -force No prompt, just do it" + echo " -prefix=DIR New directory to find HDF5 lib/ and include/" + echo " subdirectories [default: current directory]" + echo " -tool=TOOL Tool to update. TOOL must be in the current" + echo " directory and writable. [default: $h5tools]" + echo " -show Show the commands without executing them" + echo " " + exit $EXIT_FAILURE +} + +# display variable values +dump_vars(){ + echo "====Showing all variable values=====" + echo prefix=$prefix + echo h5tools=$h5tools + echo "====End Showing=====" +} + +# show actions to be taken +show_action() +{ + echo "Update the following tools because they are now installed at a new directory" + for t in $foundtools; do + echo "${t}:" + echo " current setting=`sed -e '/^prefix=/s/prefix=//p' -e d $t`" + echo " new setting="\""$prefix"\" + done +} + + +# Report Error message +ERROR() +{ + echo "***ERROR***" + echo "$1" +} + +# Main +# +# Initialization +h5tools="h5cc h5pcc h5fc h5pfc h5c++" # possible hdf5 tools +foundtools= # tools found and will be modified +fmode= # force mode, default is off +prefix=`(cd ..;pwd)` + +# Parse options +for arg in $@ ; do + case "$arg" in + -prefix=*) + prefix="`expr "$arg" : '-prefix=\(.*\)'`" + ;; + -echo) + set -x + ;; + -show) + SHOW="echo" + ;; + -tool=*) + h5tools="`expr "$arg" : '-tool=\(.*\)'`" + ;; + -help|help) + usage + ;; + -force) + fmode=yes + ;; + *) + ERROR "Unknown Option($arg)" + usage + exit $EXIT_FAILURE + ;; + esac +done + +# Sanity checks +#if [ ! -d $prefix ]; then +# ERROR "prefix($prefix) is not an existing directory" +# exit $EXIT_FAILURE +#fi + +for x in $h5tools; do + if [ -f $x ]; then + foundtools="$foundtools $x" + if [ ! -w $x ]; then + ERROR "h5tool($x) is not writable" + exit $EXIT_FAILURE + fi + fi +done + +if [ -z "$foundtools" ]; then + ERROR "found no tools to modify" + exit $EXIT_FAILURE +fi + +# Show actions to be taken and get consent +show_action + + +# Update them +if [ "$SHOW" = "echo" ]; then + echo "===Update commands are:====" +# cat $CMDFILE + echo "===End Update commands=====" +fi + +for t in $foundtools; do + echo Update $t ... +# COMMAND="ed - $t" +# if [ "$SHOW" = "echo" ]; then +# echo $COMMAND +# else +# $COMMAND < $CMDFILE + ed - $t << end + g/^H5BLD_CPPFLAGS/s/-I\/.*include //g + g/^H5BLD_LDFLAGS/s/-L\/.*lib //g + g/^H5BLD_LDFLAGS/s/-L\/.*lib64 //g + . + w +end +# fi +done + + +# Cleanup +#rm -f $CMDFILE +exit $EXIT_SUCCESS + +# Some possible future features to add +# CCBASE - Name of the alternative C compiler +# CLINKERBASE - Name of the alternative linker +# LDFLAGS - Path to different libraries your application will link with +# (this path should include the path to the zlib library) +# LIBS - Libraries your application will link with diff --git a/bin/pkgscrpts/makeHDF5BinaryTarfiles.pl b/bin/pkgscrpts/makeHDF5BinaryTarfiles.pl new file mode 100755 index 0000000..32b3049 --- /dev/null +++ b/bin/pkgscrpts/makeHDF5BinaryTarfiles.pl @@ -0,0 +1,368 @@ +#!/usr/bin/perl +# makeTarFiles.pl + +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# +# +# +use warnings; +use strict; +use Cwd; +use File::Basename; + + +my %destsubdir = ('emu' => 'sunos-5.11-sparc-32-sunc512', + 'emu64' => 'sunos-5.11-sparc-64-sunc512', + 'ostrich' => 'linux-el6-ppc64-gcc447', + 'ostrichxl' => 'linux-el6-ppc64-xl13.1', + 'platypus' => 'linux-centos6-x86_64-gcc447', + 'platypus32' => 'linux-centos6-x86_64-32-gcc447', + 'moohan' => 'linux-centos7-x86_64-gcc485', + 'moohan32' => 'linux-centos7-x86_64-32-gcc485', + 'kite' => 'osx-10.8-x86_64-clang5.1', + 'quail' => 'osx-10.9-x86_64-clang6.0', + 'osx1010test' => 'osx-10.10-x86_64-clang6.0'); + +my %szipdir = ('emu' => '/mnt/hdf/packages/szip/shared/encoder/SunOS-5.10', + 'emu-static' => '/mnt/hdf/packages/szip/static/encoder/SunOS-5.10', + 'emu64' => '/mnt/hdf/packages/szip-PIC/shared/encoder/SunOS-5.11-64', + 'emu64-static' => '/mnt/hdf/packages/szip-PIC/shared/encoder/SunOS-5.11-64', + 'kite' => '/mnt/hdf/packages/szip/shared/encoder/MacOS-10.8', + 'kite-static' => '/mnt/hdf/packages/szip-PIC/static/encoder/MacOS-10.8', + 'ostrich32' => '/mnt/hdf/packages/szip/shared/encoder/Linux2.6-ppc64-gcc', + 'ostrich32-static' => '/mnt/hdf/packages/szip/static/encoder/Linux2.6-ibmppc64-gcc-32', + 'ostrich' => '/mnt/hdf/packages/szip/shared/encoder/Linux2.6-ppc64-gcc-64', + 'ostrich-static' => '/mnt/hdf/packages/szip/static/encoder/Linux2.6-ibmppc64-gcc', + 'ostrichxl' => '/mnt/hdf/packages/szip/shared/encoder/Linux2.6-ppc64-gcc-64', + 'ostrichxl-static' => '/mnt/hdf/packages/szip/static/encoder/Linux2.6-ibmppc64-gcc', + 'osx1010test' => '/mnt/hdf/packages/szip/shared/encoder/MacOS-10.8', + 'osx1010test-static' => '/mnt/hdf/packages/szip-PIC/static/encoder/MacOS-10.8', + 'moohan' => '/mnt/hdf/packages/szip/shared/encoder/Linux2.6-x86_64-gcc', + 'moohan-static' => '/mnt/hdf/packages/szip/static/encoder/Linux2.6-x86_64-gcc', + 'moohan32' => '/mnt/hdf/packages/szip/shared/encoder/Linux2.6-x86_64-gcc-m32', + 'moohan32-static' => '/mnt/hdf/packages/szip-PIC/static/encoder/Linux2.6-x86_64-gcc-m32', + 'platypus32' => '/mnt/hdf/packages/szip/shared/encoder/Linux2.6-x86_64-gcc-m32', + 'platypus32-static' => '/mnt/hdf/packages/szip-PIC/static/encoder/Linux2.6-x86_64-gcc-m32', + 'platypus' => '/mnt/hdf/packages/szip/shared/encoder/Linux2.6-x86_64-gcc', + 'platypus-static' => '/mnt/hdf/packages/szip/static/encoder/Linux2.6-x86_64-gcc', + 'quail' => '/mnt/hdf/packages/szip/shared/encoder/MacOS-10.8', + 'quail-static' => '/mnt/hdf/packages/szip-PIC/static/encoder/MacOS-10.8'); + +my %zlibdir = ('emu' => '/mnt/hdf/packages/zlib-125/shared/SunOS-5.10', + 'emu-static' => '/mnt/hdf/packages/zlib-125/static/SunOS-5.10', + 'emu64' => '/mnt/hdf/packages/zlib-123-PIC/SunOS-5.11-64', + 'emu64-static' => '/mnt/hdf/packages/zlib-123-PIC/SunOS-5.11-64', + 'kite' => ' /mnt/hdf/packages/zlib-125/shared/mac-intel-x86_64', + 'kite-static' => ' /mnt/hdf/packages/zlib-125/static/mac-intel-x86_64', + 'ostrich32' => '/mnt/hdf/packages/zlib-125/PIC/Linux2.6-ppc64-gcc', + 'ostrich32-static' => '/mnt/hdf/packages/zlib-125/PIC/Linux2.6-ppc64-gcc', + 'ostrich' => '/mnt/hdf/packages/zlib-125/PIC/Linux2.6-ppc64-gcc-64', + 'ostrich-static' => '/mnt/hdf/packages/zlib-125/PIC/Linux2.6-ppc64-gcc-64', + 'ostrichxl' => '/mnt/hdf/packages/zlib-125/PIC/Linux2.6-ppc64-gcc-64', + 'ostrichxl-static' => '/mnt/hdf/packages/zlib-125/PIC/Linux2.6-ppc64-gcc-64', + 'osx1010test' => ' /mnt/hdf/packages/zlib-125/shared/mac-intel-x86_64', + 'osx1010test-static' => ' /mnt/hdf/packages/zlib-125/static/mac-intel-x86_64', + 'moohan' => '/mnt/hdf/packages/zlib-125/shared/Linux2.6-x86_64-gcc', + 'moohan-static' => '/mnt/hdf/packages/zlib-125/static/Linux2.6-x86_64-gcc', + 'moohan32' => '/mnt/hdf/packages/zlib-128/Linux2.6-x86_64-gcc-m32', + 'moohan32-static' => '/mnt/hdf/packages/zlib-128/Linux2.6-x86_64-gcc-m32', + 'platypus32' => '/mnt/hdf/packages/zlib-128/Linux2.6-x86_64-gcc-m32', + 'platypus32-static' => '/mnt/hdf/packages/zlib-128/Linux2.6-x86_64-gcc-m32', + 'platypus' => '/mnt/hdf/packages/zlib-125/shared/Linux2.6-x86_64-gcc', + 'platypus-static' => '/mnt/hdf/packages/zlib-125/static/Linux2.6-x86_64-gcc', + 'quail' => ' /mnt/hdf/packages/zlib-125/shared/mac-intel-x86_64', + 'quail-static' => ' /mnt/hdf/packages/zlib-125/static/mac-intel-x86_64'); + +my $indirectory = "."; +$indirectory = shift; + +my $outdirectory = "."; +$outdirectory = shift; + +my $key = "."; +#$key = shift; + +my $scriptdirname = dirname(__FILE__); + +unless (-d $outdirectory) { + print "$outdirectory not found. Create it or choose another one and try again.\n"; + exit 1; +} + +print "Subdirectories of $indirectory will be tarred and stored in $outdirectory.\n"; + + +my $tarfilename; +my $tardirname; +my $output; +my $cmd; + +# I'm currently copying system zlibs for at least solaris and FreeBSD machines. Since this script runs on jam it may require scp to get the libs. + +#For future reference +# command for getting szlib files and links for shared binaries: +# tar cvf - -C /lib . | tar xvf - -C . +# libz.so.1.2.3 and the static files should just be copied because they're in directories +# with other files. Then create the libz.so.1 and libz.so symbolic links. +sub addzandszlibs { + my $dir = shift; + my $indirectory = shift; + my $currentdir = getcwd(); + + if (-d "$indirectory/$dir" ) { + my $szdir = $szipdir{$dir}; + my $zldir = $zlibdir{$dir}; + if ($dir =~ /static/ || $dir =~ /ostrich/) { + $cmd = "cp $szdir/lib/libsz.a $indirectory/$dir/lib"; + $output = `$cmd`; + print $output; + $cmd = "cp $zldir/lib/libz.a $indirectory/$dir/lib"; + $output = `$cmd`; + print $output; + } elsif ($dir eq "freedom" || $dir eq "loyalty") { + $cmd = "cp $szdir/lib/libsz.so.2 $indirectory/$dir/lib"; + $output = `$cmd`; + print $output; + $cmd = "cp $zldir/lib/libz.so.5 $indirectory/$dir/lib"; + $output = `$cmd`; + print $output; + + chdir "$indirectory/$dir/lib" or die "Couldn't change directory to $indirectory/$dir/lib, $!"; + $cmd = "ln -s libsz.so.2 libsz.so"; + $output = `$cmd`; + print $output; + + $cmd = "ln -s libz.so.5 libz.so"; + $output = `$cmd`; + print $output; + + chdir $currentdir or die "Couldn't change directory back to $currentdir, $!"; + } elsif ($dir eq "quail" || $dir eq "kite" || $dir eq "osx1010test") { + #we've been using the static libraries for the macs - built with -fPIC +# $cmd = "cp $szdir/lib/libsz.a $indirectory/$dir/lib"; +# $output = `$cmd`; +# print $output; +# $cmd = "cp $zldir/lib/libz.a $indirectory/$dir/lib"; +# $output = `$cmd`; +# print $output; + $cmd = "cp $szdir/lib/libsz.2.0.0.dylib $indirectory/$dir/lib"; + $output = `$cmd`; + print $output; + $cmd = "cp $zldir/lib/libz.1.2.5.dylib $indirectory/$dir/lib"; + $output = `$cmd`; + print $output; + + chdir "$indirectory/$dir/lib" or die "Couldn't change directory to $indirectory/$dir/lib, $!"; + $cmd = "ln -s libsz.2.0.0.dylib libsz.2.dylib"; + $output = `$cmd`; + print $output; + + $cmd = "ln -s libsz.2.0.0.dylib libsz.dylib"; + $output = `$cmd`; + print $output; + + $cmd = "ln -s libz.1.2.5.dylib libz.1.dylib"; + $output = `$cmd`; + print $output; + + $cmd = "ln -s libz.1.2.5.dylib libz.dylib"; + $output = `$cmd`; + print $output; + + chdir $currentdir or die "Couldn't change directory back to $currentdir, $!"; + + } elsif ($dir eq "emu64") { + $cmd = "cp $szdir/lib/libsz.so.2.0.0 $indirectory/$dir/lib"; + $output = `$cmd`; + print $output; + $cmd = "cp $zldir/lib/libz.a $indirectory/$dir/lib"; + $output = `$cmd`; + print $output; + + chdir "$indirectory/$dir/lib" or die "Couldn't change directory to $indirectory/$dir/lib, $!"; + $cmd = "ln -s libsz.so.2.0.0 libsz.so.2"; + $output = `$cmd`; + print $output; + + $cmd = "ln -s libsz.so.2.0.0 libsz.so"; + $output = `$cmd`; + print $output; + + chdir $currentdir or die "Couldn't change directory back to $currentdir, $!"; + + } elsif ($dir eq "platypus32" || $dir eq "moohan32") { + $cmd = "cp $szdir/lib/libsz.so.2.0.0 $indirectory/$dir/lib"; + $output = `$cmd`; + print $output; + + # $cmd = "cp $zldir/lib/libz.a $indirectory/$dir/lib"; + # $output = `$cmd`; + # print $output; + + chdir "$indirectory/$dir/lib" or die "Couldn't change directory to $indirectory/$dir/lib, $!"; + $cmd = "ln -s libsz.so.2.0.0 libsz.so.2"; + $output = `$cmd`; + print $output; + + $cmd = "ln -s libsz.so.2.0.0 libsz.so"; + $output = `$cmd`; + print $output; + + # $cmd = "ln -s libz.so.1.2.8 libz.so.1"; + # $output = `$cmd`; + # print $output; + + # $cmd = "ln -s libz.so.1.2.8 libz.so"; + # $output = `$cmd`; + # print $output; + + chdir $currentdir or die "Couldn't change directory back to $currentdir, $!"; + + } else { + $cmd = "cp $szdir/lib/libsz.so.2.0.0 $indirectory/$dir/lib"; + $output = `$cmd`; + print $output; + + $cmd = "cp $zldir/lib/libz.so.1.2.5 $indirectory/$dir/lib"; + $output = `$cmd`; + print $output; + + chdir "$indirectory/$dir/lib" or die "Couldn't change directory to $indirectory/$dir/lib, $!"; + $cmd = "ln -s libsz.so.2.0.0 libsz.so.2"; + $output = `$cmd`; + print $output; + + $cmd = "ln -s libsz.so.2.0.0 libsz.so"; + $output = `$cmd`; + print $output; + + $cmd = "ln -s libz.so.1.2.5 libz.so.1"; + $output = `$cmd`; + print $output; + + $cmd = "ln -s libz.so.1.2.5 libz.so"; + $output = `$cmd`; + print $output; + + chdir $currentdir or die "Couldn't change directory back to $currentdir, $!"; + } + } +} + +sub makeTarFile { + my $directoryname = shift; + my $origdirname = shift; + my $tarfilename = shift; + my $tardirname = shift; + $cmd = "mv $indirectory/$origdirname $indirectory/$tardirname"; + $output = `$cmd`; + print $output; + if (-d $indirectory."/".$tardirname."/doc/hdf5/examples") { + $cmd = "mv $indirectory/$tardirname/doc/hdf5/examples $indirectory/$tardirname/examples"; + $output = `$cmd`; + print $output; + $cmd = "rm -rf $indirectory/$tardirname/doc"; + $output = `$cmd`; + print $output; + } + $cmd = "tar zcvf $outdirectory/$directoryname/$tarfilename -C $indirectory $tardirname"; + print "Need to run $cmd.\n"; + $output = `$cmd`; + sleep 10; + print "Create $tarfilename: $output\n"; + $cmd = "mv $indirectory/$tardirname $indirectory/$origdirname"; + $output = `$cmd`; + print $output; +} + +foreach $key (keys %destsubdir) { + print "Process ".$key."\n\n"; + #skip unless there's a directory by the name of $key or $key-static + next unless -d $indirectory.'/'.$key || -d $indirectory.'/'.$key."-static"; + my $version; + # This assumes a static directory. Probably the others should be checked if this + # doesn't exist. + $cmd = "grep \"HDF5 Version\" $indirectory/$key/lib/libhdf5.settings"; + $_ = `$cmd`; + print $_, "\n"; + s/HDF5 Version://; + s/^\s+//; + chomp; + $version = $_; + #my $directoryname = substr $destsubdir{$key}, 0, rindex($destsubdir{$key}, '-'); + my $directoryname = $destsubdir{$key}; + mkdir $outdirectory."/".$directoryname, 0755 unless -d $outdirectory."/".$directoryname; + my $staticdir = $key."-static"; + print $indirectory."/$key tarfile will be put in " . $outdirectory."/".$directoryname."\n"; + if (-e $outdirectory."/".$destsubdir{$key}."/README") { + print $outdirectory."/".$destsubdir{$key}."/README" . " has already been created.\n"; + } + else { + print "Make the Outer README file: "; + $cmd = "perl ./makeOuterREADME.pl $indirectory/$key $outdirectory $directoryname"; + print $cmd, "\n"; + my $output = `$cmd`; + print $output; + } + my $file = ""; + my @dirnames = ""; + opendir(DIR, $indirectory) or die "can't open .: $!"; + while (defined($file = readdir(DIR))) { + next unless ($file eq $key || $file eq "$key-static") && -d $indirectory."/".$file; + push @dirnames, $file; + } + foreach my $dir (@dirnames) { + next if $dir eq ""; + print "Make the Inner README files.\n"; + $cmd = "perl ./makeInternalREADME.pl $indirectory/$dir"; + print $cmd, "\n"; + $output = `$cmd`; + print $output; + print "Add the zlib and szip files for $dir.\n"; + &addzandszlibs($dir, $indirectory); + my $currentdir = getcwd(); + + print "Remove all lib*.la files from $dir/lib*.\n"; + $cmd = "rm $indirectory/$dir/lib*/lib*.la"; + print $cmd, "\n"; + $output = `$cmd`; + print $output; + + chdir "$indirectory/$dir/bin" or die "Couldn't change directory to $indirectory/$dir/bin, $!"; + + $cmd = "$scriptdirname/h5rmflags -force"; + $output = `$cmd`; + print $output; + chdir $currentdir or die "Couldn't change directory back to $currentdir, $!"; + print "Tar up the files into the output directory.\n"; + if (-d $indirectory."/".$dir) { + if ($dir =~ /static/) { + $tarfilename = "hdf5-$version-$destsubdir{$key}-static.tar.gz"; + $tardirname = "hdf5-$version-$destsubdir{$key}-static"; + } else { + $tarfilename = "hdf5-$version-$destsubdir{$key}-shared.tar.gz"; + $tardirname = "hdf5-$version-$destsubdir{$key}-shared"; + } + &makeTarFile($directoryname, $dir, $tarfilename, $tardirname); + } + } + # If this copy is done after h5rmflags is run on all the directories the compile scripts + # in the utilities directory will already have the paths removed. + if (-d $indirectory."/".$staticdir) { + $cmd = "cp -prv $indirectory/$staticdir/bin $outdirectory/$directoryname/utilities"; + $output = `$cmd`; + print $output; + } +} + diff --git a/bin/pkgscrpts/makeInternalREADME.pl b/bin/pkgscrpts/makeInternalREADME.pl new file mode 100755 index 0000000..355036f --- /dev/null +++ b/bin/pkgscrpts/makeInternalREADME.pl @@ -0,0 +1,215 @@ +#!/usr/bin/perl +# makeInternalREADME.pl +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF4. The full HDF4 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF4 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF4/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# + +use warnings; +use strict; + +my $section2="For information on compilers and settings used to build these HDF5 +libraries, please refer to: + + ./lib/libhdf5.settings + +The contents of this directory are: + + COPYING - Copyright notice + README - This file + RELEASE.txt - Detailed information regarding this release + bin/ - Directory containing HDF5 pre-compiled utilities + include/ - Directory containing HDF5 include files + lib/ - Directory containing HDF5 libraries and settings + share/ - Directory containing example code in C, C++, and + Fortran using HDF5 and HDF5 HL library APIs. The + shell scripts provided with these examples will + compile and run them, and will also test the + h5cc, h5c++, and h5fc compile scripts found + in the installed bin directory. + +These binaries were built with the ZLIB and SZIP (version 2.1, Encoder +ENABLED) external libraries which are included in the lib directory for +convenience. + +We also provide the ZLIB and SZIP source code on our ftp server at: + + ftp://ftp.hdfgroup.org/lib-external/ + +The official ZLIB and SZIP pages are at: + + ZLIB: http://www.zlib.net/ + SZIP: http://hdfgroup.org/doc_resource/SZIP/ + +"; + +my $section3 = "If using the shared libraries, you must add the HDF5 library path +to the LD_LIBRARY_PATH variable. +"; + +my $section4 = "We provide scripts for compiling applications with the HDF5 libraries: + + bin/h5cc - for C + bin/h5fc - for F90 (if Fortran 90 library is included with the binaries) + bin/h5c++ - for C++ (if C++ library is included with the binaries) + +After you have installed the binaries to their final destination, you can use +these scripts (h5cc, h5fc, h5c++) to compile. However, you must first run +./h5redeploy in the bin directory to change site specific paths in the scripts. + +You may also need to change other variables in the scripts, depending +on how things are set up on your system. Here are some of the variables +to check: + + prefix - Path to the HDF5 top level installation directory + CCBASE - Name of the C compiler + CLINKERBASE - Name of the linker + LIBS - Libraries your application will link with + +For further details refer to the INSTALL files in + ftp://ftp.hdfgroup.org/HDF5/current/src/unpacked/release_docs/ +or in the ./release_docs/ directory of the HDF5 source code, which can be found +on the HDF Group ftp server at ftp://ftp.hdfgroup.org/HDF5/current/src/. + +Please send questions, comments, and suggestions to the appropriate +contact address from http://www.hdfgroup.org/about/contact.html + + +"; + +my $indirectory = "."; +$indirectory = shift; +my $linktype = "shared"; +if ($indirectory =~ /static/) { + $linktype = "static"; +} +my $modestring=""; +if ($indirectory =~ /32/) { + $modestring = "in 32 bit mode "; +} + +my $version; + +my $outfile = "$indirectory/README"; +open OUTFILE, ">$outfile" or die "$!Couldn't open $outfile - check permissions for $indirectory\n"; +my $hostname; +my $cmd = "grep \"HDF5 Version\" $indirectory/lib/libhdf5.settings"; +$_ = `$cmd`; +#print OUTFILE $_, "\n"; +s/HDF5 Version://; +s/^\s+//; +chomp; +$version = $_; +#print OUTFILE $_, "\n"; + +my $versionstring= "This directory contains the $linktype binary distribution of HDF5-".$version; + +$cmd = "grep \"Uname information:\" $indirectory/lib/libhdf5.settings"; +$_ = `$cmd`; +s/Uname information://; +s/^\s+//; +#print OUTFILE $_; +chomp; +#s/(^\w+)(\s)(\S+)/$1/; +#s/(^.*)(-)(.*)(200[7-8])(.*)(\s)(\S+)/$1 $5/; +#my $platformstring = "\nthat was compiled on:" . $_ . " "; +my $platformstring = ""; +my $hostnamestring = $_; +my @hostnamestring = split / /, $hostnamestring; +#print OUTFILE "Size of hostnamestring is ", scalar @hostnamestring, "\n"; +#print OUTFILE $hostnamestring[0] . "\t" . $hostnamestring[2]."\t".$hostnamestring[19]."\n"; +$hostname = $hostnamestring[1]; +#my $size = scalar @hostnamestring; +if ($hostname =~ /loyalty/) { + $platformstring = "\nthat was compiled " . $modestring . "on: " . $hostnamestring[0]." " . $hostnamestring[2]." " . $hostnamestring[-1] . " "; +} +elsif ($hostname =~ /freedom/) { + $platformstring = "\nthat was compiled " . $modestring . "on: " . $hostnamestring[0]." " . $hostnamestring[2]." " . $hostnamestring[-1] . " "; +} elsif ($hostname =~ /emu/) { + $platformstring = "\nthat was compiled " . $modestring . "on: " . $hostnamestring[0]." " . $hostnamestring[2] . " " . $hostnamestring[-2] . " "; +} elsif ($hostname =~ /fred/) { + $platformstring = "\nthat was compiled " . $modestring . "on: " . $hostnamestring[0]." " . $hostnamestring[2] . " " . $hostnamestring[-1] . " "; +} else { + $_ = $hostnamestring[2]; + my $pos = index $_, '-'; + my $os = substr $_, 0, $pos; + $platformstring = "\nthat was compiled " . $modestring . "on: " . $hostnamestring[0] . " " . $os . " " . $hostnamestring[-2] . " "; +} + + +my $mappingstring = ""; +#no mappingstring for 1.6. Put it back for 1.8. +#$cmd = "grep \"Default API Mapping:\" $indirectory/lib/libhdf5.settings"; +#$_ = `$cmd`; +#s/Default API Mapping://; +#s/^\s+//; +#chomp; +#if (/v\d+/) { +# s/v//; +# s/(\d)(\d)/$1\.$2/g; +# $mappingstring = "using the default\nAPI mapping for VERSION ".$_."."; +# +#} +print OUTFILE $versionstring; +print OUTFILE $platformstring."\n\n"; +#print OUTFILE $mappingstring; + +#if ($hostname eq "loyalty.hdfgroup.uiuc.edu" || $hostname eq "freedom.hdfgroup.uiuc.edu") { +# print OUTFILE " It includes the C APIs,\nbuilt using the following "; +# print OUTFILE "compilers:\n\n"; +#} +#else { +if ($linktype eq "shared" && !($hostname =~ /32/)) { + print OUTFILE "\n\nIt includes the C, C++, F90 and Java APIs, built using the following\n"; +} else { + print OUTFILE "\n\nIt includes the C, C++, and F90 APIs, built using the following\n"; +} +print OUTFILE "compilers:\n\n"; +#} + +# Only the gcc compiler version is in libhdf5.settings, so for now I looked +# up the versions and hardcoded them here. We will put them in libhdf5.settings +# for the next release. +if ($indirectory =~ /gnu484/) { + print OUTFILE "\tgcc, g++, and gfortran 4.8.4\n\n"; +} elsif ($hostname =~ /jam/ || $hostname =~ /koala/) { + print OUTFILE "\tgcc, g++, and gfortran 4.1.2\n\n"; +} elsif ($hostname =~ /platypus/) { + print OUTFILE "\tgcc, g++, and gfortran 4.4.7\n\n"; + if ($linktype eq "shared" && !($hostname =~ /32/)) { + print OUTFILE "\tjava 1.8.0_51\n\n"; + } +} elsif ($hostname =~ /moohan/) { + print OUTFILE "\tgcc, g++, and gfortran 4.8.5\n\n"; + if ($linktype eq "shared" && !($hostname =~ /32/)) { + print OUTFILE "\tjava 1.8.0_51\n\n"; + } +} elsif ($hostname =~ /emu/) { + print OUTFILE "\tSun C and C++ 5.12, Sun Fortran 95 8.6\n\n"; +} elsif ($hostname =~ /loyalty/ || $hostname =~ /freedom/) { + print OUTFILE "\tgcc, g++, and gfortran 4.6.1\n\n"; +} elsif ($hostname =~ /duck/) { + print OUTFILE "\tApple clang/clang++ 3.0 from Xcode 4.6.1 and gfortran 4.8.2\n\n"; +} elsif ($hostname =~ /kite/) { + print OUTFILE "\tApple clang/clang++ 5.1 from Xcode 5.0.2 and gfortran 4.8.2\n\n"; +} elsif ($hostname =~ /quail/) { + print OUTFILE "\tgcc, g++ 5.1 from Xcode 5.1 and gfortran 4.8.2\n\n"; +} elsif ($hostname =~ /osx1010test/) { + print OUTFILE "\tgcc, g++ 5.1 from Xcode 5.1 and gfortran 4.8.2\n\n"; +} + +print OUTFILE $section2; + +print OUTFILE $section3; + +print OUTFILE $section4; + diff --git a/bin/pkgscrpts/makeOuterREADME.pl b/bin/pkgscrpts/makeOuterREADME.pl new file mode 100755 index 0000000..602ad28 --- /dev/null +++ b/bin/pkgscrpts/makeOuterREADME.pl @@ -0,0 +1,182 @@ +#!/usr/bin/perl +# makeOuterREADME.pl + +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF4. The full HDF4 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF4 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF4/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# + +use warnings; +use strict; + +my $indirectory = "."; +$indirectory = shift; + +my $outdirectory = "."; +$outdirectory = shift; + +my $outsubdir = shift; + +my $version; + +my $outfile = "$outdirectory/$outsubdir/README"; +open OUTFILE, ">$outfile"; +my $hostname=""; +my $cmd = "grep \"HDF5 Version\" $indirectory-static/lib/libhdf5.settings"; +$_ = `$cmd`; +print OUTFILE $_, "\n"; +s/HDF5 Version://; +s/^\s+//; +chomp; +$version = $_; +#print OUTFILE $_, "\n"; +my $versionstring= "This directory contains the precompiled HDF5 $version binary distribution\n(include files, libraries, utilities) for"; + +$cmd = "grep \"Uname information:\" $indirectory-static/lib/libhdf5.settings"; +$_ = `$cmd`; +s/Uname information://; +s/^\s+//; +chomp; +print "String to work with is $_\n"; +my $platformstring = ""; +my $hostnamestring = $_; +my @hostnamestring = split / /, $hostnamestring; +$platformstring = "$hostnamestring[0] "; +if ($indirectory =~ /jam/ || $indirectory =~ /koala/) { + $hostnamestring = $hostnamestring[2]; + my $pos = index $hostnamestring, "-"; + if ($pos > 0) { + $platformstring .= substr $hostnamestring, 0, $pos; + } else { + $platformstring .= $hostnamestring[2]; + } + $platformstring .= " ".$hostnamestring[-3]; +} elsif ($indirectory =~ /linew/) { + $platformstring .= "$hostnamestring[2] $hostnamestring[-2]"; +} else { + $platformstring .= "$hostnamestring[2] $hostnamestring[-1]"; +} + +print OUTFILE $versionstring." ".$platformstring.":\n\n"; +my $line1; +my $line3; +my $line5; +my $compilerstring=""; +my $compilerstring1=""; +my $compilerstring2=""; + + +print $indirectory, "\n"; + +if ($indirectory =~ /ostrich/) { +# $line1 = " hdf5-$version-$outsubdir-16API.tar.gz - Includes C, C++, F90 APIs (using\n"; + $line3 = " hdf5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using"; + $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 APIs (using"; + $compilerstring = " gcc, g++, and gfortran 4.4.7)"; +} +elsif ($indirectory =~ /platypus/) { +# $line1 = " hdf5-$version-$outsubdir-16API.tar.gz - Includes C, C++, F90 APIs (using\n"; + $line3 = " hdf5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using"; + $compilerstring1 = " gcc, g++, and gfortran 4.4.7)\n"; + if ($indirectory =~ /32/) { + $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 and Java APIs (using"; + $compilerstring2 = " gcc, g++, and gfortran 4.4.7)\n"; + } else { + $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 and Java APIs (using"; + $compilerstring2 = " gcc, g++, and gfortran 4.4.7 and java 1.8.0_51)\n"; + } +} +elsif ($indirectory =~ /moohan/) { +# $line1 = " hdf5-$version-$outsubdir-16API.tar.gz - Includes C, C++, F90 APIs (using\n"; + $line3 = " hdf5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using"; + $compilerstring1 = " gcc, g++, and gfortran 4.8.5)\n"; + if ($indirectory =~ /32/) { + $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 and Java APIs (using"; + $compilerstring2 = " gcc, g++, and gfortran 4.4.7)\n"; + } else { + $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 and Java APIs (using"; + $compilerstring2 = " gcc, g++, and gfortran 4.8.5 and java 1.8.0_51)\n"; + } +} +elsif ($indirectory =~ /emu/) { +# $line1 = " hdf5-$version-$outsubdir-16API.tar.gz - Includes C, C++, F90 APIs (using\n"; + $line3 = " hdf5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using"; + $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 APIs (using"; + $compilerstring = " Sun C and C++ 5.12, Sun Fortran 95 8.6)\n"; +} +elsif ($indirectory =~ /kite/) { + $line3 = " hfd5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using"; + $line5 = " hfd5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 APIs (using"; + $compilerstring = " Apple clang/clang++ 5.1 from Xcode 5.0.2, + gfortran 4.8.2)\n"; +} +elsif ($indirectory =~ /quail/) { + $line3 = " hfd5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using"; + $line5 = " hfd5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 APIs (using"; + $compilerstring = " Apple clang/clang++ 6.0 from Xcode 5.1, + gfortran 4.9.2)\n"; +} +elsif ($indirectory =~ /osx1010test/) { + $line3 = " hdf5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using"; + $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 APIs (using"; + $compilerstring = " Apple clang/clang++ 6.1 from Xcode 6.1, + gfortran 4.9.2)\n"; +} +elsif ($indirectory =~ /osx1011test/) { + $line3 = " hdf5-$version-$outsubdir-static.tar.gz - Includes C, C++, F90 APIs (using"; + $line5 = " hdf5-$version-$outsubdir-shared.tar.gz - Includes C, C++, F90 APIs (using"; + $compilerstring = " Apple clang/clang++ 7.0.2 from Xcode 7.0, + gfortran 5.2.0)\n"; +} + + print OUTFILE $line3; + print OUTFILE $compilerstring1."\n"; +if ($line5 ne "") { + print OUTFILE $line5; + print OUTFILE $compilerstring2."\n"; +} +#elsif ($indirectory =~ /-16API/) { +# print OUTFILE $line1; +# print OUTFILE $compilerstring; +# print OUTFILE " USES THE VERSION 1.6 DEFAULT API\n"; +# print OUTFILE " MAPPING.\n\n"; +#} + +print OUTFILE " utilities/ - Directory containing the compiled HDF5 utilities.\n"; +print OUTFILE " These utilities are STATICALLY linked and will run as is.\n\n"; +#print OUTFILE " The tools can be downloaded separately, or ALL in one\n"; +#print OUTFILE " compressed file (5-$version-$outsubdir-static-util.tar.gz).\n\n"; +print OUTFILE "\n"; +print OUTFILE "To obtain the HDF5 distribution, 'unzip' and 'untar' the distribution\n"; +print OUTFILE "file:\n\n"; +print OUTFILE " gzip -cd | tar xvf -\n"; + + +#$cmd = "grep \"Configured by:\" $indirectory/$key-static/lib/libhdf5.settings"; +#$_ = `$cmd`; +#s/Configured by://; +#s/^\s+//; +#print OUTFILE $_; +#chomp; +#my $hostnamestring = $_; +#s/(^\w+)(\s)(\S+)/$1/; +#s/(^.*)(-)(.*)(200[7-8])(.*)(\s)(\S+)/$1 $5/; +#my $platformstring = $_ . ":\n\n"; +#my @hostnamestring = split /@/, $hostnamestring; +#print "Size of hostnamestring is ", scalar @hostnamestring, "\n"; +#print $hostnamestring[0] . "\t" . $hostnamestring[2]."\t".$hostnamestring[19]."\n"; +#my $platformstring = $hostnamestring[1].":\n\n"; +#$hostnamestring = $hostnamestring[1]; +#my $pos = index $hostnamestring, "."; +#if ($pos > 0) { +# @hostnamestring = split /\./, $hostnamestring; +# $platformstring = $hostnamestring[0].":\n\n"; +#} -- cgit v0.12