improve libelf/gettext to support android (#322)

* improve libiconv

* patch libiconv to support for android

* improve gettest to support android

* improve libelf and elfutils
pull/323/head
ruki 4 years ago committed by GitHub
parent f3add34062
commit e8665e224a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      packages/e/elfutils/xmake.lua
  2. 61
      packages/g/gettext/xmake.lua
  3. 12
      packages/l/libelf/xmake.lua
  4. 1636
      packages/l/libiconv/patches/1.15/patch-utf8mac.diff
  5. 41
      packages/l/libiconv/patches/1.16/makefile.in.patch
  6. 29
      packages/l/libiconv/xmake.lua
  7. 4
      scripts/test.lua

@ -10,10 +10,6 @@ package("elfutils")
add_patches("0.183", path.join(os.scriptdir(), "patches", "0.183", "configure.patch"), "7a16719d9e3d8300b5322b791ba5dd02986f2663e419c6798077dd023ca6173a")
add_deps("m4", "zlib")
--[[
if is_plat("android") then
add_deps("argp-standalone")
end]]
on_install("linux", function (package)
local configs = {"--disable-dependency-tracking",

@ -15,11 +15,9 @@ package("gettext")
add_deps("libiconv")
end
on_install("macosx", "linux", function (package)
on_install("macosx", "linux", "android", function (package)
local configs = {"--disable-dependency-tracking",
"--disable-silent-rules",
"--enable-shared=no",
"--enable-static=yes",
"--with-included-glib",
"--with-included-libcroco",
"--with-included-libunistring",
@ -31,10 +29,63 @@ package("gettext")
"--without-bzip2",
"--without-cvs",
"--without-xz"}
if is_plat("macosx") then
table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
if package:debug() then
table.insert(configs, "--enable-debug")
end
if package:config("pic") ~= false then
table.insert(configs, "--with-pic")
end
if package:is_plat("macosx") then
table.insert(configs, "--with-included-gettext")
end
import("package.tools.autoconf").install(package, configs)
if package:is_plat("android") then
io.replace("./gettext-tools/configure", "#define gid_t int", "")
io.replace("./gettext-tools/configure", "#define uid_t int", "")
io.replace("./gettext-runtime/configure", "#define gid_t int", "")
io.replace("./gettext-runtime/configure", "#define uid_t int", "")
io.replace("./gettext-tools/gnulib-lib/spawn.in.h", "@HAVE_SPAWN_H@", "0")
io.replace("./gettext-tools/gnulib-lib/spawn.in.h", "@HAVE_POSIX_SPAWNATTR_T@", "0")
io.replace("./gettext-tools/gnulib-lib/spawn.in.h", "@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@", "0")
io.replace("./gettext-runtime/src/Makefile.in",
"bin_PROGRAMS = gettext$(EXEEXT) ngettext$(EXEEXT) envsubst$(EXEEXT)",
"bin_PROGRAMS =", {plain = true})
io.replace("./gettext-tools/src/Makefile.in",
"bin_PROGRAMS = .*noinst_PROGRAMS =",
"bin_PROGRAMS =\nnoinst_PROGRAMS =")
io.replace("./gettext-tools/src/Makefile.in",
"noinst_PROGRAMS = hostname$(EXEEXT) urlget$(EXEEXT) \\",
"bin_PROGRAMS =", {plain = true})
io.replace("./gettext-tools/src/Makefile.in",
"cldr-plurals$(EXEEXT)",
"", {plain = true})
io.replace("./gettext-tools/src/Makefile.in",
"install-exec-local:",
"install-exec-local: \n\ninstall-exec-local_: ", {plain = true})
io.replace("./gettext-tools/config.h.in", "#undef ICONV_CONST", "#define ICONV_CONST const")
io.replace("./gettext-runtime/config.h.in", "#undef ICONV_CONST", "#define ICONV_CONST const")
io.replace("./gettext-tools/libgrep/langinfo.in.h", "@HAVE_LANGINFO_H@", "0")
io.replace("./gettext-tools/gnulib-lib/langinfo.in.h", "@HAVE_LANGINFO_H@", "0")
io.replace("./gettext-runtime/gnulib-lib/langinfo.in.h", "@HAVE_LANGINFO_H@", "0")
end
local cflags = {}
local ldflags = {}
for _, dep in ipairs(package:orderdeps()) do
local fetchinfo = dep:fetch()
if fetchinfo then
for _, includedir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do
table.insert(cflags, "-I" .. includedir)
end
for _, linkdir in ipairs(fetchinfo.linkdirs) do
table.insert(ldflags, "-L" .. linkdir)
end
for _, link in ipairs(fetchinfo.links) do
table.insert(ldflags, "-l" .. link)
end
end
end
import("package.tools.autoconf").install(package, configs, {cflags = cflags, ldflags = ldflags})
end)
on_test(function (package)

@ -10,7 +10,7 @@ package("libelf")
add_includedirs("include", "include/libelf")
on_install("linux", function (package)
on_install("linux", "android", function (package)
local configs = {"--disable-dependency-tracking",
"--disable-compat"}
table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
@ -22,9 +22,19 @@ package("libelf")
if package:config("pic") ~= false then
cxflags = "-fPIC"
end
if package:is_plat("android") then
io.replace("./configure", "#define off_t long", "")
io.replace("lib/private.h", "HAVE_MEMMOVE", "1")
io.replace("lib/private.h", "HAVE_MEMCPY", "1")
package:add("defines", "__LIBELF64=1")
package:add("defines", "__LIBELF64_LINUX=1")
package:add("defines", "__libelf_u64_t=uint64_t")
package:add("defines", "__libelf_i64_t=int64_t")
end
import("package.tools.autoconf").install(package, configs, {cxflags = cxflags})
end)
on_test(function (package)
assert(package:has_cfuncs("elf_begin", {includes = "libelf/gelf.h"}))
assert(package:has_cfuncs("elf_begin", {includes = "libelf/libelf.h"}))
end)

File diff suppressed because it is too large Load Diff

@ -0,0 +1,41 @@
diff --git a/Makefile.in b/Makefile.in
index 5d501ce..08899a9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -31,11 +31,6 @@ SHELL = @SHELL@
all : lib/localcharset.h force
cd lib && $(MAKE) all
- cd srclib && $(MAKE) all
- cd src && $(MAKE) all
- cd po && $(MAKE) all
- cd man && $(MAKE) all
- if test -d tests; then cd tests && $(MAKE) all; fi
lib/localcharset.h :
builddir="`pwd`"; cd libcharset && $(MAKE) all && $(MAKE) install-lib libdir="$$builddir/lib" includedir="$$builddir/lib"
@@ -50,12 +45,8 @@ install-lib : all force
install : lib/localcharset.h force
cd libcharset && $(MAKE) install prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)'
cd lib && $(MAKE) install prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)'
- cd srclib && $(MAKE) install prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)'
- cd src && $(MAKE) install prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)'
if [ ! -d $(DESTDIR)$(includedir) ] ; then $(mkinstalldirs) $(DESTDIR)$(includedir) ; fi
$(INSTALL_DATA) include/iconv.h.inst $(DESTDIR)$(includedir)/iconv.h
- cd po && $(MAKE) install prefix='$(prefix)' exec_prefix='$(exec_prefix)' datarootdir='$(datarootdir)' datadir='$(datadir)'
- cd man && $(MAKE) install prefix='$(prefix)' exec_prefix='$(exec_prefix)' datarootdir='$(datarootdir)' datadir='$(datadir)' mandir='$(mandir)'
install-strip : lib/localcharset.h force
cd libcharset && $(MAKE) install-strip prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)'
@@ -88,11 +79,6 @@ uninstall : force
check : all force
cd libcharset && $(MAKE) check
cd lib && $(MAKE) check
- cd srclib && $(MAKE) check
- cd src && $(MAKE) check
- cd po && $(MAKE) check
- cd man && $(MAKE) check
- if test -d tests; then cd tests && $(MAKE) check; fi
mostlyclean : force
cd libcharset && $(MAKE) mostlyclean

@ -9,34 +9,39 @@ package("libiconv")
add_versions("1.15", "ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178")
if is_plat("macosx") then
add_patches("1.15", "https://raw.githubusercontent.com/Homebrew/patches/9be2793af/libiconv/patch-utf8mac.diff",
"e8128732f22f63b5c656659786d2cf76f1450008f36bcf541285268c66cabeab")
add_patches("1.15", path.join(os.scriptdir(), "patches", "1.15", "patch-utf8mac.diff"),
"e8128732f22f63b5c656659786d2cf76f1450008f36bcf541285268c66cabeab")
elseif is_plat("android") then
add_patches("1.x", path.join(os.scriptdir(), "patches", "1.16", "makefile.in.patch"),
"d09e4212040f5adf1faa5cf5a9a18f6f79d4cdce9affb05f2e75df2ea3b3d686")
end
on_load(function (package)
package:addenv("PATH", "bin")
end)
on_install("macosx", "linux", function (package)
on_install("macosx", "linux", "android", function (package)
local configs = {"--disable-dependency-tracking", "--enable-extra-encodings"}
table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
if package:debug() then
table.insert(configs, "--enable-debug")
else
table.insert(configs, "--disable-debug")
end
if package:config("shared") then
table.insert(configs, "--enable-shared=yes")
table.insert(configs, "--enable-static=no")
else
table.insert(configs, "--enable-static=yes")
table.insert(configs, "--enable-shared=no")
if package:config("pic") ~= false then
table.insert(configs, "--with-pic")
end
if package:is_plat("android") then
io.replace("./configure", "#define gid_t int", "")
io.replace("./configure", "#define uid_t int", "")
end
os.vrunv("make", {"-f", "Makefile.devel", "CFLAGS=" .. (package:config("cflags") or "")})
import("package.tools.autoconf").install(package, configs)
end)
on_test(function (package)
os.vrun("iconv --version")
if package:is_plat("macosx", "linux") then
os.vrun("iconv --version")
end
assert(package:has_cfuncs("iconv_open(0, 0);", {includes = "iconv.h"}))
end)

@ -13,6 +13,7 @@ local options =
, {'p', "plat", "kv", nil, "Set the given platform." }
, {'a', "arch", "kv", nil, "Set the given architecture." }
, {'m', "mode", "kv", nil, "Set the given mode." }
, {'j', "jobs", "kv", nil, "Set the build jobs." }
, {nil, "cflags", "kv", nil, "Set the cflags." }
, {nil, "cxxflags", "kv", nil, "Set the cxxflags." }
, {nil, "ldflags", "kv", nil, "Set the ldflags." }
@ -82,6 +83,9 @@ function _require_packages(argv, packages)
if argv.shallow then
table.insert(require_argv, "--shallow")
end
if argv.jobs then
table.insert(require_argv, "--jobs=" .. argv.jobs)
end
if argv.mode == "debug" and argv.kind == "shared" then
table.insert(require_argv, "--extra={debug=true,configs={shared=true}}")
elseif argv.mode == "debug" then

Loading…
Cancel
Save