#!/usr/bin/perl # makeInternalREADME.pl use warnings; use strict; my $section2="For information on compilers and settings used to build these HDF4 libraries, please refer to: ./lib/libhdf4.settings The contents of this directory are: COPYING - Copyright notice README - This file RELEASE.txt - Detailed information regarding this release bin/ - Directory containing HDF4 pre-compiled utilities include/ - Directory containing HDF4 include files lib/ - Directory containing HDF4 libraries and settings share/ - Directory containing example code in C, and Fortran using HDF4 library APIs. The shell scripts provided with these examples will compile and run them, and will also test the h4cc and h4fc 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. The official ZLIB and SZIP pages are at: ZLIB: http://www.zlib.net/ SZIP: https://portal.hdfgroup.org/display/HDF5/Szip+Compression+in+HDF+Products "; my $section3 = "If using the shared libraries, you must add the HDF4 library path to the LD_LIBRARY_PATH variable. "; my $section4 = "We provide scripts for compiling applications with the HDF4 libraries: bin/h4cc - for C bin/h4fc - for F90 (if Fortran 90 library is included with the binaries) After you have installed the binaries to their final destination, you can use these scripts (h4cc, h4fc) to compile. However, you must first run ./h4redeploy 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 HDF4 top level installation directory CCBASE - Name of the C compiler CLINKERBASE - Name of the linker LIBS - Libraries your application will link with For more information see the HDF Support Portal: https://portal.hdfgroup.org/display/support HDF4 Documentation can be found here: https://portal.hdfgroup.org/display/HDF4/HDF4 "; my $indirectory = "."; $indirectory = shift; my $linktype = "shared"; my $cmd = "grep \"Shared Libraries: no\" $indirectory/lib/libhdf4.settings"; $_ = `$cmd`; if ($_ =~ /no/) { $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 \"HDF4 Version\" $indirectory/lib/libhdf4.settings"; $_ = `$cmd`; #print OUTFILE $_, "\n"; s/HDF4 Version://; s/^\s+//; chomp; $version = $_; #print OUTFILE $_, "\n"; my $versionstring= "This directory contains the $linktype binary distribution of HDF-".$version; $cmd = "grep \"Uname information:\" $indirectory/lib/libhdf4.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 =~ /emu/) { $platformstring = "\nthat was compiled " . $modestring . "on: " . $hostnamestring[0]." " . $hostnamestring[2] . " " . $hostnamestring[-2] . " "; } 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 and Java APIs, built using the following\n"; } else { print OUTFILE "\n\nIt includes the 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 ($hostname =~ /platypus/) { if ($linktype eq "shared" && !($hostname =~ /32/)) { print OUTFILE "\tgcc 4.4.7 and java 1.8.0_51\n\n"; } else { print OUTFILE "\tgcc and gfortran 4.4.7\n\n"; } } elsif ($hostname =~ /moohan/ || $hostname =~ /kituo/ || $hostname =~ /jelly/) { if ($linktype eq "shared" && !($hostname =~ /32/)) { print OUTFILE "\tgcc 4.8.5 and java 1.8.0\n\n"; } else { print OUTFILE "\tgcc and gfortran 4.8.5\n\n"; } } elsif ($hostname =~ /emu/) { print OUTFILE "\tSun C 5.12, Sun Fortran 95 8.6\n\n"; } elsif ($hostname =~ /kite/) { if ($linktype eq "shared") { print OUTFILE "\tApple clang 8.1 and java 1.8.0\n\n"; } else { print OUTFILE "\tApple clang 8.1 and gfortran 7.1.0\n\n"; } } elsif ($hostname =~ /osx1010dev/) { if ($linktype eq "shared") { print OUTFILE "\tApple clang 6.1 and java 1.8.0\n\n"; } else { print OUTFILE "\tApple clang 6.1 and gfortran 4.9.2\n\n"; } } elsif ($hostname =~ /osx1011dev/) { if ($linktype eq "shared") { print OUTFILE "\tApple clang 7.3 and java 1.8.0\n\n"; } else { print OUTFILE "\tApple clang 7.3 and gfortran 5.2.0\n\n"; } } print OUTFILE $section2; print OUTFILE $section3; print OUTFILE $section4;