Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Sep 2014 15:00:15 +0000 (UTC)
From:      Dmitry Sivachenko <demon@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r366882 - in head/textproc/randlm: . files
Message-ID:  <201409011500.s81F0FWL076201@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: demon
Date: Mon Sep  1 15:00:15 2014
New Revision: 366882
URL: http://svnweb.freebsd.org/changeset/ports/366882
QAT: https://qat.redports.org/buildarchive/r366882/

Log:
  Allow to build with clang compiler.

Added:
  head/textproc/randlm/files/patch-src-RandLM-LogFreqSketch.cpp   (contents, props changed)
  head/textproc/randlm/files/patch-src-RandLM-RandLM.h   (contents, props changed)
  head/textproc/randlm/files/patch-src-RandLM-RandLMFilter.h   (contents, props changed)
  head/textproc/randlm/files/patch-src-RandLM-RandLMPreproc.h   (contents, props changed)
  head/textproc/randlm/files/patch-src-RandLM-RandLMQuantiser.h   (contents, props changed)
  head/textproc/randlm/files/patch-src-RandLM-RandLMTypes.h   (contents, props changed)
Modified:
  head/textproc/randlm/Makefile

Modified: head/textproc/randlm/Makefile
==============================================================================
--- head/textproc/randlm/Makefile	Mon Sep  1 14:56:27 2014	(r366881)
+++ head/textproc/randlm/Makefile	Mon Sep  1 15:00:15 2014	(r366882)
@@ -15,17 +15,17 @@ LIB_DEPENDS=	libboost_thread.so:${PORTSD
 RUN_DEPENDS=	${LOCALBASE}/include/google/sparse_hash_map:${PORTSDIR}/devel/google-sparsehash
 
 GNU_CONFIGURE=	yes
-USE_GCC=	yes
 USE_PERL5=	run
 USE_AUTOTOOLS=	libtoolize aclocal autoconf automake
 AUTOMAKE_ARGS=	--add-missing
 USE_LDCONFIG=	yes
-USES=		libtool
+USES=		libtool compiler:c++11-lang
 MAKE_JOBS_UNSAFE=yes
-CFLAGS+=	-I${LOCALBASE}/include
+CXXFLAGS+=	-std=c++11 -I${LOCALBASE}/include
 LDFLAGS+=	-L${LOCALBASE}/lib
 
 post-patch:
-	cd ${WRKSRC}/hadoop && ${MV} strings.cpp strings.cc
+	cd ${WRKSRC}/hadoop && ${MV} strings.cpp strings.cc && ${MV} strings.h s.h
+	${REINPLACE_CMD} -e s#strings.h#s.h# ${WRKSRC}/hadoop/r_compute_ngram_counts.cpp ${WRKSRC}/hadoop/m_compute_ngram_counts_batch.cpp
 
 .include <bsd.port.mk>

Added: head/textproc/randlm/files/patch-src-RandLM-LogFreqSketch.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/randlm/files/patch-src-RandLM-LogFreqSketch.cpp	Mon Sep  1 15:00:15 2014	(r366882)
@@ -0,0 +1,20 @@
+--- src/RandLM/LogFreqSketch.cpp.orig	2012-03-30 13:53:30.000000000 +0400
++++ src/RandLM/LogFreqSketch.cpp	2014-09-01 18:22:05.000000000 +0400
+@@ -162,7 +162,7 @@ namespace randlm {
+ 
+   bool LogFreqSketch::load(RandLMFile* fin) {
+     // just maximum m 
+-    return fin->read((char*)&maximum_m_, sizeof(maximum_m_));;
++    return fin->read((char*)&maximum_m_, sizeof(maximum_m_)).good();
+   }
+ 
+   bool LogFreqSketch::save(RandLMFile* fout) {
+@@ -170,7 +170,7 @@ namespace randlm {
+     assert(LogFreqBloomFilter::save(fout));  // saves RandLMStruct first
+     assert(OnlineRandLMStruct::save(fout));
+     // just maximum m
+-    return fout->write((char*)&maximum_m_, sizeof(maximum_m_));;
++    return fout->write((char*)&maximum_m_, sizeof(maximum_m_)).good();
+   }
+ 
+ }

Added: head/textproc/randlm/files/patch-src-RandLM-RandLM.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/randlm/files/patch-src-RandLM-RandLM.h	Mon Sep  1 15:00:15 2014	(r366882)
@@ -0,0 +1,13 @@
+--- src/RandLM/RandLM.h.orig	2012-03-30 13:53:30.000000000 +0400
++++ src/RandLM/RandLM.h	2014-09-01 18:11:00.000000000 +0400
+@@ -86,8 +86,8 @@ namespace randlm {
+ 
+     static const std::string kRandLMFileType;
+ 
+-    static const float kNullLogProb = -1000000;
+-    static const float kUnknownLogProb = 1000000;
++    static constexpr float kNullLogProb = -1000000;
++    static constexpr float kUnknownLogProb = 1000000;
+ 
+     static const int kMainEventIdx = 0;
+     static const int kAuxEventIdx = 1;

Added: head/textproc/randlm/files/patch-src-RandLM-RandLMFilter.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/randlm/files/patch-src-RandLM-RandLMFilter.h	Mon Sep  1 15:00:15 2014	(r366882)
@@ -0,0 +1,34 @@
+--- src/RandLM/RandLMFilter.h.orig	2014-09-01 18:07:56.000000000 +0400
++++ src/RandLM/RandLMFilter.h	2014-09-01 18:08:39.000000000 +0400
+@@ -289,7 +289,7 @@ namespace randlm {
+       std::cerr << "Saved ResizedBitFilter. Rho = " << rho() << "." << std::endl;
+       assert(fout->write((char*)&old_addresses_, sizeof(old_addresses_)));
+       assert(fout->write((char*)&a_, sizeof(a_)));
+-      return fout->write((char*)&b_, sizeof(b_));
++      return fout->write((char*)&b_, sizeof(b_)).good();
+     }
+   protected:
+     bool load(RandLMFile* fin) {
+@@ -297,7 +297,7 @@ namespace randlm {
+       std::cerr << "Loaded ResizedBitFilter. Rho = " << rho() << "." << std::endl;
+       assert(fin->read((char*)&old_addresses_, sizeof(old_addresses_)));
+       assert(fin->read((char*)&a_, sizeof(a_)));
+-      return fin->read((char*)&b_, sizeof(b_));
++      return fin->read((char*)&b_, sizeof(b_)).good();
+     }
+     // member data
+     uint64_t old_addresses_;  // size of pre-resized filter
+@@ -342,11 +342,11 @@ namespace randlm {
+     }
+     bool save(RandLMFile* fout) {
+       assert(Filter<T>::save(fout));
+-      return fout->write((char*)&wrap_around_, sizeof(wrap_around_));
++      return fout->write((char*)&wrap_around_, sizeof(wrap_around_)).good();
+     }
+     private:
+     bool load(RandLMFile* fin) {
+-      return fin->read((char*)&wrap_around_, sizeof(wrap_around_));
++      return fin->read((char*)&wrap_around_, sizeof(wrap_around_)).good();
+     }
+     inline bool incrementSubCell(int bit, int len, T* cell) {
+       // increment counter consisting of bits [startbit, startbit + len - 1] rest stays unchanged

Added: head/textproc/randlm/files/patch-src-RandLM-RandLMPreproc.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/randlm/files/patch-src-RandLM-RandLMPreproc.h	Mon Sep  1 15:00:15 2014	(r366882)
@@ -0,0 +1,11 @@
+--- src/RandLM/RandLMPreproc.h.orig	2014-09-01 18:11:27.000000000 +0400
++++ src/RandLM/RandLMPreproc.h	2014-09-01 18:11:43.000000000 +0400
+@@ -407,7 +407,7 @@ namespace randlm {
+   // Concrete subclass of NormalisedNgramFile for backoff model data
+   class BackoffModelFile : public NormalisedNgramFile {
+   public:
+-    static const float kNullBackoffWeight = 0; // indicates lack of backoff weight
++    static constexpr float kNullBackoffWeight = 0; // indicates lack of backoff weight
+     static bool ValidWeight(float boweight);
+     // creation at start of pipeline (i.e. load a preprocess backoff model)
+     BackoffModelFile(const std::string & input_path, const std::string & input_type,

Added: head/textproc/randlm/files/patch-src-RandLM-RandLMQuantiser.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/randlm/files/patch-src-RandLM-RandLMQuantiser.h	Mon Sep  1 15:00:15 2014	(r366882)
@@ -0,0 +1,11 @@
+--- src/RandLM/RandLMQuantiser.h.orig	2014-09-01 18:09:32.000000000 +0400
++++ src/RandLM/RandLMQuantiser.h	2014-09-01 18:09:51.000000000 +0400
+@@ -38,7 +38,7 @@ namespace randlm {
+   
+   class Quantiser {
+   public:
+-    static const float kFloatErr = 0.00001f;
++    static constexpr float kFloatErr = 0.00001f;
+ 
+     Quantiser(RandLMInfo* info, Stats* stats, EventType event) 
+       : info_(info), event_type_(event), code_to_value_(NULL),

Added: head/textproc/randlm/files/patch-src-RandLM-RandLMTypes.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/randlm/files/patch-src-RandLM-RandLMTypes.h	Mon Sep  1 15:00:15 2014	(r366882)
@@ -0,0 +1,11 @@
+--- src/RandLM/RandLMTypes.h.orig	2014-09-01 18:20:25.000000000 +0400
++++ src/RandLM/RandLMTypes.h	2014-09-01 18:21:06.000000000 +0400
+@@ -21,7 +21,7 @@
+ #include <string>
+ #include <stdint.h>
+ 
+-#define iterate(c,i) for(typeof(c.begin()) i = c.begin(); i != c.end(); i++)
++#define iterate(c,i) for(auto i = c.begin(); i != c.end(); i++)
+ 
+ namespace randlm {
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409011500.s81F0FWL076201>