debian.build.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. Description: Modify the main Makefile
  2. Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
  3. Date: 2017-01-13
  4. Forwarded: no
  5. Last-Update: 2020-12-20
  6. * Fix CUR_PATH definition
  7. * Use the build flags to make hardening build succeed
  8. * Provide an install target
  9. * Don't use the libusb.h code copy
  10. --- a/Makefile
  11. +++ b/Makefile
  12. @@ -21,24 +21,25 @@
  13. COMPILE_FLAGS += $(addprefix -D, $(DEFINES))
  14. -CUR_PATH = $(shell echo $(PWD))
  15. +CUR_PATH = .
  16. INCLUDEPATHS = $(addprefix -I$(CUR_PATH)/, $(dir $(SOURCE_FULL)) libusb )
  17. LOADPATHS =
  18. LIBS = -lusb-1.0
  19. -CPP = g++
  20. -
  21. +
  22. ykushcmd : $(PROG_OBJ) $(OBJS)
  23. - $(CPP) -o bin/$@ $(PROG_OBJ) $(OBJS) $(LIBS)
  24. + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o bin/$@ $(PROG_OBJ) $(OBJS) $(LIBS)
  25. $(PROG_OBJ) : %.o : %.cpp
  26. - $(CPP) $(COMPILE_FLAGS) $(INCLUDEPATHS) -c $< -o $@
  27. + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(COMPILE_FLAGS) $(INCLUDEPATHS) -c $< -o $@
  28. $(OBJS) : %.o : %.cpp %.h
  29. - $(CPP) $(COMPILE_FLAGS) $(INCLUDEPATHS) -c $< -o $@
  30. + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(COMPILE_FLAGS) $(INCLUDEPATHS) -c $< -o $@
  31. clean :
  32. rm -f bin/yktrl $(OBJS) $(PROG_OBJ)
  33. +install:
  34. + install -D bin/ykushcmd $(DESTDIR)/usr/bin/ykushcmd
  35. --- a/src/usbhid/usbhid.cpp
  36. +++ b/src/usbhid/usbhid.cpp
  37. @@ -14,7 +14,7 @@
  38. limitations under the License.
  39. *******************************************************************************/
  40. #include "usbhid.h"
  41. -#include <libusb.h>
  42. +#include <libusb-1.0/libusb.h>
  43. #include <cstdlib>
  44. #include <string.h>
  45. #include <string>
  46. --- a/src/usbhid/usbhid.h
  47. +++ b/src/usbhid/usbhid.h
  48. @@ -16,7 +16,7 @@
  49. #ifndef _USBHID_H_
  50. #define _USBHID_H_
  51. -#include <libusb.h>
  52. +#include <libusb-1.0/libusb.h>
  53. /** hidapi info structure */