forked from camphogg/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdcm.rb
41 lines (32 loc) · 1.01 KB
/
gdcm.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
require "formula"
class Gdcm < Formula
homepage "http://sourceforge.net/projects/gdcm/"
url "https://downloads.sourceforge.net/project/gdcm/gdcm%202.x/GDCM%202.4.1/gdcm-2.4.1.tar.bz2"
sha1 "1ba1b46455b962d78f0ad4863872ab06019f3c23"
option "with-check", "Run the GDCM test suite"
depends_on "cmake" => :build
def install
sourcedir = "#{pwd}/source_files"
builddir = "#{pwd}/build_files"
targets = Dir.glob("*")
mkdir sourcedir
targets.each do |target|
mv target, File.join(sourcedir, File.basename(target))
end
mkdir builddir do
args = std_cmake_args
args << "-DGDCM_BUILD_APPLICATIONS=ON"
args << "-DGDCM_BUILD_EXAMPLES=ON"
args << "-DGDCM_BUILD_SHARED_LIBS=ON"
args << "-DGDCM_BUILD_TESTING=ON" if build.with? "check"
args << sourcedir
system "cmake", *args
system "make"
system "make", "test" if build.with? "check"
system "make", "install"
end
end
test do
system "#{bin}/gdcminfo", "--version"
end
end