forked from lotia/homebrew-versions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hdf4.rb
74 lines (65 loc) · 2.28 KB
/
hdf4.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
require 'formula'
class Hdf4 < Formula
homepage 'http://www.hdfgroup.org'
url 'http://www.hdfgroup.org/ftp/HDF/releases/HDF4.2.10/src/hdf-4.2.10.tar.bz2'
sha1 '5163543895728dabb536a0659b3d965d55bccf74'
option 'enable-fortran', 'Build Fortran interface.'
depends_on 'cmake' => :build
depends_on 'pkg-config' => :build
depends_on 'szip'
depends_on 'jpeg'
depends_on :fortran if build.include? 'enable-fortran'
def patches
# redefine library name to "df" from "hdf". this seems to be an artifact
# of using cmake that needs to be corrected for compatibility with
# anything depending on hdf4.
DATA
end
def install
ENV['SZIP_INSTALL'] = HOMEBREW_PREFIX
args = std_cmake_args
args.concat [
'-DBUILD_SHARED_LIBS=ON',
'-DBUILD_TESTING=OFF',
'-DHDF4_BUILD_TOOLS=ON',
'-DHDF4_BUILD_UTILS=ON',
'-DHDF4_BUILD_WITH_INSTALL_NAME=ON',
'-DHDF4_ENABLE_JPEG_LIB_SUPPORT=ON',
'-DHDF4_ENABLE_NETCDF=OFF', # Conflict. Just install NetCDF for this.
'-DHDF4_ENABLE_SZIP_ENCODING=ON',
'-DHDF4_ENABLE_SZIP_SUPPORT=ON',
'-DHDF4_ENABLE_Z_LIB_SUPPORT=ON'
]
if build.include? 'enable-fortran'
args.concat %W[-DHDF4_BUILD_FORTRAN=ON -DCMAKE_Fortran_MODULE_DIRECTORY=#{include}]
else
args << '-DHDF4_BUILD_FORTRAN=OFF'
end
mkdir 'build' do
system 'cmake', '..', *args
system 'make install'
# Remove stray ncdump executable as it conflicts with NetCDF.
rm (bin + 'ncdump')
end
end
def caveats; <<-EOS.undent
HDF4 has been superseeded by HDF5. However, the API changed
substantially and some programs still require the HDF4 libraries in order
to function.
EOS
end
end
__END__
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba2cf13..27a3df4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -95,7 +95,7 @@ MARK_AS_ADVANCED (HDF4_NO_PACKAGES)
# Set the core names of all the libraries
#-----------------------------------------------------------------------------
SET (HDF4_LIB_CORENAME "hdf4")
-SET (HDF4_SRC_LIB_CORENAME "hdf")
+SET (HDF4_SRC_LIB_CORENAME "df")
SET (HDF4_SRC_FCSTUB_LIB_CORENAME "hdf_fcstub")
SET (HDF4_SRC_FORTRAN_LIB_CORENAME "hdf_fortran")
SET (HDF4_MF_LIB_CORENAME "mfhdf")