From 5d8be178b51441b15ae72b39b75e5dd3e1580183 Mon Sep 17 00:00:00 2001 From: Emily Mabrey Date: Sat, 31 Jul 2021 04:33:00 -0400 Subject: [PATCH 1/4] Various contributor script changes. Update `msgfmt.py` to recent python 3 version. Instruct CMake to load `Gettext.Tools` version `0.21.0.1` when using NuGet. Cleanup `regen_POT_file.sh`. Correct list of languages in `LanguageNames.txt` Cleanup various locale Perl scripts. Make `find-PO-no-Id.sh` use glob file access. Cleanup output of `locale_diagnostics.sh` Cleanup bash scripts and add double-quoting to prevent string issues. Move various locale scripts to `locale/scripts` directory. Signed-off-by: Emily Mabrey --- images/{ => scripts}/degimpify.sh | 6 +- locale/CMakeLists.txt | 9 ++- locale/regen_POT_file.sh | 56 ------------------- locale/{ => scripts}/LanguageNames.txt | 13 ++--- locale/scripts/find-PO-no-Id.sh | 18 ++++++ .../find-POT-duplicates.pl} | 3 +- .../fix-PO-files.py} | 2 +- .../locale_cpp_name_generator.pl} | 0 locale/scripts/locale_diagnostics.sh | 23 ++++++++ locale/{ => scripts}/msgfmt.py | 42 ++++++-------- locale/scripts/regen_POT_file.sh | 44 +++++++++++++++ locale/update_po_files.sh | 55 ------------------ 12 files changed, 117 insertions(+), 154 deletions(-) rename images/{ => scripts}/degimpify.sh (74%) delete mode 100644 locale/regen_POT_file.sh rename locale/{ => scripts}/LanguageNames.txt (83%) create mode 100644 locale/scripts/find-PO-no-Id.sh rename locale/{find-duplicates.pl => scripts/find-POT-duplicates.pl} (86%) mode change 100755 => 100644 rename locale/{fix_po_files.py => scripts/fix-PO-files.py} (99%) rename locale/{CeePlusPlusifyLanguageNames.pl => scripts/locale_cpp_name_generator.pl} (100%) mode change 100755 => 100644 create mode 100644 locale/scripts/locale_diagnostics.sh rename locale/{ => scripts}/msgfmt.py (87%) create mode 100644 locale/scripts/regen_POT_file.sh delete mode 100755 locale/update_po_files.sh diff --git a/images/degimpify.sh b/images/scripts/degimpify.sh similarity index 74% rename from images/degimpify.sh rename to images/scripts/degimpify.sh index 44dc5159be..1ecd7a8a73 100644 --- a/images/degimpify.sh +++ b/images/scripts/degimpify.sh @@ -12,9 +12,9 @@ shopt -s nullglob input_dirs="$*" if [ $# -eq 0 ]; then - input_dirs[0]="./EditButtons" - input_dirs[1]="./TranscriptionImages" - input_dirs[2]="./ControlButtons" + input_dirs[0]="${BASH_SOURCE[0]}/../../images/EditButtons" + input_dirs[1]="${BASH_SOURCE[0]}/../../images/TranscriptionImages" + input_dirs[2]="${BASH_SOURCE[0]}/../../images/ControlButtons" fi for dir in "${input_dirs[@]}" diff --git a/locale/CMakeLists.txt b/locale/CMakeLists.txt index ad8ab50f71..9297f8f1ac 100755 --- a/locale/CMakeLists.txt +++ b/locale/CMakeLists.txt @@ -16,9 +16,9 @@ if( GETTEXT_FOUND ) mark_as_advanced( FORCE GETTEXT_MSGMERGE_EXECUTABLE ) set( msgfmt "${GETTEXT_MSGFMT_EXECUTABLE}" ) elseif( PYTHON ) - set( msgfmt "${PYTHON}" "${TARGET_ROOT}/msgfmt.py" ) + set( msgfmt "${PYTHON}" "${TARGET_ROOT}/scripts/msgfmt.py" ) elseif( CMAKE_SYSTEM_NAME MATCHES "Windows" ) - nuget_package( pkgdir "Gettext.Tools" "0.20.1.1" ) + nuget_package( pkgdir "Gettext.Tools" "0.21.0.1" ) file( TO_NATIVE_PATH "${pkgdir}/tools/bin/msgfmt.exe" msgfmt ) endif() @@ -80,9 +80,8 @@ endforeach() add_custom_target( "${TARGET}" ALL DEPENDS ${OUTPUTS} SOURCES "${SOURCES}" ) if( NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" ) - if( NOT WIN32) - install( DIRECTORY ${locale}/ - TYPE LOCALE ) + if( NOT WIN32 ) + install( DIRECTORY ${locale} TYPE LOCALE ) endif() endif() diff --git a/locale/regen_POT_file.sh b/locale/regen_POT_file.sh deleted file mode 100644 index 6e4bdadf3d..0000000000 --- a/locale/regen_POT_file.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# Run this script with locale as the current directory -set -o errexit -echo ";; Recreating tenacity.pot using .h, .cpp and .mm files" -for path in ../modules/mod-* ../libraries/lib-* ../include ../src ; do - find $path -name \*.h -o -name \*.cpp -o -name \*.mm -done | LANG=c sort | \ -sed -E 's/\.\.\///g' |\ -xargs xgettext \ ---no-wrap \ ---default-domain=tenacity \ ---directory=.. \ ---keyword=_ --keyword=XO --keyword=XC:1,2c --keyword=XXO --keyword=XXC:1,2c --keyword=XP:1,2 --keyword=XPC:1,2,4c \ ---add-comments=" i18n" \ ---add-location=file \ ---copyright-holder='Tenacity Contributors' \ ---package-name="tenacity" \ ---package-version='3.0.4' \ ---msgid-bugs-address="emabrey@tenacityaudio.org" \ ---add-location=file -L C -o tenacity.pot -echo ";; Adding nyquist files to tenacity.pot" -for path in ../plug-ins ; do find $path -name \*.ny -not -name rms.ny; done | LANG=c sort | \ -sed -E 's/\.\.\///g' |\ -xargs xgettext \ ---no-wrap \ ---default-domain=tenacity \ ---directory=.. \ ---keyword=_ --keyword=_C:1,2c --keyword=ngettext:1,2 --keyword=ngettextc:1,2,4c \ ---add-comments=" i18n" \ ---add-location=file \ ---copyright-holder='Tenacity Contributors' \ ---package-name="tenacity" \ ---package-version='3.0.4' \ ---msgid-bugs-address="emabrey@tenacityaudio.org" \ ---add-location=file -L Lisp -j -o tenacity.pot -#Disable PO file modification because it will hurt Weblate merge -- emabrey. -#if test "${TENACITY_ONLY_POT:-}" = 'y'; then -# return 0 -#fi -#echo ";; Updating the .po files - Updating Project-Id-Version" -#for i in *.po; do -# sed -e '/^"Project-Id-Version:/c\ -# "Project-Id-Version: tenacity 3.0.4\\n"' $i > TEMP; mv TEMP $i -#done -#echo ";; Updating the .po files" -#sed 's/.*/echo "msgmerge --lang=& &.po tenacity.pot -o &.po";\ -#msgmerge --no-wrap --lang=& &.po tenacity.pot -o &.po;/g' LINGUAS | bash -#echo ";; Removing '#~|' (which confuse Windows version of msgcat)" -#for i in *.po; do -# sed '/^#~|/d' $i > TEMP; mv TEMP $i -#done -#echo "" -echo ";; POT file generated" -echo "" -head -n 11 tenacity.pot | tail -n 3 -wc -l tenacity.pot diff --git a/locale/LanguageNames.txt b/locale/scripts/LanguageNames.txt similarity index 83% rename from locale/LanguageNames.txt rename to locale/scripts/LanguageNames.txt index f48ae9e823..8abda80c8e 100644 --- a/locale/LanguageNames.txt +++ b/locale/scripts/LanguageNames.txt @@ -5,7 +5,7 @@ bg Български bn বাংলা bs Bosanski ca Català -ca_ES@valencia Valencià +ca@valencia Valencià co Corsu cs Čeština cy Cymraeg @@ -15,7 +15,6 @@ el Ελληνικά en English es Español eu Euskara -eu_ES Euskara (Espainiako) fa فارسی fi Suomi fr Français @@ -40,19 +39,19 @@ nb Norsk nl Nederlands oc Occitan pl Polski -pt Português +pt_PT Português pt_BR Português (Brasil) ro Română ru Русский sk Slovenčina sl Slovenščina -sr_RS Српски -sr_RS@latin Srpski +sr Српски +sr_Latn Srpski sv Svenska ta தமிழ் tg Тоҷикӣ tr Türkçe uk Українська vi Tiếng Việt -zh_CN 中文(简体) -zh_TW 中文(繁體) +zh 中文(简体) +zh_Hant 中文(繁體) diff --git a/locale/scripts/find-PO-no-Id.sh b/locale/scripts/find-PO-no-Id.sh new file mode 100644 index 0000000000..c35a67ba87 --- /dev/null +++ b/locale/scripts/find-PO-no-Id.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Run this script on a directory to handle PO files with no id + +shopt -s nullglob + +input_dirs="$*" + +if [ $# -eq 0 ]; then + input_dirs[0]="${BASH_SOURCE[0]}/../" +fi + +for dir in "${input_dirs[@]}" +do + for po_file in "${dir}"/*.po; do + sed -i '/^Project/d' "$po_file" + done +done diff --git a/locale/find-duplicates.pl b/locale/scripts/find-POT-duplicates.pl old mode 100755 new mode 100644 similarity index 86% rename from locale/find-duplicates.pl rename to locale/scripts/find-POT-duplicates.pl index 01ce79a70e..5f2d7e7b93 --- a/locale/find-duplicates.pl +++ b/locale/scripts/find-POT-duplicates.pl @@ -2,8 +2,7 @@ use strict 'vars'; -open(my $fh, "<", "audacity.pot") - or die "Can't open < audacity.pot: $!"; +open(my $fh, "<", "../tenacity.pot") or die "Can't open < ../tenacity.pot: $!"; my @sourcelines = (); diff --git a/locale/fix_po_files.py b/locale/scripts/fix-PO-files.py similarity index 99% rename from locale/fix_po_files.py rename to locale/scripts/fix-PO-files.py index 2b8d5e0ad6..6ce8525664 100644 --- a/locale/fix_po_files.py +++ b/locale/scripts/fix-PO-files.py @@ -1,7 +1,7 @@ import polib import os -localedir = './' +localedir = '../' count_seen = 0 count_modified = 0 diff --git a/locale/CeePlusPlusifyLanguageNames.pl b/locale/scripts/locale_cpp_name_generator.pl old mode 100755 new mode 100644 similarity index 100% rename from locale/CeePlusPlusifyLanguageNames.pl rename to locale/scripts/locale_cpp_name_generator.pl diff --git a/locale/scripts/locale_diagnostics.sh b/locale/scripts/locale_diagnostics.sh new file mode 100644 index 0000000000..b6b29cc367 --- /dev/null +++ b/locale/scripts/locale_diagnostics.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Report how complete each translation catalog is + +# How many messages in total? +total=$(grep -c '^msgid' "${BASH_SOURCE[0]}/../tenacity.pot") + + +declare -i badlines +for po_file in "${BASH_SOURCE[0]}/../"*.po; do + # If there are errors from msgcmp, then the last line on standard error + # contains a count of problematic messages; else it won't match the + # pattern in awk, so assume no errors + errors=$(msgcmp "$po_file" "${BASH_SOURCE[0]}/../tenacity.pot" 2>&1 | awk '/msgcmp: found [0-9]* fatal error/ { nn = $3 } END {print 0+nn}') + complete=$((total-errors)) + + # detect whether this sequence occurs in any .po file. It will break msgfmt on Windows. + badlines=$(grep -F -c '#~|' "${po_file}") + + echo "$po_file: completed $complete of $total ($((complete*100/total))%); Windows Incompatible Lines: $badlines" +done | sort -n -t , -k3 + +exit 0 diff --git a/locale/msgfmt.py b/locale/scripts/msgfmt.py similarity index 87% rename from locale/msgfmt.py rename to locale/scripts/msgfmt.py index 3f731e941e..63d52d1f46 100644 --- a/locale/msgfmt.py +++ b/locale/scripts/msgfmt.py @@ -5,8 +5,7 @@ This program converts a textual Uniforum-style message catalog (.po file) into a binary GNU catalog (.mo file). This is essentially the same function as the -GNU msgfmt program, however, it is a simpler implementation. Currently it -does not handle plural forms but it does handle message contexts. +GNU msgfmt program, however, it is a simpler implementation. Usage: msgfmt.py [OPTIONS] filename.po @@ -33,11 +32,12 @@ import array from email.parser import HeaderParser -__version__ = "1.2" +__version__ = "1.1" MESSAGES = {} + def usage(code, msg=''): print(__doc__, file=sys.stderr) if msg: @@ -45,16 +45,15 @@ def usage(code, msg=''): sys.exit(code) -def add(ctxt, id, str, fuzzy): + +def add(id, str, fuzzy): "Add a non-fuzzy translation to the dictionary." global MESSAGES if not fuzzy and str: - if ctxt is None: - MESSAGES[id] = str - else: - MESSAGES[b"%b\x04%b" % (ctxt, id)] = str + MESSAGES[id] = str + def generate(): "Return the generated output." global MESSAGES @@ -96,10 +95,10 @@ def generate(): return output + def make(filename, outfile): ID = 1 STR = 2 - CTXT = 3 # Compute .mo name from .po name and arguments if filename.endswith('.po'): @@ -116,7 +115,7 @@ def make(filename, outfile): print(msg, file=sys.stderr) sys.exit(1) - section = msgctxt = None + section = None fuzzy = 0 # Start off assuming Latin-1, so everything decodes without failure, @@ -130,8 +129,8 @@ def make(filename, outfile): lno += 1 # If we get a comment line after a msgstr, this is a new entry if l[0] == '#' and section == STR: - add(msgctxt, msgid, msgstr, fuzzy) - section = msgctxt = None + add(msgid, msgstr, fuzzy) + section = None fuzzy = 0 # Record a fuzzy mark if l[:2] == '#,' and 'fuzzy' in l: @@ -139,16 +138,10 @@ def make(filename, outfile): # Skip comments if l[0] == '#': continue - # Now we are in a msgid or msgctxt section, output previous section - if l.startswith('msgctxt'): - if section == STR: - add(msgctxt, msgid, msgstr, fuzzy) - section = CTXT - l = l[7:] - msgctxt = b'' - elif l.startswith('msgid') and not l.startswith('msgid_plural'): + # Now we are in a msgid section, output previous section + if l.startswith('msgid') and not l.startswith('msgid_plural'): if section == STR: - add(msgctxt, msgid, msgstr, fuzzy) + add(msgid, msgstr, fuzzy) if not msgid: # See whether there is an encoding declaration p = HeaderParser() @@ -190,9 +183,7 @@ def make(filename, outfile): if not l: continue l = ast.literal_eval(l) - if section == CTXT: - msgctxt += l.encode(encoding) - elif section == ID: + if section == ID: msgid += l.encode(encoding) elif section == STR: msgstr += l.encode(encoding) @@ -203,7 +194,7 @@ def make(filename, outfile): sys.exit(1) # Add last entry if section == STR: - add(msgctxt, msgid, msgstr, fuzzy) + add(msgid, msgstr, fuzzy) # Compute output output = generate() @@ -215,6 +206,7 @@ def make(filename, outfile): print(msg, file=sys.stderr) + def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'hVo:', diff --git a/locale/scripts/regen_POT_file.sh b/locale/scripts/regen_POT_file.sh new file mode 100644 index 0000000000..05db1509e7 --- /dev/null +++ b/locale/scripts/regen_POT_file.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Run this script with /locale/script/ as the current directory +set -o errexit + +echo ";; Recreating tenacity.pot using .h, .cpp and .mm files" +for path in "${BASH_SOURCE[0]}/../modules/mod-*" "${BASH_SOURCE[0]}/../libraries/lib-*" "${BASH_SOURCE[0]}/../include" "${BASH_SOURCE[0]}/../src" ; do + find "$path" -name \*.h -o -name \*.cpp -o -name \*.mm +done | LANG=c sort | \ +sed -E 's/\.\.\///g' |\ +xargs xgettext \ +--no-wrap \ +--default-domain=tenacity \ +--directory="${BASH_SOURCE[0]}/../.." \ +--keyword=_ --keyword=XO --keyword=XC:1,2c --keyword=XXO --keyword=XXC:1,2c --keyword=XP:1,2 --keyword=XPC:1,2,4c \ +--add-comments=" i18n" \ +--add-location=file \ +--copyright-holder='Tenacity Contributors' \ +--package-name="tenacity" \ +--package-version='3.0.4' \ +--msgid-bugs-address="emabrey@tenacityaudio.org" \ +--add-location=file -L C -o "${BASH_SOURCE[0]}/../tenacity.pot" + +echo ";; Adding nyquist files to tenacity.pot" +for path in "${BASH_SOURCE[0]}/../../plug-ins/"* ; do find "$path" -name \*.ny -not -name rms.ny; done | LANG=c sort | \ +sed -E 's/\.\.\///g' |\ +xargs xgettext \ +--no-wrap \ +--default-domain=tenacity \ +--directory="${BASH_SOURCE[0]}/../.." \ +--keyword=_ --keyword=_C:1,2c --keyword=ngettext:1,2 --keyword=ngettextc:1,2,4c \ +--add-comments=" i18n" \ +--add-location=file \ +--copyright-holder='Tenacity Contributors' \ +--package-name="tenacity" \ +--package-version='3.0.4' \ +--msgid-bugs-address="emabrey@tenacityaudio.org" \ +--add-location=file -L Lisp -j -o "${BASH_SOURCE[0]}/../tenacity.pot" + +echo "" +echo ";; POT file generated" +echo "" + +head -n 11 "${BASH_SOURCE[0]}/../tenacity.pot" | tail -n 3 +wc -l "${BASH_SOURCE[0]}/../tenacity.pot" diff --git a/locale/update_po_files.sh b/locale/update_po_files.sh deleted file mode 100755 index c703a89934..0000000000 --- a/locale/update_po_files.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -# Run this script with locale as the current directory -set -o errexit -echo ";; Recreating tenacity.pot using .h, .cpp and .mm files" -for path in ../modules/mod-* ../libraries/lib-* ../include ../src ; do - find $path -name \*.h -o -name \*.cpp -o -name \*.mm -done | LANG=c sort | \ -sed -E 's/\.\.\///g' |\ -xargs xgettext \ ---no-wrap \ ---default-domain=tenacity \ ---directory=.. \ ---keyword=_ --keyword=XO --keyword=XC:1,2c --keyword=XXO --keyword=XXC:1,2c --keyword=XP:1,2 --keyword=XPC:1,2,4c \ ---add-comments=" i18n" \ ---add-location=file \ ---copyright-holder='Tenacity Contributors' \ ---package-name="tenacity" \ ---package-version='3.0.4' \ ---msgid-bugs-address="emabrey@tenacityaudio.org" \ ---add-location=file -L C -o tenacity.pot -echo ";; Adding nyquist files to tenacity.pot" -for path in ../plug-ins ; do find $path -name \*.ny -not -name rms.ny; done | LANG=c sort | \ -sed -E 's/\.\.\///g' |\ -xargs xgettext \ ---no-wrap \ ---default-domain=tenacity \ ---directory=.. \ ---keyword=_ --keyword=_C:1,2c --keyword=ngettext:1,2 --keyword=ngettextc:1,2,4c \ ---add-comments=" i18n" \ ---add-location=file \ ---copyright-holder='Tenacity Contributors' \ ---package-name="tenacity" \ ---package-version='3.0.4' \ ---msgid-bugs-address="emabrey@tenacityaudio.org" \ ---add-location=file -L Lisp -j -o tenacity.pot -if test "${TENACITY_ONLY_POT:-}" = 'y'; then - return 0 -fi -echo ";; Updating the .po files - Updating Project-Id-Version" -for i in *.po; do - sed -e '/^"Project-Id-Version:/c\ - "Project-Id-Version: tenacity 3.0.4\\n"' $i > TEMP; mv TEMP $i -done -echo ";; Updating the .po files" -sed 's/.*/echo "msgmerge --lang=& &.po tenacity.pot -o &.po";\ -msgmerge --no-wrap --lang=& &.po tenacity.pot -o &.po;/g' LINGUAS | bash -echo ";; Removing '#~|' (which confuse Windows version of msgcat)" -for i in *.po; do - sed '/^#~|/d' $i > TEMP; mv TEMP $i -done -echo "" -echo ";;Translation updated" -echo "" -head -n 11 tenacity.pot | tail -n 3 -wc -l tenacity.pot From 8b0bf908aff581f4a5e2c8d69545e4bd910baa04 Mon Sep 17 00:00:00 2001 From: Emily Mabrey Date: Sat, 31 Jul 2021 13:03:41 -0400 Subject: [PATCH 2/4] Improve `locale_diagnostics.sh` Signed-off-by: Emily Mabrey --- locale/scripts/locale_diagnostics.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/scripts/locale_diagnostics.sh b/locale/scripts/locale_diagnostics.sh index b6b29cc367..616789ce5c 100644 --- a/locale/scripts/locale_diagnostics.sh +++ b/locale/scripts/locale_diagnostics.sh @@ -3,15 +3,15 @@ # Report how complete each translation catalog is # How many messages in total? -total=$(grep -c '^msgid' "${BASH_SOURCE[0]}/../tenacity.pot") +total=$(grep -c '^msgid' "../tenacity.pot") declare -i badlines -for po_file in "${BASH_SOURCE[0]}/../"*.po; do +for po_file in ../*.po; do # If there are errors from msgcmp, then the last line on standard error # contains a count of problematic messages; else it won't match the # pattern in awk, so assume no errors - errors=$(msgcmp "$po_file" "${BASH_SOURCE[0]}/../tenacity.pot" 2>&1 | awk '/msgcmp: found [0-9]* fatal error/ { nn = $3 } END {print 0+nn}') + errors=$(msgcmp "$po_file" "../tenacity.pot" 2>&1 | awk '/msgcmp: found [0-9]* fatal error/ { nn = $3 } END {print 0+nn}') complete=$((total-errors)) # detect whether this sequence occurs in any .po file. It will break msgfmt on Windows. From d118b79a04da4e49c72601ab8d04810b8890e2f6 Mon Sep 17 00:00:00 2001 From: Emily Mabrey Date: Sat, 31 Jul 2021 13:11:01 -0400 Subject: [PATCH 3/4] Return `msgfmt.py` to version 1.2 Signed-off-by: Emily Mabrey --- locale/scripts/msgfmt.py | 42 ++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/locale/scripts/msgfmt.py b/locale/scripts/msgfmt.py index 63d52d1f46..3f731e941e 100644 --- a/locale/scripts/msgfmt.py +++ b/locale/scripts/msgfmt.py @@ -5,7 +5,8 @@ This program converts a textual Uniforum-style message catalog (.po file) into a binary GNU catalog (.mo file). This is essentially the same function as the -GNU msgfmt program, however, it is a simpler implementation. +GNU msgfmt program, however, it is a simpler implementation. Currently it +does not handle plural forms but it does handle message contexts. Usage: msgfmt.py [OPTIONS] filename.po @@ -32,12 +33,11 @@ import array from email.parser import HeaderParser -__version__ = "1.1" +__version__ = "1.2" MESSAGES = {} - def usage(code, msg=''): print(__doc__, file=sys.stderr) if msg: @@ -45,15 +45,16 @@ def usage(code, msg=''): sys.exit(code) - -def add(id, str, fuzzy): +def add(ctxt, id, str, fuzzy): "Add a non-fuzzy translation to the dictionary." global MESSAGES if not fuzzy and str: - MESSAGES[id] = str + if ctxt is None: + MESSAGES[id] = str + else: + MESSAGES[b"%b\x04%b" % (ctxt, id)] = str - def generate(): "Return the generated output." global MESSAGES @@ -95,10 +96,10 @@ def generate(): return output - def make(filename, outfile): ID = 1 STR = 2 + CTXT = 3 # Compute .mo name from .po name and arguments if filename.endswith('.po'): @@ -115,7 +116,7 @@ def make(filename, outfile): print(msg, file=sys.stderr) sys.exit(1) - section = None + section = msgctxt = None fuzzy = 0 # Start off assuming Latin-1, so everything decodes without failure, @@ -129,8 +130,8 @@ def make(filename, outfile): lno += 1 # If we get a comment line after a msgstr, this is a new entry if l[0] == '#' and section == STR: - add(msgid, msgstr, fuzzy) - section = None + add(msgctxt, msgid, msgstr, fuzzy) + section = msgctxt = None fuzzy = 0 # Record a fuzzy mark if l[:2] == '#,' and 'fuzzy' in l: @@ -138,10 +139,16 @@ def make(filename, outfile): # Skip comments if l[0] == '#': continue - # Now we are in a msgid section, output previous section - if l.startswith('msgid') and not l.startswith('msgid_plural'): + # Now we are in a msgid or msgctxt section, output previous section + if l.startswith('msgctxt'): + if section == STR: + add(msgctxt, msgid, msgstr, fuzzy) + section = CTXT + l = l[7:] + msgctxt = b'' + elif l.startswith('msgid') and not l.startswith('msgid_plural'): if section == STR: - add(msgid, msgstr, fuzzy) + add(msgctxt, msgid, msgstr, fuzzy) if not msgid: # See whether there is an encoding declaration p = HeaderParser() @@ -183,7 +190,9 @@ def make(filename, outfile): if not l: continue l = ast.literal_eval(l) - if section == ID: + if section == CTXT: + msgctxt += l.encode(encoding) + elif section == ID: msgid += l.encode(encoding) elif section == STR: msgstr += l.encode(encoding) @@ -194,7 +203,7 @@ def make(filename, outfile): sys.exit(1) # Add last entry if section == STR: - add(msgid, msgstr, fuzzy) + add(msgctxt, msgid, msgstr, fuzzy) # Compute output output = generate() @@ -206,7 +215,6 @@ def make(filename, outfile): print(msg, file=sys.stderr) - def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'hVo:', From f395687c9fb7f3f2aa5cdaf3557cf780f58e2792 Mon Sep 17 00:00:00 2001 From: Sol Fisher Romanoff Date: Thu, 2 Dec 2021 09:32:47 +0200 Subject: [PATCH 4/4] Change bash scripts to be POSIX-compatible some Unix-like operating systems, namely Alpine, don't come with bash preinstalled. scripts in the lib-src/ directory were left untouched. Signed-off-by: Sol Fisher Romanoff --- images/scripts/degimpify.sh | 2 +- linux/AppRun.sh | 7 +- linux/build-environment/dependencies.sh | 20 +++-- linux/build-environment/entrypoint.sh | 2 +- linux/check_dependencies.sh | 2 +- locale/diagnostics.sh | 10 ++- locale/no_id.sh | 4 +- locale/scripts/find-PO-no-Id.sh | 11 +-- locale/scripts/locale_diagnostics.sh | 2 +- locale/scripts/regen_POT_file.sh | 20 +++-- mac/scripts/build_dist.sh | 17 ++-- mac/scripts/build_wxwidgets | 60 +++++++------- mac/scripts/install_wxlibs.sh | 24 +++--- scripts/ci/linux/split_debug_symbols.sh | 2 +- scripts/ci/macos/repeat_hdiutil.sh | 4 +- scripts/maketarball.sh | 106 ++++++++++++------------ 16 files changed, 149 insertions(+), 144 deletions(-) diff --git a/images/scripts/degimpify.sh b/images/scripts/degimpify.sh index 1ecd7a8a73..964dbccf57 100644 --- a/images/scripts/degimpify.sh +++ b/images/scripts/degimpify.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Run this script on a directory to "degimpify" all XPM files # within that directory (meaning any file ending with .XPM) diff --git a/linux/AppRun.sh b/linux/AppRun.sh index 9eb02b7bf8..53452b1409 100755 --- a/linux/AppRun.sh +++ b/linux/AppRun.sh @@ -1,8 +1,8 @@ -#!/usr/bin/env bash +#!/bin/sh # The AppImage runtime sets some special environment variables. We provide # default values here in case the user tries to run this script outside an # AppImage where the variables would otherwise be undefined. -if [[ ! "${APPIMAGE}" || ! "${APPDIR}" ]]; then +if [ ! "${APPIMAGE}" ] || [ ! "${APPDIR}" ]; then export APPIMAGE="$(readlink -f "${0}")" export APPDIR="$(dirname "${APPIMAGE}")" fi @@ -12,8 +12,7 @@ export LD_LIBRARY_PATH="${APPDIR}/lib:${LD_LIBRARY_PATH}" export AUDACITY_PATH="${AUDACITY_PATH}:${APPDIR}/share/tenacity" export AUDACITY_MODULES_PATH="${AUDACITY_MODULES_PATH}:${APPDIR}/lib/modules" -function help() -{ +help() { # Normal tenacity help "${APPDIR}/bin/tenacity" --help # Special options handled by this script diff --git a/linux/build-environment/dependencies.sh b/linux/build-environment/dependencies.sh index a377ddf2bf..aae87f34ee 100644 --- a/linux/build-environment/dependencies.sh +++ b/linux/build-environment/dependencies.sh @@ -1,7 +1,9 @@ +#!/bin/sh + export TZ=Europe/London ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -apt_packages_basic=( +apt_packages_basic=" build-essential python3-minimal python3-pip @@ -9,16 +11,16 @@ apt_packages_basic=( libstdc++-9-dev cmake git -) +" -apt_packages_minimal_deps=( +apt_packages_minimal_deps=" libgtk2.0-dev libasound2-dev libavformat-dev libjack-jackd2-dev -) +" -apt_packages_full_deps=( +apt_packages_full_deps=" zlib1g-dev libexpat1-dev libmp3lame-dev @@ -51,12 +53,12 @@ apt_packages_full_deps=( libcurl4-openssl-dev libpng-dev libjpeg-turbo8-dev -) +" apt-get install -y --no-install-recommends \ - "${apt_packages_basic[@]}" \ - "${apt_packages_minimal_deps[@]}" \ - "${apt_packages_full_deps[@]}" + "$apt_packages_basic" \ + "$apt_packages_minimal_deps" \ + "$apt_packages_full_deps" pip3 install conan diff --git a/linux/build-environment/entrypoint.sh b/linux/build-environment/entrypoint.sh index 2aff493d4e..469ea235d9 100644 --- a/linux/build-environment/entrypoint.sh +++ b/linux/build-environment/entrypoint.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh conan --version diff --git a/linux/check_dependencies.sh b/linux/check_dependencies.sh index e93fa76ec9..eeb250887d 100755 --- a/linux/check_dependencies.sh +++ b/linux/check_dependencies.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh version="@CPACK_PACKAGE_NAME@ v@CPACK_PACKAGE_VERSION@ @CPACK_AUDACITY_ARCH_LABEL@" diff --git a/locale/diagnostics.sh b/locale/diagnostics.sh index 0c76f74e49..3101b46fa8 100755 --- a/locale/diagnostics.sh +++ b/locale/diagnostics.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Report how complete each translation catalog is @@ -8,9 +8,11 @@ total=`grep '^msgid' audacity.pot | wc -l` #CSV header echo "Name,Completed,Pct. completed,Bad lines" -declare -i badlines +badlines=0 + +for filename in *.po; do + [ -e "$filename" ] || break -for filename in `ls *.po`; do # If there are errors from msgcmp, then the last line on standard error # contains a count of problematic messages; else it won't match the # pattern in awk, so assume no errors @@ -20,7 +22,7 @@ for filename in `ls *.po`; do # detect whether this sequence occurs in any .po file. It will break # msgfmt on Windows. - badlines=`fgrep '#~|' ${filename} | wc -l` + badlines=`grep -Fc '#~|' "${filename}"` # produce comma-separated values echo "$filename,$complete,$((complete*100/total)),$badlines" diff --git a/locale/no_id.sh b/locale/no_id.sh index d8a2d14e1e..8e49783f75 100755 --- a/locale/no_id.sh +++ b/locale/no_id.sh @@ -1,3 +1,5 @@ +#!/bin/sh + for i in *.po; do sed -i '/^Project/d' $i -done \ No newline at end of file +done diff --git a/locale/scripts/find-PO-no-Id.sh b/locale/scripts/find-PO-no-Id.sh index c35a67ba87..842ea9b3b3 100644 --- a/locale/scripts/find-PO-no-Id.sh +++ b/locale/scripts/find-PO-no-Id.sh @@ -1,16 +1,13 @@ -#!/bin/bash +#!/bin/sh # Run this script on a directory to handle PO files with no id - -shopt -s nullglob - -input_dirs="$*" +DIRNAME=$(dirname "$0") if [ $# -eq 0 ]; then - input_dirs[0]="${BASH_SOURCE[0]}/../" + set -- "$DIRNAME/../" fi -for dir in "${input_dirs[@]}" +for dir in "$@" do for po_file in "${dir}"/*.po; do sed -i '/^Project/d' "$po_file" diff --git a/locale/scripts/locale_diagnostics.sh b/locale/scripts/locale_diagnostics.sh index 616789ce5c..a5f3155890 100644 --- a/locale/scripts/locale_diagnostics.sh +++ b/locale/scripts/locale_diagnostics.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Report how complete each translation catalog is diff --git a/locale/scripts/regen_POT_file.sh b/locale/scripts/regen_POT_file.sh index 05db1509e7..91ef76b49d 100644 --- a/locale/scripts/regen_POT_file.sh +++ b/locale/scripts/regen_POT_file.sh @@ -1,16 +1,18 @@ -#!/bin/bash +#!/bin/sh # Run this script with /locale/script/ as the current directory set -o errexit +DIRNAME=$(dirname "$0") + echo ";; Recreating tenacity.pot using .h, .cpp and .mm files" -for path in "${BASH_SOURCE[0]}/../modules/mod-*" "${BASH_SOURCE[0]}/../libraries/lib-*" "${BASH_SOURCE[0]}/../include" "${BASH_SOURCE[0]}/../src" ; do +for path in "$DIRNAME/../modules/mod-*" "$DIRNAME/../libraries/lib-*" "$DIRNAME/../include" "$DIRNAME/../src" ; do find "$path" -name \*.h -o -name \*.cpp -o -name \*.mm done | LANG=c sort | \ sed -E 's/\.\.\///g' |\ xargs xgettext \ --no-wrap \ --default-domain=tenacity \ ---directory="${BASH_SOURCE[0]}/../.." \ +--directory="$DIRNAME/../.." \ --keyword=_ --keyword=XO --keyword=XC:1,2c --keyword=XXO --keyword=XXC:1,2c --keyword=XP:1,2 --keyword=XPC:1,2,4c \ --add-comments=" i18n" \ --add-location=file \ @@ -18,15 +20,15 @@ xargs xgettext \ --package-name="tenacity" \ --package-version='3.0.4' \ --msgid-bugs-address="emabrey@tenacityaudio.org" \ ---add-location=file -L C -o "${BASH_SOURCE[0]}/../tenacity.pot" +--add-location=file -L C -o "$DIRNAME/../tenacity.pot" echo ";; Adding nyquist files to tenacity.pot" -for path in "${BASH_SOURCE[0]}/../../plug-ins/"* ; do find "$path" -name \*.ny -not -name rms.ny; done | LANG=c sort | \ +for path in "$DIRNAME/../../plug-ins/"* ; do find "$path" -name \*.ny -not -name rms.ny; done | LANG=c sort | \ sed -E 's/\.\.\///g' |\ xargs xgettext \ --no-wrap \ --default-domain=tenacity \ ---directory="${BASH_SOURCE[0]}/../.." \ +--directory="$DIRNAME/../.." \ --keyword=_ --keyword=_C:1,2c --keyword=ngettext:1,2 --keyword=ngettextc:1,2,4c \ --add-comments=" i18n" \ --add-location=file \ @@ -34,11 +36,11 @@ xargs xgettext \ --package-name="tenacity" \ --package-version='3.0.4' \ --msgid-bugs-address="emabrey@tenacityaudio.org" \ ---add-location=file -L Lisp -j -o "${BASH_SOURCE[0]}/../tenacity.pot" +--add-location=file -L Lisp -j -o "$DIRNAME/../tenacity.pot" echo "" echo ";; POT file generated" echo "" -head -n 11 "${BASH_SOURCE[0]}/../tenacity.pot" | tail -n 3 -wc -l "${BASH_SOURCE[0]}/../tenacity.pot" +head -n 11 "$DIRNAME/../tenacity.pot" | tail -n 3 +wc -l "$DIRNAME/../tenacity.pot" diff --git a/mac/scripts/build_dist.sh b/mac/scripts/build_dist.sh index 81ada77299..4178466d57 100755 --- a/mac/scripts/build_dist.sh +++ b/mac/scripts/build_dist.sh @@ -1,19 +1,19 @@ -#!/bin/bash +#!/bin/sh # Function to retrieve a value from a plist -function plist +plist() { /usr/libexec/PlistBuddy -c "Print ${2}" "${1}" } -function realpath +realpath() { python -c "import os; import sys; print(os.path.realpath(sys.argv[1]))" "${1}" } # Function to notarize a file (APP or DMG) -function notarize +notarize() { # Bail if not signing if [ -z "${SIGNING}" ] @@ -80,7 +80,7 @@ function notarize rm "${OUTPUT}" } -if [ -z "${SRCROOT}" -o -z "${DSTROOT}" ] +if [ -z "${SRCROOT}" ] || [ -z "${DSTROOT}" ] then if [ "${#}" -ne 2 ] then @@ -129,8 +129,9 @@ IDENT=$(plist "${DSTROOT}/Tenacity.app/Contents/Info.plist" "CFBundleIdentifier" SIGNING= if [ -r ~/.tenacity_signing ] then - source ~/.tenacity_signing - if [ -n "${CODESIGN_APP_IDENTITY}" -a -n "${NOTARIZE_USERNAME}" -a -n "${NOTARIZE_PASSWORD}" ] + . ~/.tenacity_signing + if [ -n "${CODESIGN_APP_IDENTITY}" ] && [ -n "${NOTARIZE_USERNAME}" ] && + [ -n "${NOTARIZE_PASSWORD}" ] then SIGNING="y" fi @@ -144,7 +145,7 @@ cd "${DSTROOT}/.." # Make sure we have consistent ownership and permissions chmod -RH 755 "${DSTROOT}" -chown -RH $(id -u):$(id -g) "${DSTROOT}" +chown -RH "$(id -u):$(id -g)" "${DSTROOT}" # Preclean rm -rf "$DMG" "$DMG.dmg" TMP.dmg diff --git a/mac/scripts/build_wxwidgets b/mac/scripts/build_wxwidgets index 270b17c69f..6b768d2633 100755 --- a/mac/scripts/build_wxwidgets +++ b/mac/scripts/build_wxwidgets @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # You can use this to build wxWidgets. Just run it from within the root of the # wxWidgets source tree like so: @@ -13,7 +13,7 @@ minver=10.7 sdkdir="" # Build a specific configuration -function bld +bld() { flavour="${1}" shift @@ -21,34 +21,35 @@ function bld # Create and change to our build directory rm -rf "bld_${flavour}_${arch}" mkdir -p "bld_${flavour}_${arch}" - pushd "bld_${flavour}_${arch}" + ( + cd "bld_${flavour}_${arch}" - # Force Audacity specific options - export CXX="g++ -std=c++1z -stdlib=libc++" - export LD="g++ -std=c++1z -stdlib=libc++" + # Force Audacity specific options + export CXX="g++ -std=c++1z -stdlib=libc++" + export LD="g++ -std=c++1z -stdlib=libc++" - # NOTES: liblzma isn't available on MacOS 10.8 or older and Audacity doesn't - # need it. So, build wxWidgets without the support to allow Audacity - # to run on MacOS 10.7 or newer. - ../configure --prefix="/usr/local/${arch}" \ - --enable-macosx-arch="${arch}" \ - --enable-shared=yes \ - --enable-unicode=yes \ - --enable-universal_binary=no \ - --enable-webkit=no \ - --with-expat=builtin \ - --with-flavour="${flavour}" \ - --with-libjpeg=builtin \ - --with-libpng=builtin \ - --with-libtiff=builtin \ - --with-macosx-sdk="${sdkdir}" \ - --with-macosx-version-min="${minver}" \ - --with-regex=builtin \ - --with-zlib=builtin \ - --without-liblzma \ - ${@} - make -j $(sysctl -n hw.ncpu) install - popd + # NOTES: liblzma isn't available on MacOS 10.8 or older and Audacity doesn't + # need it. So, build wxWidgets without the support to allow Audacity + # to run on MacOS 10.7 or newer. + ../configure --prefix="/usr/local/${arch}" \ + --enable-macosx-arch="${arch}" \ + --enable-shared=yes \ + --enable-unicode=yes \ + --enable-universal_binary=no \ + --enable-webkit=no \ + --with-expat=builtin \ + --with-flavour="${flavour}" \ + --with-libjpeg=builtin \ + --with-libpng=builtin \ + --with-libtiff=builtin \ + --with-macosx-sdk="${sdkdir}" \ + --with-macosx-version-min="${minver}" \ + --with-regex=builtin \ + --with-zlib=builtin \ + --without-liblzma \ + "${@}" + make -j "$(sysctl -n hw.ncpu)" install + ) } # Only build 32-bit version if running on 10.14 or older and @@ -56,8 +57,7 @@ function bld arches="x86_64" osver="$(sw_vers -productVersion)" sdkver="$(xcrun --show-sdk-version)" -if [ "${osver}" \< "10.15" -a "${sdkver}" \< "10.14" ] -then +if expr "${osver}" \< "10.15" && expr "${sdkver}" \< "10.14"; then arches="${arches} i386" fi diff --git a/mac/scripts/install_wxlibs.sh b/mac/scripts/install_wxlibs.sh index 3cca40c387..0152505973 100755 --- a/mac/scripts/install_wxlibs.sh +++ b/mac/scripts/install_wxlibs.sh @@ -14,26 +14,26 @@ resolve() update_paths() { - local indent="${1}" - local path=$(resolve "${2}") - local base="${path##*/}" + _indent="${1}" + _path=$(resolve "${2}") + _base="${_path##*/}" - if [ -e "${LIBPATH}/${base}" ] + if [ -e "${LIBPATH}/${_base}" ] then return fi - - printf "%${indent}.${indent}cCopying '${path}' into bundle\n" " " - cp -p "${path}" "${LIBPATH}" - for lib in $(otool -L "${path}" | awk '/libwx.*dylib /{print $1}') + printf "%${_indent}.${_indent}cCopying '${_path}' into bundle\n" " " + cp -p "${_path}" "${LIBPATH}" + + for lib in $(otool -L "${_path}" | awk '/libwx.*dylib /{print $1}') do - path=$(resolve "${lib}") + _path=$(resolve "${lib}") - printf "%${indent}.${indent}cChanging '${lib}' to '@loader_path/../Frameworks/${path##*/}'\n" " " - install_name_tool -change "${lib}" "@loader_path/../Frameworks/${path##*/}" "${LIBPATH}/${base}" + printf "%${_indent}.${_indent}cChanging '${lib}' to '@loader_path/../Frameworks/${path##*/}'\n" " " + install_name_tool -change "${lib}" "@loader_path/../Frameworks/${path##*/}" "${LIBPATH}/${_base}" - update_paths $((indent + 2)) "${path}" + update_paths $((_indent + 2)) "${_path}" done } diff --git a/scripts/ci/linux/split_debug_symbols.sh b/scripts/ci/linux/split_debug_symbols.sh index d200e4ebea..641cebcee7 100644 --- a/scripts/ci/linux/split_debug_symbols.sh +++ b/scripts/ci/linux/split_debug_symbols.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh set -x objcopy --only-keep-debug --compress-debug-section=zlib "${1}" "${1}.debug" diff --git a/scripts/ci/macos/repeat_hdiutil.sh b/scripts/ci/macos/repeat_hdiutil.sh index bf4e5e7673..d73e598429 100755 --- a/scripts/ci/macos/repeat_hdiutil.sh +++ b/scripts/ci/macos/repeat_hdiutil.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh ((${BASH_VERSION%%.*} >= 4)) || { echo >&2 "$0: Error: Please upgrade Bash."; exit 1; } @@ -8,7 +8,7 @@ max_retry=12 counter=0 num_secs_await_retry=20 -echo "Trying: /usr/bin/hdiutil $@" +echo "Trying: /usr/bin/hdiutil $*" until /usr/bin/hdiutil "$@"; do sleep $num_secs_await_retry diff --git a/scripts/maketarball.sh b/scripts/maketarball.sh index a00cb88515..927e2a7176 100755 --- a/scripts/maketarball.sh +++ b/scripts/maketarball.sh @@ -1,15 +1,15 @@ -#!/bin/bash +#!/bin/sh # Copyright 2003, 2004, 2005 Dominic Mazzoni and Matt Brubeck # Distributed under the GNU General Public License 2.0. # See the file LICENSE.txt for details. # Re-written in Bash by Richard Ash 2006 - 2013 -function myrmrvf { +myrmrvf() { # a replacement for rm -rvf that has it's output controlled # by the value of the first argument # setting it to 1 makes it verbose, to anything else makes it quiet - if [ $1 -eq 1 ] ; then #verbose mode + if [ "$1" -eq 1 ] ; then #verbose mode shift echo "rm -rf $*" rm -rf $* @@ -20,11 +20,11 @@ function myrmrvf { fi } -function myrmvf { +myrmvf() { # a replacement for rm -vf that has it's output controlled # by the value of the first argument # setting it to 1 makes it verbose, to anything else makes it quiet - if [ $1 -eq 1 ] ; then #verbose mode + if [ "$1" -eq 1 ] ; then #verbose mode shift echo "rm -f $*" rm -f $* @@ -35,23 +35,23 @@ function myrmvf { fi } -function myfindrm { +myfindrm() { # search the file tree removing files that match the specified pattern in # the second argument, with output controlled by the value of the first # argument. # setting it to 1 makes it verbose, to anything else makes it quiet - if [ $1 -eq 1 ] ; then + if [ "$1" -eq 1 ] ; then find . -name "$2" -print -delete else find . -name "$2" -delete fi } -function cleanfulltree { +cleanfulltree() { # does the clean-up op on the full source tree prior to building the full # tarball printf "making distclean ... " - if [ $1 -eq 1 ] ; then + if [ "$1" -eq 1 ] ; then make distclean else make distclean 2>/dev/null > /dev/null @@ -65,98 +65,98 @@ function cleanfulltree { fi printf "removing GIT directories ... " - myrmrvf $1 .git .gitignore - myrmrvf $1 .gitignore - myrmrvf $1 .gitattributes + myrmrvf "$1" .git .gitignore + myrmrvf "$1" .gitignore + myrmrvf "$1" .gitattributes printf "Done\n" printf "removing vim / emacs temp files ... " - myfindrm $1 "*~" + myfindrm "$1" "*~" printf "Done\n" printf "removing Python droppings ... " - myfindrm $1 "*.pyc" + myfindrm "$1" "*.pyc" printf "Done\n" printf "removing executable and other intermediate files ... " - myrmvf $1 src/tenacity src/.depend src/.gchdepend - myfindrm $1 config.status - myfindrm $1 config.log - myfindrm $1 config.cache + myrmvf "$1" src/tenacity src/.depend src/.gchdepend + myfindrm "$1" config.status + myfindrm "$1" config.log + myfindrm "$1" config.cache find . -depth -name 'autom4te.cache' -execdir rm -rf '{}' ';' find . -depth -name '.deps' -execdir rm -rf '{}' ';' - myfindrm $1 aclocal.m4 + myfindrm "$1" aclocal.m4 printf "Done\n" printf "removing orphaned symlinks in lib-src/ ... " - myrmvf $1 lib-src/*.a + myrmvf "$1" lib-src/*.a printf "Done\n" printf "removing doxygen output files ... " - myrmrvf $1 dox + myrmrvf "$1" dox printf "Done\n" printf "removing unused libraries from GIT tree ..." - myrmrvf $1 lib-src/libscorealign + myrmrvf "$1" lib-src/libscorealign printf "Done\n" } # remove all the things we have in GIT for convenience rather than being # necessary -function slimtree { +slimtree() { printf "removing todo lists ... " - myrmvf $1 todo.txt + myrmvf "$1" todo.txt printf "Done\n" # we cannot remove tests/ because subsequent builds fail ... printf "removing scripts and tests ... " - myrmrvf $1 scripts tests/ProjectCheckTests/ + myrmrvf "$1" scripts tests/ProjectCheckTests/ printf "Done\n" printf "removing libraries that should be installed locally ... " - myrmrvf $1 lib-src/expat lib-src/libid3tag - myrmrvf $1 lib-src/libmad lib-src/libogg - myrmrvf $1 lib-src/libvorbis lib-src/soundtouch + myrmrvf "$1" lib-src/expat lib-src/libid3tag + myrmrvf "$1" lib-src/libmad lib-src/libogg + myrmrvf "$1" lib-src/libvorbis lib-src/soundtouch # these bindings aren't built by default, we don't need them - myrmrvf $1 lib-src/portaudio-v19/bindings/ + myrmrvf "$1" lib-src/portaudio-v19/bindings/ printf "Done\n" printf "removing qa ... " - myrmrvf $1 qa + myrmrvf "$1" qa printf "Done\n" printf "removing unused portaudio-v19 directories ... " - myrmrvf $1 lib-src/portaudio-v19/docs - myrmrvf $1 lib-src/portaudio-v19/pa_asio - myrmrvf $1 lib-src/portaudio-v19/pa_sgi - myrmrvf $1 lib-src/portaudio-v19/pa_mac_sm - myrmrvf $1 lib-src/portaudio-v19/testcvs + myrmrvf "$1" lib-src/portaudio-v19/docs + myrmrvf "$1" lib-src/portaudio-v19/pa_asio + myrmrvf "$1" lib-src/portaudio-v19/pa_sgi + myrmrvf "$1" lib-src/portaudio-v19/pa_mac_sm + myrmrvf "$1" lib-src/portaudio-v19/testcvs printf "Done\n" printf "removing unused portmidi directories ... " - myrmrvf $1 lib-src/portmidi/pm_cl - myrmrvf $1 lib-src/portmidi/pm_csharp - myrmrvf $1 lib-src/portmidi/pm_dylib - myrmrvf $1 lib-src/portmidi/pm_java - myrmrvf $1 lib-src/portmidi/pm_mingw - myrmrvf $1 lib-src/portmidi/pm_python - myrmrvf $1 lib-src/portmidi/pm_qt - myrmrvf $1 lib-src/portmidi/pm_test - myrmrvf $1 lib-src/portmidi/portmidi_cdt.zip + myrmrvf "$1" lib-src/portmidi/pm_cl + myrmrvf "$1" lib-src/portmidi/pm_csharp + myrmrvf "$1" lib-src/portmidi/pm_dylib + myrmrvf "$1" lib-src/portmidi/pm_java + myrmrvf "$1" lib-src/portmidi/pm_mingw + myrmrvf "$1" lib-src/portmidi/pm_python + myrmrvf "$1" lib-src/portmidi/pm_qt + myrmrvf "$1" lib-src/portmidi/pm_test + myrmrvf "$1" lib-src/portmidi/portmidi_cdt.zip printf "Done\n" printf "removing Nyquist plug-ins that are just for show ... " - myrmvf $1 plug-ins/analyze.ny plug-ins/fadein.ny plug-ins/fadeout.ny - myrmvf $1 plug-ins/undcbias.ny + myrmvf "$1" plug-ins/analyze.ny plug-ins/fadein.ny plug-ins/fadeout.ny + myrmvf "$1" plug-ins/undcbias.ny printf "Done\n" printf "Removing developer scripts not needed to build tenacity ... " - myrmrvf $1 scripts/mw2html_audacity + myrmrvf "$1" scripts/mw2html_audacity printf "Done\n" printf "Removing Mac and Windows build files ... " - myrmrvf $1 mac - myrmrvf $1 win + myrmrvf "$1" mac + myrmrvf "$1" win printf "Done\n" } @@ -209,7 +209,7 @@ if [ -f "lib-src/Makefile" ] ; then # we have a Makefile - is it new enough? t2=$(date +%s -r "lib-src/Makefile") t1=$(date +%s -r "lib-src/Makefile.in") - if [ $t1 -gt $t2 ] ; then + if [ "$t1" -gt "$t2" ] ; then # not new enough, reconfigure reconf=1 fi @@ -251,7 +251,7 @@ if [ ! -x "config.status" ] ; then exit 1 fi -echo -n "Getting program version ... " +printf "Getting program version ... " # first off, find out what C++ pre-processor configure has found for us to use # (because we want the same one that will be used to build Audacity). This is a # neat trick using the config.status script left behind after configure has @@ -260,7 +260,7 @@ cppprog="$(echo '@CXX@' | ./config.status --file=-)" # run the preprocessor, convert output to shell variables, and evaluate to # define them -eval $(cpp -E <