improve zlib and libjpeg to support iphoneos and android

pull/18/head
ruki 6 years ago
parent 18a9b2e16f
commit e1c95d5902
No known key found for this signature in database
GPG Key ID: 33341DF9719963FA
  1. 8
      packages/l/libjpeg/xmake.lua
  2. 12
      packages/z/zlib/xmake.lua
  3. 4
      scripts/test.lua

@ -15,6 +15,10 @@ package("libjpeg")
os.cp("libjpeg.lib", package:installdir("lib")) os.cp("libjpeg.lib", package:installdir("lib"))
end) end)
on_install("macosx", "linux", function (package) on_install(function (package)
import("package.tools.autoconf").install(package) import("package.tools.autoconf").install(package, {"--enable-shared=no"})
end)
on_test(function (package)
assert(package:has_cfuncs("jpeg_create_compress(0)", {includes = {"stdio.h", "jpeglib.h"}}))
end) end)

@ -9,8 +9,8 @@ package("zlib")
add_versions("1.2.10", "8d7e9f698ce48787b6e1c67e6bff79e487303e66077e25cb9784ac8835978017") add_versions("1.2.10", "8d7e9f698ce48787b6e1c67e6bff79e487303e66077e25cb9784ac8835978017")
add_versions("1.2.11", "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1") add_versions("1.2.11", "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1")
on_install("macosx", "linux", function (package) on_install("linux", "macosx", function (package)
import("package.tools.autoconf").install(package) import("package.tools.autoconf").install(package, {"--static"})
end) end)
on_install("windows", function (package) on_install("windows", function (package)
@ -20,6 +20,14 @@ package("zlib")
os.cp("*.h", package:installdir("include")) os.cp("*.h", package:installdir("include"))
end) end)
on_install("iphoneos", "android", "cross", function (package)
import("package.tools.autoconf").configure(package, {host = "", "--static"})
io.gsub("Makefile", "\nAR=.-\n", "\nAR=" .. (package:build_getenv("ar") or "") .. "\n")
io.gsub("Makefile", "\nARFLAGS=.-\n", "\nARFLAGS=cr\n")
io.gsub("Makefile", "\nRANLIB=.-\n", "\nRANLIB=\n")
os.vrun("make install -j4")
end)
on_test(function (package) on_test(function (package)
assert(package:has_cfuncs("inflate", {includes = "zlib.h"})) assert(package:has_cfuncs("inflate", {includes = "zlib.h"}))
end) end)

@ -8,6 +8,7 @@ local options =
, {'D', "diagnosis", "k", nil, "Enable diagnosis information." } , {'D', "diagnosis", "k", nil, "Enable diagnosis information." }
, {'p', "plat", "kv", nil, "Set the given platform." } , {'p', "plat", "kv", nil, "Set the given platform." }
, {'a', "arch", "kv", nil, "Set the given architecture." } , {'a', "arch", "kv", nil, "Set the given architecture." }
, {nil, "ndk", "kv", nil, "Set the android NDK directory."}
, {nil, "packages", "vs", nil, "The package list." } , {nil, "packages", "vs", nil, "The package list." }
} }
@ -54,6 +55,9 @@ function main(...)
if argv.arch then if argv.arch then
table.insert(config_argv, "--arch=" .. argv.arch) table.insert(config_argv, "--arch=" .. argv.arch)
end end
if argv.ndk then
table.insert(config_argv, "--ndk=" .. argv.ndk)
end
os.execv("xmake", config_argv) os.execv("xmake", config_argv)
os.exec("xmake repo --add local-repo %s", repodir) os.exec("xmake repo --add local-repo %s", repodir)
os.exec("xmake repo -l") os.exec("xmake repo -l")

Loading…
Cancel
Save