Source: original-awk
Version: 2012-12-20-6
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap
original-awk fails to cross build from source, because the packaging
forces the build architecture compiler "gcc". Using a triplet-prefixed
compiler fixes that, but makes executing maketab fail. For building
maketabe the build architecture compiler was the right thing. So we also
need to extend the build system to differentiate between these
compilers. The attached patch implements that and makes original-awk
cross buildable. Please consider applying it.
Helmut
diff --minimal -Nru original-awk-2012-12-20/debian/changelog
original-awk-2012-12-20/debian/changelog
--- original-awk-2012-12-20/debian/changelog2017-01-08 18:47:44.0
+0100
+++ original-awk-2012-12-20/debian/changelog2017-08-05 22:00:10.0
+0200
@@ -1,3 +1,12 @@
+original-awk (2012-12-20-6.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Fix FTCBFS: Closes: #-1.
++ Let dpkg's buildtools.mk supply CC and CC_FOR_BUILD.
++ cross.patch: Use CC_FOR_BUILD for maketab.
+
+ -- Helmut Grohne Sat, 05 Aug 2017 22:00:10 +0200
+
original-awk (2012-12-20-6) unstable; urgency=medium
* Rename all patches to end with .patch.
diff --minimal -Nru original-awk-2012-12-20/debian/patches/cross.patch
original-awk-2012-12-20/debian/patches/cross.patch
--- original-awk-2012-12-20/debian/patches/cross.patch 1970-01-01
01:00:00.0 +0100
+++ original-awk-2012-12-20/debian/patches/cross.patch 2017-08-05
22:00:10.0 +0200
@@ -0,0 +1,19 @@
+--- original-awk-2012-12-20.orig/makefile
original-awk-2012-12-20/makefile
+@@ -30,6 +30,7 @@
+ CC = gcc -fprofile-arcs -ftest-coverage # then gcov f1.c; cat f1.c.gcov
+ CC = gcc -g -Wall -pedantic
+ CC = gcc -O4 -Wall -pedantic -fno-strict-aliasing
++CC_FOR_BUILD ?= $(CC)
+
+ YACC = bison -d -y
+ YACC = yacc -d -S
+@@ -62,7 +63,7 @@
+ ./maketab >proctab.c
+
+ maketab: ytab.h maketab.c
+- $(CC) $(CFLAGS) maketab.c -o maketab
++ $(CC_FOR_BUILD) $(CFLAGS) maketab.c -o maketab
+
+ bundle:
+ @cp ytab.h ytabh.bak
diff --minimal -Nru original-awk-2012-12-20/debian/patches/series
original-awk-2012-12-20/debian/patches/series
--- original-awk-2012-12-20/debian/patches/series 2017-01-08
17:00:00.0 +0100
+++ original-awk-2012-12-20/debian/patches/series 2017-08-05
22:00:10.0 +0200
@@ -1,3 +1,4 @@
01-awk-is-called-original-awk-here.patch
02-remove-generated-files-in-clean-target.patch
03-cflags-and-cppflags-together.patch
+cross.patch
diff --minimal -Nru original-awk-2012-12-20/debian/rules
original-awk-2012-12-20/debian/rules
--- original-awk-2012-12-20/debian/rules2017-01-08 17:00:00.0
+0100
+++ original-awk-2012-12-20/debian/rules2017-08-05 22:00:10.0
+0200
@@ -1,4 +1,8 @@
#!/usr/bin/make -f
+
+-include /usr/share/dpkg/buildtools.mk
+CC_FOR_BUILD ?= cc
+
%:
dh $@
@@ -6,13 +10,12 @@
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-CC = gcc
CFLAGS := `dpkg-buildflags --get CFLAGS` -Wall
LDFLAGS := `dpkg-buildflags --get LDFLAGS`
CPPFLAGS := `dpkg-buildflags --get CPPFLAGS`
override_dh_auto_build:
- dh_auto_build -- CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)"
ALLOC="$(LDFLAGS)" YACC="bison -d -y"
+ dh_auto_build -- CC="$(CC)" CC_FOR_BUILD="$(CC_FOR_BUILD)"
CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" ALLOC="$(LDFLAGS)" YACC="bison -d -y"
override_dh_auto_install:
install -m 755 a.out debian/$(package)/usr/bin/$(package)