diff --git a/pkgs/os-specific/linux/radeontop/default.nix b/pkgs/os-specific/linux/radeontop/default.nix new file mode 100644 index 00000000000..ed159bbf37f --- /dev/null +++ b/pkgs/os-specific/linux/radeontop/default.nix @@ -0,0 +1,39 @@ +{ stdenv, fetchurl, substituteAll, pkgconfig +, gettext, ncurses, libdrm, libpciaccess }: + +stdenv.mkDerivation rec { + name = "radeontop-${version}"; + version = "0.8"; + + src = fetchurl { + url = "https://github.com/clbr/radeontop/archive/v${version}.tar.gz"; + sha256 = "12c4kpr9zy2a21k8mck9cbfwm54x1l0i96va97m70pc9ramf2c24"; + }; + + buildInputs = [ pkgconfig gettext ncurses libdrm libpciaccess ]; + + patches = [ + ./install-paths.patch + + # The default generation of version.h expects a git clone. + (substituteAll { + src = ./version-header.patch; + inherit version; + }) + ]; + + postPatch = '' + substituteInPlace radeontop.c \ + --replace /usr/share/locale $out/share/locale + ''; + + makeFlags = "DESTDIR=$(out)"; + + meta = with stdenv.lib; { + description = "Top-like tool for viewing AMD Radeon GPU utilization"; + homepage = https://github.com/clbr/radeontop; + platforms = platforms.linux; + license = licenses.gpl3; + maintainers = [ maintainers.rycee ]; + }; +} diff --git a/pkgs/os-specific/linux/radeontop/install-paths.patch b/pkgs/os-specific/linux/radeontop/install-paths.patch new file mode 100644 index 00000000000..59aee99d0bc --- /dev/null +++ b/pkgs/os-specific/linux/radeontop/install-paths.patch @@ -0,0 +1,36 @@ +diff -Nurp radeontop-0.8-orig/Makefile radeontop-0.8/Makefile +--- radeontop-0.8-orig/Makefile 2015-01-03 09:34:30.205507608 +0100 ++++ radeontop-0.8/Makefile 2015-01-03 09:43:22.835174006 +0100 +@@ -7,7 +7,6 @@ + # nostrip disable stripping, default off + # plain apply neither -g nor -s. + +-PREFIX ?= /usr + INSTALL ?= install + + nls ?= 1 +@@ -74,10 +73,10 @@ trans: + --package-name radeontop + + install: all +- $(INSTALL) -D -m755 $(bin) $(DESTDIR)/$(PREFIX)/sbin/$(bin) +- $(INSTALL) -D -m644 radeontop.1 $(DESTDIR)/$(PREFIX)/share/man/man1/radeontop.1 ++ $(INSTALL) -D -m755 $(bin) $(DESTDIR)/sbin/$(bin) ++ $(INSTALL) -D -m644 radeontop.1 $(DESTDIR)/share/man/man1/radeontop.1 + ifeq ($(nls), 1) +- $(MAKE) -C translations install PREFIX=$(PREFIX) ++ $(MAKE) -C translations install DESTDIR=$(DESTDIR) + endif + + man: +diff -Nurp radeontop-0.8-orig/translations/Makefile radeontop-0.8/translations/Makefile +--- radeontop-0.8-orig/translations/Makefile 2015-01-03 09:34:30.205507608 +0100 ++++ radeontop-0.8/translations/Makefile 2015-01-03 09:43:40.235309691 +0100 +@@ -15,6 +15,6 @@ $(obj): $(src) + $(MSGFMT) -o $@ $< + + %.inst: %.mo +- $(INSTALL) -D -m 644 $< $(DESTDIR)/$(PREFIX)/share/locale/$*/LC_MESSAGES/radeontop.mo ++ $(INSTALL) -D -m 644 $< $(DESTDIR)/share/locale/$*/LC_MESSAGES/radeontop.mo + + install: all $(inst) diff --git a/pkgs/os-specific/linux/radeontop/version-header.patch b/pkgs/os-specific/linux/radeontop/version-header.patch new file mode 100644 index 00000000000..784464794d7 --- /dev/null +++ b/pkgs/os-specific/linux/radeontop/version-header.patch @@ -0,0 +1,21 @@ +diff -Nurp radeontop-0.8-orig/include/version.h radeontop-0.8/include/version.h +--- radeontop-0.8-orig/include/version.h 1970-01-01 01:00:00.000000000 +0100 ++++ radeontop-0.8/include/version.h 2015-01-03 09:34:58.114335049 +0100 +@@ -0,0 +1,6 @@ ++#ifndef VER_H ++#define VER_H ++ ++#define VERSION "@version@" ++ ++#endif +diff -Nurp radeontop-0.8-orig/Makefile radeontop-0.8/Makefile +--- radeontop-0.8-orig/Makefile 2015-01-03 09:34:30.205507608 +0100 ++++ radeontop-0.8/Makefile 2015-01-03 09:38:36.765881422 +0100 +@@ -67,7 +67,6 @@ clean: + .git: + + $(verh): .git +- ./getver.sh + + trans: + xgettext -o translations/radeontop.pot -k_ *.c \ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1614c17d09f..d3715037de4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8663,6 +8663,8 @@ let radeontools = callPackage ../os-specific/linux/radeontools { }; + radeontop = callPackage ../os-specific/linux/radeontop { }; + raspberrypifw = callPackage ../os-specific/linux/firmware/raspberrypi {}; regionset = callPackage ../os-specific/linux/regionset { };