📦

xfce4-sensors-pluginでxnvctrlを除外する

に公開

はじめに

Parabolaでxfce4-sensors-pluginを入れようとすると、以下のようにlibxnvctrlの依存を解決できない状態になります。

$ sudo pacman -S xfce4-sensors-plugin
resolving dependencies...warning: 
cannot resolve "libxnvctrl", a dependency of "xfce4-sensors-plugin":: 
The following package cannot be upgraded due to unresolvable 
dependencies:      xfce4-sensors-plugin

libxnvctrl自体はGPLでライセンスされているソフトウェアですが、依存にNVIDIAのプロプライエタリなパッケージが含まれています。NVIDIAのパッケージは大抵の人類には不要なので、パッケージを修正し、除外してインストールすることにします。

パッケージの取得と修正

まずは-Siオプションで、xfce4-sensors-pluginパッケージの詳細な情報を確認します。

$ pacman -Si xfce4-sensors-plugin
Repository      : extra
Name            : xfce4-sensors-plugin
Version         : 1.5.0-2
Description     : Sensors plugin for the Xfce panel
Architecture    : x86_64
URL             : https://docs.xfce.org/panel-plugins/xfce4-sensors-plugin/start
Licenses        : GPL-2.0-or-later
Groups          : xfce4-goodies
Provides        : None
Depends On      : xfce4-panel  lm_sensors  libnotify  libxnvctrl
                  hicolor-icon-theme
Optional Deps   : hddtemp: for monitoring the temperature of hard drives
Conflicts With  : None
Replaces        : None
Download Size   : 222.76 KiB
Installed Size  : 900.40 KiB
Packager        : Robin Candau <antiz@archlinux.org>
Build Date      : Thu 12 Jun 2025 01:50:01 PM JST
Validated By    : MD5 Sum  SHA-256 Sum  Signature

内容を確認すると、PackagerにArchと書かれており、Archのパッケージをそのまま使用していることがわかります。Archのパッケージを管理しているリポジトリから、xfce4-sensors-pluginをクローンします。

$ git clone https://gitlab.archlinux.org/archlinux/packaging/packages/xfce4-sensors-plugin.git
$ cd xfce4-sensors-plugin

Arch系のディストリビューションはPacmanというパッケージマネージャーを使用しています。これは比較的単純な構造で、パッケージ内にあるPKGBUILDというファイルで、そのパッケージが何に依存しているのか、どこからソースコードを取得するのか、どうビルドし、インストールするのかといったことが記述されています。

libxnvctrlを除外するためのPKGBUILDの差分を以下に示します。

$ git diff PKGBUILD 
diff --git a/PKGBUILD b/PKGBUILD
index 00108a9..44cb812 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -11,7 +11,7 @@ arch=('x86_64')
 url="https://docs.xfce.org/panel-plugins/xfce4-sensors-plugin/start"
 license=('GPL-2.0-or-later')
 groups=('xfce4-goodies')
-depends=('xfce4-panel' 'lm_sensors' 'libnotify' 'libxnvctrl' 'hicolor-icon-theme')
+depends=('xfce4-panel' 'lm_sensors' 'libnotify' 'hicolor-icon-theme')
 makedepends=('git' 'hddtemp' 'meson' 'netcat' 'xfce4-dev-tools')
 optdepends=('hddtemp: for monitoring the temperature of hard drives')
 source=("git+https://gitlab.xfce.org/panel-plugins/xfce4-sensors-plugin.git#tag=$pkgname-$pkgver")
@@ -21,6 +21,7 @@ build() {
   arch-meson $pkgname build \
     -Dhddtemp=enabled \
     -Dnetcat=enabled \
+    -Dxnvctrl=disabled \
     --localstatedir=/var
   meson compile -C build
 }

dependsという行が、xfce4-sensors-pluginが依存しているパッケージの一覧になります。ここのlibxnvctrlを削除します。

また、ビルド時の依存関係を記述するmakedependsを見ると、xfce4-sensors-pluginはビルドにmesonを使っていることがわかります。Arch用のarch-mesonコマンドを記述しているところが実際のビルドのオプションを指定している箇所です。ここで、-Dxnvctrl=disabledを記述すれば、libxnvctrlを除外することができます。

ビルドとインストール

実際のビルドには、mesonとxfce4-dev-toolsが必要になるのでインストールしておきます。

$ sudo pacman -S meson xfce4-dev-tools

幾多の幸運が重なれば、以下のコマンドでlibxnvctrlを必要としないxfce4-sensors-pluginがビルド、インストールされるはずです。

$ makepkg -si

Discussion