@@ -9,19 +9,32 @@ 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 (" 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 )
19
32
20
33
on_install (" macosx" , " linux" , " android" , function (package )
21
34
local configs = {" --disable-dependency-tracking" ,
22
35
" --disable-silent-rules" ,
23
- " --with-included-glib" ,
24
36
" --with-included-libcroco" ,
37
+ " --with-included-glib" ,
25
38
" --with-included-libunistring" ,
26
39
" --with-lispdir=#{elisp}" ,
27
40
" --disable-java" ,
@@ -31,8 +44,11 @@ package("gettext")
31
44
" --without-bzip2" ,
32
45
" --without-cvs" ,
33
46
" --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
36
52
if package :debug () then
37
53
table.insert (configs , " --enable-debug" )
38
54
end
@@ -42,34 +58,44 @@ package("gettext")
42
58
if package :is_plat (" macosx" ) then
43
59
table.insert (configs , " --with-included-gettext" )
44
60
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" )
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 =\n noinst_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\n install-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
73
99
end
74
100
local cflags = {}
75
101
local ldflags = {}
@@ -87,7 +113,38 @@ package("gettext")
87
113
end
88
114
end
89
115
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
91
148
package :addenv (" PATH" , " bin" )
92
149
end )
93
150
0 commit comments