pull/18/head
ruki 6 years ago
parent f2068e7018
commit e25ba1dd98
No known key found for this signature in database
GPG Key ID: 33341DF9719963FA
  1. 9
      packages/p/protobuf-cpp/xmake.lua
  2. 49
      packages/p/protoc/xmake.lua

@ -1,28 +1,25 @@
package("protobuf-cpp")
set_homepage("https://developers.google.com/protocol-buffers/")
set_description("Google's data interchange format")
set_description("Google's data interchange format for cpp")
add_urls("https://github.com/protocolbuffers/protobuf/releases/download/v$(version)/protobuf-cpp-$(version).zip")
add_versions("3.8.0", "91ea92a8c37825bd502d96af9054064694899c5c7ecea21b8d11b1b5e7e993b5")
add_deps("protoc")
if is_plat("windows") then
add_deps("cmake")
end
add_links("protobuf")
on_load(function (package)
package:addenv("PATH", "bin")
end)
on_install("windows", function (package)
os.cd("cmake")
import("package.tools.cmake").install(package)
end)
on_install("linux", "macosx", function (package)
import("package.tools.autoconf").install(package)
import("package.tools.autoconf").install(package, {"--enable-shared=no"})
end)
on_test(function (package)

@ -0,0 +1,49 @@
package("protoc")
set_kind("binary")
set_homepage("https://developers.google.com/protocol-buffers/")
set_description("Google's data interchange format compiler")
if is_host("windows") then
if is_arch("x64") then
add_urls("https://github.com/protocolbuffers/protobuf/releases/download/v$(version)/protoc-$(version)-win64.zip")
add_versions("3.8.0", "ac07cd66824f93026a796482dc85fa89deaf5be1b0e459de9100cff2992e6905")
else
add_urls("https://github.com/protocolbuffers/protobuf/releases/download/v$(version)/protoc-$(version)-win32.zip")
add_versions("3.8.0", "93c5b7efe418b539896b2952ab005dd81fa418b76abee8c4341b4796b391999e")
end
elseif is_host("macosx") then
if is_arch("x86_64") then
add_urls("https://github.com/protocolbuffers/protobuf/releases/download/v$(version)/protoc-$(version)-osx-x86_64.zip")
add_versions("3.8.0", "8093a79ca6f22bd9b178cc457a3cf44945c088f162e237b075584f6851ca316c")
else
add_urls("https://github.com/protocolbuffers/protobuf/releases/download/v$(version)/protoc-$(version)-osx-x86_32.zip")
add_versions("3.8.0", "14376f58d19a7579c43ee95d9f87ed383391d695d4968107f02ed226c13448ae")
end
else
add_urls("https://github.com/protocolbuffers/protobuf/releases/download/v$(version)/protobuf-cpp-$(version).zip")
add_versions("3.8.0", "91ea92a8c37825bd502d96af9054064694899c5c7ecea21b8d11b1b5e7e993b5")
end
on_install("@windows", "@macosx", function (package)
os.cp("bin", package:installdir())
os.cp("include", package:installdir())
end)
on_install("@linux", function (package)
import("package.tools.autoconf").install(package, {"--enable-shared=no", "--enable-static=no"})
end)
on_test(function (package)
io.writefile("test.proto", [[
syntax = "proto3";
package test;
message TestCase {
string name = 4;
}
message Test {
repeated TestCase case = 1;
}
]])
os.vrun("protoc test.proto --cpp_out=.")
end)
Loading…
Cancel
Save