1{
2 lib,
3 stdenv,
4 fetchurl,
5 perl,
6 swig,
7 gd,
8 ncurses,
9 python311,
10 libxml2,
11 tcl,
12 libusb-compat-0_1,
13 pkg-config,
14 boost,
15 libtool,
16 pythonBindings ? true,
17 tclBindings ? true,
18 perlBindings ? stdenv.buildPlatform == stdenv.hostPlatform,
19 buildPackages,
20}:
21let
22 python3 = python311; # needs distutils and imp
23in
24stdenv.mkDerivation rec {
25 pname = "hamlib";
26 version = "4.6.2";
27
28 src = fetchurl {
29 url = "mirror://sourceforge/hamlib/hamlib-${version}.tar.gz";
30 hash = "sha256-sqxz9E3RFh6V/e5slSdhRHV2R7+S1/2zae4v5B7Ueug=";
31 };
32
33 strictDeps = true;
34 depsBuildBuild = [ buildPackages.stdenv.cc ];
35 nativeBuildInputs =
36 [
37 swig
38 pkg-config
39 libtool
40 ]
41 ++ lib.optionals pythonBindings [ python3 ]
42 ++ lib.optionals tclBindings [ tcl ]
43 ++ lib.optionals perlBindings [ perl ];
44
45 buildInputs =
46 [
47 gd
48 libxml2
49 libusb-compat-0_1
50 boost
51 ]
52 ++ lib.optionals pythonBindings [
53 python3
54 ncurses
55 ]
56 ++ lib.optionals tclBindings [ tcl ];
57
58 configureFlags =
59 [
60 "CC_FOR_BUILD=${stdenv.cc.targetPrefix}cc"
61 ]
62 ++ lib.optionals perlBindings [ "--with-perl-binding" ]
63 ++ lib.optionals tclBindings [
64 "--with-tcl-binding"
65 "--with-tcl=${tcl}/lib/"
66 ]
67 ++ lib.optionals pythonBindings [ "--with-python-binding" ];
68
69 meta = with lib; {
70 description = "Runtime library to control radio transceivers and receivers";
71 longDescription = ''
72 Hamlib provides a standardized programming interface that applications
73 can use to send the appropriate commands to a radio.
74
75 Also included in the package is a simple radio control program 'rigctl',
76 which lets one control a radio transceiver or receiver, either from
77 command line interface or in a text-oriented interactive interface.
78 '';
79 license = with licenses; [
80 gpl2Plus
81 lgpl2Plus
82 ];
83 homepage = "https://hamlib.sourceforge.net";
84 maintainers = with maintainers; [ relrod ];
85 platforms = with platforms; unix;
86 };
87}