diff options
Diffstat (limited to 'gn')
-rw-r--r-- | gn/packages/bazel.scm | 785 | ||||
-rw-r--r-- | gn/packages/tensorflow.scm | 302 |
2 files changed, 1087 insertions, 0 deletions
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))) diff --git a/gn/packages/tensorflow.scm b/gn/packages/tensorflow.scm new file mode 100644 index 0000000..b20ad4f --- /dev/null +++ b/gn/packages/tensorflow.scm @@ -0,0 +1,302 @@ +(define-module (gn packages tensorflow) + #: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 gnu) + #:use-module (gn packages bazel) + #:use-module (gnu packages assembly) + #:use-module (gnu packages base) + #:use-module (gnu packages commencement) + #:use-module (gnu packages compression) + #:use-module (gnu packages curl) + #:use-module (gnu packages databases) + #:use-module (gnu packages gcc) + #:use-module (gnu packages icu4c) + #:use-module (gnu packages image) + #:use-module (gnu packages maths) + #:use-module (gnu packages mpi) + #:use-module (gnu packages pcre) + #:use-module (gnu packages protobuf) + #:use-module (gnu packages python) + #:use-module (gnu packages python-xyz) + #:use-module (gnu packages rpc) + #:use-module (gnu packages regex) + #:use-module (gnu packages serialization) + #:use-module (gnu packages sqlite) + #:use-module (gnu packages version-control)) + +(define-public tensorflow + (package + (name "tensorflow") + (version "2.4.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/tensorflow/tensorflow") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0yl06aypfxrcs35828xf04mkidz1x0j89v0q5h4d2xps1cb5rv3f")))) + (build-system gnu-build-system) + (arguments + `( + #:tests? #f ; Worry about this later. + #: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)) + (bazelrc (string-append HOME "/bazelrc")) + (srcdeps (string-append HOME "/srcdeps")) + ) + (setenv "HOME" HOME) + (with-output-to-file bazelrc + (lambda _ + (format #t + "startup --server_javabase=~a~@ + startup --batch~@ + build --define=-copt=\"-Wl,-rpath -Wl,~a/lib\"~@ + 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 (assoc-ref inputs "gcc:lib") (getenv "PATH") (getenv "PYTHONPATH") out))) + (newline) + (invoke "cat" bazelrc) + (newline) + + (substitute* ".bazelrc" + (("PREFIX=/usr") (string-append "PREFIX=" out))) + + ;; Use the pre-downloaded files + (substitute* "WORKSPACE" + (("\\\".*github.com/bazelbuild/rules_closure/.*.tar.gz") + (string-append "\"file://" (assoc-ref inputs "io_bazel_rules_closure"))) + ) + (substitute* "third_party/toolchains/preconfig/generate/archives.bzl" + (("\\\".*github.com/bazelbuild/bazel-toolchains/.*.tar.gz") + (string-append "\"file://" (assoc-ref inputs "bazel_toolchains"))) + ) + (substitute* "tensorflow/workspace.bzl" + (("\\\".*github.com/bazelbuild/rules_swift/.*.tar.gz") + (string-append "\"file://" (assoc-ref inputs "build_bazel_rules_swift"))) + (("\\\".*github.com/googleapis/googleapis/.*.zip") + (string-append "\"file://" (assoc-ref inputs "com_google_googleapis"))) + (("\\\".*github.com/bazelbuild/bazel-skylib/.*.tar.gz") + (string-append "\"file://" (assoc-ref inputs "bazel_skylib"))) + (("\\\".*github.com/bazelbuild/rules_cc/.*.zip") + (string-append "\"file://" (assoc-ref inputs "rules_cc"))) + (("\\\".*github.com/bazelbuild/rules_android/.*.zip") + (string-append "\"file://" (assoc-ref inputs "build_bazel_rules_android"))) + ) + + (substitute* "configure.py" + (("/usr/bin/ldd") (which "ldd"))) + + ;; Lets fix some hardcoded /usr/bins + ;(substitute* "third_party/toolchains/preconfig/generate/generate.bzl" + ; (("/usr/bin/python") + ; (string-append (dirname (or (which "python") + ; (which "python3"))) + ; "/python")) + ; ) + + ;; cpu detection fails, hardcode Linux as OS. + ;(substitute* "third_party/gpus/cuda_configure.bzl" + ; ((".*Linux.*") " if True:\n")) + ;(substitute* "third_party/remote_config/common.bzl" + ; (("uname") (which "uname"))) + + ;(substitute* "third_party/remote_config/common.bzl" + ; ;(("\\\"which\\\"") (string-append "\"" (which "which") "\"")) + ; (("python_bin_path =.*") (string-append "python_bin_path = \"" (which "python") "\"\n")) + ; ) + + ;; Copy sources to one directory + ;(mkdir-p srcdeps) + ;(for-each + ; (lambda (file) + ; (copy-recursively file (string-append srcdeps "/" (strip-store-file-name file)))) + ; (list (assoc-ref inputs "io_bazel_rules_closure"))) + #t))) + (replace 'build + (lambda* (#:key inputs #:allow-other-keys) + (let* ((jdk (assoc-ref inputs "jdk")) + (HOME (string-append (getcwd) "/" ,name)) + (bazelrc (string-append HOME "/bazelrc")) + (srcdeps (string-append HOME "/srcdeps")) + ) + (setenv "TF_SYSTEM_LIBS" (string-append "absl_py," + "astor_archive," + "astunparse_archive," + ;"boringssl," + ;"com_github_googleapis_googleapis," + ;"com_github_googlecloudplatform_google_cloud_cpp," + "com_github_grpc_grpc," + "com_google_protobuf," + "com_googlesource_code_re2," + "curl," + "cython," + "dill_archive," + "double_conversion," + ;"enum34_archive," ; python2 only? + "flatbuffers," + ;"functools32_archive," ; python2 only? + "gast_archive," + "gif," + "hwloc," + "icu," + "jsoncpp_git," + "libjpeg_turbo," + "lmdb," + "nasm," + ;"nsync," + ;"opt_einsum_archive," + "org_sqlite," + ;"pasta," + "pcre," + "png," + "pybind11," + "six_archive," + "snappy," + "tblib_archive," + "termcolor_archive," + "typing_extensions_archive," + "wrapt," + "zlib")) + (setenv "PYTHON_BIN_PATH" (which "python")) + (setenv "GCC_HOST_COMPILER_PATH" (string-append (assoc-ref inputs "gcc-toolchain") "/bin/gcc")) + (setenv "GCC_HOST_COMPILER_PREFIX" (string-append (assoc-ref inputs "gcc-toolchain") "/bin")) + ;(setenv "LD_LIBRARY_PATH" (string-append (assoc-ref inputs "gcc:lib") "/lib")) + (setenv "LD_LIBRARY_PATH" (string-append (assoc-ref inputs "gcc:lib"))) + ;(invoke "python3" "configure.py") + (invoke "./configure") + ;(substitute* ".tf_configure.bazelrc" + ; (("PYTHON_LIB_PATH.*") (string-append "PYTHON_LIB_PATH=\"" (getenv "PYTHONPATH") "\"\n"))) + (invoke "bazel" + (string-append "--bazelrc=" bazelrc) + "build" + ;"--config=opt" + "--config=avx_linux" + ;"//tensorflow:libtensorflow_cc.so" + "//tensorflow/tools/pip_package:build_pip_package" + ;"//tensorflow/tools/lib_package:libtensorflow" + ) + ) + )) + ) + )) + (native-inputs + `( + ("bazel" ,bazel-bootstrap) + ("gcc:lib" ,gcc "lib") + ("gcc-toolchain" ,gcc-toolchain) + ("git" ,git) + ("python" ,python) + ("which" ,which) + + ;; https://github.com/tensorflow/tensorflow/blob/master/third_party/systemlibs/syslibs_configure.bzl + ("absl_py" ,python-absl-py) + ("astor_archive" ,python-astor) + ("astunparse_archive" ,python-astunparse) + ("com_googlesource_code_re2" ,re2) + ("com_google_protobuf" ,protobuf) + ("com_github_grpc_grpc" ,grpc) + ("curl" ,curl) + ("cython" ,python-cython) + ("dill_archive" ,python-dill) + ("double-conversion" ,double-conversion) + ("flatbuffers" ,flatbuffers) + ("gast_archive" ,python-gast) + ("gif" ,giflib) + ("hwloc" ,hwloc) + ("icu" ,icu4c) + ("jsoncpp_git" ,jsoncpp) + ("libjpeg_turbo" ,libjpeg-turbo) + ("lmdb" ,lmdb) + ("nasm" ,nasm) + ("org_sqlite" ,sqlite) + ("pcre" ,pcre2) + ("png" ,libpng) + ("pybind11" ,pybind11) + ("six_archive" ,python-six) + ("snappy" ,snappy) + ("tblib_archive" ,python-tblib) + ("termcolor_archive" ,python-termcolor) + ("typing_extensions_archive" ,python-typing-extensions) + ("wrapt" ,python-wrapt) + ("zlib" ,zlib) + + ("io_bazel_rules_closure" + ,(origin + (method url-fetch) + (uri "https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz") + (file-name "io_bazel_rules_closure.tar.gz") + (sha256 + (base32 + "1abbgk05f9flpv35zzw9fjjdvd3g1d8b0vbk0f2z4wfx10ykh02v")))) + ("bazel_toolchains" + ,(origin + (method url-fetch) + (uri "https://github.com/bazelbuild/bazel-toolchains/archive/92dd8a7a518a2fb7ba992d47c8b38299fe0be825.tar.gz") + (file-name "bazel_toolchains.tar.gz") + (sha256 + (base32 + "1xgyalc8pvy76rghkby28vz5y9ng1qhrqhn817vfwa1ny3wiis48")))) + ("build_bazel_rules_swift" + ,(origin + (method url-fetch) + (uri "https://github.com/bazelbuild/rules_swift/archive/3eeeb53cebda55b349d64c9fc144e18c5f7c0eb8.tar.gz") + (file-name "build_bazel_rules_swift.tar.gz") + (sha256 + (base32 + "11n8fmb5mf2zwgn202p8nmh82c8i1hm90pvajdks65yqvb33p0yh")))) + ("com_google_googleapis" + ,(origin + (method url-fetch) + (uri "https://github.com/googleapis/googleapis/archive/541b1ded4abadcc38e8178680b0677f65594ea6f.zip") + (file-name "com_google_googleapis.zip") + (sha256 + (base32 + "0059835rzfr9mb9x5m6ij7pi1y372qzdqls4a6vg8mf50qdv1fky")))) + ("bazel_skylib" + ,(origin + (method url-fetch) + (uri "https://github.com/bazelbuild/bazel-skylib/releases/download/0.9.0/bazel_skylib-0.9.0.tar.gz") + (file-name "bazel_skylib-0.9.0.tar.gz") + (sha256 + (base32 + "183w7h2cyzlq7q5q86yivzdwafyxvxc5dqii0yvksnhjj5a3dphx")))) + ("rules_cc" + ,(origin + (method url-fetch) + (uri "https://github.com/bazelbuild/rules_cc/archive/01d4a48911d5e7591ecb1c06d3b8af47fe872371.zip") + (file-name "rules_cc.zip") + (sha256 + (base32 + "1ybcjfwjykk7qii17dr640jivxssy1hb3x0hbd65bh461jlpcfyg")))) + ("build_bazel_rules_android" + ,(origin + (method url-fetch) + (uri "https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip") + (file-name "build_bazel_rules_android.zip") + (sha256 + (base32 + "01kqga5xrkchw4kmr60r4m5xmy90zhxh1yb59mp94ndvv1fx21nd")))) + )) + (home-page "https://www.tensorflow.org/") + (synopsis "Machine learning framework") + (description "TensorFlow is a flexible platform for building and training +machine learning models. It provides a library for high performance numerical +computation and includes high level Python APIs, including both a sequential API +for beginners that allows users to build models quickly by plugging together +building blocks and a subclassing API with an imperative style for advanced +research.") + (license license:asl2.0))) |