Browse Source

Update patch for main Makefile

Christoph Biedl 3 years ago
parent
commit
da65a1b06e
4 changed files with 70 additions and 58 deletions
  1. 1 1
      debian/control
  2. 67 0
      debian/patches/debian.build.patch
  3. 0 56
      debian/patches/fix-build.patch
  4. 2 1
      debian/patches/series

+ 1 - 1
debian/control

@@ -5,7 +5,7 @@ Standards-Version: 4.2.1
 Vcs-Browser: https://git.in-ulm.de/cbiedl/ykush-control
 Vcs-Browser: https://git.in-ulm.de/cbiedl/ykush-control
 Vcs-Git: https://git.in-ulm.de/cbiedl/ykush-control.git
 Vcs-Git: https://git.in-ulm.de/cbiedl/ykush-control.git
 Build-Depends: debhelper (>= 11~),
 Build-Depends: debhelper (>= 11~),
-    libhidapi-dev,
+    libusb-1.0-0-dev,
     pandoc,
     pandoc,
 Priority: extra
 Priority: extra
 Section: utils
 Section: utils

+ 67 - 0
debian/patches/debian.build.patch

@@ -0,0 +1,67 @@
+Description: Modify the main Makefile
+Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
+Date: 2017-01-13
+Forwarded: no
+Last-Update: 2020-12-20
+
+    * Fix CUR_PATH definition
+    * Use the build flags to make hardening build succeed
+    * Provide an install target
+    * Don't use the libusb.h code copy
+
+--- a/Makefile
++++ b/Makefile
+@@ -21,24 +21,25 @@
+ 
+ COMPILE_FLAGS += $(addprefix -D, $(DEFINES))
+ 
+-CUR_PATH = $(shell echo $(PWD))
++CUR_PATH = .
+ INCLUDEPATHS = $(addprefix -I$(CUR_PATH)/, $(dir $(SOURCE_FULL)) libusb )
+ LOADPATHS = 
+ LIBS = -lusb-1.0
+-CPP = g++
+- 
++
+ 
+ 
+ ykushcmd : $(PROG_OBJ) $(OBJS)
+-	$(CPP) -o bin/$@ $(PROG_OBJ) $(OBJS) $(LIBS)
++	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o bin/$@ $(PROG_OBJ) $(OBJS) $(LIBS)
+ 
+ $(PROG_OBJ) :  %.o : %.cpp
+-	$(CPP) $(COMPILE_FLAGS) $(INCLUDEPATHS) -c $< -o $@
++	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(COMPILE_FLAGS) $(INCLUDEPATHS) -c $< -o $@
+ 
+ $(OBJS) : %.o : %.cpp %.h
+-	$(CPP) $(COMPILE_FLAGS) $(INCLUDEPATHS) -c $< -o $@
++	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(COMPILE_FLAGS) $(INCLUDEPATHS) -c $< -o $@
+ 
+ 
+ clean :
+ 	rm -f bin/yktrl $(OBJS) $(PROG_OBJ)
+ 
++install:
++	install -D bin/ykushcmd $(DESTDIR)/usr/bin/ykushcmd
+--- a/src/usbhid/usbhid.cpp
++++ b/src/usbhid/usbhid.cpp
+@@ -14,7 +14,7 @@
+ limitations under the License.
+ *******************************************************************************/
+ #include "usbhid.h"
+-#include <libusb.h>
++#include <libusb-1.0/libusb.h>
+ #include <cstdlib>
+ #include <string.h>
+ #include <string>
+--- a/src/usbhid/usbhid.h
++++ b/src/usbhid/usbhid.h
+@@ -16,7 +16,7 @@
+ #ifndef _USBHID_H_
+ #define _USBHID_H_
+ 
+-#include <libusb.h>
++#include <libusb-1.0/libusb.h>
+ 
+ 
+ /** hidapi info structure */

+ 0 - 56
debian/patches/fix-build.patch

@@ -1,56 +0,0 @@
-Description: Several changes to make the build succeed
-Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
-
-    * Use hidapi-libusb provided by Debian
-    * Use the build flags to make hardening build succeed
-    * Provide an install target
-    * Don't abort from failing "make clean"
-
---- a/Makefile
-+++ b/Makefile
-@@ -1,23 +1,21 @@
--CUR_PATH = $(shell echo $(PWD))
- OBJS = $(addprefix ykushcmd/objs/,ykushcmd.o commandParser.o usbcom.o)
--LIBS = -lhidapi-libusb -lusb-1.0 -ludev
--LOADPATHS = -L$(CUR_PATH)/ykushcmd/linux
--PREPROCESSOR_DEFS = -DLINUX
--CPP = g++
-+LIBS = -lhidapi-libusb
- 
--ykushcmd : $(OBJS)
--	$(CPP) $(LOADPATHS) -o bin/ykushcmd $(OBJS) $(LIBS)
-+bin/ykushcmd : $(OBJS)
-+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o bin/ykushcmd $(OBJS) $(LIBS)
- 
- 
- ykushcmd/objs/ykushcmd.o : ykushcmd/ykushcmd.cpp ykushcmd/commandParser.h
--	$(CPP) $(PREPROCESSOR_DEFS) -c ykushcmd/ykushcmd.cpp -o ykushcmd/objs/ykushcmd.o
-+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -c ykushcmd/ykushcmd.cpp -o ykushcmd/objs/ykushcmd.o
- 
--ykushcmd/objs/commandParser.o : ykushcmd/commandParser.cpp ykushcmd/commandParser.h ykushcmd/usbcom.h 
--	$(CPP) $(PREPROCESSOR_DEFS) -c ykushcmd/commandParser.cpp -o ykushcmd/objs/commandParser.o
-+ykushcmd/objs/commandParser.o : ykushcmd/commandParser.cpp ykushcmd/commandParser.h ykushcmd/usbcom.h
-+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -c ykushcmd/commandParser.cpp -o ykushcmd/objs/commandParser.o
- 
--ykushcmd/objs/usbcom.o : ykushcmd/usbcom.cpp ykushcmd/linux/hidapi.h ykushcmd/usbcom.h
--	$(CPP) $(PREPROCESSOR_DEFS) -c ykushcmd/usbcom.cpp -o ykushcmd/objs/usbcom.o
-+ykushcmd/objs/usbcom.o : ykushcmd/usbcom.cpp ykushcmd/usbcom.h
-+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -c ykushcmd/usbcom.cpp -o ykushcmd/objs/usbcom.o
- 
- clean :
--	rm -f bin/ykushcmd $(OBJS)
-+	-rm -f bin/ykushcmd $(OBJS)
- 
-+install:
-+	install -D bin/ykushcmd $(DESTDIR)/usr/bin/ykushcmd
---- a/ykushcmd/usbcom.cpp
-+++ b/ykushcmd/usbcom.cpp
-@@ -59,7 +59,7 @@
- #ifndef LINUX
- 	#include "windows\hidapi.h"
- #else
--	#include "linux/hidapi.h"
-+	#include <hidapi/hidapi.h>
- #endif
- 
- #include "usbcom.h"

+ 2 - 1
debian/patches/series

@@ -1 +1,2 @@
-fix-build.patch
+# changes for the Debian packaging
+debian.build.patch