diff options
author | glarkin <glarkin@FreeBSD.org> | 2010-09-24 22:58:14 +0800 |
---|---|---|
committer | glarkin <glarkin@FreeBSD.org> | 2010-09-24 22:58:14 +0800 |
commit | 4e293f9888882b9b431bef160df8ff490c28d13c (patch) | |
tree | 99566afd3bd3c3e2d24a642c89f42af96fe7da46 | |
parent | d49ae77ebc193d6ed859f83a78fbfa516fa1267c (diff) | |
download | freebsd-ports-graphics-4e293f9888882b9b431bef160df8ff490c28d13c.tar.gz freebsd-ports-graphics-4e293f9888882b9b431bef160df8ff490c28d13c.tar.zst freebsd-ports-graphics-4e293f9888882b9b431bef160df8ff490c28d13c.zip |
- Added new patches to support building under gcc 4.5 due to impending
default gcc version change when USE_FORTRAN=yes. Patches included from
http://bugs.gentoo.org/show_bug.cgi?id=318045. [1]
- Renamed and conditionalized some patches to support tgammaf function
on OSVERSION < 800023. Previously, it was included even when present
in the system math library. Also fixed name-mangling problem in the
patches. Declarations were wrapped in 'extern "C"', but the
definitions were not, causing a linker error.
- Added a patch to CMakeLists.txt to prevent cmake from changing rpath
during the installation phase. That caused libstdc++ from /usr/lib
to be used instead of the one supplied with gcc 4.5.
Requested by: gerald [1]
-rw-r--r-- | math/freemat/Makefile | 13 | ||||
-rw-r--r-- | math/freemat/files/extra-patch-libs__libFN__CMakeLists.txt | 13 | ||||
-rw-r--r-- | math/freemat/files/extra-patch-libs__libFN__FNFun.cpp (renamed from math/freemat/files/patch-libs__libFN__FNFun.cpp) | 8 | ||||
-rw-r--r-- | math/freemat/files/extra-patch-libs__libFN__mathfunc4.cpp | 37 | ||||
-rw-r--r-- | math/freemat/files/patch-CMakeLists.txt | 29 | ||||
-rw-r--r-- | math/freemat/files/patch-libs__libFN__CMakeLists.txt | 15 | ||||
-rw-r--r-- | math/freemat/files/patch-libs__libFreeMat__Array.cpp | 11 | ||||
-rw-r--r-- | math/freemat/files/patch-libs__libFreeMat__Math.cpp | 14 | ||||
-rw-r--r-- | math/freemat/files/patch-libs__libFreeMat__Operators.hpp | 179 |
9 files changed, 294 insertions, 25 deletions
diff --git a/math/freemat/Makefile b/math/freemat/Makefile index c587d092f82..8e3f8253985 100644 --- a/math/freemat/Makefile +++ b/math/freemat/Makefile @@ -23,6 +23,8 @@ LIB_DEPENDS= lapack.4:${PORTSDIR}/math/lapack \ pcre.0:${PORTSDIR}/devel/pcre BUILD_DEPENDS= pkg-config:${PORTSDIR}/devel/pkg-config +LICENSE= GPLv2 + WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}.1${DISTVERSIONSUFFIX} .ifdef WITH_MPI @@ -62,6 +64,13 @@ LIB_DEPENDS+= portaudio.0:${PORTSDIR}/audio/portaudio .include <bsd.port.pre.mk> +.if ${OSVERSION} < 800023 +# Add math functions that didn't exist until 8.x +EXTRA_PATCHES+= ${FILESDIR}/extra-patch-libs__libFN__CMakeLists.txt \ + ${FILESDIR}/extra-patch-libs__libFN__mathfunc4.cpp \ + ${FILESDIR}/extra-patch-libs__libFN__FNFun.cpp +.endif + .if exists(${LOCALBASE}/lib/libatlas_r.so) && !defined(WITH_BLAS) WITH_ATLAS= yes .endif @@ -101,11 +110,11 @@ post-extract: @cd ${WRKSRC} && ${FIND} . -name \*.moc.cpp -delete pre-configure: - ${RM} ${WRKSRC}/CMakeCache.txt + @${RM} ${WRKSRC}/CMakeCache.txt # Avoid conflict with QT3 post-configure: - ${FIND} ${WRKSRC} -name Makefile | ${XARGS} \ + @${FIND} ${WRKSRC} -name Makefile | ${XARGS} \ ${REINPLACE_CMD} -e '/^QT_CFLAGS/s|-I${LOCALBASE}/include ||' post-install: diff --git a/math/freemat/files/extra-patch-libs__libFN__CMakeLists.txt b/math/freemat/files/extra-patch-libs__libFN__CMakeLists.txt new file mode 100644 index 00000000000..f6ad2eaeb73 --- /dev/null +++ b/math/freemat/files/extra-patch-libs__libFN__CMakeLists.txt @@ -0,0 +1,13 @@ +--- ./libs/libFN/CMakeLists.txt.orig 2009-10-09 02:23:29.000000000 -0400 ++++ ./libs/libFN/CMakeLists.txt 2010-09-22 15:28:57.000000000 -0400 +@@ -13,6 +13,10 @@ + mathfunc4.cpp
+ )
+ ENDIF( MSVC )
++ ++SET(LIBM_FILES ++ mathfunc4.cpp ++) +
+ ADD_LIBRARY( FN
+ FNFun.cpp
diff --git a/math/freemat/files/patch-libs__libFN__FNFun.cpp b/math/freemat/files/extra-patch-libs__libFN__FNFun.cpp index 6e8498d5f61..7290b5b51a4 100644 --- a/math/freemat/files/patch-libs__libFN__FNFun.cpp +++ b/math/freemat/files/extra-patch-libs__libFN__FNFun.cpp @@ -1,17 +1,17 @@ ---- ./libs/libFN/FNFun.cpp.orig 2009-11-14 18:51:06.000000000 -0500 -+++ ./libs/libFN/FNFun.cpp 2009-11-14 20:26:43.000000000 -0500 +--- ./libs/libFN/FNFun.cpp.orig 2009-10-09 02:23:29.000000000 -0400 ++++ ./libs/libFN/FNFun.cpp 2010-09-22 15:29:22.000000000 -0400 @@ -35,6 +35,14 @@ double trunc( double x ); float truncf( float x ); #endif -+#if defined(__FreeBSD__) +#ifdef __cplusplus +extern "C" { ++#endif + float lgammaf(float x); + float tgammaf(float x); ++#ifdef __cplusplus +} +#endif -+#endif //! //@Module ERFC Complimentary Error Function diff --git a/math/freemat/files/extra-patch-libs__libFN__mathfunc4.cpp b/math/freemat/files/extra-patch-libs__libFN__mathfunc4.cpp new file mode 100644 index 00000000000..a610ee84eae --- /dev/null +++ b/math/freemat/files/extra-patch-libs__libFN__mathfunc4.cpp @@ -0,0 +1,37 @@ +--- ./libs/libFN/mathfunc4.cpp.orig 2010-09-22 15:28:16.000000000 -0400 ++++ ./libs/libFN/mathfunc4.cpp 2010-09-22 15:27:09.000000000 -0400 +@@ -248,11 +248,17 @@ + return r;
+ }
+
++#ifdef __cplusplus ++extern "C" { ++#endif + float lgammaf(float x)
+ {
+ int local_signgam;
+ return lgammaf_r(x, &local_signgam/*(_REENT_SIGNGAM(_REENT))*/);
+ }
++#ifdef __cplusplus ++} ++#endif +
+ float gammaf_r(float x, int *signgamp)
+ {
+@@ -264,6 +270,9 @@ + return gammaf_r(x, &(_REENT_SIGNGAM(_REENT)));
+ }*/
+
++#ifdef __cplusplus ++extern "C" { ++#endif + float tgammaf(float x)
+ {
+ float y;
+@@ -272,3 +281,6 @@ + if (local_signgam < 0) y = -y;
+ return y;
+ }
++#ifdef __cplusplus ++} ++#endif diff --git a/math/freemat/files/patch-CMakeLists.txt b/math/freemat/files/patch-CMakeLists.txt index def3f6b672a..459ee0fc511 100644 --- a/math/freemat/files/patch-CMakeLists.txt +++ b/math/freemat/files/patch-CMakeLists.txt @@ -1,6 +1,27 @@ ---- ./CMakeLists.txt.orig 2009-11-13 18:28:43.000000000 -0500 -+++ ./CMakeLists.txt 2009-11-13 19:28:04.000000000 -0500 -@@ -217,7 +217,7 @@ +--- CMakeLists.txt.orig 2009-10-09 02:24:39.000000000 -0400 ++++ CMakeLists.txt 2010-09-23 15:07:03.000000000 -0400 +@@ -15,6 +15,20 @@ +
+ PROJECT(FreeMat CXX C )
+
++# skip the full RPATH for the build tree ++SET(CMAKE_SKIP_BUILD_RPATH TRUE) ++ ++# when building, use the install RPATH already ++# (so it doesn't need to relink when installing) ++SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) ++ ++# the RPATH to be used when installing ++SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") ++ ++# add the automatically determined parts of the RPATH ++# which point to directories outside the build tree to the install RPATH ++SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) ++# + SET(CPACK_PACKAGE_VERSION_MAJOR "4")
+ SET(CPACK_PACKAGE_VERSION_MINOR "0")
+ SET(VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
+@@ -217,7 +231,7 @@ INCLUDE_DIRECTORIES(${PORTAUDIO_SYS_INCLUDE_DIR})
SET (PORTAUDIO_LIBRARY ${PORTAUDIO_SYS_LIBRARY})
ENDIF (FORCE_BUNDLED_PORTAUDIO OR NOT SYSTEM_PORTAUDIO_AVAILABLE)
@@ -9,7 +30,7 @@ SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} ${PORTAUDIO_LIBRARY})
IF (APPLE)
FIND_LIBRARY(COREAUDIO_LIBRARY CoreAudio)
-@@ -245,7 +245,7 @@ +@@ -245,7 +259,7 @@ ######################################################################
# LLVM Support
######################################################################
diff --git a/math/freemat/files/patch-libs__libFN__CMakeLists.txt b/math/freemat/files/patch-libs__libFN__CMakeLists.txt deleted file mode 100644 index 85fdf248f44..00000000000 --- a/math/freemat/files/patch-libs__libFN__CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ ---- ./libs/libFN/CMakeLists.txt.orig 2009-11-13 20:28:30.000000000 -0500 -+++ ./libs/libFN/CMakeLists.txt 2009-11-13 22:38:43.000000000 -0500 -@@ -13,6 +13,12 @@ - mathfunc4.cpp
- )
- ENDIF( MSVC )
-+ -+IF (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") -+ SET(LIBM_FILES -+ mathfunc4.cpp -+ ) -+ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") -
- ADD_LIBRARY( FN
- FNFun.cpp
diff --git a/math/freemat/files/patch-libs__libFreeMat__Array.cpp b/math/freemat/files/patch-libs__libFreeMat__Array.cpp new file mode 100644 index 00000000000..e1314fe1c95 --- /dev/null +++ b/math/freemat/files/patch-libs__libFreeMat__Array.cpp @@ -0,0 +1,11 @@ +--- ./libs/libFreeMat/Array.cpp.orig 2009-10-09 02:24:20.000000000 -0400 ++++ ./libs/libFreeMat/Array.cpp 2010-09-21 14:32:02.000000000 -0400 +@@ -465,7 +465,7 @@ + + void Array::set(const QString& field, ArrayVector& data) { + if (isEmpty() && m_type.Class != Struct) +- *this = Array::Array(Struct); ++ *this = Array(Struct); + if (m_type.Class != Struct) throw Exception("Unsupported type for A.field=B"); + StructArray &rp(structPtr()); + if (isEmpty()) diff --git a/math/freemat/files/patch-libs__libFreeMat__Math.cpp b/math/freemat/files/patch-libs__libFreeMat__Math.cpp new file mode 100644 index 00000000000..bde8b1271b6 --- /dev/null +++ b/math/freemat/files/patch-libs__libFreeMat__Math.cpp @@ -0,0 +1,14 @@ +--- ./libs/libFreeMat/Math.cpp.orig 2009-10-09 02:24:22.000000000 -0400 ++++ ./libs/libFreeMat/Math.cpp 2010-09-21 14:32:02.000000000 -0400 +@@ -1590,9 +1590,9 @@ + + Array Not(const Array& A) { + if (A.isScalar()) +- return Array::Array(!A.toClass(Bool).constRealScalar<bool>()); ++ return Array(!A.toClass(Bool).constRealScalar<bool>()); + const Array &Abool(A.toClass(Bool)); +- return Array::Array(Apply(Abool.constReal<bool>(),notfunc)); ++ return Array(Apply(Abool.constReal<bool>(),notfunc)); + } + + Array Plus(const Array& A) { diff --git a/math/freemat/files/patch-libs__libFreeMat__Operators.hpp b/math/freemat/files/patch-libs__libFreeMat__Operators.hpp new file mode 100644 index 00000000000..485fe70d27b --- /dev/null +++ b/math/freemat/files/patch-libs__libFreeMat__Operators.hpp @@ -0,0 +1,179 @@ +--- ./libs/libFreeMat/Operators.hpp.orig 2009-10-09 02:24:22.000000000 -0400 ++++ ./libs/libFreeMat/Operators.hpp 2010-09-21 14:32:02.000000000 -0400 +@@ -142,11 +142,11 @@ + if (!Bcast.isScalar()) Bcast = Bcast.asDenseArray(); + if (Acast.isScalar() && Bcast.isScalar()) { + if (Acast.allReal() && Bcast.allReal()) { +- F = Array::Array(Op::func(Acast.constRealScalar<T>(), ++ F = Array(Op::func(Acast.constRealScalar<T>(), + Bcast.constRealScalar<T>())); + } else { + Acast.forceComplex(); Bcast.forceComplex(); +- F = Array::Array(T(0),T(0)); ++ F = Array(T(0),T(0)); + Op::func(Acast.constRealScalar<T>(), + Acast.constImagScalar<T>(), + Bcast.constRealScalar<T>(), +@@ -155,7 +155,7 @@ + } + } else if (Acast.isScalar()) { + if (Acast.allReal() && Bcast.allReal()) { +- F = Array::Array(Tclass,Bcast.dimensions()); ++ F = Array(Tclass,Bcast.dimensions()); + T* ret = F.real<T>().data(); + const T& Ap = Acast.constRealScalar<T>(); + const T* Bp = Bcast.constReal<T>().constData(); +@@ -163,7 +163,7 @@ + for (uint64 i=0;i<q;i++) ret[i] = Op::func(Ap,Bp[i]); + } else { + Acast.forceComplex(); Bcast.forceComplex(); +- F = Array::Array(Tclass,Bcast.dimensions()); ++ F = Array(Tclass,Bcast.dimensions()); + T* Cr = F.real<T>().data(); + T* Ci = F.imag<T>().data(); + const T& Ar = Acast.constRealScalar<T>(); +@@ -175,7 +175,7 @@ + } + } else if (Bcast.isScalar()) { + if (Bcast.allReal() && Acast.allReal()) { +- F = Array::Array(Tclass,Acast.dimensions()); ++ F = Array(Tclass,Acast.dimensions()); + T* ret = F.real<T>().data(); + const T* Ap = Acast.constReal<T>().constData(); + const T& Bp = Bcast.constRealScalar<T>(); +@@ -183,7 +183,7 @@ + for (uint64 i=0;i<q;i++) ret[i] = Op::func(Ap[i],Bp); + } else { + Acast.forceComplex(); Bcast.forceComplex(); +- F = Array::Array(Tclass,Acast.dimensions()); ++ F = Array(Tclass,Acast.dimensions()); + T* Cr = F.real<T>().data(); + T* Ci = F.imag<T>().data(); + const T* Ar = Acast.constReal<T>().constData(); +@@ -197,7 +197,7 @@ + if (Acast.dimensions() != Bcast.dimensions()) + throw Exception("size mismatch in arguments to binary operator"); + if (Bcast.allReal() && Acast.allReal()) { +- F = Array::Array(Tclass,Acast.dimensions()); ++ F = Array(Tclass,Acast.dimensions()); + T* ret = F.real<T>().data(); + const T* Ap = Acast.constReal<T>().constData(); + const T* Bp = Bcast.constReal<T>().constData(); +@@ -205,7 +205,7 @@ + for (uint64 i=0;i<q;i++) ret[i] = Op::func(Ap[i],Bp[i]); + } else { + Acast.forceComplex(); Bcast.forceComplex(); +- F = Array::Array(Tclass,Acast.dimensions()); ++ F = Array(Tclass,Acast.dimensions()); + T* Cr = F.real<T>().data(); + T* Ci = F.imag<T>().data(); + const T* Ar = Acast.constReal<T>().constData(); +@@ -328,17 +328,17 @@ + if (!Acast.isScalar()) Acast = Acast.asDenseArray(); + if (!Bcast.isScalar()) Bcast = Bcast.asDenseArray(); + if (Acast.isScalar() && Bcast.isScalar()) { +- F = Array::Array(Op::func(Acast.constRealScalar<T>(), ++ F = Array(Op::func(Acast.constRealScalar<T>(), + Bcast.constRealScalar<T>())); + } else if (Acast.isScalar()) { +- F = Array::Array(Bool,Bcast.dimensions()); ++ F = Array(Bool,Bcast.dimensions()); + bool* ret = F.real<bool>().data(); + const T& Ap = Acast.constRealScalar<T>(); + const T* Bp = Bcast.constReal<T>().constData(); + uint64 q = uint64(Bcast.length()); + for (uint64 i=0;i<q;i++) ret[i] = Op::func(Ap,Bp[i]); + } else if (Bcast.isScalar()) { +- F = Array::Array(Bool,Acast.dimensions()); ++ F = Array(Bool,Acast.dimensions()); + bool* ret = F.real<bool>().data(); + const T* Ap = Acast.constReal<T>().constData(); + const T& Bp = Bcast.constRealScalar<T>(); +@@ -347,7 +347,7 @@ + } else { + if (Acast.dimensions() != Bcast.dimensions()) + throw Exception("size mismatch in arguments to binary operator"); +- F = Array::Array(Bool,Acast.dimensions()); ++ F = Array(Bool,Acast.dimensions()); + bool* ret = F.real<bool>().data(); + const T* Ap = Acast.constReal<T>().constData(); + const T* Bp = Bcast.constReal<T>().constData(); +@@ -395,18 +395,18 @@ + if (!Bcast.isScalar()) Bcast = Bcast.asDenseArray(); + if (Acast.isScalar() && Bcast.isScalar()) { + if (Acast.allReal() && Bcast.allReal()) { +- F = Array::Array(Op::func(Acast.constRealScalar<T>(), ++ F = Array(Op::func(Acast.constRealScalar<T>(), + Bcast.constRealScalar<T>())); + } else { + Acast.forceComplex(); Bcast.forceComplex(); +- F = Array::Array(Op::func(Acast.constRealScalar<T>(), ++ F = Array(Op::func(Acast.constRealScalar<T>(), + Acast.constImagScalar<T>(), + Bcast.constRealScalar<T>(), + Bcast.constImagScalar<T>())); + } + } else if (Acast.isScalar()) { + if (Acast.allReal() && Bcast.allReal()) { +- F = Array::Array(Bool,Bcast.dimensions()); ++ F = Array(Bool,Bcast.dimensions()); + bool* ret = F.real<bool>().data(); + const T& Ap = Acast.constRealScalar<T>(); + const T* Bp = Bcast.constReal<T>().constData(); +@@ -414,7 +414,7 @@ + for (uint64 i=0;i<q;i++) ret[i] = Op::func(Ap,Bp[i]); + } else { + Acast.forceComplex(); Bcast.forceComplex(); +- F = Array::Array(Bool,Bcast.dimensions()); ++ F = Array(Bool,Bcast.dimensions()); + bool* ret = F.real<bool>().data(); + const T& Ar = Acast.constRealScalar<T>(); + const T& Ai = Acast.constImagScalar<T>(); +@@ -425,7 +425,7 @@ + } + } else if (Bcast.isScalar()) { + if (Bcast.allReal() && Acast.allReal()) { +- F = Array::Array(Bool,Acast.dimensions()); ++ F = Array(Bool,Acast.dimensions()); + bool* ret = F.real<bool>().data(); + const T* Ap = Acast.constReal<T>().constData(); + const T& Bp = Bcast.constRealScalar<T>(); +@@ -433,7 +433,7 @@ + for (uint64 i=0;i<q;i++) ret[i] = Op::func(Ap[i],Bp); + } else { + Acast.forceComplex(); Bcast.forceComplex(); +- F = Array::Array(Bool,Acast.dimensions()); ++ F = Array(Bool,Acast.dimensions()); + bool* ret = F.real<bool>().data(); + const T* Ar = Acast.constReal<T>().constData(); + const T* Ai = Acast.constImag<T>().constData(); +@@ -446,7 +446,7 @@ + if (Acast.dimensions() != Bcast.dimensions()) + throw Exception("size mismatch in arguments to binary operator"); + if (Bcast.allReal() && Acast.allReal()) { +- F = Array::Array(Bool,Acast.dimensions()); ++ F = Array(Bool,Acast.dimensions()); + bool* ret = F.real<bool>().data(); + const T* Ap = Acast.constReal<T>().constData(); + const T* Bp = Bcast.constReal<T>().constData(); +@@ -454,7 +454,7 @@ + for (uint64 i=0;i<q;i++) ret[i] = Op::func(Ap[i],Bp[i]); + } else { + Acast.forceComplex(); Bcast.forceComplex(); +- F = Array::Array(Bool,Acast.dimensions()); ++ F = Array(Bool,Acast.dimensions()); + bool* ret = F.real<bool>().data(); + const T* Ar = Acast.constReal<T>().constData(); + const T* Ai = Acast.constImag<T>().constData(); +@@ -533,9 +533,9 @@ + if (!Acast.isScalar()) Acast = Acast.asDenseArray(); + if (Acast.isScalar()) { + if (Acast.allReal()) { +- F = Array::Array(Op::func(Acast.constRealScalar<T>())); ++ F = Array(Op::func(Acast.constRealScalar<T>())); + } else { +- F = Array::Array(T(0),T(0)); ++ F = Array(T(0),T(0)); + Op::func(Acast.constRealScalar<T>(), + Acast.constImagScalar<T>(), + F.realScalar<T>(),F.imagScalar<T>()); |