From 1a33b4b654903ec597fcdb743e649466bc563304 Mon Sep 17 00:00:00 2001 From: Vladimír Čunát Date: Mon, 18 Jun 2012 15:37:35 +0000 Subject: Fixing stardict broken by my mistake. svn path=/nixpkgs/trunk/; revision=34549 --- .../stardict-3.0.3-compositelookup_cpp.patch | 19 +++++++++ .../stardict-3.0.3-correct-glib-include.patch | 13 ++++++ .../misc/stardict/stardict-3.0.3-entry.patch | 20 ++++++++++ .../misc/stardict/stardict-3.0.3-gcc46.patch | 13 ++++++ .../misc/stardict/stardict-3.0.3-overflow.patch | 26 ++++++++++++ .../stardict/stardict-3.0.3-zlib-1.2.5.2.patch | 39 ++++++++++++++++++ pkgs/applications/misc/stardict/stardict.nix | 46 ++++++++++++++++++++++ 7 files changed, 176 insertions(+) create mode 100644 pkgs/applications/misc/stardict/stardict-3.0.3-compositelookup_cpp.patch create mode 100644 pkgs/applications/misc/stardict/stardict-3.0.3-correct-glib-include.patch create mode 100644 pkgs/applications/misc/stardict/stardict-3.0.3-entry.patch create mode 100644 pkgs/applications/misc/stardict/stardict-3.0.3-gcc46.patch create mode 100644 pkgs/applications/misc/stardict/stardict-3.0.3-overflow.patch create mode 100644 pkgs/applications/misc/stardict/stardict-3.0.3-zlib-1.2.5.2.patch create mode 100644 pkgs/applications/misc/stardict/stardict.nix (limited to 'pkgs/applications/misc/stardict') 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 ++#include + + 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 ++ + #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; + } + ++extern int gzclose_compat(void * file); + namespace zip { +-typedef ResourceWrapper gzFile; ++typedef ResourceWrapper 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]; + }; +} + -- cgit 1.4.1