From 3e723d2951881b469acfe77e37c66cfa39ea6bca Mon Sep 17 00:00:00 2001 From: Kacper Kasper Date: Sat, 16 Dec 2017 13:24:23 +0100 Subject: [PATCH] openexr: enable on gcc2. --- media-libs/ilmbase/ilmbase-2.2.0.recipe | 8 +- .../ilmbase/patches/ilmbase-2.2.0.patchset | 167 ++++++++++ media-libs/openexr/openexr-2.2.0.recipe | 11 +- .../openexr/patches/openexr-2.2.0.patchset | 295 ++++++++++++++++++ 4 files changed, 477 insertions(+), 4 deletions(-) create mode 100644 media-libs/ilmbase/patches/ilmbase-2.2.0.patchset create mode 100644 media-libs/openexr/patches/openexr-2.2.0.patchset diff --git a/media-libs/ilmbase/ilmbase-2.2.0.recipe b/media-libs/ilmbase/ilmbase-2.2.0.recipe index ff330112a..1bd56ac35 100644 --- a/media-libs/ilmbase/ilmbase-2.2.0.recipe +++ b/media-libs/ilmbase/ilmbase-2.2.0.recipe @@ -12,11 +12,15 @@ LICENSE="BSD (3-clause)" COPYRIGHT="2002-2014 Industrial Light & Magic" SOURCE_URI="http://download.savannah.nongnu.org/releases/openexr/ilmbase-$portVersion.tar.gz" CHECKSUM_SHA256="ecf815b60695555c1fbc73679e84c7c9902f4e8faa6e8000d2f905b8b86cedc7" -REVISION="4" +REVISION="5" -ARCHITECTURES="!x86_gcc2 x86 x86_64" +ARCHITECTURES="x86_gcc2 x86 x86_64" SECONDARY_ARCHITECTURES="x86" +if [ $effectiveTargetArchitecture = "x86_gcc2" ]; then + PATCHES="ilmbase-2.2.0.patchset" +fi + PROVIDES=" ilmbase$secondaryArchSuffix = $portVersion lib:libhalf$secondaryArchSuffix = 12.0.0 compat >= 12 diff --git a/media-libs/ilmbase/patches/ilmbase-2.2.0.patchset b/media-libs/ilmbase/patches/ilmbase-2.2.0.patchset new file mode 100644 index 000000000..446cbf9bd --- /dev/null +++ b/media-libs/ilmbase/patches/ilmbase-2.2.0.patchset @@ -0,0 +1,167 @@ +From 253c255d474d66d6a7c6807ce0deb4ada9022659 Mon Sep 17 00:00:00 2001 +From: Kacper Kasper +Date: Sat, 16 Dec 2017 10:52:53 +0100 +Subject: gcc2 support + + +diff --git a/Half/eLut.cpp b/Half/eLut.cpp +index ce64b50..8deed8b 100644 +--- a/Half/eLut.cpp ++++ b/Half/eLut.cpp +@@ -110,5 +110,6 @@ main () + } + + cout << "};\n"; ++ cout.flush(); + return 0; + } +diff --git a/Half/toFloat.cpp b/Half/toFloat.cpp +index 001bc51..fd50b84 100644 +--- a/Half/toFloat.cpp ++++ b/Half/toFloat.cpp +@@ -135,7 +135,7 @@ int + main () + { + cout.precision (9); +- cout.setf (ios_base::hex, ios_base::basefield); ++ cout.setf (ios::hex, ios::basefield); + + cout << "//\n" + "// This is an automatically generated file.\n" +@@ -160,5 +160,6 @@ main () + } + + cout << "};\n"; ++ cout.flush(); + return 0; + } +diff --git a/Iex/IexBaseExc.cpp b/Iex/IexBaseExc.cpp +index 3b2e197..2fcf602 100644 +--- a/Iex/IexBaseExc.cpp ++++ b/Iex/IexBaseExc.cpp +@@ -151,6 +151,6 @@ iex_debugTrap() + { + // how to in Linux? + if (0 != ::getenv("IEXDEBUGTHROW")) +- __builtin_trap(); ++ abort(); + } + #endif +diff --git a/IexMath/IexMathFpu.h b/IexMath/IexMathFpu.h +index df2a3e5..c6ae73b 100644 +--- a/IexMath/IexMathFpu.h ++++ b/IexMath/IexMathFpu.h +@@ -69,7 +69,9 @@ int fpExceptions (); + // that will be called when SIGFPE occurs. + //------------------------------------------ + +-extern "C" typedef void (* FpExceptionHandler) (int type, const char explanation[]); ++extern "C" { ++ typedef void (* FpExceptionHandler) (int type, const char explanation[]); ++} + + void setFpExceptionHandler (FpExceptionHandler handler); + +diff --git a/Imath/ImathMatrix.h b/Imath/ImathMatrix.h +index 3e96c2f..533ad26 100644 +--- a/Imath/ImathMatrix.h ++++ b/Imath/ImathMatrix.h +@@ -3242,6 +3242,8 @@ Matrix44::shear (const Shear6 &h) + // Implementation of stream output + //-------------------------------- + ++#define ios_base ios ++ + template + std::ostream & + operator << (std::ostream &s, const Matrix33 &m) +@@ -3320,6 +3322,7 @@ operator << (std::ostream &s, const Matrix44 &m) + return s; + } + ++#undef ios_base + + //--------------------------------------------------------------- + // Implementation of vector-times-matrix multiplication operators +diff --git a/Imath/ImathVec.h b/Imath/ImathVec.h +index fb859eb..5fa0e91 100644 +--- a/Imath/ImathVec.h ++++ b/Imath/ImathVec.h +@@ -126,9 +126,6 @@ template class Vec2 + template + bool operator == (const Vec2 &v) const; + +- template +- bool operator != (const Vec2 &v) const; +- + + //----------------------------------------------------------------------- + // Compare two vectors and test if they are "approximately equal": +@@ -339,9 +336,6 @@ template class Vec3 + template + bool operator == (const Vec3 &v) const; + +- template +- bool operator != (const Vec3 &v) const; +- + //----------------------------------------------------------------------- + // Compare two vectors and test if they are "approximately equal": + // +@@ -524,9 +518,6 @@ template class Vec4 + template + bool operator == (const Vec4 &v) const; + +- template +- bool operator != (const Vec4 &v) const; +- + + //----------------------------------------------------------------------- + // Compare two vectors and test if they are "approximately equal": +@@ -969,14 +960,6 @@ Vec2::operator == (const Vec2 &v) const + return x == v.x && y == v.y; + } + +-template +-template +-inline bool +-Vec2::operator != (const Vec2 &v) const +-{ +- return x != v.x || y != v.y; +-} +- + template + bool + Vec2::equalWithAbsError (const Vec2 &v, T e) const +@@ -1432,14 +1415,6 @@ Vec3::operator == (const Vec3 &v) const + return x == v.x && y == v.y && z == v.z; + } + +-template +-template +-inline bool +-Vec3::operator != (const Vec3 &v) const +-{ +- return x != v.x || y != v.y || z != v.z; +-} +- + template + bool + Vec3::equalWithAbsError (const Vec3 &v, T e) const +@@ -1853,14 +1828,6 @@ Vec4::operator == (const Vec4 &v) const + return x == v.x && y == v.y && z == v.z && w == v.w; + } + +-template +-template +-inline bool +-Vec4::operator != (const Vec4 &v) const +-{ +- return x != v.x || y != v.y || z != v.z || w != v.w; +-} +- + template + bool + Vec4::equalWithAbsError (const Vec4 &v, T e) const +-- +2.15.0 + diff --git a/media-libs/openexr/openexr-2.2.0.recipe b/media-libs/openexr/openexr-2.2.0.recipe index e248b8259..76b558ea2 100644 --- a/media-libs/openexr/openexr-2.2.0.recipe +++ b/media-libs/openexr/openexr-2.2.0.recipe @@ -9,13 +9,17 @@ image file format." HOMEPAGE="http://www.openexr.com/" COPYRIGHT="2002-2014 Industrial Light & Magic" LICENSE="BSD (3-clause)" -REVISION="4" +REVISION="5" SOURCE_URI="http://download.savannah.nongnu.org/releases/openexr/openexr-$portVersion.tar.gz" CHECKSUM_SHA256="36a012f6c43213f840ce29a8b182700f6cf6b214bea0d5735594136b44914231" -ARCHITECTURES="!x86_gcc2 x86 x86_64" +ARCHITECTURES="x86_gcc2 x86 x86_64" SECONDARY_ARCHITECTURES="x86" +if [ $effectiveTargetArchitecture = "x86_gcc2" ]; then + PATCHES="openexr-$portVersion.patchset" +fi + PROVIDES=" openexr$secondaryArchSuffix = $portVersion lib:libilmimf$secondaryArchSuffix = 22.0.0 compat >= 22 @@ -70,6 +74,9 @@ ${pathSecondaryArchSuffix}/pkgconfig/IlmBase.pc | sed s/IlmBase\.pc//g) export PKG_CONFIG_PATH+=:$IlmBasePkgconfig ./bootstrap + if [ $effectiveTargetArchitecture = "x86_gcc2" ]; then + export CXXFLAGS="-ftemplate-depth-30" + fi runConfigure ./configure make $jobArgs } diff --git a/media-libs/openexr/patches/openexr-2.2.0.patchset b/media-libs/openexr/patches/openexr-2.2.0.patchset new file mode 100644 index 000000000..28a2849b2 --- /dev/null +++ b/media-libs/openexr/patches/openexr-2.2.0.patchset @@ -0,0 +1,295 @@ +From e8e55e976474b2816574ac1734e6f1b2c80033dd Mon Sep 17 00:00:00 2001 +From: Kacper Kasper +Date: Sat, 16 Dec 2017 12:02:34 +0100 +Subject: gcc2 support + + +diff --git a/IlmImf/ImfChannelListAttribute.cpp b/IlmImf/ImfChannelListAttribute.cpp +index 5549493..8fb8800 100644 +--- a/IlmImf/ImfChannelListAttribute.cpp ++++ b/IlmImf/ImfChannelListAttribute.cpp +@@ -46,6 +46,19 @@ OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER + + namespace { + ++template ++void checkIsNullTerminated (char (&str)[N], const char *what) ++{ ++ for (size_t i = 0; i < N; ++i) { ++ if (str[i] == '\0') ++ return; ++ } ++ std::stringstream s; ++ s << "Invalid " << what << ": it is more than " << (N - 1) ++ << " characters long."; ++ throw IEX_NAMESPACE::InputExc(s); ++} ++ + template + void checkIsNullTerminated (const char (&str)[N], const char *what) + { +diff --git a/IlmImf/ImfCheckedArithmetic.h b/IlmImf/ImfCheckedArithmetic.h +index 6a7fc15..43da516 100644 +--- a/IlmImf/ImfCheckedArithmetic.h ++++ b/IlmImf/ImfCheckedArithmetic.h +@@ -63,8 +63,11 @@ uiMult (T a, T b) + // Unsigned integer multiplication + // + +- IMF_STATIC_ASSERT (!std::numeric_limits::is_signed && +- std::numeric_limits::is_integer); ++ { ++ const bool c = !std::numeric_limits::is_signed && ++ std::numeric_limits::is_integer; ++ IMF_STATIC_ASSERT (c); ++ } + + if (a > 0 && b > std::numeric_limits::max() / a) + throw IEX_NAMESPACE::OverflowExc ("Integer multiplication overflow."); +@@ -81,8 +84,11 @@ uiDiv (T a, T b) + // Unsigned integer division + // + +- IMF_STATIC_ASSERT (!std::numeric_limits::is_signed && +- std::numeric_limits::is_integer); ++ { ++ const bool c = !std::numeric_limits::is_signed && ++ std::numeric_limits::is_integer; ++ IMF_STATIC_ASSERT (c); ++ } + + if (b == 0) + throw IEX_NAMESPACE::DivzeroExc ("Integer division by zero."); +@@ -99,8 +105,11 @@ uiAdd (T a, T b) + // Unsigned integer addition + // + +- IMF_STATIC_ASSERT (!std::numeric_limits::is_signed && +- std::numeric_limits::is_integer); ++ { ++ const bool c = !std::numeric_limits::is_signed && ++ std::numeric_limits::is_integer; ++ IMF_STATIC_ASSERT (c); ++ } + + if (a > std::numeric_limits::max() - b) + throw IEX_NAMESPACE::OverflowExc ("Integer addition overflow."); +@@ -117,8 +126,11 @@ uiSub (T a, T b) + // Unsigned integer subtraction + // + +- IMF_STATIC_ASSERT (!std::numeric_limits::is_signed && +- std::numeric_limits::is_integer); ++ { ++ const bool c = !std::numeric_limits::is_signed && ++ std::numeric_limits::is_integer; ++ IMF_STATIC_ASSERT (c); ++ } + + if (a < b) + throw IEX_NAMESPACE::UnderflowExc ("Integer subtraction underflow."); +@@ -145,8 +157,11 @@ checkArraySize (T n, size_t s) + // size_t (n). + // + +- IMF_STATIC_ASSERT (!std::numeric_limits::is_signed && +- std::numeric_limits::is_integer); ++ { ++ const bool c = !std::numeric_limits::is_signed && ++ std::numeric_limits::is_integer; ++ IMF_STATIC_ASSERT (c); ++ } + + IMF_STATIC_ASSERT (sizeof (T) <= sizeof (size_t)); + +diff --git a/IlmImf/ImfFastHuf.cpp b/IlmImf/ImfFastHuf.cpp +index 86c84dc..01edad4 100644 +--- a/IlmImf/ImfFastHuf.cpp ++++ b/IlmImf/ImfFastHuf.cpp +@@ -107,7 +107,7 @@ FastHufDecoder::FastHufDecoder + for (int i = 0; i <= MAX_CODE_LEN; ++i) + { + codeCount[i] = 0; +- base[i] = 0xffffffffffffffffL; ++ base[i] = 0xffffffffffffffffLL; + offset[i] = 0; + } + +@@ -352,7 +352,7 @@ FastHufDecoder::buildTables (Int64 *base, Int64 *offset) + + for (int i = 0; i <= MAX_CODE_LEN; ++i) + { +- if (base[i] != 0xffffffffffffffffL) ++ if (base[i] != 0xffffffffffffffffLL) + { + _ljBase[i] = base[i] << (64 - i); + } +@@ -362,7 +362,7 @@ FastHufDecoder::buildTables (Int64 *base, Int64 *offset) + // Unused code length - insert dummy values + // + +- _ljBase[i] = 0xffffffffffffffffL; ++ _ljBase[i] = 0xffffffffffffffffLL; + } + } + +@@ -417,7 +417,7 @@ FastHufDecoder::buildTables (Int64 *base, Int64 *offset) + + int minIdx = TABLE_LOOKUP_BITS; + +- while (minIdx > 0 && _ljBase[minIdx] == 0xffffffffffffffffL) ++ while (minIdx > 0 && _ljBase[minIdx] == 0xffffffffffffffffLL) + minIdx--; + + if (minIdx < 0) +@@ -427,7 +427,7 @@ FastHufDecoder::buildTables (Int64 *base, Int64 *offset) + // Set the min value such that the table is never tested. + // + +- _tableMin = 0xffffffffffffffffL; ++ _tableMin = 0xffffffffffffffffLL; + } + else + { +diff --git a/IlmImf/ImfHeader.cpp b/IlmImf/ImfHeader.cpp +index d6b55f3..212e623 100644 +--- a/IlmImf/ImfHeader.cpp ++++ b/IlmImf/ImfHeader.cpp +@@ -114,6 +114,19 @@ initialize (Header &header, + header.insert ("channels", ChannelListAttribute ()); + } + ++template ++void checkIsNullTerminated (char (&str)[N], const char *what) ++{ ++ for (size_t i = 0; i < N; ++i) { ++ if (str[i] == '\0') ++ return; ++ } ++ std::stringstream s; ++ s << "Invalid " << what << ": it is more than " << (N - 1) ++ << " characters long."; ++ throw IEX_NAMESPACE::InputExc(s); ++} ++ + template + void checkIsNullTerminated (const char (&str)[N], const char *what) + { +diff --git a/IlmImf/ImfStdIO.cpp b/IlmImf/ImfStdIO.cpp +index 1839a94..dfe518e 100644 +--- a/IlmImf/ImfStdIO.cpp ++++ b/IlmImf/ImfStdIO.cpp +@@ -95,7 +95,11 @@ checkError (ostream &os) + + StdIFStream::StdIFStream (const char fileName[]): + OPENEXR_IMF_INTERNAL_NAMESPACE::IStream (fileName), ++#ifdef HAVE_IOS_BASE + _is (new ifstream (fileName, ios_base::binary)), ++#else ++ _is (new ifstream (fileName, ios::binary)), ++#endif + _deleteStream (true) + { + if (!*_is) +@@ -158,7 +162,11 @@ StdIFStream::clear () + + StdOFStream::StdOFStream (const char fileName[]): + OPENEXR_IMF_INTERNAL_NAMESPACE::OStream (fileName), ++#ifdef HAVE_IOS_BASE + _os (new ofstream (fileName, ios_base::binary)), ++#else ++ _os (new ofstream (fileName, ios::binary)), ++#endif + _deleteStream (true) + { + if (!*_os) +diff --git a/IlmImf/ImfStringVectorAttribute.cpp b/IlmImf/ImfStringVectorAttribute.cpp +index 88fdf8e..bc4f15b 100644 +--- a/IlmImf/ImfStringVectorAttribute.cpp ++++ b/IlmImf/ImfStringVectorAttribute.cpp +@@ -65,7 +65,8 @@ StringVectorAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os + { + int strSize = _value[i].size(); + Xdr::write (os, strSize); +- Xdr::write (os, &_value[i][0], strSize); ++ std::string str = _value[i]; ++ Xdr::write (os, &str[0], strSize); + } + } + +diff --git a/IlmImf/b44ExpLogTable.cpp b/IlmImf/b44ExpLogTable.cpp +index 24e35fb..620b090 100644 +--- a/IlmImf/b44ExpLogTable.cpp ++++ b/IlmImf/b44ExpLogTable.cpp +@@ -131,6 +131,7 @@ main () + } + + cout << "};\n"; ++ cout.flush(); + + return 0; + } +diff --git a/exrenvmap/namespaceAlias.h b/exrenvmap/namespaceAlias.h +index bf488da..dbe9d9b 100644 +--- a/exrenvmap/namespaceAlias.h ++++ b/exrenvmap/namespaceAlias.h +@@ -38,8 +38,8 @@ + #include "ImathNamespace.h" + #include "IexNamespace.h" + +-namespace IMF = OPENEXR_IMF_NAMESPACE; +-namespace IMATH = IMATH_NAMESPACE; +-namespace IEX = IEX_NAMESPACE; ++#define IMF OPENEXR_IMF_NAMESPACE ++#define IMATH IMATH_NAMESPACE ++#define IEX IEX_NAMESPACE + + #endif /* NAMESPACEALIAS_H_ */ +diff --git a/exrmaketiled/namespaceAlias.h b/exrmaketiled/namespaceAlias.h +index 19567eb..92b9c86 100644 +--- a/exrmaketiled/namespaceAlias.h ++++ b/exrmaketiled/namespaceAlias.h +@@ -38,8 +38,8 @@ + #include + #include + +-namespace IMF = OPENEXR_IMF_NAMESPACE; +-namespace IMATH = IMATH_NAMESPACE; +-namespace IEX = IEX_NAMESPACE; ++#define IMF OPENEXR_IMF_NAMESPACE ++#define IMATH IMATH_NAMESPACE ++#define IEX IEX_NAMESPACE + + #endif /* NAMESPACEALIAS_H_ */ +diff --git a/exrmultipart/exrmultipart.cpp b/exrmultipart/exrmultipart.cpp +index 8c4fa66..b192dd8 100644 +--- a/exrmultipart/exrmultipart.cpp ++++ b/exrmultipart/exrmultipart.cpp +@@ -140,7 +140,7 @@ bool + is_number(const std::string& s) + { + std::string::const_iterator it = s.begin(); +- while (it != s.end() && std::isdigit(*it)) ++it; ++ while (it != s.end() && isdigit(*it)) ++it; + return !s.empty() && it == s.end(); + } + +diff --git a/exrmultiview/namespaceAlias.h b/exrmultiview/namespaceAlias.h +index 19567eb..92b9c86 100644 +--- a/exrmultiview/namespaceAlias.h ++++ b/exrmultiview/namespaceAlias.h +@@ -38,8 +38,8 @@ + #include + #include + +-namespace IMF = OPENEXR_IMF_NAMESPACE; +-namespace IMATH = IMATH_NAMESPACE; +-namespace IEX = IEX_NAMESPACE; ++#define IMF OPENEXR_IMF_NAMESPACE ++#define IMATH IMATH_NAMESPACE ++#define IEX IEX_NAMESPACE + + #endif /* NAMESPACEALIAS_H_ */ +-- +2.15.0 +