Bug#1069921: libusb-java FTCBFS: uses the build architecture compiler

Helmut Grohne helmut at subdivi.de
Fri Apr 26 14:06:17 BST 2024


Source: libusb-java
Version: 0.8+ztex20090101-9
Tags: patch
User: debian-cross at lists.debian.org
Usertags: ftcbfs

libusb-java fails to cross build from source, because the upstream
Makefile uses a non-standard variable (GCC) for the C compiler and
because debian/rules does not pass cross tools to make. I propose
renaming the variable to the usual CC variable and using dh_auto_build.
Please find a patch attached.

Helmut
-------------- next part --------------
diff --minimal -Nru libusb-java-0.8+ztex20090101/debian/changelog libusb-java-0.8+ztex20090101/debian/changelog
--- libusb-java-0.8+ztex20090101/debian/changelog	2021-02-07 23:29:30.000000000 +0100
+++ libusb-java-0.8+ztex20090101/debian/changelog	2024-04-26 11:25:31.000000000 +0200
@@ -1,3 +1,10 @@
+libusb-java (0.8+ztex20090101-9.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Use cross tools for build. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Fri, 26 Apr 2024 11:25:31 +0200
+
 libusb-java (0.8+ztex20090101-9) unstable; urgency=medium
 
   * Team upload.
diff --minimal -Nru libusb-java-0.8+ztex20090101/debian/patches/cross.patch libusb-java-0.8+ztex20090101/debian/patches/cross.patch
--- libusb-java-0.8+ztex20090101/debian/patches/cross.patch	1970-01-01 01:00:00.000000000 +0100
+++ libusb-java-0.8+ztex20090101/debian/patches/cross.patch	2024-04-26 11:25:31.000000000 +0200
@@ -0,0 +1,50 @@
+--- libusb-java-0.8+ztex20090101.orig/Makefile
++++ libusb-java-0.8+ztex20090101/Makefile
+@@ -21,7 +21,7 @@
+ ###############################
+ # this should not be modified #
+ ###############################
+-GCC=gcc
++CC?=gcc
+ STRIP=strip
+ CHMOD=chmod -x
+ JAVAC=javac -source 7 -target 7 -encoding ISO-8859-1
+@@ -51,7 +51,7 @@
+ libs: $(LIBTARGET_SH)
+ 
+ %.o: %.c LibusbJava.h
+-	$(GCC) -fPIC -g -c -std=c99 -Wall -Wno-pointer-to-int-cast $(LIBINCS) $< -o$@
++	$(CC) -fPIC -g -c -std=c99 -Wall -Wno-pointer-to-int-cast $(LIBINCS) $< -o$@
+ 
+ $(LIBTARGET_ST): $(LIBSRCS)
+ 
+@@ -64,25 +64,25 @@
+ 
+ 
+ $(LIBTARGET_ST)$(VERSIONSUFFIX): $(LIBSRCS)
+-	$(GCC) -shared -Wl,-soname,$(LIBTARGET_ST),-static $(LIBINCS) $(LIBSRCS) -static -o $(LIBTARGET_ST)$(VERSIONSUFFIX) $(LIBLIBS)
++	$(CC) -shared -Wl,-soname,$(LIBTARGET_ST),-static $(LIBINCS) $(LIBSRCS) -static -o $(LIBTARGET_ST)$(VERSIONSUFFIX) $(LIBLIBS)
+ 	[ -r $(LIBTARGET_ST) ] || ln -s $(LIBTARGET_ST)$(VERSIONSUFFIX) $(LIBTARGET_ST)
+ 	$(STRIP) $(LIBTARGET_ST)
+ 	$(CHMOD) $(LIBTARGET_ST)
+ 
+ $(LIBTARGET_SH)$(VERSIONSUFFIX): $(LIBSRCS)
+-	$(GCC) -fPIC -shared -Wl,-soname,$(LIBTARGET_SH) $(LIBINCS) $(LIBSRCS) -o $(LIBTARGET_SH)$(VERSIONSUFFIX) $(LIBLIBS)
++	$(CC) -fPIC -shared -Wl,-soname,$(LIBTARGET_SH) $(LIBINCS) $(LIBSRCS) -o $(LIBTARGET_SH)$(VERSIONSUFFIX) $(LIBLIBS)
+ 	[ -r $(LIBTARGET_SH) ] || ln -s $(LIBTARGET_SH)$(VERSIONSUFFIX) $(LIBTARGET_SH)
+ 	$(STRIP) $(LIBTARGET_SH)
+ 	$(CHMOD) $(LIBTARGET_SH)
+ 
+ $(LIBTARGET)$(VERSIONSUFFIX): $(LIBSRCS)
+-	$(GCC) -fPIC -shared -Wl,-soname,$(LIBTARGET) $(LIBINCS) $(LIBSRCS) -o $(LIBTARGET)$(VERSIONSUFFIX) $(LIBLIBS)
++	$(CC) -fPIC -shared -Wl,-soname,$(LIBTARGET) $(LIBINCS) $(LIBSRCS) -o $(LIBTARGET)$(VERSIONSUFFIX) $(LIBLIBS)
+ 	[ -r $(LIBTARGET) ] || ln -s $(LIBTARGET)$(VERSIONSUFFIX) $(LIBTARGET)
+ 	$(STRIP) $(LIBTARGET)
+ 	$(CHMOD) $(LIBTARGET)
+ 
+ $(LIBTARGET_64)$(VERSIONSUFFIX): $(LIBSRCS64)
+-	$(GCC) -fPIC -m64 -shared -std=c99 -Wall -Wno-pointer-to-int-cast -Wl,-soname,$(LIBTARGET_64) $(LIBINCS) $(LIBSRCS64) $(LIBLIBS) -o $(LIBTARGET_64)$(VERSIONSUFFIX)
++	$(CC) -fPIC -m64 -shared -std=c99 -Wall -Wno-pointer-to-int-cast -Wl,-soname,$(LIBTARGET_64) $(LIBINCS) $(LIBSRCS64) $(LIBLIBS) -o $(LIBTARGET_64)$(VERSIONSUFFIX)
+ 	[ -r $(LIBTARGET_64) ] || ln -s $(LIBTARGET_64)$(VERSIONSUFFIX) $(LIBTARGET_64)
+ 	$(STRIP) $(LIBTARGET_64)
+ 	$(CHMOD) $(LIBTARGET_64)
diff --minimal -Nru libusb-java-0.8+ztex20090101/debian/patches/series libusb-java-0.8+ztex20090101/debian/patches/series
--- libusb-java-0.8+ztex20090101/debian/patches/series	2020-09-05 14:43:49.000000000 +0200
+++ libusb-java-0.8+ztex20090101/debian/patches/series	2024-04-26 11:25:31.000000000 +0200
@@ -1,3 +1,4 @@
 jniInclude.patch
 sharedLibraries.patch
 java-compat.patch
+cross.patch
diff --minimal -Nru libusb-java-0.8+ztex20090101/debian/rules libusb-java-0.8+ztex20090101/debian/rules
--- libusb-java-0.8+ztex20090101/debian/rules	2021-02-07 23:27:55.000000000 +0100
+++ libusb-java-0.8+ztex20090101/debian/rules	2024-04-26 11:25:27.000000000 +0200
@@ -15,7 +15,7 @@
 
 DOCPATH=doc/html
 override_dh_auto_build-arch:
-	$(MAKE) STRIP="# not stripping: " libs
+	dh_auto_build -- STRIP="# not stripping: " libs
 	touch build-arch-stamp
 
 override_dh_auto_build-indep:


More information about the pkg-java-maintainers mailing list