[125804] trunk/dports/pure/pure-stldict

ryandesign at macports.org ryandesign at macports.org
Fri Sep 26 13:50:48 PDT 2014


Revision: 125804
          https://trac.macports.org/changeset/125804
Author:   ryandesign at macports.org
Date:     2014-09-26 13:50:48 -0700 (Fri, 26 Sep 2014)
Log Message:
-----------
pure-stldict: add tr1 support for systems with libstdc++

Modified Paths:
--------------
    trunk/dports/pure/pure-stldict/Portfile

Added Paths:
-----------
    trunk/dports/pure/pure-stldict/files/patch-tr1-support.diff

Modified: trunk/dports/pure/pure-stldict/Portfile
===================================================================
--- trunk/dports/pure/pure-stldict/Portfile	2014-09-26 20:49:02 UTC (rev 125803)
+++ trunk/dports/pure/pure-stldict/Portfile	2014-09-26 20:50:48 UTC (rev 125804)
@@ -17,12 +17,19 @@
 checksums               rmd160  edd27eea378ae97f444909e271307b5c30e313ad \
                         sha256  5b894ae6dc574c7022258e2732bea649c82c959ec4d0be13fb5a3e8ba8488f28
 
+depends_build-append    port:pkgconfig
+
 patchfiles              patch-Makefile.diff
+patchfiles-append       patch-tr1-support.diff
 
-depends_build-append    port:pkgconfig
-
 # These are set in the Makefile but the pure portgroup overrides them.
 configure.cxxflags-append -g -std=c++0x -Wall
 
+# No auto-detection of TR1 support yet.
+# https://bitbucket.org/purelang/pure-lang/issue/29/pure-stldict-08-fails-to-build-on-os-x-108
+if {${configure.cxx_stdlib} eq "libstdc++"} {
+    configure.cxxflags-append -DHAVE_TR1
+}
+
 test.run                yes
 test.target             check

Added: trunk/dports/pure/pure-stldict/files/patch-tr1-support.diff
===================================================================
--- trunk/dports/pure/pure-stldict/files/patch-tr1-support.diff	                        (rev 0)
+++ trunk/dports/pure/pure-stldict/files/patch-tr1-support.diff	2014-09-26 20:50:48 UTC (rev 125804)
@@ -0,0 +1,123 @@
+https://bitbucket.org/purelang/pure-lang/issue/29/pure-stldict-08-fails-to-build-on-os-x-108
+--- hashdict.cc.orig	Fri Sep 26 07:21:36 2014 +0200
++++ hashdict.cc	Fri Sep 26 07:40:50 2014 +0200
+@@ -5,8 +5,22 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <pure/runtime.h>
++#include <algorithm>
++
++/* Define this for C++ TR1 extensions support. This is needed to get tuple and
++   unordered_map for some older C++ libraries which don't provide full C++11
++   support yet. */
++//#define HAVE_TR1
++#ifdef HAVE_TR1
++#include <tr1/unordered_map>
++#include <tr1/tuple>
++using namespace std;
++using namespace std::tr1;
++#else
+ #include <unordered_map>
+-#include <algorithm>
++#include <tuple>
++using namespace std;
++#endif
+ 
+ // Enable this for some additional (possibly costly) assertions in the code.
+ //#define DEBUG 1
+@@ -117,8 +131,6 @@
+   return true;
+ }
+ 
+-using namespace std;
+-
+ // Hashing and comparing Pure expressions. The required functionality is in
+ // the Pure runtime (hash() and same() functions, see pure/runtime.h).
+ 
+@@ -560,8 +572,6 @@
+   return eqchk(x.second, y.second);
+ }
+ 
+-#include <tuple>
+-
+ #ifdef HAVE_STD_IS_PERMUTATION
+ #define my_is_permutation is_permutation
+ #else
+@@ -575,18 +585,18 @@
+ 			      ForwardIterator2 d_first, BinaryPredicate p)
+ {
+   // skip common prefix
+-  std::tie(first, d_first) = std::mismatch(first, last, d_first, p);
++  tie(first, d_first) = mismatch(first, last, d_first, p);
+   // iterate over the rest, counting how many times each element
+   // from [first, last) appears in [d_first, d_last)
+   if (first != last) {
+     ForwardIterator2 d_last = d_first;
+-    std::advance(d_last, std::distance(first, last));
++    advance(d_last, distance(first, last));
+     for (ForwardIterator1 i = first; i != last; ++i) {
+-      using std::placeholders::_1;
+-      if (i != std::find_if(first, i, std::bind(p, _1, *i)))
++      using placeholders::_1;
++      if (i != find_if(first, i, bind(p, _1, *i)))
+ 	continue; // already counted this *i
+-      auto m = std::count_if(d_first, d_last, std::bind(p, _1, *i));
+-      if (m==0 || std::count_if(i, last, std::bind(p, _1, *i)) != m) {
++      auto m = count_if(d_first, d_last, bind(p, _1, *i));
++      if (m==0 || count_if(i, last, bind(p, _1, *i)) != m) {
+ 	return false;
+       }
+     }
+--- orddict.cc.orig	Fri Sep 26 07:21:36 2014 +0200
++++ orddict.cc	Fri Sep 26 07:40:50 2014 +0200
+@@ -8,6 +8,19 @@
+ #include <map>
+ #include <algorithm>
+ 
++/* Define this for C++ TR1 extensions support. This is needed to get tuple and
++   unordered_map for some older C++ libraries which don't provide full C++11
++   support yet. */
++//#define HAVE_TR1
++#ifdef HAVE_TR1
++#include <tr1/tuple>
++using namespace std;
++using namespace std::tr1;
++#else
++#include <tuple>
++using namespace std;
++#endif
++
+ // Enable this for some additional (possibly costly) assertions in the code.
+ //#define DEBUG 1
+ 
+@@ -582,8 +595,6 @@
+   return eqchk(x.second, y.second);
+ }
+ 
+-#include <tuple>
+-
+ #ifdef HAVE_STD_IS_PERMUTATION
+ #define my_is_permutation is_permutation
+ #else
+@@ -595,16 +606,16 @@
+ 			      ForwardIterator2 d_first, BinaryPredicate p)
+ {
+   // skip common prefix
+-  std::tie(first, d_first) = std::mismatch(first, last, d_first, p);
++  tie(first, d_first) = mismatch(first, last, d_first, p);
+   // iterate over the rest, counting how many times each element
+   // from [first, last) appears in [d_first, d_last)
+   if (first != last) {
+     ForwardIterator2 d_last = d_first;
+-    std::advance(d_last, std::distance(first, last));
++    advance(d_last, distance(first, last));
+     for (ForwardIterator1 i = first; i != last; ++i) {
+-      if (i != std::find(first, i, *i)) continue; // already counted this *i
+-      auto m = std::count(d_first, d_last, *i);
+-      if (m==0 || std::count(i, last, *i) != m) {
++      if (i != find(first, i, *i)) continue; // already counted this *i
++      auto m = count(d_first, d_last, *i);
++      if (m==0 || count(i, last, *i) != m) {
+ 	return false;
+       }
+     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140926/f4c6fc3f/attachment.html>


More information about the macports-changes mailing list