From 2f74496ebf8bed02fbed5b9102aa5ffd69da8a21 Mon Sep 17 00:00:00 2001 From: Bruno Date: Sun, 9 Jun 2024 18:16:48 -0300 Subject: [PATCH] build/windows: No need to add BOM anymore Inno Installer 6.3 added support to UTF-8 *.isl files without a BOM --- build/windows/installer/lang/addbom.sh | 3 --- build/windows/installer/lang/meson.build | 33 +++--------------------- 2 files changed, 3 insertions(+), 33 deletions(-) delete mode 100644 build/windows/installer/lang/addbom.sh diff --git a/build/windows/installer/lang/addbom.sh b/build/windows/installer/lang/addbom.sh deleted file mode 100644 index 61e2739331..0000000000 --- a/build/windows/installer/lang/addbom.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -sed "1s/^/\xEF\xBB\xBF/" "$1" > "$2" diff --git a/build/windows/installer/lang/meson.build b/build/windows/installer/lang/meson.build index 58810c7fd6..fe724158c4 100644 --- a/build/windows/installer/lang/meson.build +++ b/build/windows/installer/lang/meson.build @@ -53,8 +53,6 @@ languages = [ { 'code': 'zh_TW', }, ] -addbom = find_program(meson.current_source_dir() / 'addbom.sh') - # Then, we generate the .isl file for each language using some xsltproc magic foreach language : languages lang_code = language.get('code') @@ -71,10 +69,10 @@ foreach language : languages configuration: { 'LANG_CHECK': lang_check }, ) - nobom_setup_isl = '@0@-nobom.setup.isl'.format(lang_code) - nobom_setup_isl_tmp = custom_target(nobom_setup_isl, + setup_isl = '@0@.setup.isl'.format(lang_code) + custom_target(setup_isl, input : [ ms_installer_config_xml, gimp_ms_installer_lang_xsl ], - output: nobom_setup_isl, + output: setup_isl, command: [ xsltproc, '--xinclude', @@ -85,31 +83,6 @@ foreach language : languages build_by_default: true, ) - setup_isl = '@0@.setup.isl'.format(lang_code) - # Inno-Setup absolutely requires a BOM to recognize UTF-8 files. - # Here I am working around 3 issues in meson: - # 1. We can't easily combine commands in meson. So either we combine - # them in an external script, or we run several custom_target(). I do - # a mix of both because custom_target() has too many bugs. - # 2. To concat a BOM to the file, I'd like to simply call this Python - # code: - # 'open("@OUTPUT@", "wb").write(b"\\xEF\\xBB\\xBF" + open("@INPUT@", "rb").read())' - # Unfortunately we can't pass several @INPUT@/@OUTPUT@ in a same arg. - # See: https://github.com/mesonbuild/meson/issues/7696 - # 3. Antislashes are replaced with slashes in custom_target(). I tried - # some weird trick encoding a string to UTF-8 instead of using the - # well known BOM bytes directly. Unfortunately result was not - # consistent on all platforms (at least Linux and Windows). - # See https://github.com/mesonbuild/meson/issues/1564 - custom_target(setup_isl, - input : [ nobom_setup_isl_tmp, 'addbom.sh' ], - output: [ setup_isl ], - command: [ - addbom, '@INPUT0@', '@OUTPUT@' - ], - build_by_default: true, - ) - if 'langname' in language # Some languages may have no default language file provided by # InnoSetup. When this happens, we must at least complete a very