|
| 1 | +let { subsetOf, BuildSpec, Local, OutputBin, OutputData, OutputLib, Source, Test, .. } = import "minimal.ncl" in |
| 2 | + |
| 3 | +let version = "1.83.0" in |
| 4 | + |
| 5 | +let base = import "../base/build.ncl" in |
| 6 | +let binutils = import "../binutils/build.ncl" in |
| 7 | +let cmake = import "../cmake/build.ncl" in |
| 8 | +let gcc = import "../gcc/build.ncl" in |
| 9 | +let glibc = import "../glibc/build.ncl" in |
| 10 | +let linux_headers = import "../linux_headers/build.ncl" in |
| 11 | +let make = import "../make/build.ncl" in |
| 12 | +let toolchain = import "../toolchain/build.ncl" in |
| 13 | + |
| 14 | +let abseil-cpp = import "../abseil-cpp/build.ncl" in |
| 15 | +let c-ares = import "../c-ares/build.ncl" in |
| 16 | +let openssl = import "../openssl/build.ncl" in |
| 17 | +let protobuf = import "../protobuf/build.ncl" in |
| 18 | +let re2 = import "../re2/build.ncl" in |
| 19 | +let zlib = import "../zlib/build.ncl" in |
| 20 | +let python = import "../python/build.ncl" in |
| 21 | + |
| 22 | +{ |
| 23 | + name = "grpc", |
| 24 | + |
| 25 | + build_deps = [ |
| 26 | + { file = "build.sh" } | Local, |
| 27 | + { |
| 28 | + url = "https://github.com/grpc/grpc/archive/refs/tags/v%{version}.tar.gz", |
| 29 | + sha256 = "90d453393a9d41215df546103b10b33b9566df79cdf6f49dc67f6c4d044d090d", |
| 30 | + extract = true, |
| 31 | + strip_prefix = "grpc-%{version}", |
| 32 | + } | Source, |
| 33 | + base, |
| 34 | + toolchain, |
| 35 | + make, |
| 36 | + cmake, |
| 37 | + abseil-cpp, |
| 38 | + c-ares, |
| 39 | + openssl, |
| 40 | + protobuf, |
| 41 | + re2, |
| 42 | + zlib, |
| 43 | + ], |
| 44 | + |
| 45 | + runtime_deps = [ |
| 46 | + glibc, |
| 47 | + subsetOf gcc ["libgcc", "libstdcpp"], |
| 48 | + abseil-cpp, |
| 49 | + c-ares, |
| 50 | + openssl, |
| 51 | + protobuf, |
| 52 | + re2, |
| 53 | + zlib, |
| 54 | + ], |
| 55 | + |
| 56 | + cmd = "./build.sh", |
| 57 | + build_args = { |
| 58 | + include version, |
| 59 | + }, |
| 60 | + |
| 61 | + outputs = { |
| 62 | + bins = { glob = "usr/bin/*" } | OutputBin, |
| 63 | + libs = { glob = "usr/lib/*.so*" } | OutputLib, |
| 64 | + headers = { glob = "usr/include/**" } | OutputData, |
| 65 | + cmake = { glob = "usr/lib/cmake/**" } | OutputData, |
| 66 | + pkgconfig = { glob = "usr/lib/pkgconfig/**" } | OutputData, |
| 67 | + roots = { glob = "usr/share/grpc/roots.pem" } | OutputData, |
| 68 | + }, |
| 69 | + |
| 70 | + attrs = { |
| 71 | + upstream_version = version, |
| 72 | + source_provenance = { |
| 73 | + category = 'GithubRepo, |
| 74 | + owner = "grpc", |
| 75 | + repo = "grpc", |
| 76 | + }, |
| 77 | + }, |
| 78 | + |
| 79 | + tests = { |
| 80 | + link_and_run = |
| 81 | + { |
| 82 | + class = 'Standalone, |
| 83 | + test_deps = [base, toolchain, binutils, linux_headers], |
| 84 | + cmds = [ |
| 85 | + ["/bin/bash", "-c", "echo '#include <grpc/grpc.h>\nint main() { grpc_init(); grpc_shutdown(); return 0; }' > test.c"], |
| 86 | + ["/bin/gcc", "test.c", "-lgrpc", "-o", "test"], |
| 87 | + ["./test"], |
| 88 | + ], |
| 89 | + } | Test, |
| 90 | + plugin_check = |
| 91 | + { |
| 92 | + class = 'Standalone, |
| 93 | + test_deps = [base], |
| 94 | + cmds = [ |
| 95 | + ["/bin/bash", "-c", "for p in cpp csharp node objective_c php python ruby; do command -v grpc_${p}_plugin > /dev/null || exit 1; done"], |
| 96 | + ], |
| 97 | + } | Test, |
| 98 | + proto_compile = |
| 99 | + { |
| 100 | + class = 'Standalone, |
| 101 | + test_deps = [base, toolchain, binutils, protobuf, python, linux_headers], |
| 102 | + cmds = [ |
| 103 | + ["/bin/bash", "-c", "echo 'syntax = \"proto3\"; package test; service Echo { rpc Ping (Message) returns (Message) {} } message Message { string body = 1; }' > test.proto"], |
| 104 | + ["/bin/bash", "-c", "protoc --cpp_out=. test.proto"], |
| 105 | + ["/bin/bash", "-c", "for p in cpp csharp node objective_c php python ruby; do protoc --plugin=protoc-gen-grpc_${p}=$(command -v grpc_${p}_plugin) --grpc_${p}_out=. test.proto; done"], |
| 106 | + ["/bin/bash", "-c", "g++ -c test.pb.cc test.grpc.pb.cc -std=c++17"], |
| 107 | + ], |
| 108 | + } | Test, |
| 109 | + }, |
| 110 | +} | BuildSpec |
0 commit comments