1.3-7: changed upstream tarball, add fixes

+- Use new upstream tarball beep-1.3.tar.gz (yes, it has changed!)
+- Add a few fixes from upstream git repo
+- Move our Makefile cleanup to upstream pull request
This commit is contained in:
Hans Ulrich Niedermann 2013-11-20 00:09:17 +01:00
commit 6f7f04e747
8 changed files with 285 additions and 45 deletions

45
0001-Fixed-Makefile.patch Normal file
View file

@ -0,0 +1,45 @@
From 8b32b8b088be1f29e8bfea57a97b9bfaa76ec8ee Mon Sep 17 00:00:00 2001
From: Chris Wong <chrisyco@gmail.com>
Date: Wed, 23 Nov 2011 10:39:53 +1300
Subject: [PATCH 1/6] Fixed Makefile
* Use /usr/share/man (see http://www.pathname.com/fhs/2.2/fhs-4.11.html#4.11.5)
* Removed trailing spaces
* Added optimization flag (must beep FAST!!!)
---
Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index cc359c4..0f4f810 100644
--- a/Makefile
+++ b/Makefile
@@ -1,19 +1,19 @@
CC=gcc
-FLAGS=-Wall
+FLAGS=-Wall -O2
EXEC_NAME=beep
INSTALL_DIR=/usr/bin
MAN_FILE=beep.1.gz
-MAN_DIR=/usr/man/man1
+MAN_DIR=/usr/share/man/man1
default : beep
-clean :
+clean :
rm ${EXEC_NAME}
beep : beep.c
${CC} ${FLAGS} -o ${EXEC_NAME} beep.c
-install :
+install :
cp ${EXEC_NAME} ${INSTALL_DIR}
# rm -f /usr/man/man1/beep.1.bz2
cp ${MAN_FILE} ${MAN_DIR}
--
1.8.4.2

View file

@ -0,0 +1,45 @@
From d3aee6c489852108c91dc22abcacff364e9429f2 Mon Sep 17 00:00:00 2001
From: Chris Wong <chrisyco@gmail.com>
Date: Wed, 23 Nov 2011 11:34:55 +1300
Subject: [PATCH 2/6] Add more error detection
---
beep.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/beep.c b/beep.c
index 452fc08..14fac3e 100644
--- a/beep.c
+++ b/beep.c
@@ -98,11 +98,11 @@ char *console_device = NULL;
void do_beep(int freq) {
- if (console_type == BEEP_TYPE_CONSOLE) {
- if(ioctl(console_fd, KIOCSOUND, freq != 0
- ? (int)(CLOCK_TICK_RATE/freq)
- : freq) < 0) {
- printf("\a"); /* Output the only beep we can, in an effort to fall back on usefulness */
+ int period = (freq != 0 ? (int)(CLOCK_TICK_RATE/freq) : freq);
+
+ if(console_type == BEEP_TYPE_CONSOLE) {
+ if(ioctl(console_fd, KIOCSOUND, period) < 0) {
+ putchar('\a'); /* Output the only beep we can, in an effort to fall back on usefulness */
perror("ioctl");
}
} else {
@@ -113,7 +113,10 @@ void do_beep(int freq) {
e.code = SND_TONE;
e.value = freq;
- write(console_fd, &e, sizeof(struct input_event));
+ if(write(console_fd, &e, sizeof(struct input_event)) < 0) {
+ putchar('\a'); /* See above */
+ perror("write");
+ }
}
}
--
1.8.4.2

View file

@ -0,0 +1,33 @@
From e1320c1da52ca92aa68b4224f9532982184fbe00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me?= <jerome@jolimont.fr>
Date: Thu, 7 Feb 2013 12:54:53 +0100
Subject: [PATCH 4/6] also catch SIGTERM for stopping the beep
Signed-off-by: Gerfried Fuchs <rhonda@deb.at>
---
beep.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/beep.c b/beep.c
index 452fc08..9cb63bf 100644
--- a/beep.c
+++ b/beep.c
@@ -127,6 +127,7 @@ void handle_signal(int signum) {
switch(signum) {
case SIGINT:
+ case SIGTERM:
if(console_fd >= 0) {
/* Kill the sound, quit gracefully */
do_beep(0);
@@ -321,6 +322,7 @@ int main(int argc, char **argv) {
parms->next = NULL;
signal(SIGINT, handle_signal);
+ signal(SIGTERM, handle_signal);
parse_command_line(argc, argv, parms);
/* this outermost while loop handles the possibility that -n/--new has been
--
1.8.4.2

View file

@ -0,0 +1,85 @@
From 947a7e332908dcba1c7e523fbdc927d39ee6adb1 Mon Sep 17 00:00:00 2001
From: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Tue, 19 Nov 2013 23:40:50 +0100
Subject: [PATCH 5/6] Make build/install more user and packaging friendly
Make the build and install more user and packaging friendly
by introducing the following features in the Makefile:
* Honor the $(CFLAGS) set when calling make.
* Prefix all install locations with $(DESTDIR) for
easy package building.
* Use GNU Makefile conventions for defining installation
directories. This means $(bindir) and $(man1dir)
instead of the former $(INSTALL_DIR) and $(MAN_DIR).
* Use install(1) for installing files and directories
so that permissions can be set properly.
* Stop "make clean" failing when it has nothing to do.
* Add 'uninstall' make target.
* Make 'install' target build executable if necessary.
---
Makefile | 40 +++++++++++++++++++++++++++++-----------
1 file changed, 29 insertions(+), 11 deletions(-)
diff --git a/Makefile b/Makefile
index 0f4f810..942a7a5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,19 +1,37 @@
CC=gcc
FLAGS=-Wall -O2
+
+INSTALL=install
+
EXEC_NAME=beep
-INSTALL_DIR=/usr/bin
MAN_FILE=beep.1.gz
-MAN_DIR=/usr/share/man/man1
-default : beep
+# Use GNU makefile conventions for directory names with one notable
+# exception: prefix is not /usr/local in order to keep the default
+# installation location for beep.
+prefix=/usr
+exec_prefix=$(prefix)
+bindir=$(exec_prefix)/bin
+datarootdir=$(prefix)/share
+mandir=$(datarootdir)/man
+man1dir=$(mandir)/man1
+
+.PHONY: all
+all: $(EXEC_NAME)
+
+.PHONY: clean
+clean:
+ rm -f $(EXEC_NAME)
-clean :
- rm ${EXEC_NAME}
+$(EXEC_NAME): beep.c
+ $(CC) $(FLAGS) $(CFLAGS) -o $(EXEC_NAME) beep.c
-beep : beep.c
- ${CC} ${FLAGS} -o ${EXEC_NAME} beep.c
+install: all
+ $(INSTALL) -m 0755 -d $(DESTDIR)$(bindir)
+ $(INSTALL) -m 0755 $(EXEC_NAME) $(DESTDIR)$(bindir)/
+ $(INSTALL) -m 0755 -d $(DESTDIR)$(man1dir)
+ $(INSTALL) -m 0644 $(MAN_FILE) $(DESTDIR)$(man1dir)/
-install :
- cp ${EXEC_NAME} ${INSTALL_DIR}
- # rm -f /usr/man/man1/beep.1.bz2
- cp ${MAN_FILE} ${MAN_DIR}
+uninstall:
+ rm -f $(DESTDIR)$(bindir)/$(EXEC_NAME)
+ rm -f $(DESTDIR)$(man1dir)/$(MAN_FILE)
--
1.8.4.2

View file

@ -0,0 +1,33 @@
From 4622dd15dc12dab47a0381a8a7188f0f0421e01d Mon Sep 17 00:00:00 2001
From: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Wed, 20 Nov 2013 00:00:54 +0100
Subject: [PATCH 6/6] Preserve file modification time on install
Add -p option to install(1) invocation in order to preserve
the timestamps of the files being installed.
---
Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 942a7a5..290b8a4 100644
--- a/Makefile
+++ b/Makefile
@@ -27,10 +27,10 @@ $(EXEC_NAME): beep.c
$(CC) $(FLAGS) $(CFLAGS) -o $(EXEC_NAME) beep.c
install: all
- $(INSTALL) -m 0755 -d $(DESTDIR)$(bindir)
- $(INSTALL) -m 0755 $(EXEC_NAME) $(DESTDIR)$(bindir)/
- $(INSTALL) -m 0755 -d $(DESTDIR)$(man1dir)
- $(INSTALL) -m 0644 $(MAN_FILE) $(DESTDIR)$(man1dir)/
+ $(INSTALL) -m 0755 -d $(DESTDIR)$(bindir)
+ $(INSTALL) -m 0755 -p $(EXEC_NAME) $(DESTDIR)$(bindir)/
+ $(INSTALL) -m 0755 -d $(DESTDIR)$(man1dir)
+ $(INSTALL) -m 0644 -p $(MAN_FILE) $(DESTDIR)$(man1dir)/
uninstall:
rm -f $(DESTDIR)$(bindir)/$(EXEC_NAME)
--
1.8.4.2

View file

@ -1,41 +0,0 @@
diff --git a/Makefile b/Makefile
index 5856f9f..32bfb6b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,19 +1,26 @@
CC=gcc
FLAGS=-Wall
EXEC_NAME=beep
-INSTALL_DIR=/usr/bin
+BIN_DIR=/usr/bin
MAN_FILE=beep.1.gz
-MAN_DIR=/usr/man/man1
+MAN_DIR=/usr/share/man/man1
-default : beep
+.PHONY: all
+all: $(EXEC_NAME)
-clean :
+.PHONY: clean
+clean:
rm ${EXEC_NAME}
-beep : beep.c
- ${CC} ${FLAGS} -o ${EXEC_NAME} beep.c
+$(EXEC_NAME): beep.c
+ $(CC) $(FLAGS) $(CFLAGS) -o $(EXEC_NAME) $<
-install :
- cp ${EXEC_NAME} ${INSTALL_DIR}
- rm -f /usr/man/man1/beep.1.bz2
- cp ${MAN_FILE} ${MAN_DIR}
+install:
+ install -m 0755 -d $(DESTDIR)$(BIN_DIR)
+ install -m 0755 -d $(DESTDIR)$(MAN_DIR)
+ install -m 0755 -p $(EXEC_NAME) $(DESTDIR)$(BIN_DIR)/
+ install -m 0644 -p $(MAN_FILE) $(DESTDIR)$(MAN_DIR)/
+
+uninstall:
+ rm -f $(DESTDIR)$(BIN_DIR)/$(EXEC_NAME)
+ rm -f $(DESTDIR)$(MAN_DIR)/$(MAN_FILE)

View file

@ -8,15 +8,46 @@
Summary: Beep the PC speaker any number of ways
Name: beep
Version: 1.3
Release: 6%{?dist}
Release: 7%{?dist}
Group: Applications/System
License: GPLv2+
URL: http://www.johnath.com/beep/
# Upstream github repo: https://github.com/johnath/beep
# hun github repo: https://github.com/ndim/beep
# Alternative source URLs to download:
# curl -L -o beep-github.tar.gz https://api.github.com/repos/johnath/beep/tarball
# curl -L -o beep-g0d790fa.tar.gz https://api.github.com/repos/johnath/beep/tarball/0d790fa
# curl -L -o beep-1.3-gdb6f31a.tar.gz https://api.github.com/repos/johnath/beep/tarball/db6f31a60303e41def1a1d0705164cd5b6d75492
Source0: http://www.johnath.com/beep/%{name}-%{version}.tar.gz
# Fedora specific files
Source1: %{name}-README.fedora
Source2: %{name}-modprobe.conf
Patch0: beep-1.2.2-install-fixes.patch
# Fix from upstream github repo
Patch1: 0001-Fixed-Makefile.patch
# Fix from upstream github repo
Patch2: 0002-Add-more-error-detection.patch
# No sense to add stuff to .gitignore in our source dir
# Patch3: 0003-Gitignorance.patch
# Fix from upstream github repo
Patch4: 0004-also-catch-SIGTERM-for-stopping-the-beep.patch
# Make build/install more user and packaging friendly
# https://github.com/johnath/beep/pull/6
Patch5: 0005-Make-build-install-more-user-and-packaging-friendly.patch
# Preserve file modification time on install
# https://github.com/johnath/beep/pull/6
Patch6: 0006-Preserve-file-modification-time-on-install.patch
BuildRequires: glibc-kernheaders
@ -32,7 +63,11 @@ what's interesting, but it's real good at that notifying part.
%prep
%setup -q
%patch0 -p1 -b .install-fixes
%patch1 -p1 -b 0001
%patch2 -p1 -b 0002
%patch4 -p1 -b 0004
%patch5 -p1 -b 0005
%patch6 -p1 -b 0006
cp -p %{SOURCE1} README.fedora
@ -66,6 +101,11 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Tue Nov 19 2013 Hans Ulrich Niedermann <hun@n-dimensional.de> - 1.3-7
- Use new upstream tarball beep-1.3.tar.gz (yes, it has changed!)
- Add a few fixes from upstream git repo
- Move our Makefile cleanup to upstream pull request
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

View file

@ -1 +1 @@
355406b51da5ea0f01affb6f6231f69a beep-1.3.tar.gz
49c340ceb95dbda3f97b2daafac7892a beep-1.3.tar.gz