about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/tix/default.nix
blob: a46b2499964c37ce27a725ad8bdef56b2dd83da7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{ lib
, stdenv
, fetchurl
, fetchpatch
, tcl
, tk
}:

tcl.mkTclDerivation {
  version = "8.4.3";
  pname = "tix";
  src = fetchurl {
     url = "mirror://sourceforge/tix/tix/8.4.3/Tix8.4.3-src.tar.gz";
     sha256 = "1jq3dkyk9mqkj4cg7mdk5r0cclqsby9l2b7wrysi0zk5yw7h8bsn";
  };
  patches = [
  (fetchpatch {
    name = "tix-8.4.3-tcl8.5.patch";
    url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-tcltk/tix/files/tix-8.4.3-tcl8.5.patch?id=56bd759df1d0c750a065b8c845e93d5dfa6b549d";
    sha256 = "0wzqmcxxq0rqpnjgxz10spw92yhfygnlwv0h8pcx2ycnqiljz6vj";
    })
    # Remove duplicated definition of XLowerWindow
    ./duplicated-xlowerwindow.patch
    # Fix incompatible function pointer conversions and implicit definition of `panic`.
    # `panic` is just `Tcl_Panic`, but it is not defined on Darwin due to a conflict with `mach/mach.h`.
    ./fix-clang16.patch
  ] ++ lib.optional (tcl.release == "8.6")
  (fetchpatch {
    name = "tix-8.4.3-tcl8.6.patch";
    url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-tcltk/tix/files/tix-8.4.3-tcl8.6.patch?id=56bd759df1d0c750a065b8c845e93d5dfa6b549d";
    sha256 = "1jaz0l22xj7x1k4rb9ia6i1psnbwk4pblgq4gfvya7gg7fbb7r36";
    })
  ;
  buildInputs = [ tk ];
  # the configure script expects to find the location of the sources of
  # tcl and tk in {tcl,tk}Config.sh
  # In fact, it only needs some private headers. We copy them in
  # the private_headers folders and trick the configure script into believing
  # the sources are here.
  preConfigure = ''
    mkdir -p private_headers/generic
    < ${tcl}/lib/tclConfig.sh sed "s@TCL_SRC_DIR=.*@TCL_SRC_DIR=private_headers@" > tclConfig.sh
    < ${tk}/lib/tkConfig.sh sed "s@TK_SRC_DIR=.*@TK_SRC_DIR=private_headers@" > tkConfig.sh
    for i in ${tcl}/include/* ${tk.dev}/include/*; do
      ln -s $i private_headers/generic;
    done;
    '';
  addTclConfigureFlags = false;
  configureFlags = [
    "--with-tclconfig=."
    "--with-tkinclude=${tk.dev}/include"
    "--with-tkconfig=."
    "--libdir=\${prefix}/lib"
  ];

  meta = with lib; {
    description = "A widget library for Tcl/Tk";
    homepage    = "https://tix.sourceforge.net/";
    platforms   = platforms.all;
    license     = with licenses; [
      bsd2 # tix
      gpl2 # patches from portage
    ];
  };
}