Skip to content

Commit 1408e47

Browse files
wucke13fgaz
andcommitted
tclPackages.blt: init at 2.5.3
This adds TCL BLT, a plotting library which LinuxCNC uses in various places to provide graphs etc. The original library is long unmaintained and incompatible with TCL 8.5 and 8.6, but the Debian maintainers provide a patch series which makes it usable on _modern_ TCL. Notably, none of the many forks of the original BLT library (see https://wiki.tcl-lang.org/page/BLT for a list of them) works with LinuxCNC, only the bespoke original with the Debian patches works. Co-authored-by: Francesco Gazzetta <fgaz@fgaz.me> Signed-off-by: wucke13 <wucke13+github@gmail.com>
1 parent a7c0d41 commit 1408e47

1 file changed

Lines changed: 111 additions & 0 deletions

File tree

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
{
2+
lib,
3+
stdenv,
4+
fetchurl,
5+
unzip,
6+
libx11,
7+
libxext,
8+
tcl,
9+
tk,
10+
}:
11+
12+
let
13+
inherit (lib.versions) majorMinor;
14+
in
15+
tcl.mkTclDerivation (finalAttrs: {
16+
pname = "blt";
17+
version = "2.5.3";
18+
19+
srcs = [
20+
(fetchurl {
21+
url = "mirror://sourceforge/wize/blt-src-${finalAttrs.version}.zip";
22+
hash = "sha256-bsd49Y9g8X4kEVbQDn5sp5k4/0D9Yd99I83t/n7EmUM=";
23+
})
24+
25+
# Debian maintains a hefty set of patches
26+
(fetchurl {
27+
url = "http://deb.debian.org/debian/pool/main/b/blt/blt_${finalAttrs.version}+dfsg-8.debian.tar.xz";
28+
hash = "sha256-tuXCdZazNedFvqWZxuLCjsenCUqIhZymvGAvuJFgyuk=";
29+
})
30+
];
31+
32+
sourceRoot = "blt${majorMinor finalAttrs.version}";
33+
34+
patches = lib.lists.map (patch: "../debian/patches/${patch}") [
35+
# taken verbatim from https://sources.debian.org/src/blt/2.5.3%2Bdfsg-8/debian/patches/series
36+
"02-debian-all.patch"
37+
"03-fedora-patch-2.patch"
38+
"04-fedora-tk8.5.6.patch"
39+
"05-tk8.5-zoomstack.patch"
40+
"doc-typos.patch"
41+
"tcl8.6.patch"
42+
"tk8.6.patch"
43+
"install.patch"
44+
"usetclint.patch"
45+
"usetkint.patch"
46+
"table.patch"
47+
"ldflags.patch"
48+
"pkgindex.patch"
49+
"decls.patch"
50+
"bltnsutil.patch"
51+
"blthash.patch"
52+
"const.patch"
53+
"uninitialized.patch"
54+
"unused.patch"
55+
"pointertoint.patch"
56+
"autoreconf.patch"
57+
"gcc-15.patch"
58+
];
59+
60+
postPatch = ''
61+
substituteInPlace configure --replace-fail 'ac_cv_sizeof_void_p=0' \
62+
'ac_cv_sizeof_void_p=${
63+
builtins.toString (
64+
if stdenv.hostPlatform.is32bit then
65+
4
66+
else if stdenv.hostPlatform.is64bit then
67+
8
68+
else
69+
abort "only 32 bit and 64 bit is supported"
70+
)
71+
}'
72+
'';
73+
74+
nativeBuildInputs = [ unzip ];
75+
buildInputs = [
76+
libx11
77+
libxext
78+
tcl
79+
tk
80+
tk.dev
81+
];
82+
83+
configureFlags = [
84+
"--with-tk=${tk}/lib"
85+
"--with-tkincls=${tk.dev}/include"
86+
"--x-includes=${libxext}/include"
87+
"--x-libraries=${libx11}/lib"
88+
];
89+
90+
env.NIX_CFLAGS_COMPILE = "-Wno-old-style-definition";
91+
hardeningDisable = [
92+
# Avoid
93+
# *** buffer overflow detected ***: terminated
94+
"fortify"
95+
];
96+
97+
# The makefiles use `mkdir` racy, and subsequent `mkdir foo` calls fail
98+
enableParallelBuilding = false;
99+
100+
preFixup = ''
101+
substituteInPlace $out/lib/blt${majorMinor finalAttrs.version}/pkgIndex.tcl \
102+
--replace-fail '@BLT_PATCH_LEVEL@' ${lib.strings.escapeShellArg finalAttrs.version}
103+
'';
104+
105+
meta = {
106+
homepage = "https://sourceforge.net/projects/wize/";
107+
description = "BLT for Tcl/Tk with patches from Debian";
108+
license = lib.licenses.tcltk;
109+
platforms = lib.platforms.unix;
110+
};
111+
})

0 commit comments

Comments
 (0)