kotlin.scm
| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu> |
| 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; |
| 6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 7 | ;;; under the terms of the GNU General Public License as published by |
| 8 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 9 | ;;; your option) any later version. |
| 10 | ;;; |
| 11 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | ;;; GNU General Public License for more details. |
| 15 | ;;; |
| 16 | ;;; You should have received a copy of the GNU General Public License |
| 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 18 | |
| 19 | (define-module (more packages kotlin) |
| 20 | #:use-module ((guix licenses) #:prefix license:) |
| 21 | #:use-module (gnu packages) |
| 22 | #:use-module (guix packages) |
| 23 | #:use-module (guix download) |
| 24 | #:use-module (guix git-download) |
| 25 | #:use-module (guix svn-download) |
| 26 | #:use-module (guix cvs-download) |
| 27 | #:use-module (guix utils) |
| 28 | #:use-module (guix build-system ant) |
| 29 | #:use-module (guix build-system gnu) |
| 30 | #:use-module (guix build-system trivial) |
| 31 | #:use-module (gnu packages autotools) |
| 32 | #:use-module (gnu packages base) |
| 33 | #:use-module (gnu packages compression) |
| 34 | #:use-module (gnu packages docbook) |
| 35 | #:use-module (gnu packages java) |
| 36 | #:use-module (gnu packages maven) |
| 37 | #:use-module (gnu packages perl) |
| 38 | #:use-module (gnu packages web) |
| 39 | #:use-module (gnu packages xml) |
| 40 | #:use-module (more packages java)) |
| 41 | |
| 42 | ;; Needs maven-core |
| 43 | (define-public kotlin |
| 44 | (package |
| 45 | (name "kotlin") |
| 46 | ;; last version with a build.xml file |
| 47 | ;; TODO: check if version 1.2.32-1.2.39 exist. 1.2.40 doesn't have build.xml. |
| 48 | (version "1.2.31") |
| 49 | (source (origin |
| 50 | (method url-fetch) |
| 51 | (uri (string-append "https://github.com/JetBrains/kotlin/archive/v" |
| 52 | version ".tar.gz")) |
| 53 | (file-name (string-append name "-" version ".tar.gz")) |
| 54 | (sha256 |
| 55 | (base32 |
| 56 | "1lm1rvj1vf4z8nzpffqcdwcydnlf24ls07z0r0nc4by3hjxzs3sv")))) |
| 57 | (build-system ant-build-system) |
| 58 | (arguments |
| 59 | `(#:phases |
| 60 | (modify-phases %standard-phases |
| 61 | (add-before 'build 'fix-build.xml |
| 62 | (lambda _ |
| 63 | (substitute* "build.xml" |
| 64 | (("org/jetbrains/kotlin/ant/antlib.xml") |
| 65 | "ant/src/org/jetbrains/kotlin/ant/antlib.xml"))))))) |
| 66 | (native-inputs |
| 67 | `(("java-intellij-compiler-javac2" ,java-intellij-compiler-javac2))) |
| 68 | (home-page "https://kotlinlang.org/") |
| 69 | (synopsis "Programming language targetting the JVM") |
| 70 | (description "") |
| 71 | (license license:asl2.0))) |
| 72 | |
| 73 | ;; The release page on github is a mess |
| 74 | (define intellij-community-version "0.182.2256") |
| 75 | (define (intellij-community-source version) |
| 76 | (origin |
| 77 | (method url-fetch) |
| 78 | (uri (string-append "https://github.com/JetBrains/intellij-community/" |
| 79 | "archive/appcode/" (substring version 2) ".tar.gz")) |
| 80 | (file-name (string-append "intellij-community-" version ".tar.gz")) |
| 81 | (sha256 |
| 82 | (base32 |
| 83 | "1b9csd0vs6m41q4jhlwl3rlfb596vcnjhch75pcwk8999zrvqf0f")) |
| 84 | (modules '((guix build utils))) |
| 85 | (snippet |
| 86 | `(begin |
| 87 | (for-each |
| 88 | (lambda (file) |
| 89 | (if (file-exists? file) |
| 90 | (delete-file-recursively file))) |
| 91 | (append (find-files "." "^lib$" #:directories? #t) |
| 92 | (find-files "." "^bin$" #:directories? #t))) |
| 93 | (for-each delete-file (find-files "." ".*.jar$")))))) |
| 94 | |
| 95 | (define-public java-intellij-compiler-instrumentation-util |
| 96 | (package |
| 97 | (name "java-intellij-compiler-instrumentation-util") |
| 98 | (version intellij-community-version) |
| 99 | (source (intellij-community-source version)) |
| 100 | (build-system ant-build-system) |
| 101 | (arguments |
| 102 | `(#:source-dir "java/compiler/instrumentation-util/src" |
| 103 | #:jar-name "instrumentation-util.jar" |
| 104 | ;; No test |
| 105 | #:tests? #f |
| 106 | #:phases |
| 107 | (modify-phases %standard-phases |
| 108 | (add-before 'build 'fix-imports |
| 109 | (lambda _ |
| 110 | (substitute* (find-files "java/compiler/instrumentation-util/src" ".*.java") |
| 111 | (("org.jetbrains.org.objectweb") "org.objectweb") |
| 112 | ;; As in build/asm/3_api_version.patch |
| 113 | (("API_VERSION") "ASM6"))))))) |
| 114 | (inputs |
| 115 | `(("java-asm" ,java-asm))) |
| 116 | (home-page "https://github.com/JetBrains/intellij-community") |
| 117 | (synopsis "") |
| 118 | (description "") |
| 119 | (license license:asl2.0))) |
| 120 | |
| 121 | (define-public java-intellij-compiler-javac2 |
| 122 | (package |
| 123 | (name "java-intellij-compiler-javac2") |
| 124 | (version intellij-community-version) |
| 125 | (source (intellij-community-source version)) |
| 126 | (build-system ant-build-system) |
| 127 | (arguments |
| 128 | `(#:source-dir "java/compiler/javac2/src" |
| 129 | #:jar-name "javac2.jar" |
| 130 | ;; No test |
| 131 | #:tests? #f)) |
| 132 | (inputs |
| 133 | `(("java-intellij-compiler-instrumentation-util" ,java-intellij-compiler-instrumentation-util))) |
| 134 | (home-page "https://github.com/JetBrains/intellij-community") |
| 135 | (synopsis "") |
| 136 | (description "") |
| 137 | (license license:asl2.0))) |
| 138 | |
| 139 | (define-public java-intellij-platform-forms-rt |
| 140 | (package |
| 141 | (name "java-intellij-platform-forms-rt") |
| 142 | (version intellij-community-version) |
| 143 | (source (intellij-community-source version)) |
| 144 | (build-system ant-build-system) |
| 145 | (arguments |
| 146 | `(#:source-dir "platform/forms_rt/src" |
| 147 | #:jar-name "forms_rt.jar" |
| 148 | ;; No test |
| 149 | #:tests? #f)) |
| 150 | (home-page "https://github.com/JetBrains/intellij-community") |
| 151 | (synopsis "") |
| 152 | (description "") |
| 153 | (license license:asl2.0))) |
| 154 | |
| 155 | ;; Newer versions are not free software anymore |
| 156 | ;; latest free versions are 1.8.1 and 1.8.0. We require something older for |
| 157 | ;; intellij though. |
| 158 | (define-public java-jgoodies-common |
| 159 | (package |
| 160 | (name "java-jgoodies-common") |
| 161 | (version "1.8.1") |
| 162 | (source (origin |
| 163 | (method url-fetch) |
| 164 | (uri "http://www.jgoodies.com/download/libraries/common/jgoodies-common-1_8_1.zip") |
| 165 | (sha256 |
| 166 | (base32 |
| 167 | "1canj4zalrp668c55ji58rk90w005q44lnwzliffsr8mlrgxgaiw")))) |
| 168 | (build-system ant-build-system) |
| 169 | (arguments |
| 170 | `(#:jar-name "jgoodies-common.jar" |
| 171 | #:source-dir "." |
| 172 | #:tests? #f; no tests |
| 173 | #:phases |
| 174 | (modify-phases %standard-phases |
| 175 | (add-before 'build 'extract-source |
| 176 | (lambda _ |
| 177 | (invoke "jar" "xf" "jgoodies-common-1.8.1-sources.jar") |
| 178 | #t))))) |
| 179 | (native-inputs |
| 180 | `(("unzip" ,unzip))) |
| 181 | (home-page "http://www.jgoodies.com") |
| 182 | (synopsis "") |
| 183 | (description "") |
| 184 | (license license:bsd-3))) |
| 185 | |
| 186 | (define-public java-jgoodies-forms |
| 187 | (package |
| 188 | (name "java-jgoodies-forms") |
| 189 | (version "1.8.0") |
| 190 | (source (origin |
| 191 | (method url-fetch) |
| 192 | (uri "http://www.jgoodies.com/download/libraries/forms/jgoodies-forms-1_8_0.zip") |
| 193 | (sha256 |
| 194 | (base32 |
| 195 | "1av4w1px1jxmv19mljyicbv657sw5nqhkfx6s7nc5ckzf9ay945h")))) |
| 196 | (build-system ant-build-system) |
| 197 | (arguments |
| 198 | `(#:jar-name "jgoodies-forms.jar" |
| 199 | #:source-dir "." |
| 200 | #:tests? #f; no tests |
| 201 | #:phases |
| 202 | (modify-phases %standard-phases |
| 203 | (add-before 'build 'extract-source |
| 204 | (lambda _ |
| 205 | (invoke "jar" "xf" "jgoodies-forms-1.8.0-sources.jar") |
| 206 | #t))))) |
| 207 | (native-inputs |
| 208 | `(("unzip" ,unzip))) |
| 209 | (inputs |
| 210 | `(("java-jgoodies-common" ,java-jgoodies-common))) |
| 211 | (home-page "http://www.jgoodies.com") |
| 212 | (synopsis "") |
| 213 | (description "") |
| 214 | (license license:bsd-3))) |
| 215 | |
| 216 | ;; Requires JGoodies Forms: http://www.jgoodies.com |
| 217 | (define-public java-intellij-compiler-forms-compiler |
| 218 | (package |
| 219 | (name "java-intellij-compiler-forms-compiler") |
| 220 | (version intellij-community-version) |
| 221 | (source (intellij-community-source version)) |
| 222 | (build-system ant-build-system) |
| 223 | (arguments |
| 224 | `(#:source-dir "java/compiler/forms-compiler/src" |
| 225 | #:jar-name "forms-compiler.jar" |
| 226 | ;; No test |
| 227 | #:tests? #f |
| 228 | #:phases |
| 229 | (modify-phases %standard-phases |
| 230 | (add-before 'build 'fix-imports |
| 231 | (lambda _ |
| 232 | (substitute* (find-files "java/compiler/forms-compiler/src" ".*.java") |
| 233 | (("org.jetbrains.org.objectweb") "org.objectweb") |
| 234 | ;; As in build/asm/3_api_version.patch |
| 235 | (("API_VERSION") "ASM6")))) |
| 236 | (add-before 'build 'fix-old-jgoodies |
| 237 | (lambda _ |
| 238 | (substitute* "java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/FormLayoutSerializer.java" |
| 239 | (("new ColumnSpec\\(spec\\)") "ColumnSpec.parse(spec)"))))))) |
| 240 | (inputs |
| 241 | `(("java-intellij-platform-forms-rt" ,java-intellij-platform-forms-rt) |
| 242 | ("java-intellij-compiler-instrumentation-util" ,java-intellij-compiler-instrumentation-util) |
| 243 | ("java-asm" ,java-asm) |
| 244 | ("java-jdom" ,java-jdom) |
| 245 | ("java-jgoodies-forms" ,java-jgoodies-forms))) |
| 246 | (home-page "https://github.com/JetBrains/intellij-community") |
| 247 | (synopsis "") |
| 248 | (description "") |
| 249 | (license license:asl2.0))) |
| 250 |