1{
2 lib,
3 emacs,
4 espeak-ng,
5 fetchFromGitHub,
6 makeWrapper,
7 stdenv,
8 tcl,
9 tclPackages,
10}:
11
12stdenv.mkDerivation (finalAttrs: {
13 pname = "emacspeak";
14 version = "59.0";
15
16 src = fetchFromGitHub {
17 owner = "tvraman";
18 repo = "emacspeak";
19 rev = finalAttrs.version;
20 hash = "sha256-npS/wlqI7nBde/2S/rzp79jdfYXIIhgsVs5VizxEDAQ=";
21 };
22
23 nativeBuildInputs = [
24 emacs
25 makeWrapper
26 ];
27
28 buildInputs = [
29 espeak-ng
30 tcl
31 tclPackages.tclx
32 ];
33
34 strictDeps = true;
35
36 preConfigure = ''
37 make config
38 '';
39
40 postBuild = ''
41 make -C servers/native-espeak PREFIX=$out "TCL_INCLUDE=${tcl}/include"
42 '';
43
44 postInstall = ''
45 make -C servers/native-espeak PREFIX=$out install
46 local d=$out/share/emacs/site-lisp/emacspeak/
47 install -d -- "$d"
48 cp -a . "$d"
49 find "$d" \( -type d -or \( -type f -executable \) \) -execdir chmod 755 {} +
50 find "$d" -type f -not -executable -execdir chmod 644 {} +
51 makeWrapper ${lib.getExe emacs} $out/bin/emacspeak \
52 --set DTK_PROGRAM "${placeholder "out"}/share/emacs/site-lisp/emacspeak/servers/espeak" \
53 --set TCLLIBPATH "${tclPackages.tclx}/lib" \
54 --add-flags '-l "${placeholder "out"}/share/emacs/site-lisp/emacspeak/lisp/emacspeak-setup.elc"'
55 '';
56
57 meta = {
58 homepage = "https://github.com/tvraman/emacspeak/";
59 description = "Emacs extension that provides spoken output";
60 changelog = "https://github.com/tvraman/emacspeak/blob/${finalAttrs.src.rev}/etc/NEWS";
61 license = with lib.licenses; [ gpl2Plus ];
62 mainProgram = "emacspeak";
63 maintainers = with lib.maintainers; [ ];
64 platforms = lib.platforms.linux;
65 # Emacspeak requires a minimal Emacs version; let's use the broken flag
66 broken = lib.versionOlder (lib.getVersion emacs) "29.1";
67 };
68})