From patchwork Tue Apr 23 10:31:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Yejun" X-Patchwork-Id: 12870 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 37357447EEE for ; Tue, 23 Apr 2019 05:42:30 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0AE7E68062B; Tue, 23 Apr 2019 05:42:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0B6C46801D7 for ; Tue, 23 Apr 2019 05:42:22 +0300 (EEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Apr 2019 19:42:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,384,1549958400"; d="scan'208";a="153058887" Received: from yguo18-skl-u1604.sh.intel.com ([10.239.13.25]) by orsmga002.jf.intel.com with ESMTP; 22 Apr 2019 19:42:20 -0700 From: "Guo, Yejun" To: ffmpeg-devel@ffmpeg.org Date: Tue, 23 Apr 2019 18:31:22 +0800 Message-Id: <1556015482-19503-1-git-send-email-yejun.guo@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [FFmpeg-devel] [PATCH V3 1/2] configure: sort decoder/encoder/filter/... names in alphabet order X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: yejun.guo@intel.com MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" take decoder names an example, with the default page length, shell command 'pr' needs two pages for all the decoder names. The names are firstly printed in the first page, then in the second page. So, as a whole, the names are sorted neither in column order nor in row order. It's a little confused. One method is to calculate the proper page length, so all the names are printed in one page by 'pr -l', and so strictly in alphabet order, column by column. Another method is to use command printf instead of pr, because buybox doesn't have pr. This patch refines print_in_columns to print the names with printf in alphabet order, very similar with 'pr -l', except the case when the last column is not fully filled with names. The interface of print_in_columns changed, the input needs to be sorted first, and then pass into print_in_columns as function parameters. It gives the flexibility the input parameters can be considered as an array and can be indexed. contributor: Alexander Strasser Signed-off-by: Guo, Yejun --- configure | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 3b11ffe..f8032aa 100755 --- a/configure +++ b/configure @@ -3832,14 +3832,28 @@ die_unknown(){ } print_in_columns() { - cols=$(expr $ncols / 24) - cat | tr ' ' '\n' | sort | pr -r "-$cols" -w $ncols -t + col_width=24 + cols=$(expr $ncols / $col_width) + rows=$(expr $(expr $# + $cols - 1) / $cols) + for row in $(seq $rows); do + index=$row + line="" + fmt="" + for col in $(seq $cols); do + if [ $index -le $# ]; then + eval line='"$line "${'$index'}' + fmt="$fmt%-${col_width}s" + fi + index=$(expr $index + $rows) + done + printf "$fmt\n" $line + done | sed 's/ *$//' } show_list() { suffix=_$1 shift - echo $* | sed s/$suffix//g | print_in_columns + print_in_columns $(echo $* | sed s/$suffix//g | tr ' ' '\n' | sort) exit 0 } @@ -7121,32 +7135,32 @@ test -n "$random_seed" && echo echo "External libraries:" -print_enabled '' $EXTERNAL_LIBRARY_LIST $EXTERNAL_AUTODETECT_LIBRARY_LIST | print_in_columns +print_in_columns $(print_enabled '' $EXTERNAL_LIBRARY_LIST $EXTERNAL_AUTODETECT_LIBRARY_LIST | tr ' ' '\n' | sort) echo echo "External libraries providing hardware acceleration:" -print_enabled '' $HWACCEL_LIBRARY_LIST $HWACCEL_AUTODETECT_LIBRARY_LIST | print_in_columns +print_in_columns $(print_enabled '' $HWACCEL_LIBRARY_LIST $HWACCEL_AUTODETECT_LIBRARY_LIST | tr ' ' '\n' | sort) echo echo "Libraries:" -print_enabled '' $LIBRARY_LIST | print_in_columns +print_in_columns $(print_enabled '' $LIBRARY_LIST | tr ' ' '\n' | sort) echo echo "Programs:" -print_enabled '' $PROGRAM_LIST | print_in_columns +print_in_columns $(print_enabled '' $PROGRAM_LIST | tr ' ' '\n' | sort) echo for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do echo "Enabled ${type}s:" eval list=\$$(toupper $type)_LIST - print_enabled '_*' $list | print_in_columns + print_in_columns $(print_enabled '_*' $list | tr ' ' '\n' | sort) echo done if test -n "$ignore_tests"; then ignore_tests=$(echo $ignore_tests | tr ',' ' ') echo "Ignored FATE tests:" - echo $ignore_tests | print_in_columns + print_in_columns $(echo $ignore_tests | tr ' ' '\n' | sort) echo fi