aboutsummaryrefslogtreecommitdiff
path: root/pkgs
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-06-30 14:32:42 +0200
committerKarel Kočí <cynerd@email.cz>2022-06-30 14:36:49 +0200
commit80372557415a2671584458be4d02cd60bcee0641 (patch)
tree63a362ec0345409c1fc50390c22b8e0d29a1eeae /pkgs
parent902f91984818f3ed0ab8b50f95e23aa9b2ab64a0 (diff)
downloadnixos-personal-80372557415a2671584458be4d02cd60bcee0641.tar.gz
nixos-personal-80372557415a2671584458be4d02cd60bcee0641.tar.bz2
nixos-personal-80372557415a2671584458be4d02cd60bcee0641.zip
pkgs/stardict: add stardict itself
It seems to not be able to find translations but I am not using it anyway. I have it just for completeness.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/default.nix6
-rw-r--r--pkgs/stardict/default.nix54
-rw-r--r--pkgs/stardict/enchant2.patch55
-rw-r--r--pkgs/stardict/gcc46.patch11
-rw-r--r--pkgs/stardict/gconf.patch32
-rw-r--r--pkgs/stardict/glib2.patch36
-rw-r--r--pkgs/stardict/gucharmap-2.patch12
-rw-r--r--pkgs/stardict/makefile.patch13
-rw-r--r--pkgs/stardict/mariadb.patch13
-rw-r--r--pkgs/stardict/wrapper.nix (renamed from pkgs/sdcv/wrapper.nix)13
10 files changed, 238 insertions, 7 deletions
diff --git a/pkgs/default.nix b/pkgs/default.nix
index 9950e7b..7d3a169 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -20,11 +20,13 @@ let
swaybackground = callPackage ./theme/swaybackground.nix { };
myswaylock = callPackage ./theme/myswaylock.nix { };
- sdcv-unwrapped = callPackage ./sdcv { };
- sdcv = callPackage ./sdcv/wrapper.nix { };
+ stardict-unwrapped = callPackage ./stardict { };
+ stardict = callPackage ./stardict/wrapper.nix { stardict = stardict-unwrapped; };
stardict-en-cz = callPackage ./stardict/en-cz.nix { };
stardict-de-cz = callPackage ./stardict/de-cz.nix { };
stardict-cz = callPackage ./stardict/cz.nix { };
+ sdcv-unwrapped = callPackage ./sdcv { };
+ sdcv = callPackage ./stardict/wrapper.nix { stardict = sdcv-unwrapped; };
ferdium = callPackage ./ferdium {
mkFranzDerivation = callPackage (
diff --git a/pkgs/stardict/default.nix b/pkgs/stardict/default.nix
new file mode 100644
index 0000000..03a6b63
--- /dev/null
+++ b/pkgs/stardict/default.nix
@@ -0,0 +1,54 @@
+{ lib, stdenv, fetchurl
+, autoreconfHook, wrapGAppsHook
+, pkg-config, automake, autoconf, libtool, intltool, gnome-doc-utils, libxslt
+, gnome2, gtk2, libxml2, enchant , mariadb-connector-c, pcre
+, speech-tools, speech-toolsDisable ? false
+, espeak, espeakDisable ? false
+}:
+
+with lib;
+
+stdenv.mkDerivation rec {
+ pname = "stardict";
+ version = "3.0.6";
+
+ src = fetchurl {
+ url = "https://downloads.sourceforge.net/project/stardict-4/${version}/stardict-${version}.tar.bz2";
+ sha256 = "1rw2dg1d489gjjx9957j2jdmjlvylv31pnx3142lwq3pi5d6j2ka";
+ };
+ patches = [
+ ./enchant2.patch
+ ./gcc46.patch
+ ./gconf.patch
+ ./glib2.patch
+ ./makefile.patch
+ ./mariadb.patch
+ ];
+
+ nativeBuildInputs = [
+ autoreconfHook wrapGAppsHook
+ pkg-config intltool gnome-doc-utils libxslt
+ ];
+ buildInputs = [
+ gnome2.gnome-common gnome2.GConf
+ gtk2 libxml2 enchant mariadb-connector-c pcre
+ ]
+ ++ optional (!speech-toolsDisable) speech-tools
+ ++ optional (!espeakDisable) espeak;
+ configureFlags = [
+ "--disable-gnome-support"
+ "--disable-gucharmap"
+ "--disable-scrollkeeper"
+ "--disable-festival"
+ "--disable-gpe-support"
+ "--disable-schemas-install"
+ ]
+ ++ optional speech-toolsDisable "--disable-speech-tools"
+ ++ optional espeakDisable "--disable-espeak";
+
+ meta = with lib; {
+ description = "Cross-platform and international dictionary software";
+ homepage = "http://stardict-4.sourceforge.net/";
+ license = licenses.gpl3;
+ };
+}
diff --git a/pkgs/stardict/enchant2.patch b/pkgs/stardict/enchant2.patch
new file mode 100644
index 0000000..56accdb
--- /dev/null
+++ b/pkgs/stardict/enchant2.patch
@@ -0,0 +1,55 @@
+From: Boyuan Yang <byang@debian.org>
+Date: Fri, 31 Jan 2020 13:14:01 -0500
+Subject: dict/configure.ac: Add support for enchant 2
+
+---
+ dict/configure.ac | 29 +++++++++++++++++++++--------
+ 1 file changed, 21 insertions(+), 8 deletions(-)
+
+diff --git a/dict/configure.ac b/dict/configure.ac
+index fc7101a..ea5b30c 100644
+--- a/dict/configure.ac
++++ b/dict/configure.ac
+@@ -45,21 +45,34 @@ dnl ================================================================
+ dnl spell plugin checks: enchant.
+ dnl ================================================================
+
+-ENCHANT_REQUIRED=1.2.0
++ENCHANT1_REQUIRED=1.2.0
++ENCHANT2_REQUIRED=2.2.3
+ AC_ARG_ENABLE([spell],
+ AS_HELP_STRING([--disable-spell],[Disable spell plugin (default: enabled)]),
+ [enable_enchant=$enableval],
+ [enable_enchant=yes])
+
+ if test "x$enable_enchant" = "xyes" ; then
+- PKG_CHECK_MODULES(ENCHANT, enchant >= $ENCHANT_REQUIRED, \
+- have_enchant=yes, have_enchant=no)
+- if test "x$have_enchant" = "xyes"; then
+- ENCHANT_CFLAGS="${ENCHANT_CFLAGS}"
+- ENCHANT_LIBS="${ENCHANT_LIBS}"
+- SPELL_PLUGIN_DIR="stardict-spell-plugin"
++ PKG_CHECK_MODULES([ENCHANT2], enchant-2 >= $ENCHANT2_REQUIRED, \
++ have_enchant2=yes, have_enchant2=no)
++ PKG_CHECK_MODULES([ENCHANT1], enchant >= $ENCHANT1_REQUIRED, \
++ have_enchant1=yes, have_enchant1=no)
++ if test "x$have_enchant2" = "xyes"; then
++ if test "x$have_enchant1" = "xyes"; then
++ AC_MSG_ERROR([You have both Enchant 1.x and Enchant 2.x installed. This is not supported.])
++ else
++ ENCHANT_CFLAGS="${ENCHANT2_CFLAGS}"
++ ENCHANT_LIBS="${ENCHANT2_LIBS}"
++ SPELL_PLUGIN_DIR="stardict-spell-plugin"
++ fi
+ else
+- AC_MSG_ERROR([Enchant library not found or too old. Use --disable-spell to build without spell plugin.])
++ if test "x$have_enchant1" = "xyes"; then
++ ENCHANT_CFLAGS="${ENCHANT1_CFLAGS}"
++ ENCHANT_LIBS="${ENCHANT1_LIBS}"
++ SPELL_PLUGIN_DIR="stardict-spell-plugin"
++ else
++ AC_MSG_ERROR([Enchant library not found or too old. Use --disable-spell to build without spell plugin.])
++ fi
+ fi
+ else
+ ENCHANT_CFLAGS=
diff --git a/pkgs/stardict/gcc46.patch b/pkgs/stardict/gcc46.patch
new file mode 100644
index 0000000..944b963
--- /dev/null
+++ b/pkgs/stardict/gcc46.patch
@@ -0,0 +1,11 @@
+diff -aur old/dict/stardict-plugins/stardict-wordnet-plugin/utils.h new/dict/stardict-plugins/stardict-wordnet-plugin/utils.h
+--- old/dict/stardict-plugins/stardict-wordnet-plugin/utils.h 2011-07-18 06:58:58.519404744 -0700
++++ new/dict/stardict-plugins/stardict-wordnet-plugin/utils.h 2011-07-18 07:01:10.739734313 -0700
+@@ -26,6 +26,7 @@
+ #ifndef __TYPES_H__
+ #define __TYPES_H__
+
++#include <cstddef>
+ #include <math.h>
+
+ typedef float single;
diff --git a/pkgs/stardict/gconf.patch b/pkgs/stardict/gconf.patch
new file mode 100644
index 0000000..3c430ab
--- /dev/null
+++ b/pkgs/stardict/gconf.patch
@@ -0,0 +1,32 @@
+From: Jeremy Bicha <jbicha@debian.org>
+Date: Tue, 16 Oct 2018 22:55:32 -0400
+Subject: build without gconf
+
+dict/doc/Readme.mac recommends removing the AM_GCONF_SOURCE_2 lines
+
+which also makes autoreconf happy
+---
+ dict/configure.ac | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/dict/configure.ac b/dict/configure.ac
+index 3225c6e..fc7101a 100644
+--- a/dict/configure.ac
++++ b/dict/configure.ac
+@@ -318,7 +318,6 @@ elif test "x${enable_maemo_support}" = "xyes" ; then
+ if test x"$GCONFTOOL" = xno; then
+ AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
+ fi
+- AM_GCONF_SOURCE_2
+ elif test "x${enable_darwin_support}" = "xyes" ; then
+ echo "Enable darwin suppport";
+ AC_DEFINE([CONFIG_DARWIN],[], [Compile with darwin support])
+@@ -339,7 +338,6 @@ dnl *********************************************
+ if test x"$GCONFTOOL" = xno; then
+ AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
+ fi
+- AM_GCONF_SOURCE_2
+
+ dnl ==========================================================================
+ dnl stuff for the CORBA interface
+
diff --git a/pkgs/stardict/glib2.patch b/pkgs/stardict/glib2.patch
new file mode 100644
index 0000000..bd0f6ba
--- /dev/null
+++ b/pkgs/stardict/glib2.patch
@@ -0,0 +1,36 @@
+diff -Naur old/dict/configure.ac new/dict/configure.ac
+--- old/dict/configure.ac 2011-07-03 16:58:40.000000000 +1000
++++ new/dict/configure.ac 2012-07-12 22:31:52.875176842 +1000
+@@ -266,6 +266,9 @@
+ fi
+ AC_SUBST(WIKI_PARSEDATA_PLUGIN_DIR)
+
++GMODULE2_LIBS=`pkg-config --libs gmodule-2.0`
++AC_SUBST([GMODULE2_LIBS])
++
+ dnl ================================================================
+ dnl main program checks.
+ dnl ================================================================
+diff -Naur old/dict/src/Makefile.am new/dict/src/Makefile.am
+--- old/dict/src/Makefile.am 2011-07-03 16:58:40.000000000 +1000
++++ new/dict/src/Makefile.am 2012-07-12 22:29:53.714870692 +1000
+@@ -33,7 +33,7 @@
+ stardict_DEPENDENCIES = lib/libstardict.la $(LOCAL_SIGCPP_LIBFILE)
+ stardict_LDFLAGS =
+ ## place libstardict.la before any system library, otherwise build with --as-needed linker option may fail
+-stardict_LDADD = lib/libstardict.la $(STARDICT_LIBS) $(LOCAL_SIGCPP_LIBFILE)
++stardict_LDADD = lib/libstardict.la $(STARDICT_LIBS) $(LOCAL_SIGCPP_LIBFILE) $(GMODULE2_LIBS)
+
+ if !GNOME_SUPPORT
+ if MAEMO_SUPPORT
+diff -Naur old/dict/src/tomboykeybinder.h new/dict/src/tomboykeybinder.h
+--- old/dict/src/tomboykeybinder.h 2011-07-03 16:58:40.000000000 +1000
++++ new/dict/src/tomboykeybinder.h 2012-07-12 22:28:04.337920391 +1000
+@@ -21,7 +21,6 @@
+ #ifndef __TOMBOY_KEY_BINDER_H__
+ #define __TOMBOY_KEY_BINDER_H__
+
+-#include <glib.h>
+
+ G_BEGIN_DECLS
+
diff --git a/pkgs/stardict/gucharmap-2.patch b/pkgs/stardict/gucharmap-2.patch
new file mode 100644
index 0000000..9a18725
--- /dev/null
+++ b/pkgs/stardict/gucharmap-2.patch
@@ -0,0 +1,12 @@
+diff -Naur old/dict/configure.ac new/dict/configure.ac
+--- old/dict/configure.ac 2022-06-30 10:07:59.300093597 +0200
++++ new/dict/configure.ac 2022-06-30 10:06:12.494954051 +0200
+@@ -94,7 +94,7 @@
+ [enable_gucharmap=yes])
+
+ if test "x$enable_gucharmap" = "xyes" ; then
+- PKG_CHECK_MODULES(GUCHARMAP, [gucharmap-2], have_gucharmap=yes, have_gucharmap=no)
++ PKG_CHECK_MODULES(GUCHARMAP, [gucharmap], have_gucharmap=yes, have_gucharmap=no)
+ if test "x$have_gucharmap" = "xyes"; then
+ GUCHARMAP_CFLAGS="${GUCHARMAP_CFLAGS}"
+ GUCHARMAP_LIBS="${GUCHARMAP_LIBS}"
diff --git a/pkgs/stardict/makefile.patch b/pkgs/stardict/makefile.patch
new file mode 100644
index 0000000..c7b3558
--- /dev/null
+++ b/pkgs/stardict/makefile.patch
@@ -0,0 +1,13 @@
+Disable compilation of stuff irrelevant to NixOS
+
+--- a/dict/Makefile.am
++++ b/dict/Makefile.am
+@@ -1,7 +1,6 @@
+ ## Process this file with automake to produce Makefile.in
+
+-SUBDIRS = m4 src stardict-plugins tests pixmaps po help data doc \
+- debian-upstream mac_dist msvc_2008
++SUBDIRS = m4 src stardict-plugins tests pixmaps po help data doc
+ ACLOCAL_AMFLAGS = -I m4
+
+ EXTRA_DIST = \
diff --git a/pkgs/stardict/mariadb.patch b/pkgs/stardict/mariadb.patch
new file mode 100644
index 0000000..b525d05
--- /dev/null
+++ b/pkgs/stardict/mariadb.patch
@@ -0,0 +1,13 @@
+diff --git a/tools/src/wikipediaImage.cpp b/tools/src/wikipediaImage.cpp
+index ff38f50..df5191b 100644
+--- a/tools/src/wikipediaImage.cpp
++++ b/tools/src/wikipediaImage.cpp
+@@ -31,7 +31,7 @@ void dump_file()
+ MYSQL mysql;
+ if (!mysql_init(&mysql))
+ return;
+- if (!mysql_real_connect(&mysql, CONN_HOST , CONN_USER , CONN_PASS, NULL , MYSQL_PORT, NULL, 0))
++ if (!mysql_real_connect(&mysql, CONN_HOST , CONN_USER , CONN_PASS, NULL , MARIADB_PORT, NULL, 0))
+ return;
+ if (mysql_select_db(&mysql, CONN_DB))
+ return;
diff --git a/pkgs/sdcv/wrapper.nix b/pkgs/stardict/wrapper.nix
index e26c58c..6547728 100644
--- a/pkgs/sdcv/wrapper.nix
+++ b/pkgs/stardict/wrapper.nix
@@ -1,8 +1,8 @@
{ lib, stdenv, makeBinaryWrapper
-, sdcv-unwrapped
+, stardict
}:
-with sdcv-unwrapped;
+with stardict;
let
@@ -11,7 +11,7 @@ let
inherit version;
inherit meta;
- nativeBuildInputs = [ sdcv-unwrapped makeBinaryWrapper ];
+ nativeBuildInputs = [ stardict makeBinaryWrapper ];
dictionaries = [ /* empty and expecting override */ ];
phases = [ "installPhase" ];
@@ -25,8 +25,11 @@ let
ln -sf "$path" "$outln"
done
done
- makeWrapper ${sdcv-unwrapped}/bin/sdcv $out/bin/sdcv \
- --set STARDICT_DATA_DIR $out/usr/share/stardict/dic
+
+ for bin in ${stardict}/bin/*; do
+ makeWrapper "$bin" "$out/bin/${"$"}{bin##*/bin/}" \
+ --set STARDICT_DATA_DIR "$out/usr/share/stardict/dic"
+ done
'';
passthru.withDictionaries = dicts: drv.overrideAttrs (oldAttrs: {