beep/beep.spec

152 lines
4.8 KiB
RPMSpec

Summary: Beep the PC speaker any number of ways
Name: beep
Version: 1.4.12
Release: %autorelease
# Automatically converted from old format: GPLv2+ - review is highly recommended.
License: GPL-2.0-or-later
URL: https://github.com/spkr-beep/beep/
# Upstream github repo: https://github.com/spkr-beep/beep
# hun github repo: https://github.com/ndim/beep
# Alternative source URL to download:
# curl -L -o spkr-beep-beep-1.4.0-db395a5.tar.gz https://api.github.com/repos/spkr-beep/beep/tarball/db395a53dc862eda80b3c1abf0d9136be97ad15a
# curl -L -o spkr-beep-beep-1.4.1-9ffa7a1.tar.gz https://api.github.com/repos/spkr-beep/beep/tarball/9ffa7a1feb195a60db20792890225b69720984d3
Source0: https://github.com/spkr-beep/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
# Fedora specific files
Source1: README.fedora
Source2: 70-pcspkr-beep.rules
Source3: 90-pcspkr-beep.rules
Source4: pcspkr-beep.conf
BuildRequires: gcc
BuildRequires: glibc-kernheaders
%{!?el7:BuildRequires: libubsan}
# for the udev macros
BuildRequires: systemd
BuildRequires: make
# Until https://bugzilla.redhat.com/show_bug.cgi?id=1652823 has been
# fixed (which makes dnf pull in a completely new debug kernel, while
# absolutely not installing the kernel module for the non-debug kernel
# actually in use), we cannot use the kmod(pcspkr.ko) recommends
# below. The boolean recommends also do not work (they do not pull in
# any package on "dnf install"), so we can only keep those here to
# document that they do not work.
#
# So people need to install the required package by hand.
#
# We would "recommend" the kernel driver and not "require" it in
# order to not break cases where beep is installed on systems other
# than bare-metal PC hardware such as containers.
#
# This assumes the people using the "beep" package can deal with a
# "beep" invocation not producing a beep on those other systems.
#
# The alternative would be to "require" the kernel driver which would
# mean that you could not install beep inside a container, even if
# that container is run in a priviledged way with access to the host's
# pcspkr.ko.
#
# While the kernel supports more speaker drivers, the only hardware
# platforms with a speaker driver supported by Fedora use pcspkr.ko
# (PCSPKR_PLATFORM in the kernel config).
#
# Recommends: kmod(pcspkr.ko)
# Recommends: (kernel-modules-extras if kernel-modules)
# Recommends: (kernel-debug-modules-extras if kernel-debug-modules)
Requires(pre): shadow-utils
# /etc/modprobe.d/
Requires: kmod
# /etc/udev/rules.d/ and /usr/lib/udev/rules.d/
%{?el7:Requires: systemd}
%{!?el7:Requires: systemd-udev}
%description
Beep allows the user to control the PC speaker with precision,
allowing different sounds to indicate different events. While it
can be run quite happily from the command line, its intended place
of use is within scripts, notifying the user when something
interesting occurs. Of course, it has no notion of what is
interesting, but it is really good at the notifying part.
%prep
%setup -q
sed -i 's|^\.\\" \(\.BR .*\)README.Distro\(.*\)|\1README.fedora\2|' beep.1.in && : #"
%build
if test "x%{build_cppflags}" = "x%%{build_cppflags}"; then
BUILD_CPPFLAGS=""
else
BUILD_CPPFLAGS="%{build_cppflags}"
fi
cat>local.mk<<EOF
# generated by beep.spec %%build
CC = %{__cc}
CFLAGS = %{build_cflags}
CFLAGS += ${CFLAGS}
CPPFLAGS = ${BUILD_CPPFLAGS}
CPPFLAGS += ${CPPFLAGS}
LDFLAGS = %{build_ldflags}
LDFLAGS += ${LDFLAGS}
prefix = %{_prefix}
exec_prefix = %{_exec_prefix}
bindir = %{_bindir}
docdir = %{_pkgdocdir}
mandir = %{_mandir}
EOF
make %{?_smp_mflags}
%{?el7:sed -i '1s|.*|#!/bin/sed -f|' contrib/morse/morse2beep.sed}
%install
rm -rf "%{buildroot}"
make %{?_smp_mflags} install DESTDIR="%{buildroot}" CC=false
install -p -m 0644 "%{SOURCE1}" "%{buildroot}%{_pkgdocdir}/README.fedora"
install -d -m 0755 "%{buildroot}%{_sysconfdir}/modprobe.d/"
install -p -m 0644 "%{SOURCE4}" "%{buildroot}%{_sysconfdir}/modprobe.d/beep.conf"
install -d -m 0755 "%{buildroot}%{_udevrulesdir}/"
install -p -m 0644 "%{SOURCE2}" "%{buildroot}%{_udevrulesdir}/"
install -p -m 0644 "%{SOURCE3}" "%{buildroot}%{_udevrulesdir}/"
%pre
getent group beep >/dev/null || groupadd -r beep
exit 0
%files
%license %{_pkgdocdir}/COPYING
%doc %{_pkgdocdir}/CREDITS.md
%doc %{_pkgdocdir}/NEWS.md
%doc %{_pkgdocdir}/PERMISSIONS.md
%doc %{_pkgdocdir}/README.fedora
%doc %{_pkgdocdir}/README.md
%doc %{_pkgdocdir}/contrib/failure-beeps
%doc %{_pkgdocdir}/contrib/morse2beep.pl
%doc %{_pkgdocdir}/contrib/morse2beep.sed
%doc %{_pkgdocdir}/contrib/success-beeps
%{_bindir}/beep
%{_mandir}/man1/beep.1*
%config(noreplace) %{_sysconfdir}/modprobe.d/beep.conf
%{_udevrulesdir}/70-pcspkr-beep.rules
%{_udevrulesdir}/90-pcspkr-beep.rules
%changelog
%autochangelog