openSUSE:Packaging vdr

Jump to: navigation, search


Guidelines for packaging VDR plugins

This guideline applies to openSUSE starting with version 13.2 and the updated vdr build service repository (VDR version >= 2.0.0).

Naming

VDR plugins are usually called vdr-something. In accordance with other distributions the packages should be called vdr-plugin-something.

Build Requirements

VDR plugin packages need to BuildRequire vdr-devel. This package provides some convenient macros to simplify the spec file.

Runtime Requirements

VDR plugin packages need to PreReq vdr(abi) = %{vdr_apiversion} as plugins only work with a specific vdr version. There is also a convenience Macro, so that you can do PreReq %{vdr_prereq}.

Macros

  • %vdr_apiversion - Version of the VDR plugin API, e.g. '2.0.6'
  • %vdr_localedir - Location of translation files
  • %vdr_libdir - Location of plugin libraries
  • %vdr_includedir - Location of VDR header files
  • %vdr_videodir - Location of the video directory (/var/spool/video)
  • %vdr_sysconfdir - Location of config files (/etc/vdr)
  • %vdr_make - Calls 'make' and automatically sets VDRDIR, LIBDIR and LOCALEDIR
  • %vdr_find_locale - Lists locale files and puts the list into vdrlocale.files
  • %vdrname - Name of the VDR package, 'vdr' for the stable version. By making the name a macro there's a chance to not require much changes when building the plugin for a development version of vdr. This is deprecated. Once we start building development versions, this will happen in a separate buildservice project so such hacks will not be necessary.

spec file template for old-style plugins

"Old" plugins are built with %vdr_make, which is short for make VDRDIR=%{vdr_includedir} LIBDIR=. LOCALEDIR=locale. The plugin is put into the current directory as libvdr-<pluginname>.so (very old plugin) or libvdr-<pluginname>.so.%{vdr_apiversion} (slightly newer plugins). Locale files are put into the locale/ subdirectory. Old plugins usually have no make install target, so the installation needs to be done manually in %install:

 %define pluginname epgfixer
 Name:           vdr-plugin-%{pluginname}
 Version:        0.3.1
 Release:        0
 Summary:        A VDR plugin that fixes EPG data
 License:        GPL-2.0
 Group:          Hardware/TV
 Url:            http://projects.vdr-developer.org/projects/plg-epgfixer
 Source0:        vdr-%{pluginname}-%{version}.tar.bz2
 BuildRequires:  gcc-c++
 BuildRequires:  pcre-devel
 BuildRequires:  pkg-config
 BuildRequires:  vdr-devel
 PreReq:         %{vdr_prereq}
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
 %description
 Epgfixer is a VDR plugin for doing extra fixing of EPG data.
 
 %prep
 %setup -q -n %{pluginname}-%{version}
 %patch0 -p 1
 
 %build
 %{vdr_make}
 
 %install
 install -d %{buildroot}%{_libdir}/vdr
 install -d %{buildroot}%{vdr_localedir}
 install libvdr-epgfixer.so.%{vdr_apiversion} %{buildroot}%{_libdir}/vdr/
 cp -a locale/* %{buildroot}%{vdr_localedir}/
 %{vdr_find_locale}
 
 %files -f vdrlocale.files
 %defattr(-,root,root)
 %{_libdir}/vdr/*
 %{vdr_dirs}
 %doc COPYING HISTORY README
 
 %changelog

Note the PreReq. Simple plugins like the one in this example would also work with a normal Requires. However, if the plugin installs configuration files that must be writeable by vdr then vdr must be pre-Required as the vdr package creates the vdr user who owns the config files.

spec file differences for "modern" plugins

Current VDR plugin with "modern" spec files build almost like standard software:

 %build
 make %{?_smp_mflags} VDRDIR=%{vdr_includedir}
 
 %install
 make install VDRDIR=%{vdr_includedir} DESTDIR=%{buildroot}
 %vdr_find_locale 

Usually they need VDRDIR=%{vdr_includedir} to find the VDR config in %{vdr_includedir}/Make.config.