From 3bdf411abd6f145cb602b73f48a275dbad2200ce Mon Sep 17 00:00:00 2001 From: Ian Lancaster Date: Thu, 5 Feb 2015 22:33:09 -0500 Subject: [PATCH] open-scene-graph 3.3.3 Closes Homebrew/homebrew#36587. Signed-off-by: Mike McQuaid --- Formula/open-scene-graph.rb | 118 ++++++++++++++---------------------- 1 file changed, 44 insertions(+), 74 deletions(-) diff --git a/Formula/open-scene-graph.rb b/Formula/open-scene-graph.rb index 8a196aa8ef..809c2f6a6f 100644 --- a/Formula/open-scene-graph.rb +++ b/Formula/open-scene-graph.rb @@ -1,25 +1,7 @@ -require 'formula' - class OpenSceneGraph < Formula - homepage 'http://www.openscenegraph.org/projects/osg' - revision 1 - - stable do - url "http://trac.openscenegraph.org/downloads/developer_releases/OpenSceneGraph-3.2.0.zip" - sha1 "c20891862b5876983d180fc4a3d3cfb2b4a3375c" - - # Build fixes for clang/c++11 - patch do - url "https://github.com/openscenegraph/osg/commit/f71491786ac2d22ef16f9f5ed31de0f6666c6600.diff" - sha1 "d96fe3dc1a01c8ad096433ef07f02803c2bf9206" - end - - # Fix freetype detection - patch do - url "https://github.com/openscenegraph/osg/commit/3063b45aba74a0cfc693d46866084cde0d8959e2.diff" - sha1 "8a2a0e8384a30e3adb2820786f91adb52ba69cd9" - end - end + homepage "http://www.openscenegraph.org/projects/osg" + url "http://trac.openscenegraph.org/downloads/developer_releases/OpenSceneGraph-3.3.3.zip" + sha1 "98697c3e3b3c6e7e2ec7a6a75ece8f790b709cd7" bottle do sha1 "39ebd1c9cb19056e150b7087586e1e63a9546288" => :mavericks @@ -27,44 +9,40 @@ class OpenSceneGraph < Formula sha1 "16055dc346e3a892c1083e08c40d32d37c2e10f0" => :lion end - head 'http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/' + head "http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/" option :cxx11 option "with-docs", "Build the documentation with Doxygen and Graphviz" deprecated_option "docs" => "with-docs" - depends_on 'cmake' => :build - depends_on 'pkg-config' => :build - depends_on 'jpeg' - depends_on 'wget' - depends_on 'gtkglext' - depends_on 'freetype' - depends_on 'gdal' => :optional - depends_on 'jasper' => :optional - depends_on 'openexr' => :optional - depends_on 'dcmtk' => :optional - depends_on 'librsvg' => :optional - depends_on 'collada-dom' => :optional - depends_on 'gnuplot' => :optional - depends_on 'ffmpeg' => :optional - depends_on 'qt5' => :optional - depends_on 'qt' => :optional + depends_on "cmake" => :build + depends_on "pkg-config" => :build + depends_on "jpeg" + depends_on "wget" + depends_on "gtkglext" + depends_on "freetype" + depends_on "gdal" => :optional + depends_on "jasper" => :optional + depends_on "openexr" => :optional + depends_on "dcmtk" => :optional + depends_on "librsvg" => :optional + depends_on "collada-dom" => :optional + depends_on "gnuplot" => :optional + depends_on "ffmpeg" => :optional + depends_on "qt5" => :optional + depends_on "qt" => :optional if build.with? "docs" depends_on "doxygen" => :build depends_on "graphviz" => :build end - # Fix osgQt for Qt 5.2 - # Reported upstream http://forum.openscenegraph.org/viewtopic.php?t=13206 - patch :DATA - def install ENV.cxx11 if build.cxx11? # Turning off FFMPEG takes this change or a dozen "-DFFMPEG_" variables - if build.without? 'ffmpeg' - inreplace 'CMakeLists.txt', 'FIND_PACKAGE(FFmpeg)', '#FIND_PACKAGE(FFmpeg)' + if build.without? "ffmpeg" + inreplace "CMakeLists.txt", "FIND_PACKAGE(FFmpeg)", "#FIND_PACKAGE(FFmpeg)" end args = std_cmake_args @@ -82,41 +60,33 @@ class OpenSceneGraph < Formula args << "-DCOLLADA_INCLUDE_DIR=#{Formula["collada-dom"].opt_include}/collada-dom" end - if build.with? 'qt5' + if build.with? "qt5" args << "-DCMAKE_PREFIX_PATH=#{Formula["qt5"].opt_prefix}" - elsif build.with? 'qt' + elsif build.with? "qt" args << "-DCMAKE_PREFIX_PATH=#{Formula["qt"].opt_prefix}" end - args << '..' - - mkdir 'build' do - system 'cmake', *args - system 'make' + mkdir "build" do + system "cmake", "..", *args + system "make" system "make", "doc_openscenegraph" if build.with? "docs" - system 'make install' - if build.with? "docs" - doc.install Dir["#{prefix}/doc/OpenSceneGraphReferenceDocs/*"] - end + system "make", "install" + doc.install Dir["#{prefix}/doc/OpenSceneGraphReferenceDocs/*"] if build.with? "docs" end end + + test do + (testpath/"test.cpp").write <<-EOS.undent + #include + #include + using namespace std; + int main() + { + cout << osgGetVersion() << endl; + return 0; + } + EOS + system ENV.cxx, "test.cpp", "-I#{include}", "-L#{lib}", "-losg", "-o", "test" + assert_equal `./test`.chomp, version.to_s + end end - -__END__ -diff --git a/src/osgQt/CMakeLists.txt b/src/osgQt/CMakeLists.txt -index 43afffe..6c62e73 100644 ---- a/src/osgQt/CMakeLists.txt -+++ b/src/osgQt/CMakeLists.txt -@@ -13,7 +13,11 @@ SET(SOURCES_H - ) - - IF ( Qt5Widgets_FOUND ) -- QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" ) -+ IF (Qt5Widgets_VERSION VERSION_LESS 5.2.0) -+ QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" ) -+ ELSE() -+ QT5_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} ) -+ ENDIF() - ELSE() - QT4_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" ) - ENDIF()