|
1 | | -package("brotli") |
2 | | - set_homepage("https://github.com/google/brotli") |
3 | | - set_description("Brotli compression format.") |
4 | | - set_license("MIT") |
5 | | - |
6 | | - set_urls("https://github.com/google/brotli/archive/$(version).tar.gz", |
7 | | - "https://github.com/google/brotli.git") |
8 | | - |
9 | | - add_versions("v1.1.0", "e720a6ca29428b803f4ad165371771f5398faba397edf6778837a18599ea13ff") |
10 | | - add_versions("v1.0.9", "f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46") |
11 | | - |
12 | | - -- Fix VC C++ 12.0 BROTLI_MSVC_VERSION_CHECK calls |
13 | | - -- VC <= 2012 build failed |
14 | | - if is_plat("windows") then |
15 | | - add_patches("v1.0.9", path.join(os.scriptdir(), "patches", "1.0.9", "common_platform.patch"), |
16 | | - "5d7363a6ed1f9a504dc7af08920cd184f0d04d1ad12d25d657364cf0a2dae6bb") |
17 | | - add_patches("v1.0.9", path.join(os.scriptdir(), "patches", "1.0.9", "tool_brotli.patch"), |
18 | | - "333e2a0306cf33f2fac381aa6b81afd3d1237e7511e5cc8fe7fb760d16d01ca1") |
19 | | - end |
20 | | - |
21 | | - add_links("brotlienc", "brotlidec", "brotlicommon") |
22 | | - |
23 | | - if is_plat("mingw") and is_subhost("msys") then |
24 | | - add_extsources("pacman::brotli") |
25 | | - elseif is_plat("linux") then |
26 | | - add_extsources("pacman::brotli", "apt::libbrotli-dev") |
27 | | - elseif is_plat("macosx") then |
28 | | - add_extsources("brew::brotli") |
29 | | - end |
30 | | - |
31 | | - on_load(function (package) |
32 | | - package:addenv("PATH", "bin") |
33 | | - end) |
34 | | - |
35 | | - if on_fetch then |
36 | | - on_fetch("linux", "macosx", function (package, opt) |
37 | | - if opt.system then |
38 | | - local result |
39 | | - for _, name in ipairs({"libbrotlidec", "libbrotlienc", "libbrotlicommon"}) do |
40 | | - local pkginfo = package.find_package and package:find_package("pkgconfig::" .. name, opt) |
41 | | - if pkginfo then |
42 | | - if not result then |
43 | | - result = table.copy(pkginfo) |
44 | | - else |
45 | | - local includedirs = pkginfo.sysincludedirs or pkginfo.includedirs |
46 | | - result.links = table.wrap(result.links) |
47 | | - result.linkdirs = table.wrap(result.linkdirs) |
48 | | - result.includedirs = table.wrap(result.includedirs) |
49 | | - table.join2(result.includedirs, includedirs) |
50 | | - table.join2(result.linkdirs, pkginfo.linkdirs) |
51 | | - table.join2(result.links, pkginfo.links) |
52 | | - end |
53 | | - end |
54 | | - end |
55 | | - return result |
56 | | - end |
57 | | - end) |
58 | | - end |
59 | | - |
60 | | - on_install(function (package) |
61 | | - os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") |
62 | | - local configs = {buildir = "xbuild", vers = package:version_str()} |
63 | | - if package:config("shared") then |
64 | | - configs.kind = "shared" |
65 | | - end |
66 | | - if package:is_plat("linux") and package:config("pic") ~= false then |
67 | | - configs.cxflags = "-fPIC" |
68 | | - end |
69 | | - import("package.tools.xmake").install(package, configs) |
70 | | - end) |
71 | | - |
72 | | - on_test(function(package) |
73 | | - if not package:is_cross() then |
74 | | - os.vrun("brotli --version") |
75 | | - end |
76 | | - assert(package:check_csnippets([[ |
77 | | - void test() { |
78 | | - BrotliEncoderState* s = BrotliEncoderCreateInstance(NULL, NULL, NULL); |
79 | | - BrotliEncoderDestroyInstance(s); |
80 | | - } |
81 | | - ]], {includes = "brotli/encode.h"})) |
82 | | - end) |
| 1 | +package("brotli") |
| 2 | + set_homepage("https://github.com/google/brotli") |
| 3 | + set_description("Brotli compression format.") |
| 4 | + set_license("MIT") |
| 5 | + |
| 6 | + set_urls("https://github.com/google/brotli/archive/$(version).tar.gz", |
| 7 | + "https://github.com/google/brotli.git") |
| 8 | + |
| 9 | + add_versions("v1.1.0", "e720a6ca29428b803f4ad165371771f5398faba397edf6778837a18599ea13ff") |
| 10 | + add_versions("v1.0.9", "f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46") |
| 11 | + |
| 12 | + -- Fix VC C++ 12.0 BROTLI_MSVC_VERSION_CHECK calls |
| 13 | + -- VC <= 2012 build failed |
| 14 | + if is_plat("windows") then |
| 15 | + add_patches("v1.0.9", path.join(os.scriptdir(), "patches", "1.0.9", "common_platform.patch"), |
| 16 | + "5d7363a6ed1f9a504dc7af08920cd184f0d04d1ad12d25d657364cf0a2dae6bb") |
| 17 | + add_patches("v1.0.9", path.join(os.scriptdir(), "patches", "1.0.9", "tool_brotli.patch"), |
| 18 | + "333e2a0306cf33f2fac381aa6b81afd3d1237e7511e5cc8fe7fb760d16d01ca1") |
| 19 | + end |
| 20 | + |
| 21 | + if is_plat("cross") then |
| 22 | + add_syslinks("m") |
| 23 | + end |
| 24 | + |
| 25 | + add_links("brotlienc", "brotlidec", "brotlicommon") |
| 26 | + |
| 27 | + if is_plat("mingw") and is_subhost("msys") then |
| 28 | + add_extsources("pacman::brotli") |
| 29 | + elseif is_plat("linux") then |
| 30 | + add_extsources("pacman::brotli", "apt::libbrotli-dev") |
| 31 | + elseif is_plat("macosx") then |
| 32 | + add_extsources("brew::brotli") |
| 33 | + end |
| 34 | + |
| 35 | + if on_fetch then |
| 36 | + on_fetch("linux", "macosx", function (package, opt) |
| 37 | + if opt.system then |
| 38 | + local result |
| 39 | + for _, name in ipairs({"libbrotlidec", "libbrotlienc", "libbrotlicommon"}) do |
| 40 | + local pkginfo = package.find_package and package:find_package("pkgconfig::" .. name, opt) |
| 41 | + if pkginfo then |
| 42 | + if not result then |
| 43 | + result = table.copy(pkginfo) |
| 44 | + else |
| 45 | + local includedirs = pkginfo.sysincludedirs or pkginfo.includedirs |
| 46 | + result.links = table.wrap(result.links) |
| 47 | + result.linkdirs = table.wrap(result.linkdirs) |
| 48 | + result.includedirs = table.wrap(result.includedirs) |
| 49 | + table.join2(result.includedirs, includedirs) |
| 50 | + table.join2(result.linkdirs, pkginfo.linkdirs) |
| 51 | + table.join2(result.links, pkginfo.links) |
| 52 | + end |
| 53 | + end |
| 54 | + end |
| 55 | + return result |
| 56 | + end |
| 57 | + end) |
| 58 | + end |
| 59 | + |
| 60 | + on_install(function (package) |
| 61 | + os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") |
| 62 | + local configs = {buildir = "xbuild", vers = package:version_str():gsub("^v", "")} |
| 63 | + if package:config("shared") then |
| 64 | + configs.kind = "shared" |
| 65 | + end |
| 66 | + if package:is_plat("linux") and package:config("pic") ~= false then |
| 67 | + configs.cxflags = "-fPIC" |
| 68 | + end |
| 69 | + import("package.tools.xmake").install(package, configs) |
| 70 | + if not package:is_cross() then |
| 71 | + package:addenv("PATH", "bin") |
| 72 | + end |
| 73 | + end) |
| 74 | + |
| 75 | + on_test(function(package) |
| 76 | + if not package:is_cross() then |
| 77 | + os.vrun("brotli --version") |
| 78 | + end |
| 79 | + assert(package:check_csnippets([[ |
| 80 | + void test() { |
| 81 | + BrotliEncoderState* s = BrotliEncoderCreateInstance(NULL, NULL, NULL); |
| 82 | + BrotliEncoderDestroyInstance(s); |
| 83 | + } |
| 84 | + ]], {includes = "brotli/encode.h"})) |
| 85 | + end) |
0 commit comments