fix-build.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. Description: Several changes to make the build succeed
  2. Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
  3. * Use hidapi-libusb provided by Debian
  4. * Use the build flags to make hardening build succeed
  5. * Provide an install target
  6. * Don't abort from failing "make clean"
  7. --- a/Makefile
  8. +++ b/Makefile
  9. @@ -1,23 +1,21 @@
  10. -CUR_PATH = $(shell echo $(PWD))
  11. OBJS = $(addprefix ykushcmd/objs/,ykushcmd.o commandParser.o usbcom.o)
  12. -LIBS = -lhidapi-libusb -lusb-1.0 -ludev
  13. -LOADPATHS = -L$(CUR_PATH)/ykushcmd/linux
  14. -PREPROCESSOR_DEFS = -DLINUX
  15. -CPP = g++
  16. +LIBS = -lhidapi-libusb
  17. -ykushcmd : $(OBJS)
  18. - $(CPP) $(LOADPATHS) -o bin/ykushcmd $(OBJS) $(LIBS)
  19. +bin/ykushcmd : $(OBJS)
  20. + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o bin/ykushcmd $(OBJS) $(LIBS)
  21. ykushcmd/objs/ykushcmd.o : ykushcmd/ykushcmd.cpp ykushcmd/commandParser.h
  22. - $(CPP) $(PREPROCESSOR_DEFS) -c ykushcmd/ykushcmd.cpp -o ykushcmd/objs/ykushcmd.o
  23. + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -c ykushcmd/ykushcmd.cpp -o ykushcmd/objs/ykushcmd.o
  24. -ykushcmd/objs/commandParser.o : ykushcmd/commandParser.cpp ykushcmd/commandParser.h ykushcmd/usbcom.h
  25. - $(CPP) $(PREPROCESSOR_DEFS) -c ykushcmd/commandParser.cpp -o ykushcmd/objs/commandParser.o
  26. +ykushcmd/objs/commandParser.o : ykushcmd/commandParser.cpp ykushcmd/commandParser.h ykushcmd/usbcom.h
  27. + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -c ykushcmd/commandParser.cpp -o ykushcmd/objs/commandParser.o
  28. -ykushcmd/objs/usbcom.o : ykushcmd/usbcom.cpp ykushcmd/linux/hidapi.h ykushcmd/usbcom.h
  29. - $(CPP) $(PREPROCESSOR_DEFS) -c ykushcmd/usbcom.cpp -o ykushcmd/objs/usbcom.o
  30. +ykushcmd/objs/usbcom.o : ykushcmd/usbcom.cpp ykushcmd/usbcom.h
  31. + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -c ykushcmd/usbcom.cpp -o ykushcmd/objs/usbcom.o
  32. clean :
  33. - rm -f bin/ykushcmd $(OBJS)
  34. + -rm -f bin/ykushcmd $(OBJS)
  35. +install:
  36. + install -D bin/ykushcmd $(DESTDIR)/usr/bin/ykushcmd
  37. --- a/ykushcmd/usbcom.cpp
  38. +++ b/ykushcmd/usbcom.cpp
  39. @@ -59,7 +59,7 @@
  40. #ifndef LINUX
  41. #include "windows\hidapi.h"
  42. #else
  43. - #include "linux/hidapi.h"
  44. + #include <hidapi/hidapi.h>
  45. #endif
  46. #include "usbcom.h"