From f7bbac4894fd0853535e4ae396fc2d4af384e601 Mon Sep 17 00:00:00 2001 From: Multrus Date: Tue, 16 Aug 2022 13:34:55 +0200 Subject: [PATCH 1/3] add new helper-script strip_defines_cppp.sh, adapt file-name in prepare_instrumentation.sh, use quotation marks --- scripts/prepare_instrumentation.sh | 4 +- scripts/strip_defines_cppp.sh | 81 ++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 2 deletions(-) create mode 100755 scripts/strip_defines_cppp.sh diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index 8ab50080a2..b36dd413a9 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -32,7 +32,7 @@ emulator="" system=`uname -s` -if [[ ($system == "Linux") && (`uname -a` == *@(microsoft|Microsoft|wsl|WSL)*) ]]; then +if [[ ($system == "Linux") && (`uname -a` == "*@(microsoft|Microsoft|wsl|WSL)*") ]]; then system="WSL" fi if [[ ($system == "Linux") || ($system == "Darwin") ]]; then @@ -94,7 +94,7 @@ if coan_exists; then coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/lib_{com,dec,enc,util,debug}/*.[hc] coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/apps/*.[hc] else - ./strip_defines_cpppnet.sh $targetdir $ifdef_list + ./strip_defines_cppp.sh $targetdir $ifdef_list fi # patch code before wmc_tool: replace hexadecimal unsigned long constants (0x...UL) by regular integer constant + cast to unsigned long diff --git a/scripts/strip_defines_cppp.sh b/scripts/strip_defines_cppp.sh new file mode 100755 index 0000000000..8563cad368 --- /dev/null +++ b/scripts/strip_defines_cppp.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +# +# (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, +# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +# contributors to this repository. All Rights Reserved. +# +# This software is protected by copyright law and by international treaties. +# The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, +# Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., +# Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, +# Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other +# contributors to this repository retain full ownership rights in their respective contributions in +# the software. This notice grants no license of any kind, including but not limited to patent +# license, nor is any license granted by implication, estoppel or otherwise. +# +# Contributors are required to enter into the IVAS codec Public Collaboration agreement before making +# contributions. +# +# This software is provided "AS IS", without any express or implied warranties. The software is in the +# development stage. It is intended exclusively for experts who have experience with such software and +# solely for the purpose of inspection. All implied warranties of non-infringement, merchantability +# and fitness for a particular purpose are hereby disclaimed and excluded. +# +# Any dispute, controversy or claim arising under or in relation to providing this software shall be +# submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in +# accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and +# the United Nations Convention on Contracts on the International Sales of Goods. +# + +STRIP_DIR=$1 +IFDEFLIST=$2 + +STRIPIFDEFCMD="./cppp/cppp.pl" + +echo "stripping defines ..." + +######################### +# strip unwanted ifdefs +# collect lists +DEFINE_OPTS="" +STRIP_DEFINE_LIST="" +KEEP_DEFINE_LIST="" +STRIPFILELIST=`find ${STRIP_DIR} -name '*.[c|h]' -o -name '*.cpp' | xargs` +#echo ${STRIPFILELIST} + + +arr=$(echo ${IFDEFLIST} | tr "," "\n") + +for IFDEFLIST in $arr ; do + if [ -f ${IFDEFLIST} ]; then + STRIP_DEFINE_LIST=`cat ${IFDEFLIST} | grep -v -E "^#" | grep -v -E "^\+" | sed s'/\r//'g | xargs` + KEEP_DEFINE_LIST=`cat ${IFDEFLIST} | grep -E "^\+" | sed s'/\r//'g | xargs` + + for i in ${STRIP_DEFINE_LIST} ; do + DEFINE_OPTS="${DEFINE_OPTS} -U ${i} " + done + echo "${IFDEFLIST}: stripping ${STRIP_DEFINE_LIST} ..." + + for i in ${KEEP_DEFINE_LIST} ; do + DEFINE_OPTS="${DEFINE_OPTS} -D ${i:1} " + done + echo "" + echo "${IFDEFLIST}: stripping else of ${KEEP_DEFINE_LIST} ..." + + for j in ${STRIPFILELIST} ; do + #echo "stripping $j ..." + #echo ${STRIPIFDEFCMD} ${DEFINE_OPTS} ${j} + ${STRIPIFDEFCMD} ${DEFINE_OPTS} ${j} + printf '.' + done + printf '\n' + # remove any *.nocppp files + find ${STRIP_DIR} -type f -name '*.nocppp' | xargs rm -f + + else + echo "no ifdef-list ${CONFIG_DIR}/${IFDEFLIST} !" + fi +done -- GitLab From fc6cc47c76b7aa00e231d5547db0c1881ce18c4e Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 16 Aug 2022 13:45:00 +0200 Subject: [PATCH 2/3] typo in prepare_instrumentation.sh --- scripts/prepare_instrumentation.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index b36dd413a9..bf1700af61 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -45,7 +45,7 @@ coan_exists () { } cppp_exists () { - type cppp/cpppnet.pl &> /dev/null ; + type cppp/cppp.pl &> /dev/null ; } if ! (coan_exists || cppp_exists); then -- GitLab From 6311ea1f76642a2c5505cab2814e1bd40b38563c Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 16 Aug 2022 15:43:50 +0200 Subject: [PATCH 3/3] fix string comparison against system, to work on all platforms --- scripts/prepare_instrumentation.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index bf1700af61..9463871f78 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -32,14 +32,13 @@ emulator="" system=`uname -s` -if [[ ($system == "Linux") && (`uname -a` == "*@(microsoft|Microsoft|wsl|WSL)*") ]]; then +if [[ ($system == "Linux") && (`uname -a` =~ (microsoft|Microsoft|wsl|WSL) ) ]]; then system="WSL" fi if [[ ($system == "Linux") || ($system == "Darwin") ]]; then emulator="wine" fi - coan_exists () { type coan &> /dev/null ; } -- GitLab