From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 62613A0C43
	for <public@inbox.dpdk.org>; Wed, 15 Sep 2021 19:36:46 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 52143410ED;
	Wed, 15 Sep 2021 19:36:46 +0200 (CEST)
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by mails.dpdk.org (Postfix) with ESMTP id 442664003C;
 Wed, 15 Sep 2021 19:36:43 +0200 (CEST)
X-IronPort-AV: E=McAfee;i="6200,9189,10108"; a="219206992"
X-IronPort-AV: E=Sophos;i="5.85,296,1624345200"; d="scan'208";a="219206992"
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 15 Sep 2021 10:36:42 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.85,296,1624345200"; d="scan'208";a="610266227"
Received: from silpixa00399126.ir.intel.com ([10.237.223.29])
 by fmsmga001.fm.intel.com with ESMTP; 15 Sep 2021 10:36:41 -0700
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>, bluca@debian.org,
 stable@dpdk.org
Date: Wed, 15 Sep 2021 18:36:33 +0100
Message-Id: <20210915173633.59057-1-bruce.richardson@intel.com>
X-Mailer: git-send-email 2.30.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] [PATCH] doc/examples: fix build on FreeBSD
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

On FreeBSD, "find" does not support the "printf" flag, so we need to
use "gfind" from the "findutils" package.

Fixes: 8260f4f98cfe ("mk: use script to generate examples.dox")
Cc: bluca@debian.org
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 doc/api/generate_examples.sh | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/doc/api/generate_examples.sh b/doc/api/generate_examples.sh
index dae7ee0be0..3e08236596 100755
--- a/doc/api/generate_examples.sh
+++ b/doc/api/generate_examples.sh
@@ -5,12 +5,22 @@
 EXAMPLES_DIR=$1
 API_EXAMPLES=$2
 
+FIND=find
+if [ "$(uname)" = "FreeBSD" ] ; then
+# on FreeBSD, we need GNU find for "-printf" flag
+	FIND=gfind
+	if ! which -s $FIND ; then
+		echo "Error: need '$FIND' on FreeBSD. Install 'findutils' pkg"
+		exit 1
+	fi
+fi
+
 # generate a .d file including both C files and also build files, so we can
 # detect both file changes and file additions/deletions
-echo "$API_EXAMPLES: $(find ${EXAMPLES_DIR} -type f \( -name '*.c' -o -name 'meson.build' \) -printf '%p ' )" > ${API_EXAMPLES}.d
+echo "$API_EXAMPLES: $($FIND ${EXAMPLES_DIR} -type f \( -name '*.c' -o -name 'meson.build' \) -printf '%p ' )" > ${API_EXAMPLES}.d
 
 exec > "${API_EXAMPLES}"
 printf '/**\n'
 printf '@page examples DPDK Example Programs\n\n'
-find "${EXAMPLES_DIR}" -type f -name '*.c' -printf '@example examples/%P\n' | LC_ALL=C sort
+$FIND "${EXAMPLES_DIR}" -type f -name '*.c' -printf '@example examples/%P\n' | LC_ALL=C sort
 printf '*/\n'
-- 
2.30.2