summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2024-01-30 22:44:09 +0100
committerRicardo Wurmus <rekado@elephly.net>2024-01-30 22:44:09 +0100
commitc2dc19aecc1b0e88e95a4722e7e65674376d2b12 (patch)
tree8e8a2ae514255ec4d8426d58227a6fad4799e5e2 /gnu
parentbed3a0b547a59f63b545db165e76ddd9af8bba1a (diff)
gnu: axoloti-patcher: Use G-expression.
* gnu/packages/axoloti.scm (axoloti-patcher)[arguments]: Use G-expression; delete 'make-git-checkout-writable phase. Change-Id: I4f9b98351f1752391211f1aed84d484184d32771
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/axoloti.scm206
1 files changed, 101 insertions, 105 deletions
diff --git a/gnu/packages/axoloti.scm b/gnu/packages/axoloti.scm
index 8e268849425..2f8497e3ddf 100644
--- a/gnu/packages/axoloti.scm
+++ b/gnu/packages/axoloti.scm
@@ -1,5 +1,5 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016, 2017, 2019, 2020, 2021 Ricardo Wurmus <rekado@elephly.net> 2;;; Copyright © 2016, 2017, 2019, 2020, 2021, 2024 Ricardo Wurmus <rekado@elephly.net>
3;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr> 3;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
4;;; 4;;;
5;;; This file is part of GNU Guix. 5;;; This file is part of GNU Guix.
@@ -18,6 +18,7 @@
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. 18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 19
20(define-module (gnu packages axoloti) 20(define-module (gnu packages axoloti)
21 #:use-module (guix gexp)
21 #:use-module (guix utils) 22 #:use-module (guix utils)
22 #:use-module (guix packages) 23 #:use-module (guix packages)
23 #:use-module (guix download) 24 #:use-module (guix download)
@@ -218,8 +219,9 @@ runtime.")
218 (name "axoloti-patcher") 219 (name "axoloti-patcher")
219 (version (package-version axoloti-runtime)) 220 (version (package-version axoloti-runtime))
220 (arguments 221 (arguments
221 `(#:tests? #f ; no check target 222 (list
222 #:modules ((guix build gnu-build-system) 223 #:tests? #f ; no check target
224 #:modules '((guix build gnu-build-system)
223 ((guix build ant-build-system) #:prefix ant:) 225 ((guix build ant-build-system) #:prefix ant:)
224 (guix build utils) 226 (guix build utils)
225 (srfi srfi-1) 227 (srfi srfi-1)
@@ -229,113 +231,107 @@ runtime.")
229 (sxml simple) 231 (sxml simple)
230 (sxml xpath) 232 (sxml xpath)
231 (sxml transform)) 233 (sxml transform))
232 #:imported-modules ((guix build ant-build-system) 234 #:imported-modules `((guix build ant-build-system)
233 ,@%gnu-build-system-modules) 235 ,@%gnu-build-system-modules)
234 #:phases 236 #:phases
235 (modify-phases %standard-phases 237 #~(modify-phases %standard-phases
236 (add-after 'unpack 'make-git-checkout-writable 238 (delete 'configure)
237 (lambda _ 239 (replace 'build
238 (for-each make-file-writable (find-files ".")) 240 (lambda* (#:key inputs #:allow-other-keys)
239 #t)) 241 (setenv "JAVA_HOME" (assoc-ref inputs "icedtea"))
240 (delete 'configure) 242 ;; We want to use our own jar files instead of the pre-built
241 (replace 'build 243 ;; stuff in lib. So we replace the zipfileset tags in the
242 (lambda* (#:key inputs #:allow-other-keys) 244 ;; build.xml with new ones that reference our jars.
243 (setenv "JAVA_HOME" (assoc-ref inputs "icedtea")) 245 (let* ((build.xml (with-input-from-file "build.xml"
244 ;; We want to use our own jar files instead of the pre-built 246 (lambda _
245 ;; stuff in lib. So we replace the zipfileset tags in the 247 (xml->sxml #:trim-whitespace? #t))))
246 ;; build.xml with new ones that reference our jars. 248 (jars (append-map (match-lambda
247 (let* ((build.xml (with-input-from-file "build.xml" 249 (((? (cut string-prefix? "java-" <>)
248 (lambda _ 250 label) . directory)
249 (xml->sxml #:trim-whitespace? #t)))) 251 (find-files directory "\\.jar$"))
250 (jars (append-map (match-lambda 252 (_ '()))
251 (((? (cut string-prefix? "java-" <>) 253 inputs))
252 label) . directory) 254 (classpath (string-join jars ":"))
253 (find-files directory "\\.jar$")) 255 (fileset (map (lambda (jar)
254 (_ '())) 256 `(zipfileset (@ (excludes "META-INF/*.SF")
255 inputs)) 257 (src ,jar))))
256 (classpath (string-join jars ":")) 258 jars)))
257 (fileset (map (lambda (jar) 259 (call-with-output-file "build.xml"
258 `(zipfileset (@ (excludes "META-INF/*.SF") 260 (lambda (port)
259 (src ,jar)))) 261 (sxml->xml
260 jars))) 262 (pre-post-order
261 (call-with-output-file "build.xml" 263 build.xml
262 (lambda (port) 264 `( ;; Remove all zipfileset tags from the "jar" tree and
263 (sxml->xml 265 ;; inject our own tags.
264 (pre-post-order 266 (jar . ,(lambda (tag . kids)
265 build.xml 267 `(jar ,@(append-map
266 `(;; Remove all zipfileset tags from the "jar" tree and 268 (filter (lambda (e)
267 ;; inject our own tags. 269 (not (eq? 'zipfileset (car e)))))
268 (jar . ,(lambda (tag . kids) 270 kids)
269 `(jar ,@(append-map 271 ,@fileset)))
270 (filter (lambda (e) 272 ;; Skip the "bundle" target (and the "-post-jar" target
271 (not (eq? 'zipfileset (car e))))) 273 ;; that depends on it), because we don't need it and it
272 kids) 274 ;; confuses sxml->xml.
273 ,@fileset))) 275 (target . ,(lambda (tag . kids)
274 ;; Skip the "bundle" target (and the "-post-jar" target 276 (let ((name ((sxpath '(name *text*))
275 ;; that depends on it), because we don't need it and it 277 (car kids))))
276 ;; confuses sxml->xml. 278 (if (or (member "bundle" name)
277 (target . ,(lambda (tag . kids) 279 (member "-post-jar" name))
278 (let ((name ((sxpath '(name *text*)) 280 '() ; skip
279 (car kids)))) 281 `(,tag ,@kids)))))
280 (if (or (member "bundle" name) 282 (*default* . ,(lambda (tag . kids) `(,tag ,@kids)))
281 (member "-post-jar" name)) 283 (*text* . ,(lambda (_ txt)
282 '() ; skip 284 (match txt
283 `(,tag ,@kids))))) 285 ;; Remove timestamp.
284 (*default* . ,(lambda (tag . kids) `(,tag ,@kids))) 286 ("${TODAY}" "(unknown)")
285 (*text* . ,(lambda (_ txt) 287 (_ txt))))))
286 (match txt 288 port)))
287 ;; Remove timestamp.
288 ("${TODAY}" "(unknown)")
289 (_ txt))))))
290 port)))
291 289
292 ;; Build it! 290 ;; Build it!
293 (invoke "ant" 291 (invoke "ant"
294 (string-append "-Djavac.classpath=" classpath) 292 (string-append "-Djavac.classpath=" classpath)
295 "-Dbuild.runtime=true" 293 "-Dbuild.runtime=true"
296 "-Dbuild.time=01/01/1970 00:00:00" 294 "-Dbuild.time=01/01/1970 00:00:00"
297 "-Djavac.source=1.7" 295 "-Djavac.source=1.7"
298 "-Djavac.target=1.7" 296 "-Djavac.target=1.7"
299 (string-append "-Dtag.short.version=" 297 (string-append "-Dtag.short.version="
300 ,version))))) 298 #$version)))))
301 (replace 'install 299 (replace 'install
302 (lambda* (#:key inputs outputs #:allow-other-keys) 300 (lambda* (#:key inputs #:allow-other-keys)
303 (let* ((out (assoc-ref outputs "out")) 301 (let ((share (string-append #$output "/share/axoloti/")))
304 (share (string-append out "/share/axoloti/"))) 302 (install-file "dist/Axoloti.jar" share)
305 (install-file "dist/Axoloti.jar" share)
306 303
307 ;; We do this to ensure that this package retains references to 304 ;; We do this to ensure that this package retains references to
308 ;; other Java packages' jar files. 305 ;; other Java packages' jar files.
309 (install-file "build.xml" share) 306 (install-file "build.xml" share)
310 307
311 ;; Create a launcher script 308 ;; Create a launcher script
312 (mkdir (string-append out "/bin")) 309 (mkdir (string-append #$output "/bin"))
313 (let ((target (string-append out "/bin/Axoloti"))) 310 (let ((target (string-append #$output "/bin/Axoloti")))
314 (with-output-to-file target 311 (with-output-to-file target
315 (lambda () 312 (lambda ()
316 (let* ((dir (string-append (assoc-ref outputs "out") 313 (let* ((dir (string-append #$output "/share/axoloti"))
317 "/share/axoloti")) 314 (runtime (search-input-directory inputs
318 (runtime (search-input-directory inputs 315 "share/axoloti"))
319 "share/axoloti")) 316 (toolchain (assoc-ref inputs "cross-toolchain"))
320 (toolchain (assoc-ref inputs "cross-toolchain")) 317 (includes (string-append
321 (includes (string-append 318 toolchain
322 toolchain 319 "/arm-none-eabi/include/c++:"
323 "/arm-none-eabi/include/c++:" 320 toolchain
324 toolchain 321 "/arm-none-eabi/include/c++/arm-none-eabi/armv7e-m")))
325 "/arm-none-eabi/include/c++/arm-none-eabi/armv7e-m"))) 322 (display
326 (display 323 (string-append "#!" (which "sh") "\n"
327 (string-append "#!" (which "sh") "\n" 324 "export CROSS_CPATH=" includes "\n"
328 "export CROSS_CPATH=" includes "\n" 325 "export CROSS_CPLUS_INCLUDE_PATH=" includes "\n"
329 "export CROSS_CPLUS_INCLUDE_PATH=" includes "\n" 326 "export CROSS_LIBRARY_PATH="
330 "export CROSS_LIBRARY_PATH=" 327 toolchain "/arm-none-eabi/lib" "\n"
331 toolchain "/arm-none-eabi/lib" "\n" 328 (which "java")
332 (which "java") 329 " -Daxoloti_release=" runtime
333 " -Daxoloti_release=" runtime 330 " -Daxoloti_runtime=" runtime
334 " -Daxoloti_runtime=" runtime 331 " -jar " dir "/Axoloti.jar")))))
335 " -jar " dir "/Axoloti.jar"))))) 332 (chmod target #o555)))))
336 (chmod target #o555))))) 333 (add-after 'install 'strip-jar-timestamps
337 (add-after 'install 'strip-jar-timestamps 334 (assoc-ref ant:%standard-phases 'strip-jar-timestamps)))))
338 (assoc-ref ant:%standard-phases 'strip-jar-timestamps)))))
339 (inputs 335 (inputs
340 `(("icedtea" ,icedtea "jdk") 336 `(("icedtea" ,icedtea "jdk")
341 ("cross-toolchain" ,(make-arm-none-eabi-nano-toolchain-4.9)) 337 ("cross-toolchain" ,(make-arm-none-eabi-nano-toolchain-4.9))