From e438bb8ffa9f1bf03d57c1ec723506a95cba8ab4 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 29 Aug 2021 16:17:02 +0300 Subject: work on packaging bazel --- gn/packages/bazel.scm | 785 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 785 insertions(+) create mode 100644 gn/packages/bazel.scm (limited to 'gn/packages/bazel.scm') diff --git a/gn/packages/bazel.scm b/gn/packages/bazel.scm new file mode 100644 index 0000000..07d1dbd --- /dev/null +++ b/gn/packages/bazel.scm @@ -0,0 +1,785 @@ +(define-module (gn packages bazel) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix utils) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix git-download) + #:use-module (guix build-system ant) + #:use-module (guix build-system gnu) + #:use-module (gnu packages backup) + #:use-module (gnu packages) + #:use-module (gnu packages base) + #:use-module (gnu packages bootstrap) + #:use-module (gnu packages compression) + #:use-module (gnu packages elf) + #:use-module (gnu packages gcc) + #:use-module (gnu packages java) + #:use-module (gnu packages java-compression) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages protobuf) + #:use-module (gnu packages python) + #:use-module (gnu packages rpc) + #:use-module (gnu packages web) + #:use-module (gn packages java) + ) + +(define-public bazel + (package + (name "bazel") + (version "3.7.2") + (source (origin + (method url-fetch/zipbomb) + (uri (string-append "https://github.com/bazelbuild/bazel/" + "releases/download/" version "/bazel-" + version "-dist.zip")) + (sha256 + (base32 + "1cfrbs23lg0jnl22ddylx3clcjw7bdpbix7r5lqibab346s5n9fy")) + (patches (search-patches + "bazel-workspace.patch" + )) + )) + (build-system gnu-build-system) + (arguments + `( + #:tests? #f + #:make-flags '("EXTRA_BAZEL_ARGS=\"--host_javabase=@local_jdk//:jdk\"") + #:phases + (modify-phases %standard-phases + (delete 'configure) + (add-before 'build 'pre-build + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (jdk (assoc-ref inputs "jdk")) + ;(HOME (string-append (getcwd) "/" ,name)) + (HOME (getcwd)) + (bazelrc (string-append HOME "/user.bazelrc")) + (srcdeps (string-append HOME "/srcdeps")) + ) + (setenv "HOME" HOME) + (setenv "PROTOC" (string-append (assoc-ref inputs "protobuf") + "/bin/protoc")) + (with-output-to-file bazelrc + (lambda _ + (format #t + "~@ + --noremote_accept_cached~@ + --verbose_failures~@ + --subcommands~@ + --compilation_mode dbg~@ + --action_env=CCACHE_DISABLE~@ + --action_env=CCACHE_TEMPDIR~@ + --sandbox_debug~@ + --sandbox_writable_path=${CCACHE_TEMPDIR}~@ + --override_repository=com_google_protobuf=${CURDIR}/tools/distributions/debian/protobuf~@ + --override_repository=remote_java_tools_linux=${CURDIR}/mock_repos/remote_java_tools_linux~@ + --override_repository=bazel_skylib=${CURDIR}/mock_repos/bazel_skylib~@ + --override_repository=io_bazel_skydoc=${CURDIR}/mock_repos/bazel_skydoc~@ + --override_repository=rules_pkg=${CURDIR}/mock_repos/rules_pkg~@ + --override_repository=rules_cc=${CURDIR}/mock_repos/rules_cc~@ + --override_repository=rules_java=${CURDIR}/mock_repos/rules_java~@ + --override_repository=rules_proto=${CURDIR}/mock_repos/rules_proto~@ + --override_repository=platforms=${CURDIR}/mock_repos/platforms~@ + --distinct_host_configuration=false~@ + ~@ + startup --server_javabase=~a~@ + startup --batch~@ + #build --distdir=distdir~@ + #fetch --distdir=distdir~@ + #query --distdir=distdir~@ + #build --verbose_failure~@ + build --color=yes~@ + build --action_env=PATH=~a~@ + build --action_env=PYTHON_LIB_PATH=~a~@ + build --define=PREFIX=~a~@ + build --host_javabase='@local_jdk//:jdk'~%" + jdk + (getenv "PATH") (getenv "PYTHONPATH") out))) + (newline) + (invoke "cat" bazelrc) + (newline) + + (substitute* ".bazelrc" + (("PREFIX=/usr") (string-append "PREFIX=" out))) + + ;; Use the local javac. + (substitute* '( + "src/java_tools/buildjar/BUILD" + "src/java_tools/buildjar/java/com/google/devtools/build/buildjar/BUILD" + "src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/plugins/BUILD" + "src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/statistics/BUILD" + "src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac/BUILD" + ) + ((".*//third_party/java/jdk/langtools:javac.*") "")) + + #t))) + ;(add-after 'unpack 'plop-vendored-tarballs + ; (lambda* (#:key inputs #:allow-other-keys) + ; (mkdir "distdir") + ; (copy-file (assoc-ref inputs "bazel_toolchains") + ; "distdir/bazel-toolchains-3.1.0.tar.gz") + ; #t)) + (add-after 'patch-source-shebangs 'patch-more-shebangs + (lambda _ + (substitute* '( + "tools/build_rules/test_rules.bzl" + "tools/cpp/cc_toolchain_config.bzl" + ) + (("/bin/bash") (which "bash"))) + (substitute* "tools/cpp/cc_toolchain_config.bzl" + (("/usr/bin/ar") (which "ar")) + (("/usr/bin/ld") (which "ld")) + (("/usr/bin/cpp") (which "cpp")) + ;(("/usr/bin/dwp") (which "dwp")) + (("/usr/bin/gcc") (which "gcc")) + (("/usr/bin/gcov") (which "gcov")) + (("/usr/bin/nm") (which "nm")) + (("/usr/bin/objcopy") (which "objcopy")) + (("/usr/bin/objdump") (which "objdump")) + (("/usr/bin/strip") (which "strip")) + ) + (substitute* "src/main/tools/BUILD" + (("-lm") "-lm '-lgcc")) + #t)) + (replace 'build + (lambda* (#:key inputs #:allow-other-keys) + (setenv "BAZEL_SH" (which "bash")) + (setenv "CC" ,(cc-for-target)) + + (setenv "BAZEL_JAVAC_OPTS" "-J-Xmx4096m") + ;(setenv "BAZEL_JAVAC_OPTS" "-J-Xmx2g -J-Xms200m") + + (setenv "EXTRA_BAZEL_ARGS" "--host_javabase=@local_jdk//:jdk") + (setenv "VERBOSE" "1") + (setenv "JAVA_HOME" (assoc-ref inputs "jdk")) + ;(invoke "bazel" "build" "//src:bazel") + (invoke "./compile.sh") + )) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((bin (string-append (assoc-ref outputs "out") "/bin"))) + (mkdir-p bin) + (install-file "output/bazel" bin) + #t))) + ) + )) + (native-inputs + `( + ("bazel" ,bazel-bootstrap) + ("jdk" ,openjdk11 "jdk") + ("protobuf" ,protobuf) + ("python" ,python-wrapper) + ("unzip" ,unzip) + ("which" ,which) + + ("java-commons-collections" ,java-commons-collections) + ("java-commons-compress" ,java-commons-compress) + ("java-commons-lang" ,java-commons-lang3) + ("java-commons-logging-minimal" ,java-commons-logging-minimal) + ("java-commons-pool" ,java-commons-pool) + ("java-dd-plist" ,java-dd-plist) + ("java-diff-utils" ,java-diff-utils) + ;("java-error-prone" ,java-error-prone) + ("java-escapevelocity" ,java-escapevelocity) + ;; libgeronimo-annotation-1.3-spec-java + ;; libgoogle-api-client-java + ;; libgoogle-auth-java + ;; libgoogle-auto-common-java + ;; libgoogle-auto-service-java + ;; libgoogle-auto-value-java + ;; libgoogle-flogger-java + ;; libgoogle-gson-java + ;; libgoogle-http-client-java + ;; ("grpc-java" ,grpc-java) + ("java-guava" ,java-guava-25) + ("java-fasterxml-jackson-core" ,java-fasterxml-jackson-core) ; fasterxml? + ;; libjacoco-java + ("java-jarjar" ,java-jarjar) + ;; libjava-allocation-instrumenter-java + ("java-javapoet" ,java-javapoet) + ("java-jaxb-api" ,java-javax-xml-bind) + ("java-jcip-annotations" ,java-jcip-annotations) + ("java-jcommander" ,java-jcommander) + ("java-jformatstring" ,java-jformatstring) + ("java-jsr305" ,java-jsr305) + ;; libnetty-tcnative-java + ;; libopencensus-java + ;; libproguard-java + ("java-protobuf" ,java-protobuf) + ("java-tomcat" ,java-tomcat) + ("java-truth" ,java-truth) + ("java-xz" ,java-xz) + + ;; protobuf-compiler-grpc + ;; protobuf-compiler-grpc-java-plugin + + + ;("bazel_toolchains" + ; ,(origin + ; (method url-fetch) + ; (uri "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/releases/download/3.1.0/bazel-toolchains-3.1.0.tar.gz") + ; (file-name "bazel-toolchains-3.1.0.tar.gz") + ; (sha256 + ; (base32 + ; "1wha3nmnszkk1wgaa4p9rfgmx5aa7c9ffs3d79m8d8y7w4im8svj")))) + )) + (home-page "https://bazel.build/") + (synopsis "") + (description "") + (license license:asl2.0))) + +(define-public bazel-bootstrap + (package + (name "bazel-bootstrap") + (version "3.7.2") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/bazelbuild/bazel/" + "releases/download/" version + "/bazel-" version "-linux-x86_64")) + (sha256 + (base32 + "03gwwka4m1cn95nzc0bmjwqshdlh9m32v8r554rksk4a37p0pp3h")))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f + #:strip-binaries? #f + #:phases + (modify-phases %standard-phases + (delete 'unpack) + (delete 'configure) + (replace 'build + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((binary (assoc-ref inputs "source")) + (out (assoc-ref outputs "out")) + (libc (assoc-ref inputs "libc")) + (ld-so (string-append libc ,(glibc-dynamic-linker))) + (rpath (string-append (assoc-ref inputs "gcc:lib") "/lib"))) + (copy-file binary "bazel") + (system "chmod 755 bazel") + (invoke "patchelf" "--set-rpath" rpath "bazel") + (invoke "patchelf" "--set-interpreter" ld-so "bazel")) + #t)) + ;; THIS NEEDS NETWORK ACCESS + ;(replace 'install-license-files + ; (lambda* (#:key outputs #:allow-other-keys) + ; (let* ((out (assoc-ref outputs "out")) + ; (bazel (string-append out "/bin/bazel")) + ; (license (string-append out "/share/doc/" + ; ,name "-" ,version "/LICENSE"))) + ; (setenv "HOME" (getcwd)) + ; (mkdir-p (dirname license)) + ; (call-with-output-file license + ; (lambda _ + ; (invoke bazel "license"))) + ; #t))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) + (install-file "bazel" bin) + #t)))))) + (native-inputs + `(("patchelf" ,patchelf))) + (inputs + `(("gcc:lib" ,(canonical-package gcc) "lib"))) + (propagated-inputs + `(("jdk" ,openjdk11 "jdk"))) + (home-page "https://bazel.build/") + (synopsis "Build and test software of any size, quickly and reliably") + (description "Bazel is a build tool that builds code quickly and reliably. +It is used to build the majority of Google's software, and thus it has been +designed to handle build problems present in Google's development environment.") + (supported-systems '("x86_64-linux")) + (license license:asl2.0))) + +(define-public bazel-bootstrap-3.1 + (package + (inherit bazel-bootstrap) + (name "bazel-bootstrap") + (version "3.1.0") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/bazelbuild/bazel/" + "releases/download/" version + "/bazel-" version "-linux-x86_64")) + (sha256 + (base32 + "1jpdah6qr7n1mpld6yilv5yic7jy8bfiy7g2bk7nc0kkzbs38d3m")))))) + +(define-public bazel-0.29 + (package + (name "bazel") + (version "0.29.1") + (source (origin + (method url-fetch/zipbomb) + (uri (string-append "https://github.com/bazelbuild/bazel/" + "releases/download/" version + "/bazel-" version "-dist.zip")) + (sha256 + (base32 + "1rcd6xy61n07n7m6dgcw23275r8z3gkwmqdkd48nwrq8yb7m4al7")))) + (build-system gnu-build-system) + (arguments + `( + #:tests? #f + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'plop-vendored-tarballs + (lambda* (#:key inputs #:allow-other-keys) + (mkdir "distdir") + (copy-file (assoc-ref inputs "remotejdk11_linux") + "distdir/zulu11.2.3-jdk11.0.1-linux_x64.tar.gz") + #t)) + (delete 'configure) + (add-before 'build 'pre-build + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (jdk (assoc-ref inputs "jdk")) + ;(HOME (string-append (getcwd) "/" ,name)) + (HOME (getcwd)) + (bazelrc (string-append HOME "/bazel-rc")) + (srcdeps (string-append HOME "/srcdeps")) + ) + (setenv "HOME" HOME) + (with-output-to-file bazelrc + (lambda _ + (format #t + "startup --server_javabase=~a~@ + startup --batch~@ + build --distdir=distdir~@ + fetch --distdir=distdir~@ + query --distdir=distdir~@ + build --verbose_failure~@ + build --color=yes~@ + build --action_env=PATH=~a~@ + build --action_env=PYTHON_LIB_PATH=~a~@ + build --define=PREFIX=~a~@ + build --host_javabase='@local_jdk//:jdk'~%" + jdk + (getenv "PATH") (getenv "PYTHONPATH") out))) + + (define (append-to-bazelrc body) + (let ((file (open-file ".bazelrc" "a"))) + (display body file) + (close-port file))) + (make-file-writable ".bazelrc") + (append-to-bazelrc "\n\n\n") + ;(append-to-bazelrc "startup --batch\n") + (append-to-bazelrc (string-append "startup --server_javabase=" (assoc-ref inputs "jdk") "\n")) + (append-to-bazelrc "build --distdir=distdir\n") + (append-to-bazelrc "fetch --distdir=distdir\n") + (append-to-bazelrc "query --distdir=distdir\n") + (append-to-bazelrc (string-append "build --override_repository=remotejdk11_linux=" (assoc-ref inputs "jdk11") "\n")) + (append-to-bazelrc "build --host_javabase='@local_jdk//:jdk\n") + + (newline) + (invoke "tail" ".bazelrc") + (newline) + (newline) + (newline) + (invoke "cat" bazelrc) + (newline) + + (substitute* ".bazelrc" + (("PREFIX=/usr") (string-append "PREFIX=" out))) + + #t))) + (replace 'build + (lambda* (#:key inputs outputs #:allow-other-keys) + (setenv "PROTOC" (string-append (assoc-ref inputs "protobuf") + "/bin/protoc")) + (invoke "sh" "compile.sh" "bootstrap") + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) + (install-file "output/bazel" bin) + #t))) + ))) + (native-inputs + `( + ("jdk" ,icedtea-8 "jdk") + ("jdk11" ,openjdk11 "jdk") + ("protobuf" ,protobuf) + ("unzip" ,unzip) + ("python" ,python-2) + ("which" ,which) + + ("remotejdk11_linux" + ,(origin + (method url-fetch) + (uri "https://mirror.bazel.build/openjdk/azul-zulu11.2.3-jdk11.0.1/zulu11.2.3-jdk11.0.1-linux_x64.tar.gz") + (sha256 + (base32 "0x9anw7bbwp9yai4r1biwcrwcymycg1kqz1bb296xlph24siqar3")))) + )) + (home-page "https://bazel.build/") + (synopsis "Build and test software of any size, quickly and reliably") + (description "Bazel is a build tool that builds code quickly and reliably. +It is used to build the majority of Google's software, and thus it has been +designed to handle build problems present in Google's development environment.") + (license license:asl2.0))) + +(define-public bazel-0.4 + (package + (name "bazel") + (version "0.4.5") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/bazelbuild/bazel") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "182r6ybajhkmkbcx2dq6p8cn2mym2lzd61h99vpx6whldrs1sqfs")))) + (build-system gnu-build-system) + (arguments + `( + #:tests? #f + #:phases + (modify-phases %standard-phases + (delete 'configure) + (add-before 'build 'pre-build + (lambda* (#:key inputs #:allow-other-keys) + (with-directory-excursion "third_party/grpc" + ;(invoke "ls" "-la") + ;(substitute* "compiler/src/java_plugin/cpp/java_generator.h" + ; (("iostream") "iostream.h")) + ;(apply invoke "gcc" + ; (list + ; "-o" "cpp_plugin" + ; ;"-Iinclude" + ; "-I." + ; "-Iinclude/grpc/include" + ; "-Iinclude/grpc" + ; (string-append "-I" (assoc-ref inputs "protobuf") "/include") "-pthread" + ; (string-append "-L" (assoc-ref inputs "protobuf") "/lib") "-lprotobuf-lite" + ; "src/compiler/config.h" + ; "src/compiler/cpp_generator.cc" + ; "src/compiler/cpp_generator.h" + ; "src/compiler/cpp_generator_helpers.h" + ; "src/compiler/cpp_plugin.cc" + ; "src/compiler/generator_helpers.h" + ; ) + ; ) + + (apply invoke "gcc" + (cons* + "-w" + "-o" "grpc-java-plugin" + ;"-Iinclude" + ;(string-append "-I" (assoc-ref inputs "pybind11") "/include/pybind11") + ;(string-append "-I" (assoc-ref inputs "python") "/include/python2.7") + (string-append "-I" (assoc-ref inputs "protobuf") "/include") "-pthread" + (string-append "-L" (assoc-ref inputs "protobuf") "/lib") "-lprotobuf-lite" + (find-files "compiler/src/java_plugin/cpp") + ;(find-files "src/compiler") + ) + ) + ) + #t)) + (replace 'build + (lambda* (#:key inputs outputs #:allow-other-keys) + (setenv "PROTOC" (string-append (assoc-ref inputs "protobuf") + "/bin/protoc")) + (setenv "GRPC_JAVA_PLUGIN" "third_party/grpc/grpc-java-plugin") + (invoke "ls" "-la" "third_party/grpc/") + (invoke "sh" "compile.sh" "bootstrap") + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) + (install-file "bazel" bin) + #t))) + ))) + (native-inputs + `( + ;("boost" ,(@ (gnu packages boost) boost)) + ("jdk" ,icedtea-8 "jdk") + ("protobuf" ,protobuf) + ("python" ,python-2) + ;("pybind11" ,(@ (gnu packages python-xyz) pybind11)) + ("which" ,which) + )) + (home-page "https://bazel.build/") + (synopsis "Build and test software of any size, quickly and reliably") + (description "Bazel is a build tool that builds code quickly and reliably. +It is used to build the majority of Google's software, and thus it has been +designed to handle build problems present in Google's development environment.") + (license license:asl2.0))) + +(define-public bazel-0.3 + (package + (name "bazel") + (version "0.3.2") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/bazelbuild/bazel") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "085cjz0qhm4a12jmhkjd9w3ic4a67035j01q111h387iklvgn6xg")))) + (build-system gnu-build-system) + (arguments + `( + #:tests? #f + #:parallel-build? #f + #:phases + (modify-phases %standard-phases + (delete 'configure) + (replace 'build + (lambda* (#:key inputs outputs #:allow-other-keys) + (setenv "PROTOC" (string-append (assoc-ref inputs "protobuf") + "/bin/protoc")) + (invoke "ls" "-la" "third_party/grpc/") + (setenv "GRPC_JAVA_PLUGIN" "third_party/grpc/protoc-gen-grpc-java-0.15.0-linux-x86_64.exe") + (invoke "sh" "compile.sh" "bootstrap") + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) + (install-file "bazel" bin) + #t))) + ))) + (native-inputs + `( + ;("grpc-java" ,grpc-java) + ("jdk" ,icedtea-8 "jdk") + ("protobuf" ,protobuf) + ("python" ,python-2) + ("which" ,which) + )) + (home-page "https://bazel.build/") + (synopsis "Build and test software of any size, quickly and reliably") + (description "Bazel is a build tool that builds code quickly and reliably. +It is used to build the majority of Google's software, and thus it has been +designed to handle build problems present in Google's development environment.") + (license license:asl2.0))) + +(define-public bazel-0.2 + (package + (name "bazel") + (version "0.2.3") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/bazelbuild/bazel") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "13mikylcnfpm79zxpc5g776vj83z441plm8sw8zr8cjgx3m1rkmf")))) + (build-system gnu-build-system) + (arguments + `( + #:tests? #f + #:phases + (modify-phases %standard-phases + (delete 'configure) + (replace 'build + (lambda* (#:key inputs outputs #:allow-other-keys) + (setenv "PROTOC" (string-append (assoc-ref inputs "protobuf") + "/bin/protoc")) + (invoke "sh" "compile.sh" "bootstrap") + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) + (install-file "bazel" bin) + #t))) + ))) + (native-inputs + `( + ("jdk" ,icedtea-8 "jdk") + ("protobuf" ,protobuf) + ("python" ,python-2) + ("which" ,which) + )) + (home-page "https://bazel.build/") + (synopsis "Build and test software of any size, quickly and reliably") + (description "Bazel is a build tool that builds code quickly and reliably. +It is used to build the majority of Google's software, and thus it has been +designed to handle build problems present in Google's development environment.") + (license license:asl2.0))) + +(define-public bazel-0.1 + (package + (name "bazel") + (version "0.1.5") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/bazelbuild/bazel") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1xxin296x34phpdflnhsd1ckag2vl04srhywml4b4a4il496x9wl")))) + (build-system gnu-build-system) + (arguments + `( + #:tests? #f + #:phases + (modify-phases %standard-phases + (delete 'configure) + (replace 'build + (lambda* (#:key inputs outputs #:allow-other-keys) + (setenv "PROTOC" (string-append (assoc-ref inputs "protobuf") + "/bin/protoc")) + (setenv "JAVA_HOME" (assoc-ref inputs "jdk")) + (invoke "sh" "compile.sh" "bootstrap") + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) + (install-file "bazel" bin) + #t))) + ))) + (native-inputs + `( + ("jdk" ,icedtea-8 "jdk") + ("protobuf" ,protobuf) + ("python" ,python-2) + ("unzip" ,unzip) + ("which" ,which) + )) + (home-page "https://bazel.build/") + (synopsis "Build and test software of any size, quickly and reliably") + (description "Bazel is a build tool that builds code quickly and reliably. +It is used to build the majority of Google's software, and thus it has been +designed to handle build problems present in Google's development environment.") + (license license:asl2.0))) + +(define-public bazel-0.0 + (let ((commit "d08b27fa9701fecfdb69e1b0d1ac2459efc2129b")) + (package + (name "bazel") + (version (git-version "0.0.0" "0" commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/bazelbuild/bazel") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0qj7iyb9ybcgfyn9m1kqm4q7r82ai8jsdgmdblwdhk4mdbxsyl2r")))) + (build-system gnu-build-system) + (arguments + `( + #:tests? #f + #:phases + (modify-phases %standard-phases + (delete 'configure) + (replace 'build + (lambda* (#:key inputs outputs #:allow-other-keys) + (setenv "PROTOC" (string-append (assoc-ref inputs "protobuf") + "/bin/protoc")) + (setenv "JAVA_HOME" (assoc-ref inputs "jdk")) + (setenv "JNILIB" (string-append (assoc-ref inputs "libunix.so") "/lib/libunix.so")) + (invoke "sh" "compile.sh") + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) + (install-file "bazel" bin) + #t))) + ))) + (native-inputs + `( + ("jdk" ,icedtea-8 "jdk") + ;("linux-libre-headers" ,(@ (gnu packages linux) linux-libre-headers)) + ("libarchive" ,libarchive) + ("libunix.so" ,java-cisd-base-with-libs) + ("pkg-config" ,pkg-config) + ("protobuf" ,protobuf-2) + ;("python" ,python) + ("which" ,which) + )) + (home-page "https://bazel.build/") + (synopsis "Build and test software of any size, quickly and reliably") + (description "Bazel is a build tool that builds code quickly and reliably. +It is used to build the majority of Google's software, and thus it has been +designed to handle build problems present in Google's development environment.") + (license license:asl2.0)))) + +(define java-cisd-base-with-libs + (package + (inherit java-cisd-base) + (arguments + (substitute-keyword-arguments (package-arguments java-cisd-base) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'install 'install-shared-libs + (lambda* (#:key outputs #:allow-other-keys) + (let ((lib (string-append (assoc-ref outputs "out") "/lib"))) + (install-file "source/c/libunix.so" lib) + (install-file "source/c/libnativedata.so" lib) + #t))))))))) + +;(define grpc-java +; (package +; (inherit grpc) +; (native-inputs +; `(("jdk" ,icedtea-8 "jdk") +; ,@(package-native-inputs grpc))))) + +(define-public grpc-java + (package + (name "grpc-java") + (version "1.26.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/grpc/grpc-java") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1m0wxd46ha4501078xp54dbshri4vmysv07qzaz85c63izw7yjva")))) + (build-system ant-build-system) + (arguments + `(#:tests? #f + #:jar-name "grpc.jar" + #:jdk ,openjdk9 + #:source-dir "core/src/main" + )) + (native-inputs + `( + ("java-animal-sniffer" ,java-animal-sniffer) + ;("java-error-prone" ,java-error-prone) + ;; libgeronimo-annotation-1.3-spec-java + ;; libgoogle-auth-java + ;; libgoogle-common-protos-java + ;; libgoogle-gson-java + ;; libgoogle-perftools-dev + ;; libgradle-plugins-java + ("java-guava" ,java-guava-25) + ;; libjacoco-java + ("java-jsr305" ,java-jsr305) + ;; libopencensus-java + ;; libperfmark-java + ;; libprotobuf-java + ;; protobuf-compiler-grpc + + ("java-protobuf" ,java-protobuf) + ("protobuf" ,protobuf) + )) + (home-page "https://github.com/grpc/grpc-java") + (synopsis "Java gRPC implementation") + (description "gRPC is a modern high performance @acronym{Remote Procedure +Call, RPC} framework that can run in any environment. It can efficiently +connect services in and across data centers with pluggable support for load +balancing, tracing, health checking and authentication. It is also applicable +in last mile of distributed computing to connect devices, mobile applications +and browsers to backend services.") + (license license:asl2.0))) -- cgit v1.2.3