Skip to content

Commit a32ec8a

Browse files
authored
ffmpeg: fix build failure with gbk encoding (#8812)
1 parent bcdb398 commit a32ec8a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/f/ffmpeg/xmake.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ package("ffmpeg")
137137
local configs = {
138138
msystem = "MINGW64",
139139
base_devel = true,
140+
uchardet = true,
140141
}
141142
-- @see https://stackoverflow.com/questions/65438878/ffmpeg-build-on-windows-using-msvc-make-fails
142143
configs.make = true
@@ -271,6 +272,13 @@ package("ffmpeg")
271272
if package:is_arch("arm", "arm64") then
272273
envs.PATH = path.join(os.programdir(), "scripts") .. path.envsep() .. envs.PATH
273274
end
275+
-- fix build failure with gbk encoding
276+
io.replace("configure", "cp_if_changed $TMPH config.h", [[
277+
config_encodings=$(uchardet $TMPH)
278+
case "$config_encodings" in GB18030|GBK|GB2312)
279+
{ printf '\xEF\xBB\xBF'; iconv -f "$config_encodings" -t UTF-8 -c $TMPH; } > config.h;;
280+
*) cp_if_changed $TMPH config.h;;
281+
esac]], {plain = true})
274282
autoconf.install(package, configs, {envs = envs})
275283
else
276284
import("core.base.option")

packages/m/msys2/xmake.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ package("msys2")
1010

1111
add_configs("make", {description = "Install gnumake.", default = false, type = "boolean"})
1212
add_configs("gcc", {description = "Install gcc.", default = false, type = "boolean"})
13+
add_configs("uchardet", {description = "Install uchardet.", default = false, type = "boolean"})
1314
add_configs("diffutils", {description = "Install diffutils.", default = false, type = "boolean"})
1415
add_configs("base_devel", {description = "Install base-devel.", default = false, type = "boolean"})
1516
add_configs("mingw64_gcc", {description = "Install mingw64 gcc.", default = false, type = "boolean"})
@@ -41,6 +42,7 @@ package("msys2")
4142
local packages = {
4243
"gcc", "make", "diffutils",
4344
base_devel = "base-devel",
45+
uchardet = "mingw-w64-x86_64-uchardet",
4446
mingw32_gcc = "mingw-w64-i686-gcc",
4547
mingw32_toolchain = "mingw-w64-i686-toolchain",
4648
mingw64_gcc = "mingw-w64-x86_64-gcc",

0 commit comments

Comments
 (0)