update glib (#2822)

* update libintl

* update glib
pull/2847/head
Hoildkv 1 year ago committed by GitHub
parent 52ebbb3060
commit 2881c7612f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 76
      packages/g/glib/xmake.lua
  2. 0
      packages/l/libintl/port/0.21/xmake.lua
  3. 426
      packages/l/libintl/port/0.22.3/xmake.lua
  4. 9
      packages/l/libintl/xmake.lua

@ -1,29 +1,35 @@
package("glib")
set_homepage("https://developer.gnome.org/glib/")
set_description("Core application library for C.")
set_homepage("https://docs.gtk.org/glib/")
set_description("Low-level core library that forms the basis for projects such as GTK+ and GNOME.")
set_license("LGPL-2.1")
set_urls("https://github.com/GNOME/glib/archive/refs/tags/$(version).tar.gz",
"https://gitlab.gnome.org/GNOME/glib/-/archive/$(version)/glib-$(version).tar.gz",
"https://gitlab.gnome.org/GNOME/glib.git")
add_versions("2.71.0", "10cdfa2893b7ccf6a95b25644ec51e2c609274a5af3ad8e743d6dc35434fdf11")
add_urls("https://download.gnome.org/sources/glib/2.78/glib-2.78.1.tar.xz", {alias = "home", version = function (version)
return format("%d.%d/glib-%s", version:major(), version:minor(), version)
end})
add_urls("https://gitlab.gnome.org/GNOME/glib/-/archive/$(version)/glib-$(version).tar.gz", {alias = "gitlab"})
add_urls("https://gitlab.gnome.org/GNOME/glib.git")
add_versions("home:2.71.0", "926816526f6e4bba9af726970ff87be7dac0b70d5805050c6207b7bb17ea4fca")
add_versions("home:2.78.1", "915bc3d0f8507d650ead3832e2f8fb670fce59aac4d7754a7dab6f1e6fed78b2")
add_patches("2.71.0", path.join(os.scriptdir(), "patches", "2.71.0", "macosx.patch"), "a0c928643e40f3a3dfdce52950486c7f5e6f6e9cfbd76b20c7c5b43de51d6399")
if is_plat("windows") then
add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
end
add_deps("meson", "ninja", "libffi", "pcre")
add_deps("meson", "ninja", "libffi", "zlib")
if is_plat("linux") then
add_deps("libiconv")
elseif is_plat("windows", "macosx") then
elseif is_plat("macosx") then
add_deps("libiconv", {system = true})
add_deps("libintl")
elseif is_plat("windows") then
add_deps("libintl")
end
add_includedirs("include/glib-2.0", "lib/glib-2.0/include")
add_links("gio-2.0", "gobject-2.0", "gthread-2.0", "gmodule-2.0", "glib-2.0", "intl")
add_links("gio-2.0", "gobject-2.0", "gthread-2.0", "gmodule-2.0", "glib-2.0")
if is_plat("macosx") then
add_syslinks("iconv")
add_frameworks("Foundation", "CoreFoundation")
add_extsources("brew::glib")
elseif is_plat("linux") then
@ -31,30 +37,36 @@ package("glib")
add_extsources("apt::libglib2.0-dev", "pacman::glib2")
end
if on_fetch then
on_fetch("macosx", "linux", function (package, opt)
if opt.system and package.find_package then
local result
for _, name in ipairs({"gio-2.0", "gobject-2.0", "gthread-2.0", "gmodule-2.0", "glib-2.0"}) do
local pkginfo = package.find_package and package:find_package("pkgconfig::" .. name, opt)
if pkginfo then
if not result then
result = table.copy(pkginfo)
else
local includedirs = pkginfo.sysincludedirs or pkginfo.includedirs
result.links = table.wrap(result.links)
result.linkdirs = table.wrap(result.linkdirs)
result.includedirs = table.wrap(result.includedirs)
table.join2(result.includedirs, includedirs)
table.join2(result.linkdirs, pkginfo.linkdirs)
table.join2(result.links, pkginfo.links)
end
on_fetch("macosx", "linux", function (package, opt)
if opt.system and package.find_package then
local result
for _, name in ipairs({"gio-2.0", "gobject-2.0", "gthread-2.0", "gmodule-2.0", "glib-2.0"}) do
local pkginfo = package.find_package and package:find_package("pkgconfig::" .. name, opt)
if pkginfo then
if not result then
result = table.copy(pkginfo)
else
local includedirs = pkginfo.sysincludedirs or pkginfo.includedirs
result.links = table.wrap(result.links)
result.linkdirs = table.wrap(result.linkdirs)
result.includedirs = table.wrap(result.includedirs)
table.join2(result.includedirs, includedirs)
table.join2(result.linkdirs, pkginfo.linkdirs)
table.join2(result.links, pkginfo.links)
end
end
return result
end
end)
end
return result
end
end)
on_load("windows", "macosx", "linux", "cross", function (package)
if package:version():ge("2.74.0") then
package:add("deps", "pcre2")
else
package:add("deps", "pcre")
end
end)
on_install("windows", "macosx", "linux", "cross", function (package)
import("package.tools.meson")
@ -69,7 +81,7 @@ package("glib")
"-Dlibmount=disabled"}
if package:is_plat("macosx") and package:version():le("2.61.0") then
table.insert(configs, "-Diconv=native")
elseif package:is_plat("windows") then
elseif package:is_plat("windows") and package:version():le("2.74.0") then
table.insert(configs, "-Diconv=external")
end
table.insert(configs, "-Dglib_debug=" .. (package:debug() and "enabled" or "disabled"))

@ -0,0 +1,426 @@
set_project("libintl")
add_rules("mode.debug", "mode.release")
set_configvar("PACKAGE", "gettext-runtime")
set_configvar("PACKAGE_NAME", "gettext-runtime")
set_configvar("PACKAGE_TARNAME", "gettext-runtime")
set_configvar("PACKAGE_BUGREPORT", "bug-gettext@gnu.org")
set_configvar("PACKAGE_URL", "")
option("installprefix")
set_default("")
set_showmenu(true)
option_end()
set_configvar("INSTALLPREFIX", get_config("installprefix"))
if has_config("installprefix") then
add_defines("LOCALEDIR=\"" .. get_config("installprefix") .. "/locale\"")
add_defines("LOCALE_ALIAS_PATH=\"" .. get_config("installprefix") .. "/locale\"")
end
option("vers")
set_default("")
set_showmenu(true)
option_end()
if has_config("vers") then
set_version(get_config("vers"))
set_configvar("VERSION", get_config("vers"))
set_configvar("PACKAGE_VERSION", get_config("vers"))
set_configvar("PACKAGE_STRING", "gettext-runtime " .. get_config("vers"))
end
option("relocatable")
set_default(true)
set_showmenu(true)
option_end()
if has_config("relocatable") then
add_defines("ENABLE_RELOCATABLE=1")
set_configvar("ENABLE_RELOCATABLE", 1)
end
includes("@builtin/check")
-- general autoconf variables
option("GNULIB_STRERROR")
add_csnippets("strerror", [[#include <string.h>
int test() { if (!*strerror(-2)) { return 1; } return 0; }]])
set_configvar("GNULIB_STRERROR", 1)
option_end()
add_options("GNULIB_STRERROR")
option("HAVE_UID_T")
add_ctypes("uid_t")
add_cincludes("stdlib.h")
option_end()
if not has_config("HAVE_UID_T") then
set_configvar("uid_t", "int", {quote = false})
end
option("HAVE_SSIZE_T")
add_ctypes("ssize_t")
add_cincludes("sys/types.h")
option_end()
if not has_config("HAVE_SSIZE_T") then
set_configvar("ssize_t", "int", {quote = false})
end
option("HAVE_NLINK_T")
add_ctypes("nlink_t")
add_cincludes("sys/types.h")
option_end()
if not has_config("HAVE_NLINK_T") then
set_configvar("nlink_t", "int", {quote = false})
end
set_configvar("LT_OBJDIR", ".libs/")
set_configvar("HAVE_INLINE", 1)
set_configvar("_ALL_SOURCE", 1)
set_configvar("_DARWIN_C_SOURCE", 1)
set_configvar("_GNU_SOURCE", 1)
set_configvar("_NETBSD_SOURCE", 1)
set_configvar("_OPENBSD_SOURCE", 1)
set_configvar("_POSIX_PTHREAD_SEMANTICS", 1)
set_configvar("__STDC_WANT_IEC_60559_ATTRIBS_EXT__", 1)
set_configvar("__STDC_WANT_IEC_60559_BFP_EXT__", 1)
set_configvar("__STDC_WANT_IEC_60559_DFP_EXT__", 1)
set_configvar("__STDC_WANT_IEC_60559_FUNCS_EXT__", 1)
set_configvar("__STDC_WANT_IEC_60559_TYPES_EXT__", 1)
set_configvar("__STDC_WANT_LIB_EXT2__", 1)
set_configvar("__STDC_WANT_MATH_SPEC_FUNCS__", 1)
set_configvar("_TANDEM_SOURCE", 1)
set_configvar("__EXTENSIONS__", 1)
set_configvar("ENABLE_EXTRA", 1)
set_configvar("_USE_STD_STAT", 1)
set_configvar("__USE_MINGW_ANSI_STDIO", 1)
set_configvar("STDC_HEADERS", 1)
set_configvar("C_ALLOCA", 1)
set_configvar("USE_UNLOCKED_IO", 1)
set_configvar("GNULIB_LOCK", 1)
set_configvar("GNULIB_MSVC_NOTHROW", 1)
set_configvar("GNULIB_CANONICALIZE_LGPL", 1)
set_configvar("GNULIB_TEST_CANONICALIZE_FILE_NAME", 1)
set_configvar("GNULIB_TEST_ENVIRON", 1)
set_configvar("GNULIB_TEST_FREXP", 1)
set_configvar("GNULIB_TEST_FREXPL", 1)
set_configvar("GNULIB_TEST_LSTAT", 1)
set_configvar("GNULIB_TEST_LOCALENAME", 1)
set_configvar("GNULIB_TEST_MALLOC_POSIX", 1)
set_configvar("GNULIB_TEST_RAISE", 1)
set_configvar("GNULIB_TEST_READ", 1)
set_configvar("GNULIB_TEST_READLINK", 1)
set_configvar("GNULIB_TEST_REALPATH", 1)
set_configvar("GNULIB_TEST_SIGPROCMASK", 1)
set_configvar("GNULIB_TEST_STAT", 1)
set_configvar("GNULIB_TEST_STRERROR", 1)
set_configvar("GNULIB_TEST_STRNLEN", 1)
set_configvar("GNULIB_TEST_WCWIDTH", 1)
set_configvar("GNULIB_UNISTR_U8_MBTOUCR", 1)
set_configvar("GNULIB_UNISTR_U8_UCTOMB", 1)
configvar_check_cincludes("ENABLE_NLS", "libintl.h", {default = 0})
configvar_check_cincludes("HAVE_DLFCN_H", "dlfcn.h")
configvar_check_cincludes("HAVE_INTTYPES_H", "inttypes.h")
configvar_check_cincludes("HAVE_MACH_O_DYLD_H", "mach-o/dyld.h")
configvar_check_cincludes("HAVE_MEMORY_H", "memory.h")
configvar_check_cincludes("HAVE_STDBOOL_H", "stdbool.h")
configvar_check_cincludes("HAVE_STDINT_H", "stdint.h")
configvar_check_cincludes("HAVE_STDIO_H", "stdio.h")
configvar_check_cincludes("HAVE_STDDEF_H", "stddef.h")
configvar_check_cincludes("HAVE_STDLIB_H", "stdlib.h")
configvar_check_cincludes("HAVE_STRINGS_H", "strings.h")
configvar_check_cincludes("HAVE_STRING_H", "string.h")
configvar_check_cincludes("HAVE_SYS_STAT_H", "sys/stat.h")
configvar_check_cincludes("HAVE_SYS_TYPES_H", "sys/types.h")
configvar_check_cincludes("HAVE_SYS_MMAN_H", "sys/mman.h")
configvar_check_cincludes("HAVE_UNISTD_H", "unistd.h")
configvar_check_cincludes("HAVE_ALLOCA_H", "alloca.h")
configvar_check_cincludes("HAVE_SEARCH_H", "search.h")
configvar_check_cincludes("HAVE_SYS_BITYPES_H", "sys/bitypes.h")
configvar_check_cincludes("HAVE_WCHAR_H", "wchar.h")
configvar_check_cincludes("HAVE_WCTYPE_H", "wctype.h")
configvar_check_cincludes("HAVE_WINSOCK2_H", "winsock2.h")
configvar_check_cincludes("HAVE_CRTDEFS_H", "crtdefs.h")
configvar_check_cincludes("HAVE_BP_SYM_H", "bp-sym.h")
configvar_check_cincludes("HAVE_XLOCALE_H", "xlocale.h")
configvar_check_cfuncs("HAVE__NSGETEXECUTABLEPATH", "_NSGetExecutablePath")
configvar_check_cfuncs("HAVE_MSVC_INVALID_PARAMETER_HANDLER", "_set_invalid_parameter_handler")
configvar_check_cfuncs("HAVE_SETLOCALE", "setlocale", {includes = "locale.h"})
configvar_check_cfuncs("HAVE_SYMLINK", "symlink", {includes = "unistd.h"})
configvar_check_cfuncs("GNULIB_FSCANF", "fscanf", {includes = "stdio.h"})
configvar_check_cfuncs("GNULIB_SCANF", "scanf", {includes = "stdio.h"})
configvar_check_cfuncs("HAVE_CANONICALIZE_FILE_NAME", "canonicalize_file_name", {includes = "stdlib.h", defines = "_GNU_SOURCE"})
configvar_check_cfuncs("HAVE_DECL_CLEARERR_UNLOCKED", "clearerr_unlocked", {includes = "stdio.h", default = 0})
configvar_check_cfuncs("HAVE_DECL_FEOF_UNLOCKED", "feof_unlocked", {includes = "stdio.h", default = 0})
configvar_check_cfuncs("HAVE_DECL_FERROR_UNLOCKED", "ferror_unlocked", {includes = "stdio.h", default = 0})
configvar_check_cfuncs("HAVE_DECL_FFLUSH_UNLOCKED", "fflush_unlocked", {includes = "stdio.h", default = 0})
configvar_check_cfuncs("HAVE_DECL_FGETS_UNLOCKED", "fgets_unlocked", {includes = "stdio.h", defines = "_GNU_SOURCE", default = 0})
configvar_check_cfuncs("HAVE_DECL_FPUTC_UNLOCKED", "fputc_unlocked", {includes = "stdio.h", default = 0})
configvar_check_cfuncs("HAVE_DECL_FREAD_UNLOCKED", "fread_unlocked", {includes = "stdio.h", default = 0})
configvar_check_cfuncs("HAVE_DECL_FWRITE_UNLOCKED", "fwrite_unlocked", {includes = "stdio.h", default = 0})
configvar_check_cfuncs("HAVE_DECL_GETCHAR_UNLOCKED", "getchar_unlocked", {includes = "stdio.h", default = 0})
configvar_check_cfuncs("HAVE_DECL_GETC_UNLOCKED", "getc_unlocked", {includes = "stdio.h", default = 0})
configvar_check_cfuncs("HAVE_DECL_PUTCHAR_UNLOCKED", "putchar_unlocked", {includes = "stdio.h", default = 0})
configvar_check_cfuncs("HAVE_DECL_PUTC_UNLOCKED", "putc_unlocked", {includes = "stdio.h", default = 0})
configvar_check_cfuncs("HAVE_DECL_SETENV", "setenv", {includes = "stdlib.h", default = 0})
configvar_check_cfuncs("HAVE_DECL_STRERROR_R", "strerror_r", {includes = "string.h", default = 0})
configvar_check_cfuncs("HAVE_SETENV", "setenv", {includes = "stdlib.h"})
configvar_check_cfuncs("HAVE_PUTENV", "putenv", {includes = "stdlib.h"})
configvar_check_cfuncs("HAVE_GETCWD", "getcwd", {includes = "unistd.h"})
configvar_check_cfuncs("HAVE_GETEXECNAME", "getexecname", {includes = "stdlib.h"})
configvar_check_cfuncs("HAVE_GETPROGNAME", "getprogname", {includes = "stdlib.h"})
configvar_check_cfuncs("HAVE_LSTAT", "lstat", {includes = "sys/stat.h"})
configvar_check_cfuncs("HAVE_MALLOC_POSIX", "malloc", {includes = "stdlib.h"})
configvar_check_cfuncs("HAVE_ATEXIT", "atexit", {includes = "stdlib.h"})
configvar_check_cfuncs("HAVE_MBRTOWC", "mbrtowc", {includes = "wchar.h"})
configvar_check_cfuncs("HAVE_WCRTOMB", "wcrtomb", {includes = "wchar.h"})
configvar_check_cfuncs("HAVE_WCSLEN", "wcslen", {includes = "wchar.h"})
configvar_check_cfuncs("HAVE_WCWIDTH", "wcwidth", {includes = "wchar.h"})
configvar_check_cfuncs("HAVE_WCSNLEN", "wcsnlen", {includes = "wchar.h"})
configvar_check_cfuncs("HAVE_MBSINIT", "mbsinit", {includes = "wchar.h"})
configvar_check_cfuncs("HAVE_BTOWC", "btowc", {includes = "wchar.h"})
configvar_check_cfuncs("HAVE_ISWBLANK", "iswblank", {includes = "wctype.h"})
configvar_check_cfuncs("HAVE_ISWCNTRL", "iswcntrl", {includes = "wctype.h"})
configvar_check_cfuncs("HAVE_RAISE", "raise", {includes = "signal.h"})
configvar_check_cfuncs("HAVE_READLINK", "readlink", {includes = "unistd.h"})
configvar_check_cfuncs("HAVE_READLINKAT", "readlinkat", {includes = "unistd.h"})
configvar_check_cfuncs("HAVE_REALPATH", "realpath", {includes = "stdlib.h"})
configvar_check_cfuncs("FUNC_REALPATH_WORKS", "realpath", {includes = "stdlib.h"})
configvar_check_cfuncs("HAVE_STPCPY", "stpcpy", {includes = "string.h"})
configvar_check_cfuncs("HAVE_STRDUP", "strdup", {includes = "string.h"})
configvar_check_cfuncs("HAVE_STRTOUL", "strtoul", {includes = "string.h"})
configvar_check_cfuncs("HAVE_MEMPCPY", "mempcpy", {includes = "string.h", defines = "_GNU_SOURCE"})
configvar_check_cfuncs("HAVE_MMAP", "mmap", {includes = "sys/mman.h"})
configvar_check_cfuncs("HAVE_MPROTECT", "mprotect", {includes = "sys/mman.h"})
configvar_check_cfuncs("HAVE_MUNMAP", "munmap", {includes = "sys/mman.h"})
configvar_check_ctypes("HAVE_LONG_LONG_INT", "long long int")
configvar_check_ctypes("HAVE_UNSIGNED_LONG_LONG_INT", "unsigned long long int")
configvar_check_ctypes("HAVE__BOOL", "_Bool")
configvar_check_ctypes("HAVE_WCHAR_T", "wchar_t", {includes = "wchar.h"})
configvar_check_ctypes("HAVE_WINT_T", "wint_t", {includes = "wchar.h"})
configvar_check_ctypes("HAVE_SIGSET_T", "sigset_t", {includes = "signal.h"})
configvar_check_macros("HAVE_MSVC_INVALID_PARAMETER_HANDLER", "_MSC_VER")
configvar_check_csnippets("HAVE_VISIBILITY", [[
extern __attribute__((__visibility__("hidden"))) int hiddenvar;
extern __attribute__((__visibility__("default"))) int exportedvar;
extern __attribute__((__visibility__("hidden"))) int hiddenfunc(void);
extern __attribute__((__visibility__("default"))) int exportedfunc(void);]], {default = 0})
configvar_check_csnippets("HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC", [[#include <sys/types.h>
#include <sys/stat.h>
struct stat st;
void test() { st.st_atim.tv_nsec; }]])
configvar_check_csnippets("TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC", [[#include <sys/types.h>
#include <sys/stat.h>
#if HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#include <time.h>
struct timespec ts;
struct stat st;
void test() { st.st_atim = ts; }]])
configvar_check_csnippets("PROGRAM_INVOCATION_NAME", [[#define _GNU_SOURCE
#include <errno.h>
extern char *program_invocation_name;]])
configvar_check_csnippets("PROGRAM_INVOCATION_SHORT_NAME", [[#define _GNU_SOURCE
#include <errno.h>
extern char *program_invocation_short_name;]])
configvar_check_csnippets("GNULIB_SIGPIPE", [[#include <signal.h>
#ifndef SIGPIPE
#error SIGPIPE not defined
#endif]])
configvar_check_csnippets("HAVE_LANGINFO_CODESET", [[#include <langinfo.h>
int test() { char* cs = nl_langinfo(CODESET); return !cs; }]])
configvar_check_csnippets("HAVE_ENVIRON_DECL=0", [[extern struct {int foo;} environ;
void test() {environ.foo = 1;}]], {includes = is_plat("windows") and "stdlib.h" or "unistd.h", default = 1})
-- config.h variables
if is_plat("windows", "mingw") then
set_configvar("USE_WINDOWS_THREADS", 1)
else
option("USE_ISOC_THREADS")
add_cfuncs("thrd_create")
add_cincludes("threads.h")
option_end()
if has_config("USE_ISOC_THREADS") then
set_configvar("USE_ISOC_AND_POSIX_THREADS", 1)
else
set_configvar("USE_POSIX_THREADS", 1)
end
end
configvar_check_ctypes("HAVE_STDINT_H_WITH_UINTMAX", "uintmax_t", {includes = "stdint.h"})
configvar_check_ctypes("HAVE_UINTMAX_T", "uintmax_t", {includes = "stdint.h"})
configvar_check_links("HAVE_PTHREAD_API", "pthread")
configvar_check_ctypes("HAVE_PTHREAD_RWLOCK", "pthread_rwlock_t", {includes = "pthread.h"})
configvar_check_cfuncs("HAVE_THRD_CREATE", "thrd_create", {includes = "threads.h"})
configvar_check_csnippets("HAVE_ALLOCA", [[
#ifdef __GNUC__
# define alloca __builtin_alloca
#elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
#else
# include <alloca.h>
#endif
void test() { char *p = (char *)alloca(1); }
]])
configvar_check_csnippets("HAVE_C_STATIC_ASSERT", [[
#include <assert.h>
void test() {
static_assert(sizeof(char) == 1, "sizeof does not work");
static_assert(sizeof(char) == 1);
}
]])
configvar_check_csnippets("FLEXIBLE_ARRAY_MEMBER=/**/", [[
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
struct m { struct m *next, **list; char name[]; };
struct s { struct s *p; struct m *m; int n; double d[]; };
int test() {
int m = getchar();
size_t nbytes = offsetof(struct s, d) + m * sizeof(double);
nbytes += sizeof(struct s) - 1;
nbytes -= nbytes % sizeof(struct s);
struct s *p = malloc(nbytes);
p->p = p;
p->m = NULL;
p->d[0] = 0.0;
return p->d != (double *)NULL;
}
]], {default = 1, quote = false})
configvar_check_csnippets("HAVE_WORKING_USELOCALE", [[
#include <locale.h>
locale_t loc1;
void test() {
uselocale(NULL);
setlocale(LC_ALL, "en_US.UTF-8");
}
]])
if is_plat("windows") and is_kind("shared") then
set_configvar("WOE32DLL", 1)
end
set_configvar("SETLOCALE_NULL_ALL_MTSAFE", is_plat("windows", "linux") and 1 or 0)
set_configvar("SETLOCALE_NULL_ONE_MTSAFE", 1)
set_configvar("NEED_SETLOCALE_IMPROVED", is_plat("mingw") and 1 or 0)
set_configvar("NEED_SETLOCALE_MTSAFE", is_plat("windows", "linux") and 0 or 1)
-- search.h variables
set_configvar("GUARD_PREFIX", "GL", {quote = false})
set_configvar("PRAGMA_SYSTEM_HEADER", "", {quote = false})
set_configvar("PRAGMA_COLUMNS", "", {quote = false})
if is_plat("windows") then
set_configvar("INCLUDE_NEXT", "include", {quote = false})
set_configvar("NEXT_SEARCH_H", "<search.h>", {quote = false})
else
set_configvar("INCLUDE_NEXT", "include_next", {quote = false})
set_configvar("NEXT_SEARCH_H", "<search.h>", {quote = false})
end
set_configvar("GNULIB_MDA_LFIND", 1)
set_configvar("GNULIB_MDA_LSEARCH", 1)
configvar_check_ctypes("HAVE_TYPE_VISIT", "VISIT", {includes = "search.h", default = 0})
option("HAVE_TSEARCH")
add_cfuncs("tsearch")
add_cincludes("search.h")
option_end()
option("HAVE_TWALK")
add_cfuncs("twalk")
add_cincludes("search.h")
option_end()
if has_config("HAVE_TSEARCH") and has_config("HAVE_TWALK") then
set_configvar("HAVE_TSEARCH", 1)
set_configvar("HAVE_TWALK", 1)
set_configvar("REPLACE_TSEARCH", 0)
set_configvar("REPLACE_TWALK", 0)
set_configvar("GNULIB_TSEARCH", 0)
else
set_configvar("tsearch", "_libintl_tsearch", {quote = false})
set_configvar("tfind", "_libintl_tfind", {quote = false})
set_configvar("tdelete", "_libintl_tdelete", {quote = false})
set_configvar("twalk", "_libintl_twalk", {quote = false})
set_configvar("rpl_tsearch", "_libintl_tsearch", {quote = false})
set_configvar("rpl_tfind", "_libintl_tfind", {quote = false})
set_configvar("rpl_tdelete", "_libintl_tdelete", {quote = false})
set_configvar("rpl_twalk", "_libintl_twalk", {quote = false})
set_configvar("HAVE_TSEARCH", 0)
set_configvar("HAVE_TWALK", 0)
set_configvar("REPLACE_TSEARCH", 1)
set_configvar("REPLACE_TWALK", 1)
set_configvar("GNULIB_TSEARCH", 1)
end
-- libgnuintl.h variables
set_configvar("HAVE_NAMELESS_LOCALES", 0)
set_configvar("ENHANCE_LOCALE_FUNCS", 0)
configvar_check_cfuncs("HAVE_NEWLOCALE", "newlocale", {includes = (is_plat("macosx") and "xlocale.h" or "locale.h"), default = 0})
configvar_check_cfuncs("HAVE_POSIX_PRINTF", "printf", {includes = "stdio.h", default = 0})
configvar_check_cfuncs("HAVE_WPRINTF", "wprintf", {includes = "wchar.h", default = 0})
configvar_check_cfuncs("HAVE_SNPRINTF", "snprintf", {includes = "stdio.h", default = 0})
configvar_check_cfuncs("HAVE_ASPRINTF", "asprintf", {includes = "stdio.h", default = 0})
target("intl")
set_kind("$(kind)")
add_defines("HAVE_CONFIG_H", "NO_XMALLOC", "IN_LIBRARY", "IN_LIBINTL")
if is_kind("shared") then
add_defines("BUILDING_LIBINTL", "BUILDING_DLL")
end
if is_plat("windows") then
add_syslinks("advapi32")
end
set_configvar("HAVE_ICONV", 0)
set_configvar("HAVE_ICONV_H", 0)
add_defines("DEPENDS_ON_LIBICONV=0")
set_configdir("gettext-runtime/intl")
add_configfiles("gettext-runtime/intl/(config.h.in)", {filename = "config.h"})
add_configfiles("gettext-runtime/intl/(libgnuintl.in.h)", {filename = "libgnuintl.h", pattern = "@(.-)@"})
add_configfiles("gettext-runtime/intl/(export.h)", {filename = "export.h", pattern = "@(.-)@"})
add_configfiles("gettext-runtime/intl/(gnulib-lib/search.in.h)", {filename = "tsearch.h", pattern = "@(.-)@"})
add_includedirs("gettext-runtime/intl", "gettext-runtime/intl/gnulib-lib")
add_files("gettext-runtime/intl/bindtextdom.c",
"gettext-runtime/intl/dcigettext.c",
"gettext-runtime/intl/dcngettext.c",
"gettext-runtime/intl/dcgettext.c",
"gettext-runtime/intl/dgettext.c",
"gettext-runtime/intl/dngettext.c",
"gettext-runtime/intl/explodename.c",
"gettext-runtime/intl/finddomain.c",
"gettext-runtime/intl/gettext.c",
"gettext-runtime/intl/hash-string.c",
"gettext-runtime/intl/intl-compat.c",
"gettext-runtime/intl/l10nflist.c",
"gettext-runtime/intl/langprefs.c",
"gettext-runtime/intl/loadmsgcat.c",
"gettext-runtime/intl/localealias.c",
"gettext-runtime/intl/log.c",
"gettext-runtime/intl/ngettext.c",
"gettext-runtime/intl/osdep.c",
"gettext-runtime/intl/plural.c",
"gettext-runtime/intl/plural-exp.c",
"gettext-runtime/intl/printf.c",
"gettext-runtime/intl/setlocale.c",
"gettext-runtime/intl/textdomain.c",
"gettext-runtime/intl/version.c",
"gettext-runtime/intl/gnulib-lib/localename.c",
"gettext-runtime/intl/gnulib-lib/localename-table.c",
"gettext-runtime/intl/gnulib-lib/localcharset.c",
"gettext-runtime/intl/gnulib-lib/relocatable.c",
"gettext-runtime/intl/gnulib-lib/setlocale-lock.c",
"gettext-runtime/intl/gnulib-lib/setlocale_null.c",
"gettext-runtime/intl/gnulib-lib/xsize.c",
"gettext-runtime/intl/gnulib-lib/tsearch.c",
"gettext-runtime/intl/gnulib-lib/glthread/lock.c",
"gettext-runtime/intl/gnulib-lib/glthread/threadlib.c")
if is_plat("windows") then
add_files("gettext-runtime/intl/gnulib-lib/windows-mutex.c",
"gettext-runtime/intl/gnulib-lib/windows-rwlock.c",
"gettext-runtime/intl/gnulib-lib/windows-recmutex.c",
"gettext-runtime/intl/gnulib-lib/windows-once.c")
end
before_build(function (target)
io.gsub("gettext-runtime/intl/gnulib-lib/tsearch.h", "(definitions of _GL_FUNCDECL_RPL etc.-)\n", "%1\n#include <c++defs.h>\n")
io.gsub("gettext-runtime/intl/gnulib-lib/tsearch.h", "(definition of _GL_ARG_NONNULL.-)\n", "%1\n#include <arg-nonnull.h>\n")
io.gsub("gettext-runtime/intl/gnulib-lib/tsearch.h", "(definition of _GL_WARN_ON_USE.-)\n", "%1\n#include <warn-on-use.h>\n")
io.replace("gettext-runtime/intl/gnulib-lib/tsearch.c", "#include <search.h>", "#include <tsearch.h>", {plain = true})
os.cp("gettext-runtime/intl/libgnuintl.h", "gettext-runtime/intl/libintl.h")
local lines = io.readfile("gettext-runtime/intl/export.h")
io.replace("gettext-runtime/intl/libgnuintl.h", "#define _LIBINTL_H 1", "#define _LIBINTL_H 1\n" .. lines, {plain = true})
io.replace("gettext-runtime/intl/libgnuintl.h", "extern", "extern LIBINTL_DLL_EXPORTED", {plain = true})
end)
after_install(function (target)
io.replace("gettext-runtime/intl/libintl.h", "extern", (target:is_plat("windows") and target:kind() == "shared") and "extern __declspec(dllimport)" or "extern", {plain = true})
os.cp("gettext-runtime/intl/libintl.h", path.join(target:installdir(), "include", "libintl.h"))
end)
target_end()

@ -5,6 +5,7 @@ package("libintl")
add_urls("https://ftp.gnu.org/gnu/gettext/gettext-$(version).tar.xz")
add_versions("0.21", "d20fcbb537e02dcf1383197ba05bd0734ef7bf5db06bdb241eb69b7d16b73192")
add_versions("0.22.3", "b838228b3f8823a6c1eddf07297197c4db13f7e1b173b9ef93f3f945a63080b6")
if is_plat("windows") then
add_syslinks("advapi32")
@ -12,9 +13,11 @@ package("libintl")
on_install("windows", "macosx", "android", function (package)
-- on linux libintl is already a part of libc
os.cp(path.join(os.scriptdir(), "port", "xmake.lua"), "xmake.lua")
io.replace("gettext-runtime/config.h.in", "$", "", {plain = true})
io.replace("gettext-runtime/config.h.in", "# ?undef (.-)\n", "${define %1}\n")
os.cp(path.join(os.scriptdir(), "port", package:version_str(), "xmake.lua"), "xmake.lua")
for _, conffile in ipairs({"gettext-runtime/config.h.in", "gettext-runtime/intl/config.h.in"}) do
io.replace(conffile, "$", "", {plain = true})
io.replace(conffile, "# ?undef (.-)\n", "${define %1}\n")
end
import("package.tools.xmake").install(package, {
vers = package:version_str(),
relocatable = true,

Loading…
Cancel
Save