aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/libqglviewer.rb
blob: 123c593780f03ff2f47ff8983dc78d42e742898c (plain)
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
require 'formula'

class Libqglviewer < Formula
  homepage 'http://www.libqglviewer.com/'
  url 'http://www.libqglviewer.com/src/libQGLViewer-2.3.16.tar.gz'
  md5 'e5b358a5af2e8aeeab91021770b10211'

  depends_on 'qt'

  def options
    [
      ['--universal', "Build both x86_64 and x86 architectures."],
    ]
  end

  def patches
    DATA
  end

  def install
    args = ["PREFIX=#{prefix}"]

    if ARGV.include? '--universal'
      args << "CONFIG += x86 x86_64"
    end

    cd 'QGLViewer' do
      system "qmake", *args
      system "make"
    end
  end

  def caveats
     <<-EOS.undent
      To avoid issues with runtime linking and facilitate usage of the library:
        sudo ln -s "#{prefix}/QGLViewer.framework" "/Library/Frameworks/QGLViewer.framework"
    EOS
  end
end

__END__
--- a/QGLViewer/QGLViewer.pro
+++ b/QGLViewer/QGLViewer.pro
@@ -246,7 +246,7 @@
     FRAMEWORK_HEADERS.path = Headers
     QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS

-    DESTDIR = ~/Library/Frameworks/
+    DESTDIR = $${PREFIX}

     QMAKE_POST_LINK=cd $$DESTDIR/QGLViewer.framework/Headers && ln -s . QGLViewer