1{ stdenv
2, lib
3, fetchurl
4, fetchpatch
5, pkg-config
6, autoreconfHook
7, glib
8, libusb1
9}:
10
11stdenv.mkDerivation rec {
12 pname = "libticables2";
13 version = "1.3.5";
14 src = fetchurl {
15 url = "mirror://sourceforge/tilp/${pname}-${version}.tar.bz2";
16 sha256 = "08j5di0cgix9vcpdv7b8xhxdjkk9zz7fqfnv3l4apk3jdr8vcvqc";
17 };
18
19 patches = [
20 (fetchpatch {
21 name = "add-support-for-aarch64-macos-target-triple.patch";
22 url = "https://github.com/debrouxl/tilibs/commit/ef41c51363b11521460f33e8c332db7b0a9ca085.patch";
23 stripLen = 2;
24 sha256 = "sha256-oTR1ACEZI0fjErpnFXTCnfLT1mo10Ypy0q0D8NOPNsM=";
25 })
26 ];
27
28 nativeBuildInputs = [
29 autoreconfHook
30 pkg-config
31 ];
32
33 buildInputs = [
34 libusb1
35 glib
36 ];
37
38 configureFlags = [
39 "--enable-libusb10"
40 ];
41
42 postInstall = ''
43 mkdir -p $out/etc/udev/rules.d
44 cat > $out/etc/udev/rules.d/69-libsane.rules << EOF
45 ACTION!="add", GOTO="libticables_end"
46
47 # serial device (assume TI calculator)
48 KERNEL=="ttyS[0-3]", ENV{ID_PDA}="1"
49 # parallel device (assume TI calculator)
50 SUBSYSTEM=="ppdev", ENV{ID_PDA}="1"
51 # SilverLink
52 SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="e001", ENV{ID_PDA}="1"
53 # TI-84+ DirectLink
54 SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="e003", ENV{ID_PDA}="1"
55 # TI-89 Titanium DirectLink
56 SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="e004", ENV{ID_PDA}="1"
57 # TI-84+ SE DirectLink
58 SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="e008", ENV{ID_PDA}="1"
59 # TI-Nspire DirectLink
60 SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="e012", ENV{ID_PDA}="1"
61
62 LABEL="libticables_end"
63 EOF
64 '';
65
66 meta = with lib; {
67 changelog = "http://lpg.ticalc.org/prj_tilp/news.html";
68 description = "This library is part of the TiLP framework";
69 homepage = "http://lpg.ticalc.org/prj_tilp/";
70 license = licenses.gpl2Plus;
71 maintainers = with maintainers; [ siraben luc65r ];
72 platforms = with platforms; linux ++ darwin;
73 };
74}