about summary refs log tree commit diff
path: root/pkgs/applications/misc/stardict
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2012-06-18 15:37:35 +0000
committerVladimír Čunát <vcunat@gmail.com>2012-06-18 15:37:35 +0000
commit1a33b4b654903ec597fcdb743e649466bc563304 (patch)
tree7102a1590b686191e73d3c1347ae9a9b41ed6d1f /pkgs/applications/misc/stardict
parentfc496faab07e16558ebb13aab9d931bb01f8fe87 (diff)
downloadnixlib-1a33b4b654903ec597fcdb743e649466bc563304.tar
nixlib-1a33b4b654903ec597fcdb743e649466bc563304.tar.gz
nixlib-1a33b4b654903ec597fcdb743e649466bc563304.tar.bz2
nixlib-1a33b4b654903ec597fcdb743e649466bc563304.tar.lz
nixlib-1a33b4b654903ec597fcdb743e649466bc563304.tar.xz
nixlib-1a33b4b654903ec597fcdb743e649466bc563304.tar.zst
nixlib-1a33b4b654903ec597fcdb743e649466bc563304.zip
Fixing stardict broken by my mistake.
svn path=/nixpkgs/trunk/; revision=34549
Diffstat (limited to 'pkgs/applications/misc/stardict')
-rw-r--r--pkgs/applications/misc/stardict/stardict-3.0.3-compositelookup_cpp.patch19
-rw-r--r--pkgs/applications/misc/stardict/stardict-3.0.3-correct-glib-include.patch13
-rw-r--r--pkgs/applications/misc/stardict/stardict-3.0.3-entry.patch20
-rw-r--r--pkgs/applications/misc/stardict/stardict-3.0.3-gcc46.patch13
-rw-r--r--pkgs/applications/misc/stardict/stardict-3.0.3-overflow.patch26
-rw-r--r--pkgs/applications/misc/stardict/stardict-3.0.3-zlib-1.2.5.2.patch39
-rw-r--r--pkgs/applications/misc/stardict/stardict.nix46
7 files changed, 176 insertions, 0 deletions
diff --git a/pkgs/applications/misc/stardict/stardict-3.0.3-compositelookup_cpp.patch b/pkgs/applications/misc/stardict/stardict-3.0.3-compositelookup_cpp.patch
new file mode 100644
index 000000000000..86825555d9cb
--- /dev/null
+++ b/pkgs/applications/misc/stardict/stardict-3.0.3-compositelookup_cpp.patch
@@ -0,0 +1,19 @@
+This patch is from OpenSUSE .src.rpm for the following crash on startup:
+
+ERROR:compositelookup.cpp:53:void CompositeLookup::send_net_dict_request(const string&, const string&): assertion failed: (NetDictRequests.end() == std::find(NetDictRequests.begin(), NetDictRequests.end(), request))
+
+--- dict/src/lib/compositelookup.cpp
++++ dict/src/lib/compositelookup.cpp
+@@ -50,8 +50,10 @@
+ void CompositeLookup::send_net_dict_request(const std::string& dict_id, const std::string& key)
+ {
+ 	NetDictRequest request(dict_id, key);
+-	g_assert(NetDictRequests.end() == std::find(NetDictRequests.begin(), NetDictRequests.end(), request));
+-	NetDictRequests.push_back(request);
++	if(NetDictRequests.end() == std::find(NetDictRequests.begin(), NetDictRequests.end(), request))
++	{
++	  NetDictRequests.push_back(request);
++	}
+ }
+ 
+ /* returns true if got expected response */
diff --git a/pkgs/applications/misc/stardict/stardict-3.0.3-correct-glib-include.patch b/pkgs/applications/misc/stardict/stardict-3.0.3-correct-glib-include.patch
new file mode 100644
index 000000000000..fd89243938eb
--- /dev/null
+++ b/pkgs/applications/misc/stardict/stardict-3.0.3-correct-glib-include.patch
@@ -0,0 +1,13 @@
+http://bugs.gentoo.org/396219
+
+--- dict/src/tomboykeybinder.h
++++ dict/src/tomboykeybinder.h
+@@ -21,7 +21,7 @@
+ #ifndef __TOMBOY_KEY_BINDER_H__
+ #define __TOMBOY_KEY_BINDER_H__
+ 
+-#include <glib/gtypes.h>
++#include <glib.h>
+ 
+ G_BEGIN_DECLS
+ 
diff --git a/pkgs/applications/misc/stardict/stardict-3.0.3-entry.patch b/pkgs/applications/misc/stardict/stardict-3.0.3-entry.patch
new file mode 100644
index 000000000000..38182b0c8e0b
--- /dev/null
+++ b/pkgs/applications/misc/stardict/stardict-3.0.3-entry.patch
@@ -0,0 +1,20 @@
+warning: key "Encoding" in group "Desktop Entry" is deprecated
+error: value "stardict.png" for key "Icon" in group "Desktop Entry" is an icon name with an extension, but there should be no extension
+error: value "Dictionary" in key "Categories" in group "Desktop Entry" requires another category to be present among the following categories: Office;TextTools
+
+--- dict/data/stardict.desktop.in
++++ dict/data/stardict.desktop.in
+@@ -1,11 +1,10 @@
+ [Desktop Entry]
+-Encoding=UTF-8
+ _Name=StarDict
+ _Comment=Lookup words
+ Exec=stardict
+ Terminal=false
+ Type=Application
+-Icon=stardict.png
++Icon=stardict
+ StartupNotify=true
+-Categories=Utility;Dictionary;
++Categories=Utility;Office;TextTools;Dictionary;
+ X-GNOME-DocPath=stardict/stardict.xml
diff --git a/pkgs/applications/misc/stardict/stardict-3.0.3-gcc46.patch b/pkgs/applications/misc/stardict/stardict-3.0.3-gcc46.patch
new file mode 100644
index 000000000000..d85bc0de5ce0
--- /dev/null
+++ b/pkgs/applications/misc/stardict/stardict-3.0.3-gcc46.patch
@@ -0,0 +1,13 @@
+http://bugs.gentoo.org/362299
+
+--- dict/stardict-plugins/stardict-wordnet-plugin/scene.h
++++ dict/stardict-plugins/stardict-wordnet-plugin/scene.h
+@@ -25,6 +25,8 @@
+ #ifndef __PHYSICS_H__
+ #define __PHYSICS_H__
+ 
++#include <cstddef>
++
+ #include "partic.h"
+ #include "spring.h"
+ 
diff --git a/pkgs/applications/misc/stardict/stardict-3.0.3-overflow.patch b/pkgs/applications/misc/stardict/stardict-3.0.3-overflow.patch
new file mode 100644
index 000000000000..482490105704
--- /dev/null
+++ b/pkgs/applications/misc/stardict/stardict-3.0.3-overflow.patch
@@ -0,0 +1,26 @@
+This patch is stardict-tools-3.0.3-destbufferoverflow.patch from OpenSUSE .src.rpm for:
+
+warning: call to ‘__fgets_chk_warn’ declared with attribute warning: fgets called with bigger size than length of destination buffer [enabled by default]
+
+--- tools/src/myspell2dic.c
++++ tools/src/myspell2dic.c
+@@ -132,7 +132,7 @@ if (argc<3) 
+ 
+ fprintf(stderr, "Enter grammar language [Spanish]: ");
+ fflush(stderr);
+-fgets(lang, 100, stdin);
++fgets(lang, 50, stdin);
+ if ((p=strchr(lang, '\n'))!=NULL) *p=0;
+ if (*lang==0) strcpy(lang, "Spanish");
+ 
+--- tools/src/ooo2dict.c
++++ tools/src/ooo2dict.c
+@@ -71,7 +71,7 @@ current2=malloc(10000);
+ 
+ fprintf(stderr, "Enter thesaurus language [WordNet_English]: ");
+ fflush(stderr);
+-fgets(lang, 100, stdin);
++fgets(lang, 50, stdin);
+ if ((p=strchr(lang, '\n'))!=NULL) *p=0;
+ if (*lang==0) strcpy(lang, "WordNet_English");
+ F=fopen((argc>1)? argv[1]: "/usr/share/myspell/dicts/th_en_US_v2.dat", "rt");
diff --git a/pkgs/applications/misc/stardict/stardict-3.0.3-zlib-1.2.5.2.patch b/pkgs/applications/misc/stardict/stardict-3.0.3-zlib-1.2.5.2.patch
new file mode 100644
index 000000000000..6a320bd4a9f2
--- /dev/null
+++ b/pkgs/applications/misc/stardict/stardict-3.0.3-zlib-1.2.5.2.patch
@@ -0,0 +1,39 @@
+http://bugs.gentoo.org/401887
+
+diff --git a/lib/src/libcommon.cpp b/lib/src/libcommon.cpp
+index 16770a3..a4299e7 100644
+--- a/lib/src/libcommon.cpp
++++ b/lib/src/libcommon.cpp
+@@ -614,7 +614,7 @@ int unpack_zlib(const char* arch_file_name, const char* out_file_name)
+ 		return EXIT_FAILURE;
+ 	}
+ 	while(true) {
+-		len = gzread(get_impl(in), buf, buffer_size);
++		len = gzread((gzFile)get_impl(in), buf, buffer_size);
+ 		if(len < 0) {
+ 			g_critical(read_file_err, arch_file_name, "");
+ 			return EXIT_FAILURE;
+@@ -871,3 +871,8 @@ int remove_recursive(const std::string& path)
+ 		return res;
+ 	}
+ }
++
++int gzclose_compat(void * file)
++{
++    return gzclose ((gzFile)file);
++}
+diff --git a/lib/src/libcommon.h b/lib/src/libcommon.h
+index 10f13b4..bdcbf2f 100644
+--- a/lib/src/libcommon.h
++++ b/lib/src/libcommon.h
+@@ -187,8 +187,9 @@ namespace clib {
+ 	typedef ResourceWrapper<FILE, FILE*, int, fclose> File;
+ }
+ 
++extern int gzclose_compat(void * file);
+ namespace zip {
+-typedef ResourceWrapper<void, void*, int, gzclose> gzFile;
++typedef ResourceWrapper<void, void*, int, gzclose_compat> gzFile;
+ }
+ 
+ /* Create a new temporary file. Return file name in file name encoding.
diff --git a/pkgs/applications/misc/stardict/stardict.nix b/pkgs/applications/misc/stardict/stardict.nix
new file mode 100644
index 000000000000..9eb3e1123421
--- /dev/null
+++ b/pkgs/applications/misc/stardict/stardict.nix
@@ -0,0 +1,46 @@
+{stdenv, fetchurl, pkgconfig, gtk, glib, zlib, libxml2, intltool, gnome_doc_utils, libgnomeui, scrollkeeper, mysql, pcre, which, libxslt}:
+stdenv.mkDerivation rec {
+  name= "stardict-3.0.3";
+
+  src = fetchurl {
+    url = "http://stardict-3.googlecode.com/files/${name}.tar.bz2";
+    sha256 = "0wrb8xqy6x9piwrn0vw5alivr9h3b70xlf51qy0jpl6d7mdhm8cv";
+  };
+
+  buildInputs = [ pkgconfig gtk glib zlib libxml2 intltool gnome_doc_utils libgnomeui scrollkeeper mysql pcre which libxslt];
+
+  postPatch = ''
+    # mysql hacks: we need dynamic linking as there is no libmysqlclient.a
+    substituteInPlace tools/configure --replace '/usr/local/include/mysql' '${mysql}/include/mysql/'
+    substituteInPlace tools/configure --replace 'AC_FIND_FILE([libmysqlclient.a]' 'AC_FIND_FILE([libmysqlclient.so]'
+    substituteInPlace tools/configure --replace '/usr/local/lib/mysql' '${mysql}/lib/mysql/'
+    substituteInPlace tools/configure --replace 'for y in libmysqlclient.a' 'for y in libmysqlclient.so'
+    substituteInPlace tools/configure --replace 'libmysqlclient.a' 'libmysqlclient.so'
+
+    # a list of p0 patches from gentoo devs
+    patch -p0 < ${./stardict-3.0.3-overflow.patch}
+    patch -p0 < ${./stardict-3.0.3-gcc46.patch}
+    patch -p0 < ${./stardict-3.0.3-compositelookup_cpp.patch}
+    patch -p0 < ${./stardict-3.0.3-correct-glib-include.patch}
+    patch -p0 < ${./stardict-3.0.3-entry.patch}
+
+    # disable the xsltproc internet query
+    substituteInPlace dict/help/Makefile.am --replace 'xsltproc -o' 'xsltproc --nonet -o'
+    substituteInPlace dict/help/Makefile.in --replace 'xsltproc -o' 'xsltproc --nonet -o'
+  '';
+
+  # another gentoo patch: a p1 patch
+  patches = [ ./stardict-3.0.3-zlib-1.2.5.2.patch ];
+
+  configurePhase = ''
+    ./configure --disable-spell --disable-gucharmap --disable-festival --disable-espeak --disable-scrollkeeper --prefix=$out
+  '';
+
+  meta = {
+    description = "stardict";
+    homepage = "A international dictionary supporting fuzzy and glob style matching";
+    license = "LGPL3";
+    maintainers = with stdenv.lib.maintainers; [qknight];
+  };
+}
+