diff --git a/pkgs/applications/science/electronics/dsview/default.nix b/pkgs/applications/science/electronics/dsview/default.nix new file mode 100644 index 000000000000..af3844f47312 --- /dev/null +++ b/pkgs/applications/science/electronics/dsview/default.nix @@ -0,0 +1,47 @@ +{ stdenv, fetchFromGitHub, pkgconfig, cmake, autoreconfHook, +glib, libzip, boost, fftw, qtbase, +libusb, makeWrapper, libsigrok4dsl, libsigrokdecode4dsl +}: + +stdenv.mkDerivation rec { + name = "dsview-${version}"; + + version = "0.99"; + + src = fetchFromGitHub { + owner = "DreamSourceLab"; + repo = "DSView"; + rev = version; + sha256 = "189i3baqgn8k3aypalayss0g489xi0an9hmvyggvxmgg1cvcwka2"; + }; + + postUnpack = '' + export sourceRoot=$sourceRoot/DSView + ''; + + patches = [ + # Fix absolute install paths + ./install.patch + ]; + + nativeBuildInputs = [ cmake pkgconfig makeWrapper ]; + + buildInputs = [ + boost fftw qtbase libusb libzip libsigrokdecode4dsl libsigrok4dsl + ]; + + enableParallelBuilding = true; + + postFixup = '' + wrapProgram $out/bin/DSView --suffix QT_PLUGIN_PATH : \ + ${qtbase.bin}/${qtbase.qtPluginPrefix} + ''; + + meta = with stdenv.lib; { + description = "A GUI program for supporting various instruments from DreamSourceLab, including logic analyzer, oscilloscope, etc"; + homepage = http://www.dreamsourcelab.com/; + license = licenses.gpl3Plus; + platforms = platforms.linux; + maintainers = [ maintainers.bachp ]; + }; +} diff --git a/pkgs/applications/science/electronics/dsview/install.patch b/pkgs/applications/science/electronics/dsview/install.patch new file mode 100644 index 000000000000..e30a28d80fa3 --- /dev/null +++ b/pkgs/applications/science/electronics/dsview/install.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c1c33e1..208a184 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -403,8 +403,8 @@ install(DIRECTORY res DESTINATION share/${PROJECT_NAME}) + install(FILES icons/logo.png DESTINATION share/${PROJECT_NAME} RENAME logo.png) + install(FILES ../NEWS DESTINATION share/${PROJECT_NAME} RENAME NEWS) + install(FILES ../ug.pdf DESTINATION share/${PROJECT_NAME} RENAME ug.pdf) +-install(FILES DreamSourceLab.rules DESTINATION /etc/udev/rules.d/) +-install(FILES DSView.desktop DESTINATION /usr/share/applications/) ++install(FILES DreamSourceLab.rules DESTINATION etc/udev/rules.d/) ++install(FILES DSView.desktop DESTINATION share/applications/) + + #=============================================================================== + #= Packaging (handled by CPack) diff --git a/pkgs/applications/science/electronics/dsview/libsigrok4dsl.nix b/pkgs/applications/science/electronics/dsview/libsigrok4dsl.nix new file mode 100644 index 000000000000..4a681907e192 --- /dev/null +++ b/pkgs/applications/science/electronics/dsview/libsigrok4dsl.nix @@ -0,0 +1,28 @@ +{ stdenv, pkgconfig, autoreconfHook, +glib, libzip, libserialport, check, libusb, libftdi, +systemd, alsaLib, dsview +}: + +stdenv.mkDerivation rec { + inherit (dsview) version src; + + name = "libsigrok4dsl-${version}"; + + postUnpack = '' + export sourceRoot=$sourceRoot/libsigrok4DSL + ''; + + nativeBuildInputs = [ pkgconfig autoreconfHook ]; + + buildInputs = [ + glib libzip libserialport libusb libftdi systemd check alsaLib + ]; + + meta = with stdenv.lib; { + description = "A fork of the sigrok library for usage with DSView"; + homepage = http://www.dreamsourcelab.com/; + license = licenses.gpl3Plus; + platforms = platforms.linux; + maintainers = [ maintainers.bachp ]; + }; +} diff --git a/pkgs/applications/science/electronics/dsview/libsigrokdecode4dsl.nix b/pkgs/applications/science/electronics/dsview/libsigrokdecode4dsl.nix new file mode 100644 index 000000000000..58f32f2ae6cc --- /dev/null +++ b/pkgs/applications/science/electronics/dsview/libsigrokdecode4dsl.nix @@ -0,0 +1,27 @@ +{ stdenv, pkgconfig, autoreconfHook, +glib, check, python3, dsview +}: + +stdenv.mkDerivation rec { + inherit (dsview) version src; + + name = "libsigrokdecode4dsl-${version}"; + + postUnpack = '' + export sourceRoot=$sourceRoot/libsigrokdecode4DSL + ''; + + nativeBuildInputs = [ pkgconfig autoreconfHook ]; + + buildInputs = [ + python3 glib check + ]; + + meta = with stdenv.lib; { + description = "A fork of the sigrokdecode library for usage with DSView"; + homepage = http://www.dreamsourcelab.com/; + license = licenses.gpl3Plus; + platforms = platforms.linux; + maintainers = [ maintainers.bachp ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2b3ce642bb9c..55b2c982ef69 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2353,6 +2353,8 @@ in dropbear = callPackage ../tools/networking/dropbear { }; + dsview = libsForQt5.callPackage ../applications/science/electronics/dsview { }; + dtach = callPackage ../tools/misc/dtach { }; dtc = callPackage ../development/compilers/dtc { }; @@ -8520,6 +8522,10 @@ in libsigrokdecode = callPackage ../development/tools/libsigrokdecode { }; + # special forks used for dsview + libsigrok4dsl = callPackage ../applications/science/electronics/dsview/libsigrok4dsl.nix { }; + libsigrokdecode4dsl = callPackage ../applications/science/electronics/dsview/libsigrokdecode4dsl.nix { }; + dcadec = callPackage ../development/tools/dcadec { }; dejagnu = callPackage ../development/tools/misc/dejagnu { };