Source: wrk
Version: 4.1.0-2
Severity: minor
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

wrk fails to cross build from source, because it does not pass cross
tools to make and the Makefile hard codes the build architecture
pkg-config. An easy way to fix the former is using dh_auto_build. The
attached patch fixes both. After applying it, wrk continues to fail
cross building, because luajit still produces a build archtecture object
file. It's not obvious how to fix that. However, it would help to see
such failures in cross build logs. Therefore, I'm asking you to apply
this partial solution to make the real issue more visible. Thanks for
considering.

Helmut
diff --minimal -Nru wrk-4.1.0/debian/changelog wrk-4.1.0/debian/changelog
--- wrk-4.1.0/debian/changelog  2020-05-16 19:47:51.000000000 +0200
+++ wrk-4.1.0/debian/changelog  2020-05-31 07:15:46.000000000 +0200
@@ -1,3 +1,12 @@
+wrk (4.1.0-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Improve cross building: (Closes: #-1)
+    + Let dh_auto_build pass cross tools to make.
+    + Make pkg-config substitutable.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Sun, 31 May 2020 07:15:46 +0200
+
 wrk (4.1.0-2) unstable; urgency=medium
 
   * Fix FTBFS on armel.
diff --minimal -Nru wrk-4.1.0/debian/patches/debian-changes 
wrk-4.1.0/debian/patches/debian-changes
--- wrk-4.1.0/debian/patches/debian-changes     2020-05-16 19:47:51.000000000 
+0200
+++ wrk-4.1.0/debian/patches/debian-changes     2020-05-31 07:15:46.000000000 
+0200
@@ -10,26 +10,27 @@
 repository.
 --- wrk-4.1.0.orig/Makefile
 +++ wrk-4.1.0/Makefile
-@@ -1,5 +1,5 @@
+@@ -1,5 +1,6 @@
++PKG_CONFIG ?= pkg-config
  CFLAGS  += -std=c99 -Wall -O2 -D_REENTRANT
 -LIBS    := -lpthread -lm -lssl -lcrypto
 +LIBS    += -lpthread -lm -lssl -lcrypto
  
  TARGET  := $(shell uname -s | tr '[A-Z]' '[a-z]' 2>/dev/null || echo unknown)
  
-@@ -17,6 +17,11 @@ else ifeq ($(TARGET), freebsd)
+@@ -17,6 +18,11 @@ else ifeq ($(TARGET), freebsd)
        LDFLAGS += -Wl,-E
  endif
  
-+CFLAGS   += $(shell pkg-config --cflags luajit)
-+LIBS     += $(shell pkg-config --libs luajit)
++CFLAGS   += $(shell $(PKG_CONFIG) --cflags luajit)
++LIBS     += $(shell $(PKG_CONFIG) --libs luajit)
 +
 +CFLAGS   += $(CPPFLAGS)
 +
  SRC  := wrk.c net.c ssl.c aprintf.c stats.c script.c units.c \
                ae.c zmalloc.c http_parser.c
  BIN  := wrk
-@@ -51,8 +56,7 @@ clean:
+@@ -51,8 +57,7 @@ clean:
        $(RM) -rf $(BIN) obj/*
  
  $(BIN): $(OBJ)
@@ -39,7 +40,7 @@
  
  $(OBJ): config.h Makefile $(DEPS) | $(ODIR)
  
-@@ -60,15 +64,13 @@ $(ODIR):
+@@ -60,15 +65,13 @@ $(ODIR):
        @mkdir -p $@
  
  $(ODIR)/bytecode.o: src/wrk.lua
diff --minimal -Nru wrk-4.1.0/debian/rules wrk-4.1.0/debian/rules
--- wrk-4.1.0/debian/rules      2020-05-16 19:47:51.000000000 +0200
+++ wrk-4.1.0/debian/rules      2020-05-31 07:15:45.000000000 +0200
@@ -14,4 +14,4 @@
        dh $@
 
 override_dh_auto_build:
-       $(MAKE) WITH_LUAJIT=/usr WITH_OPENSSL=/usr VER=debian/$(DEB_VERSION)
+       dh_auto_build -- WITH_LUAJIT=/usr WITH_OPENSSL=/usr 
VER=debian/$(DEB_VERSION)

Reply via email to