local.build_hardening-flags.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. Subject: Enable hardened build flags
  2. Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
  3. Bug-Debian: http://bugs.debian.org/656650
  4. Forwarded: not-needed
  5. Last-Update: 2015-12-04
  6. --- a/Makefile.am
  7. +++ b/Makefile.am
  8. @@ -11,7 +11,7 @@
  9. ## warning with -Wmissing-prototypes).
  10. ## -Wmissing-prototypes removed (eg, Linux 2.2.6 headers
  11. ## aren't up to it).
  12. -CFLAGS = -O2 -fno-builtin -Wall -DSBINDIR='"$(sbindir)"'
  13. +CFLAGS = $(shell dpkg-buildflags --get CFLAGS) -O2 -fno-builtin -Wall -DSBINDIR='"$(sbindir)"'
  14. #CFLAGS = -O2 -fno-builtin -Wall -ansi -DSBINDIR='"$(sbindir)"'
  15. #CFLAGS = -O2 -fno-builtin -Wall -ansi -pedantic -Wmissing-prototypes -Werror -DSBINDIR='"$(sbindir)"'
  16. --- a/plugins/Makefile
  17. +++ b/plugins/Makefile
  18. @@ -1,7 +1,8 @@
  19. CC = gcc
  20. COPTS = -O2 -g
  21. -CFLAGS = $(COPTS) -I.. -I../../include -fPIC
  22. -LDFLAGS = -shared
  23. +CFLAGS = $(shell dpkg-buildflags --get CFLAGS) $(COPTS) -I.. -I../../include -fPIC
  24. +CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
  25. +LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) -shared
  26. LDADD = -lutil
  27. INSTALL = install -o root
  28. prefix = /usr/local
  29. @@ -16,7 +17,7 @@
  30. all: $(PLUGINS)
  31. %.so: %.c
  32. - $(CC) -o $@ $(LDFLAGS) $(CFLAGS) $^ $(LDADD)
  33. + $(CC) -o $@ $(LDFLAGS) $(CPPFLAGS) $(CFLAGS) $^ $(LDADD)
  34. LIBDIR ?= $(DESTDIR)$(prefix)/lib/pptpd