From patchwork Tue Apr 5 19:26:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schiffer X-Patchwork-Id: 606682 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (caladan.dune.hu [78.24.191.180]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qff5B4lY5z9t3Z for ; Wed, 6 Apr 2016 05:27:42 +1000 (AEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id BA652B91B55; Tue, 5 Apr 2016 21:27:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on arrakis.dune.hu X-Spam-Level: ** X-Spam-Status: No, score=2.4 required=5.0 tests=RDNS_NONE autolearn=no autolearn_force=no version=3.4.1 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP; Tue, 5 Apr 2016 21:27:21 +0200 (CEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 198A4B91B54 for ; Tue, 5 Apr 2016 21:27:20 +0200 (CEST) X-policyd-weight: using cached result; rate: -6.1 Received: from chaos.universe-factory.net (unknown [37.72.148.22]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Tue, 5 Apr 2016 21:27:19 +0200 (CEST) Received: from avalon.neoraider.dn42 (unknown [IPv6:fd1b:c28a:2fd6::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by chaos.universe-factory.net (Postfix) with ESMTPSA id 688A81835E1 for ; Tue, 5 Apr 2016 21:27:19 +0200 (CEST) From: Matthias Schiffer To: openwrt-devel@lists.openwrt.org Date: Tue, 5 Apr 2016 21:26:55 +0200 Message-Id: X-Mailer: git-send-email 2.8.0 Subject: [OpenWrt-Devel] [PATCH] xtables-addons: build: fix configure compatiblity with POSIX shells X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Fixes build with /bin/sh pointing to certain versions of dash (for example on Void Linux). Signed-off-by: Matthias Schiffer --- ...-configure-compatiblity-with-POSIX-shells.patch | 51 ++++++++++++++++++++++ .../patches/002-fix-kernel-version-detection.patch | 12 ++--- 2 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 package/network/utils/xtables-addons/patches/001-build-fix-configure-compatiblity-with-POSIX-shells.patch diff --git a/package/network/utils/xtables-addons/patches/001-build-fix-configure-compatiblity-with-POSIX-shells.patch b/package/network/utils/xtables-addons/patches/001-build-fix-configure-compatiblity-with-POSIX-shells.patch new file mode 100644 index 0000000..e0b11b5 --- /dev/null +++ b/package/network/utils/xtables-addons/patches/001-build-fix-configure-compatiblity-with-POSIX-shells.patch @@ -0,0 +1,51 @@ +From f07a0a5cb8b3c5e1aee8b30c7fa21ccfbf24a95a Mon Sep 17 00:00:00 2001 +Message-Id: +From: Matthias Schiffer +Date: Fri, 1 Apr 2016 22:24:00 +0200 +Subject: [PATCH] build: fix configure compatiblity with POSIX shells + +The kernel version detection code uses some bashisms, which makes the build +fail on Debian systems where /bin/sh links to dash. Replace with POSIX- +conforming commands at the cost of requiring awk. +--- + configure.ac | 24 +++++++++--------------- + 1 file changed, 9 insertions(+), 15 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 82a1355..5a5ea57 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -44,21 +44,15 @@ regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \ + + if test -n "$kbuilddir"; then + AC_MSG_CHECKING([kernel version that we will build against]) +- krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease)"; +- kmajor="${krel%%[[^0-9]]*}"; +- kmajor="$(($kmajor+0))"; +- krel="${krel:${#kmajor}}"; +- krel="${krel#.}"; +- kminor="${krel%%[[^0-9]]*}"; +- kminor="$(($kminor+0))"; +- krel="${krel:${#kminor}}"; +- krel="${krel#.}"; +- kmicro="${krel%%[[^0-9]]*}"; +- kmicro="$(($kmicro+0))"; +- krel="${krel:${#kmicro}}"; +- krel="${krel#.}"; +- kstable="${krel%%[[^0-9]]*}"; +- kstable="$(($kstable+0))"; ++ krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')"; ++ save_IFS=$IFS; ++ IFS='.'; ++ set x $krel; ++ IFS=$save_IFS; ++ kmajor="$(($2+0))"; ++ kminor="$(($3+0))"; ++ kmicro="$(($4+0))"; ++ kstable="$(($5+0))"; + if test -z "$kmajor" -o -z "$kminor" -o -z "$kmicro"; then + echo "WARNING: Version detection did not succeed. Continue at own luck."; + else +-- +2.8.0 + diff --git a/package/network/utils/xtables-addons/patches/002-fix-kernel-version-detection.patch b/package/network/utils/xtables-addons/patches/002-fix-kernel-version-detection.patch index e4101ad..6a7a099 100644 --- a/package/network/utils/xtables-addons/patches/002-fix-kernel-version-detection.patch +++ b/package/network/utils/xtables-addons/patches/002-fix-kernel-version-detection.patch @@ -1,11 +1,11 @@ --- a/configure.ac +++ b/configure.ac -@@ -44,7 +44,7 @@ regular_CFLAGS="-Wall -Waggregate-return +@@ -44,7 +44,7 @@ regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \ if test -n "$kbuilddir"; then AC_MSG_CHECKING([kernel version that we will build against]) -- krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease)"; -+ krel="$(make -sC "$kbuilddir" M=$PWD kernelversion)"; - kmajor="${krel%%[[^0-9]]*}"; - kmajor="$(($kmajor+0))"; - krel="${krel:${#kmajor}}"; +- krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')"; ++ krel="$(make -sC "$kbuilddir" M=$PWD kernelversion | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')"; + save_IFS=$IFS; + IFS='.'; + set x $krel;