@@ -9,13 +9,22 @@ package("gettext")
9
9
add_versions (" 0.19.8-1" , " 105556dbc5c3fbbc2aa0edb46d22d055748b6f5c7cd7a8d99f8e7eb84e938be4" )
10
10
add_versions (" 0.21" , " d20fcbb537e02dcf1383197ba05bd0734ef7bf5db06bdb241eb69b7d16b73192" )
11
11
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" )
12
15
13
16
if is_plat (" macosx" ) then
14
- add_deps (" libiconv" , {system = true })
15
17
add_frameworks (" CoreFoundation" )
16
- else
17
- add_deps (" libiconv" )
18
18
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 )
19
28
20
29
on_install (" macosx" , " linux" , " android" , function (package )
21
30
local configs = {" --disable-dependency-tracking" ,
@@ -42,35 +51,6 @@ package("gettext")
42
51
if package :is_plat (" macosx" ) then
43
52
table.insert (configs , " --with-included-gettext" )
44
53
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 =\n noinst_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\n install-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
74
54
local cflags = {}
75
55
local ldflags = {}
76
56
for _ , dep in ipairs (package :orderdeps ()) do
@@ -87,7 +67,64 @@ package("gettext")
87
67
end
88
68
end
89
69
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 =\n noinst_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\n install-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
91
128
package :addenv (" PATH" , " bin" )
92
129
end )
93
130
0 commit comments