aboutsummaryrefslogtreecommitdiff
path: root/textproc/sdcv
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2014-01-19 14:28:36 +0000
committerMartin Wilke <miwi@FreeBSD.org>2014-01-19 14:28:36 +0000
commit81d0f2b19b64e912890ac54ad10217feb0c8d317 (patch)
treeb855251ea18a9c93de844e3676bcd79777c2ef12 /textproc/sdcv
parentb5e3bad02aaee2d5cec984c71e8e9da83c7ba8d1 (diff)
downloadports-81d0f2b19b64e912890ac54ad10217feb0c8d317.tar.gz
ports-81d0f2b19b64e912890ac54ad10217feb0c8d317.zip
Notes
Diffstat (limited to 'textproc/sdcv')
-rw-r--r--textproc/sdcv/Makefile42
-rw-r--r--textproc/sdcv/files/patch-src__lib__lib.cpp27
-rw-r--r--textproc/sdcv/files/patch-src__lib__mapfile.hpp12
-rw-r--r--textproc/sdcv/files/patch-src__libwrapper.cpp50
-rw-r--r--textproc/sdcv/files/patch-src__readline.cpp10
-rw-r--r--textproc/sdcv/files/patch-src__sdcv.cpp15
-rw-r--r--textproc/sdcv/files/patch-src__utils.cpp11
-rw-r--r--textproc/sdcv/pkg-plist10
8 files changed, 151 insertions, 26 deletions
diff --git a/textproc/sdcv/Makefile b/textproc/sdcv/Makefile
index 329eacae5886..1477c7832b7b 100644
--- a/textproc/sdcv/Makefile
+++ b/textproc/sdcv/Makefile
@@ -10,33 +10,33 @@ MASTER_SITES= SF
MAINTAINER= ports@FreeBSD.org
COMMENT= Text-based utility for work with dictionaries in StarDict's format
-OPTIONS_DEFINE= NLS
+LICENSE= GPLv2 # (or later)
USE_BZIP2= yes
-GNU_CONFIGURE= yes
-USE_AUTOTOOLS= libtool
+USES= gettext pkgconfig readline
USE_GNOME= glib20
-USES= pkgconfig iconv
+USE_AUTOTOOLS= libtoolize aclocal automake autoconf
+LIBTOOLIZE_ARGS=--copy --force
+ACLOCAL_ARGS= --automake-acdir=${ACLOCAL_DIR} -I m4
+AUTOMAKE_ARGS= --add-missing --copy
+
SUB_FILES= pkg-message
-NLS_USES= gettext
-NLS_CPPFLAGS= -I${LOCALBASE}/include
-NLS_LDFLAGS= -L${LOCALBASE}/lib
-NLS_CONFIGURE_ENABLE= nls
+CPPFLAGS+= -I${LOCALBASE}/include
+LDFLAGS+= -L${LOCALBASE}/lib
post-patch:
- @${REINPLACE_CMD} -e 's|/usr/share|${PREFIX}/share|g' \
- ${WRKSRC}/doc/sdcv.1
- @${REINPLACE_CMD} -e '1425 s, install-data,,' \
- ${WRKSRC}/po/Makefile.in.in
- @${REINPLACE_CMD} -e 's, getopt.h,,g' ${WRKSRC}/src/Makefile.in
- @${REINPLACE_CMD} -e '146 s|()|(int, char * const [], const char *)|g' \
- ${WRKSRC}/src/getopt.h
- @${REINPLACE_CMD} -e '516 s|sizeof|(guint32)sizeof|g' \
- ${WRKSRC}/src/lib/lib.cpp
- @${REINPLACE_CMD} -e 's|/usr/share|${PREFIX}/share|g' \
- ${WRKSRC}/src/sdcv.cpp
- @${REINPLACE_CMD} -e 's,@mandir@/uk,@mandir@,' \
- ${WRKSRC}/doc/uk/Makefile.in
+.for i in doc/sdcv.1 src/sdcv.cpp
+ @${REINPLACE_CMD} -e \
+ 's|/usr/share|${PREFIX}/share|' ${WRKSRC}/${i}
+.endfor
+ @${REINPLACE_CMD} -e \
+ 's|@mandir@/uk|@mandir@|' ${WRKSRC}/doc/uk/Makefile.am
+ @${REINPLACE_CMD} -e \
+ 's|getopt1.c getopt.h||' ${WRKSRC}/src/Makefile.am
+
+pre-configure:
+ @${RM} -f ${WRKSRC}/m4/gettext.m4
+ @${RM} -f ${WRKSRC}/src/getopt.h
.include <bsd.port.mk>
diff --git a/textproc/sdcv/files/patch-src__lib__lib.cpp b/textproc/sdcv/files/patch-src__lib__lib.cpp
new file mode 100644
index 000000000000..06d46e87249c
--- /dev/null
+++ b/textproc/sdcv/files/patch-src__lib__lib.cpp
@@ -0,0 +1,27 @@
+--- src/lib/lib.cpp.orig
++++ src/lib/lib.cpp
+@@ -496,9 +496,13 @@
+ entries[i].keystr=p;
+ len=strlen(p);
+ p+=len+1;
+- entries[i].off=g_ntohl(*reinterpret_cast<guint32 *>(p));
++ /*
++ * Can not use typecasting here, because *data does not have
++ * to be alligned and unalligned access fails on some architectures.
++ */
++ entries[i].off=((unsigned char)p[0] << 24) | ((unsigned char)p[1] << 16) | ((unsigned char)p[2] << 8) | (unsigned char)p[3];
+ p+=sizeof(guint32);
+- entries[i].size=g_ntohl(*reinterpret_cast<guint32 *>(p));
++ entries[i].size=((unsigned char)p[0] << 24) | ((unsigned char)p[1] << 16) | ((unsigned char)p[2] << 8) | (unsigned char)p[3];
+ p+=sizeof(guint32);
+ }
+ }
+@@ -513,7 +517,7 @@
+ {
+ fseek(idxfile, wordoffset[page_idx], SEEK_SET);
+ guint32 page_size=wordoffset[page_idx+1]-wordoffset[page_idx];
+- fread(wordentry_buf, std::min(sizeof(wordentry_buf), page_size), 1, idxfile); //TODO: check returned values, deal with word entry that strlen>255.
++ fread(wordentry_buf, std::min(sizeof(wordentry_buf), (size_t)page_size), 1, idxfile); //TODO: check returned values, deal with word entry that strlen>255.
+ return wordentry_buf;
+ }
+
diff --git a/textproc/sdcv/files/patch-src__lib__mapfile.hpp b/textproc/sdcv/files/patch-src__lib__mapfile.hpp
new file mode 100644
index 000000000000..0637a27997b7
--- /dev/null
+++ b/textproc/sdcv/files/patch-src__lib__mapfile.hpp
@@ -0,0 +1,12 @@
+--- src/lib/mapfile.hpp.orig
++++ src/lib/mapfile.hpp
+@@ -5,6 +5,9 @@
+ # include "config.h"
+ #endif
+
++#include <cstdlib>
++#include <unistd.h>
++
+ #ifdef HAVE_MMAP
+ # include <sys/types.h>
+ # include <fcntl.h>
diff --git a/textproc/sdcv/files/patch-src__libwrapper.cpp b/textproc/sdcv/files/patch-src__libwrapper.cpp
new file mode 100644
index 000000000000..55fb7c0cf432
--- /dev/null
+++ b/textproc/sdcv/files/patch-src__libwrapper.cpp
@@ -0,0 +1,50 @@
+--- src/libwrapper.cpp.orig
++++ src/libwrapper.cpp
+@@ -24,6 +24,7 @@
+
+ #include <glib/gi18n.h>
+ #include <map>
++#include <cstring>
+
+ #include "utils.hpp"
+
+@@ -117,7 +118,6 @@
+ switch (*p++) {
+ case 'm':
+ case 'l': //need more work...
+- case 'g':
+ sec_size = strlen(p);
+ if (sec_size) {
+ res+="\n";
+@@ -127,6 +127,7 @@
+ }
+ sec_size++;
+ break;
++ case 'g':
+ case 'x':
+ sec_size = strlen(p);
+ if (sec_size) {
+@@ -208,6 +209,15 @@
+
+ void Library::LookupData(const string &str, TSearchResultList& res_list)
+ {
++#if defined(_LIBCPP_VERSION)
++ std::vector<std::vector<gchar *> > drl(ndicts());
++ if (!Libs::LookupData(str.c_str(), &drl[0]))
++ return;
++ for (int idict=0; idict<ndicts(); ++idict)
++ for (gchar *res : drl[idict]) {
++ SimpleLookup(res, res_list);
++ g_free(res);
++#else
+ std::vector<gchar *> drl[ndicts()];
+ if (!Libs::LookupData(str.c_str(), drl))
+ return;
+@@ -215,6 +225,7 @@
+ for (std::vector<gchar *>::size_type j=0; j<drl[idict].size(); ++j) {
+ SimpleLookup(drl[idict][j], res_list);
+ g_free(drl[idict][j]);
++#endif
+ }
+ }
+
diff --git a/textproc/sdcv/files/patch-src__readline.cpp b/textproc/sdcv/files/patch-src__readline.cpp
new file mode 100644
index 000000000000..1e6641c923f7
--- /dev/null
+++ b/textproc/sdcv/files/patch-src__readline.cpp
@@ -0,0 +1,10 @@
+--- src/readline.cpp.orig
++++ src/readline.cpp
+@@ -23,6 +23,7 @@
+ #endif
+
+ #include <cstdio>
++#include <cstdlib>
+ #ifdef WITH_READLINE
+ # include <readline/readline.h>
+ # include <readline/history.h>
diff --git a/textproc/sdcv/files/patch-src__sdcv.cpp b/textproc/sdcv/files/patch-src__sdcv.cpp
new file mode 100644
index 000000000000..4067984cc1eb
--- /dev/null
+++ b/textproc/sdcv/files/patch-src__sdcv.cpp
@@ -0,0 +1,15 @@
+--- src/sdcv.cpp.orig
++++ src/sdcv.cpp
+@@ -161,7 +161,11 @@
+
+ strlist_t dicts_dir_list;
+
+- dicts_dir_list.push_back(std::string(g_get_home_dir())+G_DIR_SEPARATOR+
++ const char *homedir = g_getenv ("HOME");
++ if (!homedir)
++ homedir = g_get_home_dir ();
++
++ dicts_dir_list.push_back(std::string(homedir)+G_DIR_SEPARATOR+
+ ".stardict"+G_DIR_SEPARATOR+"dic");
+ dicts_dir_list.push_back(data_dir);
+
diff --git a/textproc/sdcv/files/patch-src__utils.cpp b/textproc/sdcv/files/patch-src__utils.cpp
new file mode 100644
index 000000000000..3d2c61882d1c
--- /dev/null
+++ b/textproc/sdcv/files/patch-src__utils.cpp
@@ -0,0 +1,11 @@
+--- src/utils.cpp.orig
++++ src/utils.cpp
+@@ -22,6 +22,8 @@
+ # include "config.h"
+ #endif
+
++#include <cstdio>
++#include <cstdlib>
+ #include <glib.h>
+ #include <glib/gi18n.h>
+
diff --git a/textproc/sdcv/pkg-plist b/textproc/sdcv/pkg-plist
index 10893f510c81..3947a4a5485d 100644
--- a/textproc/sdcv/pkg-plist
+++ b/textproc/sdcv/pkg-plist
@@ -1,7 +1,7 @@
bin/sdcv
man/man1/sdcv.1.gz
-%%NLS%%share/locale/ru/LC_MESSAGES/sdcv.mo
-%%NLS%%share/locale/sk/LC_MESSAGES/sdcv.mo
-%%NLS%%share/locale/uk/LC_MESSAGES/sdcv.mo
-%%NLS%%share/locale/zh_CN/LC_MESSAGES/sdcv.mo
-%%NLS%%share/locale/zh_TW/LC_MESSAGES/sdcv.mo
+share/locale/ru/LC_MESSAGES/sdcv.mo
+share/locale/sk/LC_MESSAGES/sdcv.mo
+share/locale/uk/LC_MESSAGES/sdcv.mo
+share/locale/zh_CN/LC_MESSAGES/sdcv.mo
+share/locale/zh_TW/LC_MESSAGES/sdcv.mo