ENH: Improve macOS build script (#4310)

* ENH: Improve macOS build script

 - Update shebang to bash, as it is already expected to be present in
   run_gettext.sh
 - Added fail-fast shell options.
 - Changed default CMake generator to Ninja
 - Adopted configuration for non-multi-config generators (Ninja, Make)
 - Added new options:
   - Allow to set CMake generator back to Xcode, no option for make
     thou.
   - Allow to build without reconfiguring CMake, improves build times.
     Unnecessary Cmake reconfigurations require full rebuild.
   - Allow to set build configuration for CMake
 - Reorganized targets into separate function to break "cd" dependency.
 - Reformat shell code.
 - Fix all warnings reported by ShellCheck linter tool.
 - Update run_gettext.sh to respect build dir in full mode.

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* FIX: Install ninja with brew on CI.

Test if building works with Ninja by default.

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* ENH: Set Xcode back as default generator.

Use Ninja on CI with explicit option.

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* FIX: Partially revent changes in run_gettext.sh

Revert changes for option parsing.
Leave fixes for issues found by ShellCheck linter tool.

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>

---------

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>
This commit is contained in:
Dzmitry Neviadomski 2024-03-05 17:35:46 +03:00 committed by GitHub
parent eae2703610
commit 7b31ee3a45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 177 additions and 69 deletions

View file

@ -8,7 +8,7 @@
FULL_MODE=false
for arg in "$@"
do
if [ "$arg" == "--full" ]; then
if [ "$arg" = "--full" ]; then
FULL_MODE=true
fi
done
@ -19,7 +19,7 @@ if $FULL_MODE; then
fi
echo $PWD
echo "$0: working dir = $PWD"
pot_file="./localization/i18n/OrcaSlicer.pot"
for dir in ./localization/i18n/*/
do
@ -28,10 +28,10 @@ do
if [ -f "$dir/OrcaSlicer_${lang}.po" ]; then
if $FULL_MODE; then
msgmerge -N -o $dir/OrcaSlicer_${lang}.po $dir/OrcaSlicer_${lang}.po $pot_file
fi
mkdir -p ./resources/i18n/${lang}/
msgfmt --check-format -o ./resources/i18n/${lang}/OrcaSlicer.mo $dir/OrcaSlicer_${lang}.po
msgmerge -N -o "$dir/OrcaSlicer_${lang}.po" "$dir/OrcaSlicer_${lang}.po" "$pot_file"
fi
mkdir -p "resources/i18n/${lang}"
msgfmt --check-format -o "resources/i18n/${lang}/OrcaSlicer.mo" "$dir/OrcaSlicer_${lang}.po"
# Check the exit status of the msgfmt command
if [ $? -ne 0 ]; then
echo "Error encountered with msgfmt command for language ${lang}."