試験運用中なLinux備忘録・旧記事

はてなダイアリーで公開していた2007年5月-2015年3月の記事を保存しています。

Mandriva Linux 2009.0のGKrellMプラグインのパッケージの不満点とその対処(volumeプラグインのALSA対応とcpufreqプラグインの追加)

Mandriva Linux 2009.0のGKrellMには「gkrellm-plugins」というパッケージがあり、幾つかのプラグインが含まれている。更に「gkrellm-plugins-[名前]」の形で追加のプラグインも利用可能となっている。しかし、使ってみると、以下の不満点があった。

  • cpufreqの状態(governorとクロック周波数)を表示する「cpufreq」のプラグインがない
  • voluneプラグインOSSサウンドシステムのミキサーで、ALSAサウンドドライバを使用している場合、一部の音量は変えられるが、変更できないものもある

そこで、「gkrellm-plugins」のソースRPMを入手してこれらの点を修正することにした。

  1. 差し替えるソースの入手
  2. .specファイルの修正点
  3. RPMパッケージ

差し替えるソースの入手

gkrellm-plugins-2.3.1-3mdv2009.0に含まれるvolumeプラグインはバージョン2.1.9で、ALSA非対応のため、対応するバージョン(2.1.13)へ上げることにした。入手はDebianパッケージのページから行った。
(2009/5/1)本家ページからダウンロードできることが分かった。
cpufreqのプラグインは新規にプラグインのページから入手。
(2014/10/13)URLを修正

.specファイルの修正点

gkrellm-plugins-2.3.1-3mdv2009.0の.specファイルに対して行ったのは以下の変更となる。

--- gkrellm-plugins-2.3.1-3mdv2009.0.orig/SPECS/gkrellm-plugins.spec
+++ gkrellm-plugins-2.3.1-3mdv2009.0/SPECS/gkrellm-plugins.spec
@@ -9,7 +9,7 @@
 %define gkrellShoot_version	0.4.4
 %define snmp_version		1.0
 %define gkrellmitime_version	1.0
-%define volume_version		2.1.9
+%define volume_version		2.1.13
 %define mailwatch_version	2.4.2
 %define gkrellmss_version	2.4
 %define gkrellmwireless_version	2.0.3
@@ -26,6 +26,12 @@
 %define timers_version		1.3
 %define gkrelltop_version	2.2.10
 %define gkrellmlaunch_version 0.5
+%define cpufreq_version 0.6.1
+
+%define libalsa			%mklibname    alsa    2
+%define libalsa_devel		%mklibname -d alsa    2
+%define libcpufreq		%mklibname    cpufreq 0
+%define libcpufreq_devel	%mklibname -d cpufreq
 
 Name:		%{name}
 Summary:	Plugins for gkrellm
@@ -35,7 +41,7 @@
 Group:		Monitoring
 URL:		http://gkrellm.net
 Source1:	http://gkrellm.luon.net/files/gkrellmms-%{gkrellmms_version}.tar.bz2
-Source2:	gkrellm-volume-%{volume_version}.tar.bz2
+Source2:	gkrellm-volume_%{volume_version}.orig.tar.gz
 Source3:	gkrellm-mailwatch-%{mailwatch_version}.tar.bz2
 Source4:	gkrellmitime-%{gkrellmitime_version}.tar.bz2
 Source5:	gkrellstock-%{gkrellStock_version}.tar.bz2
@@ -62,8 +68,10 @@
 Source22:	gkrellm_timers-%{timers_version}.tar.bz2
 Source23:	http://psychology.rutgers.edu/~zaimi/html/gkrelltop/gkrelltop_%{gkrelltop_version}.orig.tar.gz
 Source24:	gkrellmlaunch-%{gkrellmlaunch_version}.tar.bz2 
+Source25:	gkrellm2-cpufreq-%{cpufreq_version}.tar.gz
 
 Requires:	gkrellm = %{version}
+Requires:	%{libalsa}
 BuildRequires:	gkrellm-devel = %{version}
 BuildRequires:	libgtk+2.0-devel
 BuildRequires:	liblirc-devel
@@ -72,6 +80,7 @@
 BuildRequires:	libesound-devel
 BuildRequires:  libopenssl-devel
 BuildRequires:  libxtst-devel
+BuildRequires:	%{libalsa_devel}
 BuildRoot:	%{_tmppath}/%{name}-%{version}
 
 
@@ -144,6 +153,16 @@
 %description mms
 GKrellMMS, allows you to control XMMS from within GKrellM.
 
+%package cpufreq
+Summary:	cpufreq plugin for %{name}
+Group:		Monitoring
+Requires:	gkrellm = %{version}
+Requires:	%{libcpufreq}
+BuildRequires:	%{libcpufreq_devel}
+
+%description cpufreq
+Display cpufreq governor and clock frequency.
+
 %prep
 %setup -q -T -D -c -a 1 -n %{name}
 %setup -q -T -D -c -a 2 -n %{name}
@@ -169,6 +188,7 @@
 %setup -q -T -D -c -a 22 -n %{name}
 %setup -q -T -D -c -a 23 -n %{name}
 %setup -q -T -D -c -a 24 -n %{name}
+%setup -q -T -D -c -a 25 -n %{name}
 
 (cd seti-%{seti_version}
 %patch2 -p1 -b .gtk2
@@ -187,8 +207,8 @@
 (cd gkrellmms
 make CFLAGS="$RPM_OPT_FLAGS"
 )
-(cd gkrellm-volume
-make CFLAGS="$RPM_OPT_FLAGS"
+(cd gkrellm-volume-%{volume_version}
+make CFLAGS="$RPM_OPT_FLAGS" enable_alsa=1
 )
 (cd gkrellm-mailwatch
 make 
@@ -236,9 +256,6 @@
 (cd gkrellm_snmp-%{snmp_version}
 make
 )
-(cd gkrellm-volume
-make
-)
 (cd gkrellsun-%{gkrellsun_version}/src20
 make
 )
@@ -266,12 +283,16 @@
 ( cd gkrellmlaunch-%{gkrellmlaunch_version}
 make
 )
+( cd gkrellm2-cpufreq-%{cpufreq_version}
+%{__sed} -i 's:gcc:%{__cc} %{optflags}:' Makefile
+make
+)
 %install
 rm -rf %{buildroot}
 mkdir -p %{buildroot}%{_libdir}/gkrellm2/plugins
 mkdir -p %{buildroot}%{_datadir}/gkrellm2/scripts
 install -c -s -m 755 gkrellmms/gkrellmms.so %{buildroot}%{_libdir}/gkrellm2/plugins
-install -c -s -m 755 gkrellm-volume/volume.so %{buildroot}%{_libdir}/gkrellm2/plugins
+install -c -s -m 755 gkrellm-volume-%{volume_version}/volume.so %{buildroot}%{_libdir}/gkrellm2/plugins
 install -c -s -m 755 gkrellm-mailwatch/mailwatch.so %{buildroot}%{_libdir}/gkrellm2/plugins
 install -c -s -m 755 gkrellmitime-%{gkrellmitime_version}/gkrellm_itime.so  %{buildroot}%{_libdir}/gkrellm2/plugins
 install -c -s -m 755 gkrellStock-%{gkrellStock_version}/gkrellstock.so  %{buildroot}%{_libdir}/gkrellm2/plugins
@@ -299,6 +320,7 @@
 install -c -s -m 755 gkrellm_timers-%{timers_version}/gkrellm_timers.so %{buildroot}%{_libdir}/gkrellm2/plugins
 install -c -s -m 755 gkrelltop-%{gkrelltop_version}.orig/gkrelltop{,d}.so %{buildroot}%{_libdir}/gkrellm2/plugins
 install -c -s -m 755 gkrellmlaunch-%{gkrellmlaunch_version}/gkrellmlaunch.so %{buildroot}%{_libdir}/gkrellm2/plugins
+install -c -s -m 755 gkrellm2-cpufreq-%{cpufreq_version}/cpufreq.so %{buildroot}%{_libdir}/gkrellm2/plugins
 
 # setup various docs
 mkdir -p doc/gkleds
@@ -314,7 +336,7 @@
 mkdir -p doc/gkrellm-reminder
 cp gkrellm-reminder-%{reminder_version}/{COPYING,ChangeLog,INSTALL,README} doc/gkrellm-reminder
 mkdir -p doc/gkrellm-volume
-cp gkrellm-volume/{COPYRIGHT,Changelog,README,THEMING} doc/gkrellm-volume
+cp gkrellm-volume-%{volume_version}/{COPYRIGHT,Changelog,README,THEMING} doc/gkrellm-volume
 mkdir -p doc/timers
 cp gkrellm_timers-%{timers_version}/{ChangeLog,README,TODO} doc/timers
 mkdir -p doc/gkrellmbgchg2
@@ -341,6 +363,8 @@
 %endif 
 mkdir -p doc/seti
 cp seti-%{seti_version}/{AUTHORS,BUGS,COPYING,ChangeLog,INSTALL,INSTALL.gtk2,LICENSE,NEWS,README,README-pcpu,TODO} doc/seti
+mkdir -p doc/gkrellm-cpufreq
+cp gkrellm2-cpufreq-%{cpufreq_version}/{ChangeLog,INSTALL,LICENSE,README} doc/gkrellm-cpufreq
 
 # fix some perms
 chmod 644 doc/gkrellmoon/*
@@ -402,6 +426,13 @@
 %doc gkrellmms/Themes
 %{_libdir}/gkrellm2/plugins/gkrellmms.so
 
+%files cpufreq
+%defattr(-,root,root)
+%doc gkrellm2-cpufreq-%{cpufreq_version}/ChangeLog
+%doc gkrellm2-cpufreq-%{cpufreq_version}/INSTALL
+%doc gkrellm2-cpufreq-%{cpufreq_version}/LICENSE
+%doc gkrellm2-cpufreq-%{cpufreq_version}/README
+%{_libdir}/gkrellm2/plugins/cpufreq.so
 
 %changelog
 * Thu Jul 24 2008 Thierry Vignaud <tvignaud@mandriva.com> 2.3.1-3mdv2009.0

RPMパッケージ

上記修正を行ったRPMパッケージ(「gkrellm-plugins」と「gkrellm-plugins-cpufreq」)とソースRPMを別館の配布ページで公開した。
(2014/10/13)配布ページは削除済み。

使用したバージョン:

  • GKrellM 2.3.1-1mdv2009.0