From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gKe0KPH1omD6JAAAgWs5BA (envelope-from ) for ; Tue, 18 May 2021 01:02:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 2MFkJPH1omAyNQAA1q6Kng (envelope-from ) for ; Mon, 17 May 2021 23:02:09 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9D93481D3 for ; Tue, 18 May 2021 01:02:08 +0200 (CEST) Received: from localhost ([::1]:34166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1limFT-0003j7-Df for larch@yhetil.org; Mon, 17 May 2021 19:02:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1limEw-0003dy-Hs for guix-devel@gnu.org; Mon, 17 May 2021 19:01:34 -0400 Received: from lepiller.eu ([2a00:5884:8208::1]:54934) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1limEp-0000XH-8H for guix-devel@gnu.org; Mon, 17 May 2021 19:01:34 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id fe33f9f8 for ; Mon, 17 May 2021 23:01:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:subject:message-id:mime-version:content-type; s=dkim; bh=q4U pXW1cdD96+PMHMLWSrDptvPSbWC6eyZhQSDSEBko=; b=RrtOKQ7qVMO5dFCKREh fqxYcQ9mLx6wUBWmNYtdHR86xGzRYyW35CbomwJe4Jzy0gyZbYW5h4rS2+SQ6QJi 1PqSaln8slOK3MSn/A2WMMVJALd9ocBMzh6lumrz4il7gAn4m/5TQwhZCRX2hPB1 AIwVvhIyryzuCgoVurL34Y754lHMIv6lJmZ0Qv2gTULOWrF1mnjIY3DWOtsw7UAC xUw0xsL7fo5qFVIJQ1utpbIwYNyaI4VkUqby+CSj7gabpfoxrONWnaHnqtmzM/Fx 7/Q8AVdjfhfM0x287zo2IPHeWcCRwOsZh+Pow4dYIIBI5dk6ReB3aYQJQR3+U5pi a2A== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 46d7e705 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Mon, 17 May 2021 23:01:19 +0000 (UTC) Date: Tue, 18 May 2021 01:01:11 +0200 From: Julien Lepiller To: guix-devel@gnu.org Subject: Scala package Message-ID: <20210518010111.7eea541a@tachikoma.lepiller.eu> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/j/J8RqiM/zag7sZ=SoFlciF" Received-SPF: pass client-ip=2a00:5884:8208::1; envelope-from=julien@lepiller.eu; helo=lepiller.eu X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1621292528; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=qYnFdwiJqMPPBuJ32KtKTSOctvNJnDOkNiA/fIwgSJc=; b=SOD/0C3vFoJd1BwoyC/4+TyqR7UW9P9E2W4z05e7b5wiEvVI8v0TcBYN+1eRa6pVRBGk8H BnjRjtDoFJ5Ou8ii+OaH3Qiu6b/zZf8QuY7UXHs6I1I0WG3FgCcyqcvnAeh2yyCDaIQbnf MTIB0tThwmYjYckespbUNICFts9JQtvweT+/fn3YX61+KTuPllO+jugm8pSWPu6MY3eC8J 1AipNWx3w9Ww/lgOCLlbkQ/oGTNtwlPb3zjKT/F3eV5viTHDnV+oYW6Qb9mh6kFhDqORTf eFiQXKJMZ8U9aUH8+IVoG3o0fPk5NOLEISuF7T4ywLOo6GNX4tjW7agDD4z4fg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1621292528; a=rsa-sha256; cv=none; b=XSErTzBRcpAGrdBwudezaMWMggLvwEbs5REFotdH69bsMiF/LkGuia/bl7LO9YTSKuLb4m /va8PPnYB+FQ/fmctB0Wo3pqAtKJfdRkhIQFQfumyRRFKwinFTgnqf2vSIDZcxN6O5lULe jAaXQ4CIVlAers8WeyZBTBZ0ZW9GuRUtKkCIEhYz3XFZbrXBin9e2UpZUaJvF0uj4FhjGV YJV+bA4DfxfARyl6qqRDppCFTrAa2O1LpkGCrUNXgMOjpSpI4l3ZlgptttYX0HgFmDJODo MNVPgNCrruAxMHAF197dTi3iOIbQ6QPSl7QYMd4vtiPAsN5keDkmbS2fbLQrfw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=lepiller.eu header.s=dkim header.b=RrtOKQ7q; dmarc=pass (policy=none) header.from=lepiller.eu; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -3.14 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lepiller.eu header.s=dkim header.b=RrtOKQ7q; dmarc=pass (policy=none) header.from=lepiller.eu; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: 9D93481D3 X-Spam-Score: -3.14 X-Migadu-Scanner: scn0.migadu.com X-TUID: OErDFTS8pyyh --MP_/j/J8RqiM/zag7sZ=SoFlciF Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Guix! I have the attached file that build Scala, although it's not bootstrapped at all. It contains %binary-scala, a few dependencies of Scala we haven't packaged yet, and the final scala, built from %binary-scala, without sbt (which requires Scala too). Since I've tried and failed to bootstrap Scala for so long, I think it's time to give up. I can't always create miracles. If this is acceptable, I will send actual patches later, and rework the sbt package I had around 2018 (I managed to build it with a Scala compiler, without a pre-existing sbt). --MP_/j/J8RqiM/zag7sZ=SoFlciF Content-Type: text/x-scheme Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=scala.scm (use-modules (guix build-system ant) (guix build-system copy) (guix git-download) (guix download) (guix packages) ((guix licenses) #:prefix license:) (gnu packages java)) (define %binary-scala (package (name "scala") (version "2.13.4") (source (origin (method url-fetch) (uri (string-append "https://downloads.lightbend.com/scala/" version "/scala-" version ".tgz")) (sha256 (base32 "1alcnzmxga00nsvgy8yky91zw5b4q0xg2697vrrdgjlglpxiqwdw")))) (build-system copy-build-system) (arguments `(#:install-plan '(("." "")) #:phases (modify-phases %standard-phases (add-before 'install 'set-java-home (lambda* (#:key inputs #:allow-other-keys) (substitute* (find-files "bin" ".") (("^#!.*" shebang) (string-append shebang "\nJAVA_HOME=" (assoc-ref inputs "openjdk")))))) (add-before 'set-java-home 'remove-unneeded (lambda _ (for-each delete-file (find-files "bin" "bat$"))))))) (inputs `(("openjdk" ,openjdk14))) (home-page "https://scala-lang.org/") (synopsis "Scala programming language") (description "Scala combines object-oriented and functional programming in one concise, high-level language. Scala's static types help avoid bugs in complex applications, and its JVM and JavaScript runtimes let you build high-performance systems with easy access to huge ecosystems of libraries.") (license license:bsd-3))) (define scala-asm (package (inherit java-asm) (version "9.1.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/scala/scala-asm") (commit "s-9.1"))) (file-name (git-file-name "scala-asm" version)) (sha256 (base32 "1wsrlb6kb0fwxjdqanxqgmq4qcyq9gqn129w3l4bj7gvlspll33l")))) (arguments `(#:jar-name "java-asm.jar" #:source-dir "src/main/java" ;; no tests #:tests? #f)))) (define java-jline3-terminal (package (name "java-jline3-terminal") (version "3.19.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/jline/jline3") (commit (string-append "jline-parent-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "16cfbkbj925c92xnwq5sbg7v57yh840g0mh95iyzkkajxirz9qn9")) (snippet ;; calls maven, and conflicts with ant `(delete-file "build")))) (build-system ant-build-system) (arguments `(#:jar-name "jline3-terminal.jar" #:source-dir "terminal/src/main/java" #:test-dir "terminal/src/test" #:phases (modify-phases %standard-phases ;(add-after 'unpack 'make-files-writable ; (lambda _ ; (for-each make-file-writable (find-files ".")) ; #t)) (add-before 'build 'copy-resources (lambda _ (copy-recursively "terminal/src/main/resources/" "build/classes") #t))))) (native-inputs `(("java-easymock" ,java-easymock) ("java-junit" ,java-junit))) (home-page "") (synopsis "") (description "") (license #f))) (define java-jline3-reader (package (inherit java-jline3-terminal) (name "java-jline3-reader") (arguments `(#:jar-name "jline3-reader.jar" #:source-dir "reader/src/main/java" #:test-dir "reader/src/test")) (inputs `(("java-jline3-terminal" ,java-jline3-terminal))))) (define scala (package (inherit %binary-scala) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/scala/scala") (commit (string-append "v" (package-version %binary-scala))))) (file-name (git-file-name "scala" (package-version %binary-scala))) (sha256 (base32 "0a6n0wnklya5mvcj03b64my7c30m2zw7spm9j1byv1rraxxjm1q1")))) (build-system ant-build-system) (arguments `(#:tests? #f #:phases (modify-phases %standard-phases (replace 'build (lambda* (#:key inputs #:allow-other-keys) (define* (build-project directory name #:optional (jar? #t)) (let* ((build-dir (string-append "build/class/" name)) (jar-name (string-append name ".jar")) (java-files (find-files directory ".*.java$")) (scala-files (find-files directory ".*.scala$"))) (mkdir-p build-dir) (format #t "Building project ~a...~%" name) (unless (eq? scala-files '()) (apply invoke "scalac" "-classpath" (string-append ;; Add any top-level directory in build that may contain ;; .class files, but don't actually add build/ iteself or ;; any individual class file. (string-join (filter (lambda (s) (eq? (string-count s #\/) 1)) (find-files "build" "." #:directories? #t)) ":")) "-d" build-dir "-nobootcp" (append scala-files java-files))) (unless (eq? java-files '()) (apply invoke "javac" "-classpath" (string-append (getenv "CLASSPATH") ":" (string-join (filter (lambda (s) (eq? (string-count s #\/) 1)) (find-files "build" "." #:directories? #t)) ":")) "-g" "-source" "1.8" "-target" "1.8" "-d" build-dir java-files)) (mkdir-p "build/jar") (if jar? (invoke "jar" "cf" (string-append "build/jar/" jar-name) "-C" build-dir ".")))) (let ((scala-asm (assoc-ref inputs "scala-asm"))) (setenv "CLASSPATH" (string-join (find-files scala-asm ".*.jar$") ":"))) (setenv "JAVA_OPTS" "-Xmx1G") (build-project "src/library" "scala-library") (build-project "src/reflect" "scala-reflect") (build-project "src/compiler" "scala-compiler" #f) (build-project "src/interactive" "scala-compiler-interactive" #f) (build-project "src/scaladoc" "scala-compiler-doc" #f) (build-project "src/repl" "scala-repl" #f) (build-project "src/repl-frontend" "scala-repl-frontend" #f) (build-project "src/scalap" "scalap") ;; create scala-compiler.jar as a union of some of those above (mkdir-p "build/class/compiler") (with-directory-excursion "build/class/compiler" (let ((scala-asm (assoc-ref inputs "scala-asm"))) (invoke "jar" "xf" (car (find-files scala-asm ".*.jar$")))) (copy-recursively "../scala-compiler" ".") (copy-recursively "../scala-compiler-interactive" ".") (copy-recursively "../scala-compiler-doc" ".") (copy-recursively "../scala-repl" ".") (copy-recursively "../scala-repl-frontend" ".")) (invoke "jar" "cf" "build/jar/scala-compiler.jar" "-C" "build/class/compiler" "."))) (replace 'install (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (lib (string-append out "/lib")) (jna (assoc-ref inputs "java-native-access")) (jline-terminal (assoc-ref inputs "java-jline3-terminal")) (jline-reader (assoc-ref inputs "java-jline3-reader"))) (mkdir-p lib) (for-each (lambda (jar) (copy-file jar (string-append lib "/" (basename jar)))) (find-files "build/jar" ".*.jar$")) (symlink (car (find-files jna "linux-.*.jar$")) (string-append lib "/jna-lib.jar")) (symlink (car (find-files jna "jna.jar$")) (string-append lib "/jna.jar")) (symlink (car (find-files jline-reader ".*.jar$")) (string-append lib "/jline-reader.jar")) (symlink (car (find-files jline-terminal ".*.jar$")) (string-append lib "/jline-terminal.jar"))))) (add-after 'install 'install-bin (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (bin (string-append out "/bin"))) (define (install-script script class) (let ((script (string-append bin "/" script))) (copy-file "src/compiler/templates/tool-unix.tmpl" script) ;; See project/ScalaTool and build.sbt (substitute* script (("@@") "@") (("@class@") class) (("@properties@") "-Dscala.home=\"$SCALA_HOME\"") (("@javaflags@") "-Xmx256M -Xms32M") (("@toolflags@") "") (("@classpath@") "")) (chmod script #o755))) (mkdir-p bin) (install-script "scala" "scala.tools.nsc.MainGenericRunner") (install-script "scalac" "scala.tools.nsc.Main") (install-script "fsc" "scala.tools.nsc.fsc.CompileClient") (install-script "scaladoc" "scala.tools.nsc.ScalaDoc") (install-script "scalap" "scala.tools.scalap.Main")))) ))) (inputs `(("scala" ,%binary-scala) ("scala-asm" ,scala-asm) ("java-jline3-terminal" ,java-jline3-terminal) ("java-jline3-reader" ,java-jline3-reader) ("java-native-access" ,java-native-access))))) %binary-scala ;scala-asm ;java-jline3 ;scala --MP_/j/J8RqiM/zag7sZ=SoFlciF--