Skip to content

Commit 0673e63

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

File tree

2 files changed

+82
-34
lines changed

2 files changed

+82
-34
lines changed

packages/g/gettext/xmake.lua

Lines changed: 70 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,22 @@ 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(function(package)
22+
if is_subhost("windows") then
23+
-- get msys2 sh to avoid using git sh
24+
local msystem = "MINGW" .. (package:is_arch64() and "64" or "32")
25+
package:add("deps", "msys2", {configs = {msystem = msystem, base_devel = true, gcc = true, make = true}})
26+
end
27+
end)
1928

2029
on_install("macosx", "linux", "android", function (package)
2130
local configs = {"--disable-dependency-tracking",
@@ -42,35 +51,6 @@ package("gettext")
4251
if package:is_plat("macosx") then
4352
table.insert(configs, "--with-included-gettext")
4453
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")
73-
end
7454
local cflags = {}
7555
local ldflags = {}
7656
for _, dep in ipairs(package:orderdeps()) do
@@ -87,7 +67,64 @@ package("gettext")
8767
end
8868
end
8969
end
90-
import("package.tools.autoconf").install(package, configs, {cflags = cflags, ldflags = ldflags})
70+
import("package.tools.autoconf")
71+
if package:is_plat("android") then
72+
if package:version():le("0.20") then
73+
io.replace("./gettext-tools/configure", "#define gid_t int", "")
74+
io.replace("./gettext-tools/configure", "#define uid_t int", "")
75+
io.replace("./gettext-runtime/configure", "#define gid_t int", "")
76+
io.replace("./gettext-runtime/configure", "#define uid_t int", "")
77+
io.replace("./gettext-tools/gnulib-lib/spawn.in.h", "@HAVE_SPAWN_H@", "0")
78+
io.replace("./gettext-tools/gnulib-lib/spawn.in.h", "@HAVE_POSIX_SPAWNATTR_T@", "0")
79+
io.replace("./gettext-tools/gnulib-lib/spawn.in.h", "@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@", "0")
80+
io.replace("./gettext-runtime/src/Makefile.in",
81+
"bin_PROGRAMS = gettext$(EXEEXT) ngettext$(EXEEXT) envsubst$(EXEEXT)",
82+
"bin_PROGRAMS =", {plain = true})
83+
io.replace("./gettext-tools/src/Makefile.in",
84+
"bin_PROGRAMS = .*noinst_PROGRAMS =",
85+
"bin_PROGRAMS =\nnoinst_PROGRAMS =")
86+
io.replace("./gettext-tools/src/Makefile.in",
87+
"noinst_PROGRAMS = hostname$(EXEEXT) urlget$(EXEEXT) \\",
88+
"bin_PROGRAMS =", {plain = true})
89+
io.replace("./gettext-tools/src/Makefile.in",
90+
"cldr-plurals$(EXEEXT)",
91+
"", {plain = true})
92+
io.replace("./gettext-tools/src/Makefile.in",
93+
"install-exec-local:",
94+
"install-exec-local: \n\ninstall-exec-local_: ", {plain = true})
95+
io.replace("./gettext-tools/config.h.in", "#undef ICONV_CONST", "#define ICONV_CONST const")
96+
io.replace("./gettext-runtime/config.h.in", "#undef ICONV_CONST", "#define ICONV_CONST const")
97+
io.replace("./gettext-tools/libgrep/langinfo.in.h", "@HAVE_LANGINFO_H@", "0")
98+
io.replace("./gettext-tools/gnulib-lib/langinfo.in.h", "@HAVE_LANGINFO_H@", "0")
99+
io.replace("./gettext-runtime/gnulib-lib/langinfo.in.h", "@HAVE_LANGINFO_H@", "0")
100+
end
101+
if is_subhost("windows") then
102+
import("core.base.option")
103+
-- needed to avoid link errors to rpl_fputc, rpl_write, ...
104+
-- 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
105+
for _, conffile in ipairs({"./configure", "./gettext-tools/configure", "./gettext-runtime/configure"}) do
106+
io.replace(conffile, "REPLACE_STDIO_WRITE_FUNCS=1", "REPLACE_STDIO_WRITE_FUNCS=0")
107+
io.replace(conffile, "REPLACE_WRITE=1", "REPLACE_WRITE=0")
108+
end
109+
local envs = os.joinenvs(autoconf.buildenvs(package, {cflags = cflags, ldflags = ldflags}), os.getenvs())
110+
envs.SHELL = "sh"
111+
autoconf.configure(package, configs, {envs = envs})
112+
113+
local njob = option.get("jobs") or tostring(os.default_njob())
114+
local argv = {"-j" .. njob}
115+
if option.get("verbose") then
116+
table.insert(argv, "V=1")
117+
end
118+
-- using execv instead of vrunv is needed when compiling on windows, otherwise it fail with
119+
-- ../libtool: line 3331: 0: Bad file descriptor
120+
-- when -v is not supplied to xmake
121+
os.execv("make", argv, {shell = true, envs = envs})
122+
os.execv("make", table.join({"install"}, argv), {shell = true, envs = envs})
123+
end
124+
end
125+
if not is_subhost("windows") then
126+
autoconf.install(package, configs, {cflags = cflags, ldflags = ldflags})
127+
end
91128
package:addenv("PATH", "bin")
92129
end)
93130

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)