]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/beep/0005-Make-build-install-more-user-and-packaging-friendly.patch
beep 1.3: Fixes for CVE-2018-0492
[people/pmueller/ipfire-2.x.git] / src / patches / beep / 0005-Make-build-install-more-user-and-packaging-friendly.patch
1 From 947a7e332908dcba1c7e523fbdc927d39ee6adb1 Mon Sep 17 00:00:00 2001
2 From: Hans Ulrich Niedermann <hun@n-dimensional.de>
3 Date: Tue, 19 Nov 2013 23:40:50 +0100
4 Subject: [PATCH] Make build/install more user and packaging friendly
5
6 Make the build and install more user and packaging friendly
7 by introducing the following features in the Makefile:
8
9 * Honor the $(CFLAGS) set when calling make.
10
11 * Prefix all install locations with $(DESTDIR) for
12 easy package building.
13
14 * Use GNU Makefile conventions for defining installation
15 directories. This means $(bindir) and $(man1dir)
16 instead of the former $(INSTALL_DIR) and $(MAN_DIR).
17
18 * Use install(1) for installing files and directories
19 so that permissions can be set properly.
20
21 * Stop "make clean" failing when it has nothing to do.
22
23 * Add 'uninstall' make target.
24
25 * Make 'install' target build executable if necessary.
26 ---
27 Makefile | 40 +++++++++++++++++++++++++++++-----------
28 1 file changed, 29 insertions(+), 11 deletions(-)
29
30 diff --git a/Makefile b/Makefile
31 index 0f4f810..942a7a5 100644
32 --- a/Makefile
33 +++ b/Makefile
34 @@ -1,19 +1,37 @@
35 CC=gcc
36 FLAGS=-Wall -O2
37 +
38 +INSTALL=install
39 +
40 EXEC_NAME=beep
41 -INSTALL_DIR=/usr/bin
42 MAN_FILE=beep.1.gz
43 -MAN_DIR=/usr/share/man/man1
44
45 -default : beep
46 +# Use GNU makefile conventions for directory names with one notable
47 +# exception: prefix is not /usr/local in order to keep the default
48 +# installation location for beep.
49 +prefix=/usr
50 +exec_prefix=$(prefix)
51 +bindir=$(exec_prefix)/bin
52 +datarootdir=$(prefix)/share
53 +mandir=$(datarootdir)/man
54 +man1dir=$(mandir)/man1
55 +
56 +.PHONY: all
57 +all: $(EXEC_NAME)
58 +
59 +.PHONY: clean
60 +clean:
61 + rm -f $(EXEC_NAME)
62
63 -clean :
64 - rm ${EXEC_NAME}
65 +$(EXEC_NAME): beep.c
66 + $(CC) $(FLAGS) $(CFLAGS) -o $(EXEC_NAME) beep.c
67
68 -beep : beep.c
69 - ${CC} ${FLAGS} -o ${EXEC_NAME} beep.c
70 +install: all
71 + $(INSTALL) -m 0755 -d $(DESTDIR)$(bindir)
72 + $(INSTALL) -m 0755 $(EXEC_NAME) $(DESTDIR)$(bindir)/
73 + $(INSTALL) -m 0755 -d $(DESTDIR)$(man1dir)
74 + $(INSTALL) -m 0644 $(MAN_FILE) $(DESTDIR)$(man1dir)/
75
76 -install :
77 - cp ${EXEC_NAME} ${INSTALL_DIR}
78 - # rm -f /usr/man/man1/beep.1.bz2
79 - cp ${MAN_FILE} ${MAN_DIR}
80 +uninstall:
81 + rm -f $(DESTDIR)$(bindir)/$(EXEC_NAME)
82 + rm -f $(DESTDIR)$(man1dir)/$(MAN_FILE)
83 --
84 2.7.5
85