diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index 8ab50080a2629ee82ce95ad67b1434590208e508..9463871f780007e33badac7e1771826bfe44eec9 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -32,20 +32,19 @@ 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 ; } cppp_exists () { - type cppp/cpppnet.pl &> /dev/null ; + type cppp/cppp.pl &> /dev/null ; } if ! (coan_exists || cppp_exists); then @@ -94,7 +93,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 0000000000000000000000000000000000000000..8563cad36885f635c66382ee67189a42885a75bc --- /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