aboutsummaryrefslogtreecommitdiffstats
path: root/textproc/pecl-cld
diff options
context:
space:
mode:
authorvanilla <vanilla@FreeBSD.org>2014-12-31 22:51:14 +0800
committervanilla <vanilla@FreeBSD.org>2014-12-31 22:51:14 +0800
commit6e03bdbfd47719102083a45c9a1e8e82f59cf81d (patch)
treeff786dcbfbad34ad7d03d09c88634ae86bf7c5b7 /textproc/pecl-cld
parentc80cd07a99033ade20d8b05ebe885d5abcb0cc0e (diff)
downloadfreebsd-ports-gnome-6e03bdbfd47719102083a45c9a1e8e82f59cf81d.tar.gz
freebsd-ports-gnome-6e03bdbfd47719102083a45c9a1e8e82f59cf81d.tar.zst
freebsd-ports-gnome-6e03bdbfd47719102083a45c9a1e8e82f59cf81d.zip
Add pecl-cld 0.5.0, PHP Bindings for Chromium Compact Language Detector.
PR: ports/196375 Submitted by: Gasol Wu <gasol.wu@gmail.com>
Diffstat (limited to 'textproc/pecl-cld')
-rw-r--r--textproc/pecl-cld/Makefile28
-rw-r--r--textproc/pecl-cld/distinfo2
-rw-r--r--textproc/pecl-cld/files/patch-cld.cc14
-rw-r--r--textproc/pecl-cld/files/patch-cld__encodings.h98
-rw-r--r--textproc/pecl-cld/files/patch-config.m417
-rw-r--r--textproc/pecl-cld/pkg-descr4
6 files changed, 163 insertions, 0 deletions
diff --git a/textproc/pecl-cld/Makefile b/textproc/pecl-cld/Makefile
new file mode 100644
index 000000000000..d8443e9b4b89
--- /dev/null
+++ b/textproc/pecl-cld/Makefile
@@ -0,0 +1,28 @@
+# Created by: Gasol Wu <gasol.wu@gmail.com>
+# $FreeBSD$
+
+PORTNAME= cld
+PORTVERSION= 0.5.0
+CATEGORIES= textproc pear
+MASTER_SITES= http://pecl.php.net/get/
+PKGNAMEPREFIX= pecl-
+DIST_SUBDIR= PECL
+
+MAINTAINER= gasol.wu@gmail.com
+COMMENT= PHP Bindings for Chromium Compact Language Detector
+
+LICENSE= BSD2CLAUSE
+
+LIB_DEPENDS= libcld.so:${PORTSDIR}/devel/cld
+
+CONFIGURE_ARGS= --enable-cld --with-libcld-dir=${LOCALBASE}/lib
+USES= tar:tgz
+USE_PHP= yes
+USE_PHP_BUILD= yes
+USE_PHPIZE= yes
+USE_PHPEXT= yes
+
+post-install:
+ @${STRIP_CMD} ${STAGEDIR}/${PREFIX}/lib/php/${PHP_EXT_DIR}/cld.so
+
+.include <bsd.port.mk>
diff --git a/textproc/pecl-cld/distinfo b/textproc/pecl-cld/distinfo
new file mode 100644
index 000000000000..4e536ff3dba6
--- /dev/null
+++ b/textproc/pecl-cld/distinfo
@@ -0,0 +1,2 @@
+SHA256 (PECL/cld-0.5.0.tgz) = b7f56a69274b2d8addcd37cafee50db0670c4384cf3c388c878449f47b86619c
+SIZE (PECL/cld-0.5.0.tgz) = 12367
diff --git a/textproc/pecl-cld/files/patch-cld.cc b/textproc/pecl-cld/files/patch-cld.cc
new file mode 100644
index 000000000000..9d6e93a1d513
--- /dev/null
+++ b/textproc/pecl-cld/files/patch-cld.cc
@@ -0,0 +1,14 @@
+--- cld.cc.orig 2011-11-15 01:13:43 UTC
++++ cld.cc
+@@ -30,8 +30,9 @@
+ #include <ctype.h>
+ #define CLD_WINDOWS
+
+-#include "encodings/compact_lang_det/compact_lang_det.h"
+-#include "encodings/compact_lang_det/ext_lang_enc.h"
++#include "compact_lang_det.h"
++#include "ext_lang_enc.h"
++#include "lang_enc.h"
+ #include "base/string_util.h"
+ #include "cld_encodings.h"
+
diff --git a/textproc/pecl-cld/files/patch-cld__encodings.h b/textproc/pecl-cld/files/patch-cld__encodings.h
new file mode 100644
index 000000000000..b4e415783ea1
--- /dev/null
+++ b/textproc/pecl-cld/files/patch-cld__encodings.h
@@ -0,0 +1,98 @@
+--- cld_encodings.h.orig 2014-12-30 06:17:16 UTC
++++ cld_encodings.h
+@@ -0,0 +1,95 @@
++// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// MKM: I copied this from the PHP port
++// (https://github.com/lstrojny/php-cld/blob/master/cld_encodings.h);
++// it just copies the encodings out of encodings.pb.h and
++// gives them string matching string constants
++
++#include "encodings/proto/encodings.pb.h"
++
++struct cld_encoding {
++ const char *name;
++ Encoding encoding;
++};
++
++const cld_encoding cld_encoding_info[] = {
++{"ISO_8859_1", ISO_8859_1},
++{"ISO_8859_2", ISO_8859_2},
++{"ISO_8859_3", ISO_8859_3},
++{"ISO_8859_4", ISO_8859_4},
++{"ISO_8859_5", ISO_8859_5},
++{"ISO_8859_6", ISO_8859_6},
++{"ISO_8859_7", ISO_8859_7},
++{"ISO_8859_8", ISO_8859_8},
++{"ISO_8859_9", ISO_8859_9},
++{"ISO_8859_10", ISO_8859_10},
++{"JAPANESE_EUC_JP", JAPANESE_EUC_JP},
++{"JAPANESE_SHIFT_JIS", JAPANESE_SHIFT_JIS},
++{"JAPANESE_JIS", JAPANESE_JIS},
++{"CHINESE_BIG5", CHINESE_BIG5},
++{"CHINESE_GB", CHINESE_GB},
++{"CHINESE_EUC_CN", CHINESE_EUC_CN},
++{"KOREAN_EUC_KR", KOREAN_EUC_KR},
++{"UNICODE", UNICODE},
++{"CHINESE_EUC_DEC", CHINESE_EUC_DEC},
++{"CHINESE_CNS", CHINESE_CNS},
++{"CHINESE_BIG5_CP950", CHINESE_BIG5_CP950},
++{"JAPANESE_CP932", JAPANESE_CP932},
++{"UTF8", UTF8},
++{"UNKNOWN_ENCODING", UNKNOWN_ENCODING},
++{"ASCII_7BIT", ASCII_7BIT},
++{"RUSSIAN_KOI8_R", RUSSIAN_KOI8_R},
++{"RUSSIAN_CP1251", RUSSIAN_CP1251},
++{"MSFT_CP1252", MSFT_CP1252},
++{"RUSSIAN_KOI8_RU", RUSSIAN_KOI8_RU},
++{"MSFT_CP1250", MSFT_CP1250},
++{"ISO_8859_15", ISO_8859_15},
++{"MSFT_CP1254", MSFT_CP1254},
++{"MSFT_CP1257", MSFT_CP1257},
++{"ISO_8859_11", ISO_8859_11},
++{"MSFT_CP874", MSFT_CP874},
++{"MSFT_CP1256", MSFT_CP1256},
++{"MSFT_CP1255", MSFT_CP1255},
++{"ISO_8859_8_I", ISO_8859_8_I},
++{"HEBREW_VISUAL", HEBREW_VISUAL},
++{"CZECH_CP852", CZECH_CP852},
++{"CZECH_CSN_369103", CZECH_CSN_369103},
++{"MSFT_CP1253", MSFT_CP1253},
++{"RUSSIAN_CP866", RUSSIAN_CP866},
++{"ISO_8859_13", ISO_8859_13},
++{"ISO_2022_KR", ISO_2022_KR},
++{"GBK", GBK},
++{"GB18030", GB18030},
++{"BIG5_HKSCS", BIG5_HKSCS},
++{"ISO_2022_CN", ISO_2022_CN},
++{"TSCII", TSCII},
++{"TAMIL_MONO", TAMIL_MONO},
++{"TAMIL_BI", TAMIL_BI},
++{"JAGRAN", JAGRAN},
++{"MACINTOSH_ROMAN", MACINTOSH_ROMAN},
++{"UTF7", UTF7},
++{"BHASKAR", BHASKAR},
++{"HTCHANAKYA", HTCHANAKYA},
++{"UTF16BE", UTF16BE},
++{"UTF16LE", UTF16LE},
++{"UTF32BE", UTF32BE},
++{"UTF32LE", UTF32LE},
++{"BINARYENC", BINARYENC},
++{"HZ_GB_2312", HZ_GB_2312},
++{"UTF8UTF8", UTF8UTF8},
++{"TAM_ELANGO", TAM_ELANGO},
++{"TAM_LTTMBARANI", TAM_LTTMBARANI},
++{"TAM_SHREE", TAM_SHREE},
++{"TAM_TBOOMIS", TAM_TBOOMIS},
++{"TAM_TMNEWS", TAM_TMNEWS},
++{"TAM_WEBTAMIL", TAM_WEBTAMIL},
++{"KDDI_SHIFT_JIS", KDDI_SHIFT_JIS},
++{"DOCOMO_SHIFT_JIS", DOCOMO_SHIFT_JIS},
++{"SOFTBANK_SHIFT_JIS", SOFTBANK_SHIFT_JIS},
++{"KDDI_ISO_2022_JP", KDDI_ISO_2022_JP},
++{"SOFTBANK_ISO_2022_JP", SOFTBANK_ISO_2022_JP},
++};
++
++COMPILE_ASSERT(arraysize(cld_encoding_info) == NUM_ENCODINGS, cld_encoding_info_length_is_wrong);
diff --git a/textproc/pecl-cld/files/patch-config.m4 b/textproc/pecl-cld/files/patch-config.m4
new file mode 100644
index 000000000000..c88d6e7b59a9
--- /dev/null
+++ b/textproc/pecl-cld/files/patch-config.m4
@@ -0,0 +1,17 @@
+--- config.m4.orig 2011-11-15 01:13:43 UTC
++++ config.m4
+@@ -7,13 +7,9 @@ if test -z "$PHP_LIBCLD_DIR"; then
+ fi
+
+ if test "$PHP_CLD" != "no"; then
+- if ! test -f $PHP_LIBCLD_DIR/libcld.a; then
+- AC_MSG_ERROR([libcld not found. Specify installation directory with --with-libcld-dir=])
+- fi
+-
+ PHP_REQUIRE_CXX()
+ PHP_SUBST(CLD_SHARED_LIBADD)
+- PHP_ADD_INCLUDE($PHP_LIBCLD_DIR)
++ PHP_ADD_INCLUDE([/usr/local/include/cld])
+ PHP_ADD_LIBRARY(stdc++, 1, CLD_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(cld, $PHP_LIBCLD_DIR, CLD_SHARED_LIBADD)
+ PHP_NEW_EXTENSION(cld, cld.cc, $ext_shared)
diff --git a/textproc/pecl-cld/pkg-descr b/textproc/pecl-cld/pkg-descr
new file mode 100644
index 000000000000..fc36ac61c1a9
--- /dev/null
+++ b/textproc/pecl-cld/pkg-descr
@@ -0,0 +1,4 @@
+Exposes Chromium Compact Language Detector to PHP to find out what language a
+text is
+
+WWW: http://pecl.php.net/package/cld