View | Details | Raw Unified | Return to bug 217671 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-15 / +13 lines)
Lines 2-38 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	sdcv
4
PORTNAME=	sdcv
5
PORTVERSION=	0.4.2
5
DISTVERSION=	0.5.0-beta2
6
PORTREVISION=	4
6
DISTVERSIONSUFFIX=	-Source
7
CATEGORIES=	textproc
7
CATEGORIES=	textproc
8
MASTER_SITES=	SF
8
MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}/
9
9
10
MAINTAINER=	ports@FreeBSD.org
10
MAINTAINER=	citrin@citrin.ru
11
COMMENT=	Text-based utility for work with dictionaries in StarDict's format
11
COMMENT=	Text-based utility for work with dictionaries in StarDict's format
12
12
13
LICENSE=	GPLv2+
13
LICENSE=	GPLv2+
14
LICENSE_FILE=	${WRKSRC}/COPYING
14
LICENSE_FILE=	${WRKSRC}/COPYING
15
15
16
GNU_CONFIGURE=	yes
16
USES=		cmake:outsource pkgconfig readline tar:bzip2
17
USES=		autoreconf gettext pkgconfig readline tar:bzip2
18
USE_GNOME=	glib20
17
USE_GNOME=	glib20
19
18
20
SUB_FILES=	pkg-message
19
SUB_FILES=	pkg-message
21
20
22
CPPFLAGS+=	-I${LOCALBASE}/include
21
OPTIONS_DEFINE=	NLS
23
LIBS+=		-L${LOCALBASE}/lib
22
OPTIONS_SUB=	yes
23
24
NLS_USES=	gettext
25
NLS_CMAKE_OFF=	-DENABLE_NLS:BOOL=OFF
24
26
25
post-patch:
27
post-patch:
26
.for i in doc/sdcv.1 src/sdcv.cpp
28
.for i in doc/sdcv.1 src/sdcv.cpp
27
	@${REINPLACE_CMD} -e \
29
	@${REINPLACE_CMD} -e \
28
		's|/usr/share|${PREFIX}/share|' ${WRKSRC}/${i}
30
		's|/usr/share|${PREFIX}/share|' ${WRKSRC}/${i}
29
.endfor
31
.endfor
30
	@${REINPLACE_CMD} -e \
32
31
		's|@mandir@/uk|@mandir@|' ${WRKSRC}/doc/uk/Makefile.am
33
post-build-NLS-on:
32
	@${REINPLACE_CMD} -e \
34
	cd ${BUILD_WRKSRC} && ${MAKE_CMD} lang
33
		's|getopt1.c getopt.h||' ${WRKSRC}/src/Makefile.am
34
	@${RM} ${WRKSRC}/src/getopt.h
35
	@${REINPLACE_CMD} '/AM_GNU_GETTEXT_VERSION/s/0\.14\.1/0.19.1/' \
36
		${WRKSRC}/configure.ac
37
35
38
.include <bsd.port.mk>
36
.include <bsd.port.mk>
(-)distinfo (-2 / +3 lines)
Lines 1-2 Link Here
1
SHA256 (sdcv-0.4.2.tar.bz2) = a164f079e93986814ea2d39f3a49cf9d1b71b01aad908254457fe3d0ded9deb2
1
TIMESTAMP = 1488927916
2
SIZE (sdcv-0.4.2.tar.bz2) = 181384
2
SHA256 (sdcv-0.5.0-beta2-Source.tar.bz2) = 386cfc96285a653c697f8baeab676cb3f1645cea029464d194872d0bbae14ffb
3
SIZE (sdcv-0.5.0-beta2-Source.tar.bz2) = 51508
(-)files/patch-CMakeLists.txt (+26 lines)
Line 0 Link Here
1
--- CMakeLists.txt.orig	2013-07-07 14:55:00 UTC
2
+++ CMakeLists.txt
3
@@ -110,6 +110,10 @@ target_link_libraries(sdcv
4
   ${ZLIB_LIBRARIES}
5
   ${READLINE_LIBRARY}
6
 )
7
+set_target_properties(sdcv
8
+	PROPERTIES
9
+	LINK_FLAGS ${GLIB2_LDFLAGS}
10
+)
11
 if (ENABLE_NLS)
12
 set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "locale")
13
 endif ()
14
@@ -117,8 +121,10 @@ endif ()
15
 include(CPack)
16
 
17
 INSTALL(TARGETS sdcv DESTINATION "bin")
18
-INSTALL(FILES doc/sdcv.1 DESTINATION "share/man/man1")
19
-INSTALL(FILES doc/uk/sdcv.1 DESTINATION "share/man/uk/man1")
20
+
21
+include(GNUInstallDirs)
22
+INSTALL(FILES doc/sdcv.1 DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
23
+INSTALL(FILES doc/uk/sdcv.1 DESTINATION "${CMAKE_INSTALL_MANDIR}/uk.UTF-8/man1")
24
 
25
 if (ENABLE_NLS)
26
   INSTALL(DIRECTORY "${gettext_outDir}" DESTINATION "share")
(-)files/patch-src__lib__lib.cpp (-27 lines)
Lines 1-27 Link Here
1
--- src/lib/lib.cpp.orig
2
+++ src/lib/lib.cpp
3
@@ -496,9 +496,13 @@
4
 		entries[i].keystr=p;
5
 		len=strlen(p);
6
 		p+=len+1;
7
-		entries[i].off=g_ntohl(*reinterpret_cast<guint32 *>(p));
8
+        /*
9
+         * Can not use typecasting here, because *data does not have
10
+         * to be alligned and unalligned access fails on some architectures.
11
+         */
12
+		entries[i].off=((unsigned char)p[0] << 24) | ((unsigned char)p[1] << 16) | ((unsigned char)p[2] << 8) | (unsigned char)p[3];
13
 		p+=sizeof(guint32);
14
-		entries[i].size=g_ntohl(*reinterpret_cast<guint32 *>(p));
15
+		entries[i].size=((unsigned char)p[0] << 24) | ((unsigned char)p[1] << 16) | ((unsigned char)p[2] << 8) | (unsigned char)p[3];
16
 		p+=sizeof(guint32);
17
 	}
18
 }
19
@@ -513,7 +517,7 @@
20
 {
21
 	fseek(idxfile, wordoffset[page_idx], SEEK_SET);
22
 	guint32 page_size=wordoffset[page_idx+1]-wordoffset[page_idx];
23
-	fread(wordentry_buf, std::min(sizeof(wordentry_buf), page_size), 1, idxfile); //TODO: check returned values, deal with word entry that strlen>255.
24
+	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.
25
 	return wordentry_buf;
26
 }
27
 
(-)files/patch-src__lib__mapfile.hpp (-2 / +2 lines)
Lines 1-6 Link Here
1
--- src/lib/mapfile.hpp.orig
1
--- src/lib/mapfile.hpp.orig	2013-07-06 22:28:17 UTC
2
+++ src/lib/mapfile.hpp
2
+++ src/lib/mapfile.hpp
3
@@ -5,6 +5,9 @@
3
@@ -4,6 +4,9 @@
4
 #  include "config.h"
4
 #  include "config.h"
5
 #endif
5
 #endif
6
 
6
 
(-)files/patch-src__libwrapper.cpp (-50 lines)
Lines 1-50 Link Here
1
--- src/libwrapper.cpp.orig
2
+++ src/libwrapper.cpp
3
@@ -24,6 +24,7 @@
4
 
5
 #include <glib/gi18n.h>
6
 #include <map>
7
+#include <cstring>
8
 
9
 #include "utils.hpp"
10
 
11
@@ -117,7 +118,6 @@
12
 		switch (*p++) {
13
 		case 'm':
14
 		case 'l': //need more work...
15
-		case 'g':
16
 			sec_size = strlen(p);
17
 			if (sec_size) {
18
 				res+="\n";
19
@@ -127,6 +127,7 @@
20
 			}
21
 			sec_size++;
22
 			break;
23
+		case 'g':
24
 		case 'x':
25
 			sec_size = strlen(p);
26
 			if (sec_size) {
27
@@ -208,6 +209,15 @@
28
 
29
 void Library::LookupData(const string &str, TSearchResultList& res_list)
30
 {
31
+#if defined(_LIBCPP_VERSION)
32
+	std::vector<std::vector<gchar *> > drl(ndicts());
33
+	if (!Libs::LookupData(str.c_str(), &drl[0]))
34
+		return;
35
+	for (int idict=0; idict<ndicts(); ++idict)
36
+		for (gchar *res : drl[idict]) {
37
+			SimpleLookup(res, res_list);
38
+			g_free(res);
39
+#else
40
 	std::vector<gchar *> drl[ndicts()];
41
 	if (!Libs::LookupData(str.c_str(), drl))
42
 		return;
43
@@ -215,6 +225,7 @@
44
 		for (std::vector<gchar *>::size_type j=0; j<drl[idict].size(); ++j) {
45
 			SimpleLookup(drl[idict][j], res_list);
46
 			g_free(drl[idict][j]);
47
+#endif
48
 		}
49
 }
50
 
(-)files/patch-src__readline.cpp (-10 lines)
Lines 1-10 Link Here
1
--- src/readline.cpp.orig
2
+++ src/readline.cpp
3
@@ -23,6 +23,7 @@
4
 #endif
5
 
6
 #include <cstdio>
7
+#include <cstdlib>
8
 #ifdef WITH_READLINE
9
 #  include <readline/readline.h>
10
 #  include <readline/history.h>
(-)files/patch-src__sdcv.cpp (-15 lines)
Lines 1-15 Link Here
1
--- src/sdcv.cpp.orig
2
+++ src/sdcv.cpp
3
@@ -161,7 +161,11 @@
4
 
5
 	strlist_t dicts_dir_list;
6
 
7
-	dicts_dir_list.push_back(std::string(g_get_home_dir())+G_DIR_SEPARATOR+
8
+	const char *homedir = g_getenv ("HOME");
9
+	if (!homedir)
10
+		homedir = g_get_home_dir ();
11
+
12
+	dicts_dir_list.push_back(std::string(homedir)+G_DIR_SEPARATOR+
13
 				 ".stardict"+G_DIR_SEPARATOR+"dic");
14
 	dicts_dir_list.push_back(data_dir);   
15
 
(-)files/patch-src__utils.cpp (-11 lines)
Lines 1-11 Link Here
1
--- src/utils.cpp.orig
2
+++ src/utils.cpp
3
@@ -22,6 +22,8 @@
4
 #  include "config.h"
5
 #endif
6
 
7
+#include <cstdio>
8
+#include <cstdlib>
9
 #include <glib.h>
10
 #include <glib/gi18n.h>
11
 
(-)files/patch-src_libwrapper.cpp (+11 lines)
Line 0 Link Here
1
--- src/libwrapper.cpp.orig	2013-07-07 14:34:44 UTC
2
+++ src/libwrapper.cpp
3
@@ -285,7 +285,7 @@ namespace {
4
         sdcv_pager& operator=(const sdcv_pager&) = delete;
5
         ~sdcv_pager() {
6
             if (output != stdout)
7
-                fclose(output);
8
+                pclose(output);
9
         }
10
         FILE *get_stream() { return output; }
11
     private:
(-)files/pkg-message.in (-2 / +2 lines)
Lines 4-14 you have to fetch the dictionaries to ma Link Here
4
4
5
1. Make directory for dictionaries files :
5
1. Make directory for dictionaries files :
6
6
7
	# mkdir -p %%PREFIX%%/share/stardict/dict
7
	# mkdir -p %%PREFIX%%/share/stardict/dic
8
8
9
9
10
2. Please put your dictionary file at :
10
2. Please put your dictionary file at :
11
11
12
 	%%PREFIX%%/share/stardict/dict/
12
 	%%PREFIX%%/share/stardict/dic/
13
13
14
**************************************************************************
14
**************************************************************************
(-)pkg-descr (-1 / +1 lines)
Lines 5-8 The word from "list of words" may be str Link Here
5
search algorithm, string may contain '?' and '*' for using regexp search.
5
search algorithm, string may contain '?' and '*' for using regexp search.
6
It work in interactive and not interactive mode.
6
It work in interactive and not interactive mode.
7
7
8
WWW: http://sdcv.sourceforge.net/
8
WWW: http://dushistov.github.io/sdcv/
(-)pkg-plist (-5 / +8 lines)
Lines 1-7 Link Here
1
bin/sdcv
1
bin/sdcv
2
man/man1/sdcv.1.gz
2
man/man1/sdcv.1.gz
3
share/locale/ru/LC_MESSAGES/sdcv.mo
3
man/uk.UTF-8/man1/sdcv.1.gz
4
share/locale/sk/LC_MESSAGES/sdcv.mo
4
%%NLS%%share/locale/cs/LC_MESSAGES/sdcv.mo
5
share/locale/uk/LC_MESSAGES/sdcv.mo
5
%%NLS%%share/locale/fr/LC_MESSAGES/sdcv.mo
6
share/locale/zh_CN/LC_MESSAGES/sdcv.mo
6
%%NLS%%share/locale/ru/LC_MESSAGES/sdcv.mo
7
share/locale/zh_TW/LC_MESSAGES/sdcv.mo
7
%%NLS%%share/locale/sk/LC_MESSAGES/sdcv.mo
8
%%NLS%%share/locale/uk/LC_MESSAGES/sdcv.mo
9
%%NLS%%share/locale/zh_CN/LC_MESSAGES/sdcv.mo
10
%%NLS%%share/locale/zh_TW/LC_MESSAGES/sdcv.mo

Return to bug 217671