Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Jan 2014 14:28:36 +0000 (UTC)
From:      Martin Wilke <miwi@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r340306 - in head/textproc/sdcv: . files
Message-ID:  <201401191428.s0JESaAO046177@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: miwi
Date: Sun Jan 19 14:28:36 2014
New Revision: 340306
URL: http://svnweb.freebsd.org/changeset/ports/340306
QAT: https://qat.redports.org/buildarchive/r340306/

Log:
  - Fix build with clang
  
  PR:		185696
  Submitted by:	ports fury

Added:
  head/textproc/sdcv/files/patch-src__lib__lib.cpp   (contents, props changed)
  head/textproc/sdcv/files/patch-src__lib__mapfile.hpp   (contents, props changed)
  head/textproc/sdcv/files/patch-src__libwrapper.cpp   (contents, props changed)
  head/textproc/sdcv/files/patch-src__readline.cpp   (contents, props changed)
  head/textproc/sdcv/files/patch-src__sdcv.cpp   (contents, props changed)
  head/textproc/sdcv/files/patch-src__utils.cpp   (contents, props changed)
Modified:
  head/textproc/sdcv/Makefile
  head/textproc/sdcv/pkg-plist   (contents, props changed)

Modified: head/textproc/sdcv/Makefile
==============================================================================
--- head/textproc/sdcv/Makefile	Sun Jan 19 14:25:38 2014	(r340305)
+++ head/textproc/sdcv/Makefile	Sun Jan 19 14:28:36 2014	(r340306)
@@ -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>

Added: head/textproc/sdcv/files/patch-src__lib__lib.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/sdcv/files/patch-src__lib__lib.cpp	Sun Jan 19 14:28:36 2014	(r340306)
@@ -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;
+ }
+ 

Added: head/textproc/sdcv/files/patch-src__lib__mapfile.hpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/sdcv/files/patch-src__lib__mapfile.hpp	Sun Jan 19 14:28:36 2014	(r340306)
@@ -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>

Added: head/textproc/sdcv/files/patch-src__libwrapper.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/sdcv/files/patch-src__libwrapper.cpp	Sun Jan 19 14:28:36 2014	(r340306)
@@ -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
+ 		}
+ }
+ 

Added: head/textproc/sdcv/files/patch-src__readline.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/sdcv/files/patch-src__readline.cpp	Sun Jan 19 14:28:36 2014	(r340306)
@@ -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>

Added: head/textproc/sdcv/files/patch-src__sdcv.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/sdcv/files/patch-src__sdcv.cpp	Sun Jan 19 14:28:36 2014	(r340306)
@@ -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);   
+ 

Added: head/textproc/sdcv/files/patch-src__utils.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/textproc/sdcv/files/patch-src__utils.cpp	Sun Jan 19 14:28:36 2014	(r340306)
@@ -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>
+ 

Modified: head/textproc/sdcv/pkg-plist
==============================================================================
--- head/textproc/sdcv/pkg-plist	Sun Jan 19 14:25:38 2014	(r340305)
+++ head/textproc/sdcv/pkg-plist	Sun Jan 19 14:28:36 2014	(r340306)
@@ -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



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