Skip to content

Commit 642c8a9

Browse files
committed
(gettext) add version 0.22.5 0.23.1 and 0.24.1 and fix libiconv
1 parent 232345e commit 642c8a9

File tree

3 files changed

+105
-37
lines changed

3 files changed

+105
-37
lines changed

.github/workflows/android_windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
matrix:
1414
arch: [armeabi-v7a, arm64-v8a]
1515
ndk: ["r22", "r27"]
16-
ndk_sdkver: ["30"]
16+
ndk_sdkver: ["21", "30"]
1717

1818
concurrency:
1919
group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-Android-Windows-${{ matrix.arch }}-${{ matrix.ndk }}-${{ matrix.ndk_sdkver }}

packages/g/gettext/xmake.lua

Lines changed: 92 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,32 @@ package("gettext")
99
add_versions("0.19.8-1", "105556dbc5c3fbbc2aa0edb46d22d055748b6f5c7cd7a8d99f8e7eb84e938be4")
1010
add_versions("0.21", "d20fcbb537e02dcf1383197ba05bd0734ef7bf5db06bdb241eb69b7d16b73192")
1111
add_versions("0.21.1", "50dbc8f39797950aa2c98e939947c527e5ac9ebd2c1b99dd7b06ba33a6767ae6")
12+
add_versions("0.22.5", "fe10c37353213d78a5b83d48af231e005c4da84db5ce88037d88355938259640")
13+
add_versions("0.23.1", "c1f97a72a7385b7e71dd07b5fea6cdaf12c9b88b564976b23bd8c11857af2970")
14+
add_versions("0.24.1", "6164ec7aa61653ac9cdfb41d5c2344563b21f707da1562712e48715f1d2052a6")
1215

1316
if is_plat("macosx") then
14-
add_deps("libiconv", {system = true})
1517
add_frameworks("CoreFoundation")
16-
else
17-
add_deps("libiconv")
1818
end
19+
add_deps("libiconv")
20+
21+
on_load("macosx", "linux", function(package)
22+
package:add("deps", "autotools")
23+
end)
24+
25+
on_load(function(package)
26+
if is_subhost("windows") then
27+
-- get msys2 sh to avoid using git sh
28+
local msystem = "MINGW" .. (package:is_arch64() and "64" or "32")
29+
package:add("deps", "msys2", {configs = {msystem = msystem, base_devel = true, gcc = true, make = true}})
30+
end
31+
end)
1932

2033
on_install("macosx", "linux", "android", function (package)
2134
local configs = {"--disable-dependency-tracking",
2235
"--disable-silent-rules",
23-
"--with-included-glib",
2436
"--with-included-libcroco",
37+
"--with-included-glib",
2538
"--with-included-libunistring",
2639
"--with-lispdir=#{elisp}",
2740
"--disable-java",
@@ -31,8 +44,11 @@ package("gettext")
3144
"--without-bzip2",
3245
"--without-cvs",
3346
"--without-xz"}
34-
table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
35-
table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
47+
if package:config("shared") then
48+
table.insert(configs, "--disable-static")
49+
else
50+
table.insert(configs, "--disable-shared")
51+
end
3652
if package:debug() then
3753
table.insert(configs, "--enable-debug")
3854
end
@@ -42,34 +58,44 @@ package("gettext")
4258
if package:is_plat("macosx") then
4359
table.insert(configs, "--with-included-gettext")
4460
end
45-
if package:is_plat("android") and package:version():le("0.20") then
46-
io.replace("./gettext-tools/configure", "#define gid_t int", "")
47-
io.replace("./gettext-tools/configure", "#define uid_t int", "")
48-
io.replace("./gettext-runtime/configure", "#define gid_t int", "")
49-
io.replace("./gettext-runtime/configure", "#define uid_t int", "")
50-
io.replace("./gettext-tools/gnulib-lib/spawn.in.h", "@HAVE_SPAWN_H@", "0")
51-
io.replace("./gettext-tools/gnulib-lib/spawn.in.h", "@HAVE_POSIX_SPAWNATTR_T@", "0")
52-
io.replace("./gettext-tools/gnulib-lib/spawn.in.h", "@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@", "0")
53-
io.replace("./gettext-runtime/src/Makefile.in",
54-
"bin_PROGRAMS = gettext$(EXEEXT) ngettext$(EXEEXT) envsubst$(EXEEXT)",
55-
"bin_PROGRAMS =", {plain = true})
56-
io.replace("./gettext-tools/src/Makefile.in",
57-
"bin_PROGRAMS = .*noinst_PROGRAMS =",
58-
"bin_PROGRAMS =\nnoinst_PROGRAMS =")
59-
io.replace("./gettext-tools/src/Makefile.in",
60-
"noinst_PROGRAMS = hostname$(EXEEXT) urlget$(EXEEXT) \\",
61-
"bin_PROGRAMS =", {plain = true})
62-
io.replace("./gettext-tools/src/Makefile.in",
63-
"cldr-plurals$(EXEEXT)",
64-
"", {plain = true})
65-
io.replace("./gettext-tools/src/Makefile.in",
66-
"install-exec-local:",
67-
"install-exec-local: \n\ninstall-exec-local_: ", {plain = true})
68-
io.replace("./gettext-tools/config.h.in", "#undef ICONV_CONST", "#define ICONV_CONST const")
69-
io.replace("./gettext-runtime/config.h.in", "#undef ICONV_CONST", "#define ICONV_CONST const")
70-
io.replace("./gettext-tools/libgrep/langinfo.in.h", "@HAVE_LANGINFO_H@", "0")
71-
io.replace("./gettext-tools/gnulib-lib/langinfo.in.h", "@HAVE_LANGINFO_H@", "0")
72-
io.replace("./gettext-runtime/gnulib-lib/langinfo.in.h", "@HAVE_LANGINFO_H@", "0")
61+
if package:is_plat("android") then
62+
if package:version():le("0.20") then
63+
io.replace("./gettext-tools/configure", "#define gid_t int", "")
64+
io.replace("./gettext-tools/configure", "#define uid_t int", "")
65+
io.replace("./gettext-runtime/configure", "#define gid_t int", "")
66+
io.replace("./gettext-runtime/configure", "#define uid_t int", "")
67+
io.replace("./gettext-tools/gnulib-lib/spawn.in.h", "@HAVE_SPAWN_H@", "0")
68+
io.replace("./gettext-tools/gnulib-lib/spawn.in.h", "@HAVE_POSIX_SPAWNATTR_T@", "0")
69+
io.replace("./gettext-tools/gnulib-lib/spawn.in.h", "@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@", "0")
70+
io.replace("./gettext-runtime/src/Makefile.in",
71+
"bin_PROGRAMS = gettext$(EXEEXT) ngettext$(EXEEXT) envsubst$(EXEEXT)",
72+
"bin_PROGRAMS =", {plain = true})
73+
io.replace("./gettext-tools/src/Makefile.in",
74+
"bin_PROGRAMS = .*noinst_PROGRAMS =",
75+
"bin_PROGRAMS =\nnoinst_PROGRAMS =")
76+
io.replace("./gettext-tools/src/Makefile.in",
77+
"noinst_PROGRAMS = hostname$(EXEEXT) urlget$(EXEEXT) \\",
78+
"bin_PROGRAMS =", {plain = true})
79+
io.replace("./gettext-tools/src/Makefile.in",
80+
"cldr-plurals$(EXEEXT)",
81+
"", {plain = true})
82+
io.replace("./gettext-tools/src/Makefile.in",
83+
"install-exec-local:",
84+
"install-exec-local: \n\ninstall-exec-local_: ", {plain = true})
85+
io.replace("./gettext-tools/config.h.in", "#undef ICONV_CONST", "#define ICONV_CONST const")
86+
io.replace("./gettext-runtime/config.h.in", "#undef ICONV_CONST", "#define ICONV_CONST const")
87+
io.replace("./gettext-tools/libgrep/langinfo.in.h", "@HAVE_LANGINFO_H@", "0")
88+
io.replace("./gettext-tools/gnulib-lib/langinfo.in.h", "@HAVE_LANGINFO_H@", "0")
89+
io.replace("./gettext-runtime/gnulib-lib/langinfo.in.h", "@HAVE_LANGINFO_H@", "0")
90+
end
91+
if is_subhost("windows") then
92+
-- needed to avoid link errors to rpl_fputc, rpl_write, ...
93+
-- rpl_* variants are enabled because SIGPIPE check fail, but i don't understand why, as i'm not very knowledgeable on msys2 and android, the fix is for now is this hack
94+
for _, conffile in ipairs({"./configure", "./gettext-tools/configure", "./gettext-runtime/configure"}) do
95+
io.replace(conffile, "REPLACE_STDIO_WRITE_FUNCS=1", "REPLACE_STDIO_WRITE_FUNCS=0")
96+
io.replace(conffile, "REPLACE_WRITE=1", "REPLACE_WRITE=0")
97+
end
98+
end
7399
end
74100
local cflags = {}
75101
local ldflags = {}
@@ -87,7 +113,38 @@ package("gettext")
87113
end
88114
end
89115
end
90-
import("package.tools.autoconf").install(package, configs, {cflags = cflags, ldflags = ldflags})
116+
import("package.tools.autoconf")
117+
local envs_opt = {cflags = clags, ldflags = ldflags}
118+
local envs = os.joinenvs(autoconf.buildenvs(package, envs_opt), os.getenvs())
119+
envs.SHELL = "sh"
120+
if package:is_plat("android") and is_subhost("windows") then
121+
table.insert(configs, "--prefix=" .. package:installdir():gsub("\\", "/"))
122+
local triples =
123+
{
124+
["armv5te"] = "arm-linux-androideabi", -- deprecated
125+
["armv7-a"] = "arm-linux-androideabi", -- deprecated
126+
["armeabi"] = "arm-linux-androideabi", -- removed in ndk r17
127+
["armeabi-v7a"] = "arm-linux-androideabi",
128+
["arm64-v8a"] = "aarch64-linux-android",
129+
i386 = "i686-linux-android", -- deprecated
130+
x86 = "i686-linux-android",
131+
x86_64 = "x86_64-linux-android",
132+
mips = "mips-linux-android", -- removed in ndk r17
133+
mips64 = "mips64-linux-android" -- removed in ndk r17
134+
}
135+
table.insert(configs, "--host=" .. (triples[package:arch()] or triples["armeabi-v7a"]))
136+
os.vrunv("./configure", configs, {shell = true, envs = os.joinenvs(envs, autoconf.autogen_envs(package, envs_opt))})
137+
138+
local njob = import("core.base.option").get("jobs") or tostring(os.default_njob())
139+
local argv = {"-j" .. njob}
140+
-- needed when compiling on windows, otherwise it fail with
141+
-- ../libtool: line 3331: 0: Bad file descriptor
142+
table.insert(argv, "V=1")
143+
os.vrunv("make", argv, {envs = envs})
144+
os.vrunv("make", {"install"}, {envs = envs})
145+
else
146+
autoconf.install(package, configs, {envs = envs})
147+
end
91148
package:addenv("PATH", "bin")
92149
end)
93150

packages/l/libiconv/port/xmake.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,24 @@ target("iconv")
222222
if is_kind("shared") then
223223
add_defines("BUILDING_LIBICONV", "BUILDING_DLL", "DLL_EXPORT")
224224
end
225+
-- relocatable.c doesn't exists anymore from >= 1.16
226+
on_load(function (target)
227+
import("core.base.semver")
228+
229+
local ver = semver.new(get_config("vers"))
230+
if ver:ge("1.16") then
231+
target:add("files", "lib/compat.c")
232+
else
233+
target:add("files", "lib/relocatable.c")
234+
end
235+
end)
225236
set_configdir(".")
226237
set_configvar("DLL_VARIABLE", (is_plat("windows") and is_kind("shared")) and "__declspec(dllimport)" or "")
227238
add_configfiles("(include/iconv.h.build.in)", {filename = "iconv.h", pattern = "@(.-)@", variables = {EILSEQ = ""}})
228239
add_configfiles("(include/iconv.h.in)", {filename = "iconv.h.inst", pattern = "@(.-)@", variables = {EILSEQ = ""}})
229240
add_configfiles("(config.h.in)", {filename = "config.h"})
230241
add_includedirs(".", "lib", "include", "libcharset/include", {public = true})
231-
add_files("lib/iconv.c", "lib/relocatable.c", "libcharset/lib/localcharset.c")
242+
add_files("lib/iconv.c", "libcharset/lib/localcharset.c")
232243
after_install(function (target)
233244
os.cp("include/iconv.h.inst", path.join(target:installdir(), "include", "iconv.h"))
234245
for _, name in ipairs(os.files("po/*.gmo")) do

0 commit comments

Comments
 (0)