From: Jakub Bogusz Date: Sun, 14 Jul 2013 14:17:53 +0000 (+0200) Subject: - updated java and python build X-Git-Tag: auto/th/OpenColorIO-1.0.8-1 X-Git-Url: http://git.pld-linux.org/?p=packages%2FOpenColorIO.git;a=commitdiff_plain;h=a05bc41edfc3e68aa345af2f57be621eb327a3cc - updated java and python build - added WIP patch for yaml-cpp 0.5 (unfinished, so stick to yaml-cpp 0.3 for now) --- diff --git a/OpenColorIO-yaml-cpp.patch b/OpenColorIO-yaml-cpp.patch new file mode 100644 index 0000000..fbb45b1 --- /dev/null +++ b/OpenColorIO-yaml-cpp.patch @@ -0,0 +1,215 @@ +--- imageworks-OpenColorIO-8883824/src/core/Config.cpp.orig 2012-12-12 00:21:23.000000000 +0100 ++++ imageworks-OpenColorIO-8883824/src/core/Config.cpp 2013-05-25 18:28:05.264387301 +0200 +@@ -240,35 +240,27 @@ OCIO_NAMESPACE_ENTER + if(node.Tag() != "View") + return; + +- std::string key, stringval; +- +- for (YAML::Iterator iter = node.begin(); ++ for (YAML::const_iterator iter = node.begin(); + iter != node.end(); + ++iter) + { +- iter.first() >> key; ++ std::string key = iter->first.as(); + + if(key == "name") + { +- if (iter.second().Type() != YAML::NodeType::Null && +- iter.second().Read(stringval)) +- v.name = stringval; ++ v.name = iter->second.as(); + } + else if(key == "colorspace") + { +- if (iter.second().Type() != YAML::NodeType::Null && +- iter.second().Read(stringval)) +- v.colorspace = stringval; ++ v.colorspace = iter->second.as(); + } + else if(key == "looks" || key == "look") + { +- if (iter.second().Type() != YAML::NodeType::Null && +- iter.second().Read(stringval)) +- v.looks = stringval; ++ v.looks = iter->second.as(); + } + else + { +- LogUnknownKeyWarning(node.Tag(), iter.first()); ++ LogUnknownKeyWarning(node.Tag(), iter->first); + } + } + +@@ -391,7 +383,24 @@ OCIO_NAMESPACE_ENTER + + + } // namespace +- ++ ++} ++ ++namespace YAML { ++ template<> ++ struct convert { ++ static bool decode(const Node &n, View &v) ++ { ++ if(node.Tag() != "View") ++ return false; ++ n >> v; ++ return true; ++ } ++ }; ++} ++ ++OCIO_NAMESPACE_ENTER ++{ + class Config::Impl + { + public: +@@ -1658,13 +1667,11 @@ OCIO_NAMESPACE_ENTER + { + try + { +- YAML::Parser parser(istream); +- YAML::Node node; +- parser.GetNextDocument(node); ++ YAML::Node node = YAML::Load(istream); + + // check profile version + int profile_version = 0; +- if(node.FindValue("ocio_profile_version") == NULL) ++ if(!node["ocio_profile_version"]) + { + std::ostringstream os; + os << "The specified file "; +@@ -1672,7 +1679,7 @@ OCIO_NAMESPACE_ENTER + throw Exception (os.str().c_str()); + } + +- node["ocio_profile_version"] >> profile_version; ++ profile_version = node["ocio_profile_version"].as(); + if(profile_version > 1) + { + std::ostringstream os; +@@ -1690,40 +1697,30 @@ OCIO_NAMESPACE_ENTER + } + + +- std::string key, stringval; +- bool boolval = false; +- +- for (YAML::Iterator iter = node.begin(); ++ for (YAML::iterator iter = node.begin(); + iter != node.end(); + ++iter) + { +- iter.first() >> key; ++ std::string key = iter->first.as(); + + if(key == "ocio_profile_version") { } // Already handled above. + else if(key == "search_path" || key == "resource_path") + { +- if (iter.second().Type() != YAML::NodeType::Null && +- iter.second().Read(stringval)) +- context_->setSearchPath(stringval.c_str()); ++ context_->setSearchPath(iter->second.as().c_str()); + } + else if(key == "strictparsing") + { +- if (iter.second().Type() != YAML::NodeType::Null && +- iter.second().Read(boolval)) +- strictParsing_ = boolval; ++ strictParsing_ = iter->second.as(); + } + else if(key == "description") + { +- if (iter.second().Type() != YAML::NodeType::Null && +- iter.second().Read(stringval)) +- description_ = stringval; ++ description_ = iter->second.as(); + } + else if(key == "luma") + { + std::vector val; +- if (iter.second().Type() != YAML::NodeType::Null) + { +- iter.second() >> val; ++ val = iter->second.as< std::vector >(); + if(val.size() != 3) + { + std::ostringstream os; +@@ -1736,46 +1733,35 @@ OCIO_NAMESPACE_ENTER + } + else if(key == "roles") + { +- const YAML::Node& roles = iter.second(); ++ const YAML::Node& roles = iter->second; + if(roles.Type() != YAML::NodeType::Map) + { + std::ostringstream os; + os << "'roles' field needs to be a (name: key) map."; + throw Exception(os.str().c_str()); + } +- for (YAML::Iterator it = roles.begin(); ++ for (YAML::const_iterator it = roles.begin(); + it != roles.end(); ++it) + { +- std::string k, v; +- it.first() >> k; +- it.second() >> v; +- roles_[pystring::lower(k)] = v; ++ roles_[pystring::lower(it->first.as())] = it->second.as(); + } + } + else if(key == "displays") + { +- if (iter.second().Type() != YAML::NodeType::Null) +- { +- iter.second() >> displays_; +- } ++ //displays_ = iter->second.as(); ++ iter->second >> displays_; + } + else if(key == "active_displays") + { +- if (iter.second().Type() != YAML::NodeType::Null) +- { +- iter.second() >> activeDisplays_; +- } ++ activeDisplays_ = iter->second.as(); + } + else if(key == "active_views") + { +- if (iter.second().Type() != YAML::NodeType::Null) +- { +- iter.second() >> activeViews_; +- } ++ activeViews_ = iter->second.as(); + } + else if(key == "colorspaces") + { +- const YAML::Node& colorspaces = iter.second(); ++ const YAML::Node& colorspaces = iter->second; + + if(colorspaces.Type() != YAML::NodeType::Sequence) + { +@@ -1804,7 +1790,7 @@ OCIO_NAMESPACE_ENTER + } + else if(key == "looks") + { +- const YAML::Node& looks = iter.second(); ++ const YAML::Node& looks = iter->second; + + if(looks.Type() != YAML::NodeType::Sequence) + { +@@ -1833,7 +1819,7 @@ OCIO_NAMESPACE_ENTER + } + else + { +- LogUnknownKeyWarning("profile", iter.first()); ++ LogUnknownKeyWarning("profile", iter->first); + } + } + diff --git a/OpenColorIO.spec b/OpenColorIO.spec index 47a9801..6d0b2d9 100644 --- a/OpenColorIO.spec +++ b/OpenColorIO.spec @@ -24,6 +24,8 @@ Source0: https://github.com/imageworks/OpenColorIO/tarball/v%{version}/%{name}-% Patch0: %{name}-system-libs.patch Patch1: %{name}-java.patch Patch2: %{name}-libsuffix.patch +# for yaml-cpp 0.5.0 (unfinished) +Patch3: %{name}-yaml-cpp.patch URL: http://opencolorio.org/ # g++ with tr1 support or... #BuildRequires: boost-devel >= 1.34 @@ -35,6 +37,7 @@ BuildRequires: python-devel %{?with_docs:BuildRequires: sphinx-pdg >= 1.1} BuildRequires: tinyxml-devel >= 2.6.1 BuildRequires: yaml-cpp-devel >= 0.2.6 +BuildRequires: yaml-cpp-devel < 0.4.0 %if %{with opengl} BuildRequires: OpenGL-devel BuildRequires: OpenGL-glut-devel @@ -174,8 +177,7 @@ cd build %endif %{!?with_sse2:-DOCIO_USE_SSE=OFF} \ -DUSE_EXTERNAL_TINYXML=ON \ - -DUSE_EXTERNAL_YAML=ON \ - -DPYTHON_INCLUDE_LIB_PREFIX=ON + -DUSE_EXTERNAL_YAML=ON %{__make} @@ -185,10 +187,6 @@ rm -rf $RPM_BUILD_ROOT %{__make} -C build install \ DESTDIR=$RPM_BUILD_ROOT -# we use PYTHON_INCLUDE_LIB_PREFIX=ON so library is useful as C++ API -# but allow it to be loaded without lib prefix -ln -sf $(basename $RPM_BUILD_ROOT%{_libdir}/libPyOpenColorIO.so.*.*.*) $RPM_BUILD_ROOT%{_libdir}/PyOpenColorIO.so - # not needed when installing to /usr %{__rm} $RPM_BUILD_ROOT%{_datadir}/ocio/setup_ocio.sh # packaged as %doc @@ -244,16 +242,13 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) %ghost %{_libdir}/libOpenColorIO-JNI.so.1 %attr(755,root,root) %{_libdir}/libOpenColorIO-JNI.so %dir %{_datadir}/ocio -%{_datadir}/ocio/OpenColorIO-1.0.6.jar +%{_datadir}/ocio/OpenColorIO-%{version}.jar %endif %files -n python-OpenColorIO %defattr(644,root,root,755) -%attr(755,root,root) %{_libdir}/libPyOpenColorIO.so.*.*.* -%attr(755,root,root) %ghost %{_libdir}/libPyOpenColorIO.so.1 -%attr(755,root,root) %{_libdir}/PyOpenColorIO.so +%attr(755,root,root) %{py_sitedir}/PyOpenColorIO.so %files -n python-OpenColorIO-devel %defattr(644,root,root,755) -%attr(755,root,root) %{_libdir}/libPyOpenColorIO.so %{_includedir}/PyOpenColorIO