Revision: 133391 https://trac.macports.org/changeset/133391 Author: hum@macports.org Date: 2015-02-28 03:42:51 -0800 (Sat, 28 Feb 2015) Log Message: ----------- simstring: update to 20140723; fetch from github; add patch for libc++; add python port Modified Paths: -------------- trunk/dports/textproc/simstring/Portfile Added Paths: ----------- trunk/dports/textproc/simstring/files/ trunk/dports/textproc/simstring/files/patch-libc++.diff Modified: trunk/dports/textproc/simstring/Portfile =================================================================== --- trunk/dports/textproc/simstring/Portfile 2015-02-28 11:38:35 UTC (rev 133390) +++ trunk/dports/textproc/simstring/Portfile 2015-02-28 11:42:51 UTC (rev 133391) @@ -2,9 +2,10 @@ # $Id$ PortSystem 1.0 +PortGroup github 1.0 -name simstring -version 1.0 +github.setup chokkan simstring 6209ea86d84f7043f8e19029d83299f458665ec5 +version 20140723 categories textproc math maintainers hum openmaintainer @@ -21,9 +22,47 @@ platforms darwin license BSD -master_sites http://www.chokkan.org/software/dist/ -checksums rmd160 91824658636dc3d4bf518971fd46ecbc0431c224 \ - sha256 386f5e18c9a92a84eccd6caee407e28da939dd74bb68bd17912c4d918f0e4171 +checksums rmd160 b583d69175504f70b7d761d9365b8a274628431a \ + sha256 298e292c597f21fd4d3e7a4e6478f9b73f46d04372b78c6ea0a901ecfeb52d2d -livecheck.type regex -livecheck.regex ${name}-(\[0-9.\]+)\\.tar +if {[string match *clang* ${configure.cxx}] && ${configure.cxx_stdlib} == "libc++"} { + # https://github.com/chokkan/simstring/issues/16 + patchfiles patch-libc++.diff + notes "UTF16/32 not supported because of libc++ incompatibility" +} + +depends_build port:autoconf \ + port:automake \ + port:libtool + +use_autoconf yes +autoconf.cmd ./autogen.sh + +# Python port +subport py27-simstring { + PortGroup python 1.0 + name py-simstring + python.versions 27 + categories-append textproc math + description SimString Python module + long_description ${description} + set python_dir ${worksrcpath}/swig/python + + depends_build-append port:swig-python + + use_configure yes + build.dir ${python_dir} + pre-build { + system -W ${python_dir} "./prepare.sh --swig" + } + build.target build_ext + destroot.dir ${python_dir} + post-destroot { + set exdir ${prefix}/share/examples/${subport} + xinstall -m 755 -d ${destroot}${exdir} + foreach py {sample.py sample_unicode.py} { + xinstall -m 755 ${python_dir}/${py} ${destroot}${exdir} + reinplace "s|#!/usr/bin/env python|#!${python.bin}|" ${destroot}${exdir}/${py} + } + } +} Added: trunk/dports/textproc/simstring/files/patch-libc++.diff =================================================================== --- trunk/dports/textproc/simstring/files/patch-libc++.diff (rev 0) +++ trunk/dports/textproc/simstring/files/patch-libc++.diff 2015-02-28 11:42:51 UTC (rev 133391) @@ -0,0 +1,69 @@ +--- swig/export.cpp 2015-02-27 21:14:36.000000000 +0900 ++++ swig/export.cpp 2015-02-27 21:06:34.000000000 +0900 +@@ -279,10 +279,10 @@ + retrieve_thru(dbr, query, this->measure, this->threshold, std::back_inserter(ret)); + break; + case 2: +- retrieve_iconv<uint16_t>(dbr, query, UTF16, this->measure, this->threshold, std::back_inserter(ret)); ++ throw std::runtime_error("UTF16 not supported in OSX python bindings because of libc++ incompatibility"); + break; + case 4: +- retrieve_iconv<uint32_t>(dbr, query, UTF32, this->measure, this->threshold, std::back_inserter(ret)); ++ throw std::runtime_error("UTF32 not supported in OSX python bindings because of libc++ incompatibility"); + break; + } + +@@ -296,18 +296,8 @@ + if (dbr.char_size() == 1) { + std::string qstr = query; + return dbr.check(qstr, translate_measure(this->measure), this->threshold); +- } else if (dbr.char_size() == 2) { +- std::basic_string<uint16_t> qstr; +- iconv_t fwd = iconv_open(UTF16, "UTF-8"); +- iconv_convert(fwd, std::string(query), qstr); +- iconv_close(fwd); +- return dbr.check(qstr, translate_measure(this->measure), this->threshold); +- } else if (dbr.char_size() == 4) { +- std::basic_string<uint32_t> qstr; +- iconv_t fwd = iconv_open(UTF32, "UTF-8"); +- iconv_convert(fwd, std::string(query), qstr); +- iconv_close(fwd); +- return dbr.check(qstr, translate_measure(this->measure), this->threshold); ++ } else { ++ throw std::runtime_error("UTF16/32 not supported in OSX python bindings because of libc++ incompatibility"); + } + + return false; +--- swig/python/sample_unicode.py.orig 2015-02-27 21:06:34.000000000 +0900 ++++ swig/python/sample_unicode.py 2015-02-28 19:33:29.000000000 +0900 +@@ -11,8 +11,8 @@ + + import simstring + +-# Open a SimString database for writing with Unicode mode. +-db = simstring.writer('sample_unicode.db', 3, False, True) ++# Open a SimString database for writing. ++db = simstring.writer('sample_unicode.db') + + # Write a string, and close the database. + db.insert('スパゲティ') +--- swig/python/setup.py.in.orig 2015-02-28 20:08:27.000000000 +0900 ++++ swig/python/setup.py.in 2015-02-28 20:06:41.000000000 +0900 +@@ -15,9 +15,6 @@ + def get_swigdir(): + return os.path.join(get_rootdir(), 'swig') + +-import os; os.environ['CC'] = 'g++'; os.environ['CXX'] = 'g++'; +-os.environ['CPP'] = 'g++'; os.environ['LDSHARED'] = 'g++' +- + from distutils.core import setup, Extension + + simstring_module = Extension( +@@ -27,7 +24,6 @@ + 'export_wrap.cpp', + ], + include_dirs=[get_includedir(),], +- extra_link_args=['-shared'], + language='c++', + ) +