Remove anki that is merged and add arc

Julien LepillerSun Oct 25 20:34:09+0100 2020

2e8f26d

Remove anki that is merged and add arc

more/packages/games.scm

2020
  #:use-module (guix packages)
2121
  #:use-module (guix download)
2222
  #:use-module (guix git-download)
23+
  #:use-module (guix build-system ant)
2324
  #:use-module (guix build-system cmake)
2425
  #:use-module (guix build-system gnu)
2526
  #:use-module (guix build-system trivial)

4243
  #:use-module (gnu packages graphics)
4344
  #:use-module (gnu packages gtk)
4445
  #:use-module (gnu packages image)
46+
  #:use-module (gnu packages java)
4547
  #:use-module (gnu packages lua)
4648
  #:use-module (more packages lua)
4749
  #:use-module (gnu packages llvm)

215217
    (description "")
216218
    (license license:agpl3)))
217219
218-
(define-public anki
219-
  (package
220-
    (name "anki")
221-
    ; the latest stable version requires qt4 webkit which we don't have because
222-
    ; of issues on arm and probably security reasons.
223-
    (version "2.1.0beta25")
224-
    (source (origin
225-
              (method url-fetch)
226-
              (uri (string-append "https://apps.ankiweb.net/downloads/beta/anki-"
227-
                                  version "-source.tgz"))
228-
              (sha256
229-
               (base32
230-
                "1p42b395k3kny5c17na3sw95mya3cw2hg3nxyj3b3mdhwdcy677r"))))
231-
    (build-system gnu-build-system)
232-
    (propagated-inputs
233-
     `(("python" ,python)
234-
       ("python-pyaudio" ,python-pyaudio)
235-
       ("python-pyqt" ,python-pyqt)
236-
       ("python-sip" ,python-sip)
237-
       ("python-decorator" ,python-decorator)))
238-
    (arguments
239-
     `(#:tests? #f
240-
       #:phases
241-
       (modify-phases %standard-phases
242-
         (delete 'configure)
243-
         (delete 'build)
244-
         (replace 'install
245-
           (lambda* (#:key inputs outputs #:allow-other-keys)
246-
             (substitute* "anki/__init__.py"
247-
               (("< 6") "< 5"))
248-
             (substitute* "aqt/qt.py"
249-
               (("from PyQt5.QtWebEngineWidgets import QWebEnginePage") ""))
250-
             (let* ((output (assoc-ref outputs "out"))
251-
                    (bindir (string-append output "/bin"))
252-
                    (libdir (string-append output "/lib/python3.5/site-packages")))
253-
               (for-each
254-
                 (lambda (file)
255-
                   (mkdir-p (dirname (string-append libdir "/" file)))
256-
                   (copy-file file (string-append libdir "/" file)))
257-
                 (append (find-files "anki" ".*\\.py")
258-
                         (find-files "aqt" ".*\\.py")))
259-
               (mkdir-p bindir)
260-
               (with-output-to-file (string-append bindir "/anki")
261-
                 (lambda _
262-
                   (display
263-
                     (string-append
264-
                       "#!" (assoc-ref inputs "python") "/bin/python3\n"
265-
                       "import aqt\n"
266-
                       "aqt.run()\n"))))
267-
               (chmod (string-append bindir "/anki") #o755)))))))
268-
    (home-page "https://apps.ankiweb.net")
269-
    (synopsis "")
270-
    (description "")
271-
    (license license:gpl2)))
272-
273220
(define-public emojicode
274221
  (package
275222
    (name "emojicode")

497444
    (synopsis "")
498445
    (description "")
499446
    (license license:gpl2+)))
447+
448+
(define-public java-arc-core
449+
  (package
450+
    (name "java-arc-core")
451+
    (version "110")
452+
    (source (origin
453+
              (method git-fetch)
454+
              (uri (git-reference
455+
                     (url "https://github.com/Anuken/Arc")
456+
                     (commit (string-append "v" version))))
457+
              (file-name (git-file-name name version))
458+
              (sha256
459+
               (base32
460+
                "1iyckj4y47bcw15vsr104gysc9idx0m301qsx817mdgfdbjp9hmi"))))
461+
    (build-system ant-build-system)
462+
    (arguments
463+
     `(#:jar-name "arc-core.jar"
464+
       #:source-dir "arc-core/src/arc"
465+
       #:test-dir "arc-core/test"
466+
       #:phases
467+
       (modify-phases %standard-phases
468+
         (add-after 'build 'build-native
469+
           (lambda* (#:key inputs outputs #:allow-other-keys)
470+
             (let ((stb (assoc-ref inputs "stb_image.h"))
471+
                   (jdk (assoc-ref inputs "jdk"))
472+
                   (lib (string-append (assoc-ref outputs "out") "/lib")))
473+
               (copy-file stb "arc-core/csrc/stb_image.h")
474+
               (invoke "gcc" "-shared" "-O2" "-fPIC"
475+
                       ; symbols specify GLIBC_2.2.5 in memcpy_wrap.c
476+
                       ;(if (member ,(%current-system)
477+
                       ;            '("i686-linux" "armhf-linux" "i586-gnu"))
478+
                       ;  "-Wl,-wrap,memcpy"
479+
                       ;  "-Wl,-wrap,memcpy,-wrap,pow")
480+
                       "-Wl,--no-undefined"
481+
                       "-Iarc-core/csrc"
482+
                       (string-append "-I" jdk "/include")
483+
                       (string-append "-I" jdk "/include/linux")
484+
                       "arc-core/csrc/pix.c"
485+
                       "-lm"
486+
                       ;"natives/memcpy_wrap.c"
487+
                       "-o" "libarc.so")
488+
               (mkdir-p lib)
489+
               (install-file "libarc.so" lib)
490+
               (install-file "libarc.so" "build/classes/"))
491+
             #t))
492+
         (add-before 'build 'fix-native-loading
493+
           (lambda _
494+
             ;; Ensure the name of the library is the same, independently from
495+
             ;; the platform, as we don't perform a cross-build for every platform.
496+
             (substitute* "arc-core/src/arc/util/SharedLibraryLoader.java"
497+
               (("if\\(isLinux\\).*")
498+
                "if(isLinux) return \"lib\" + libraryName + \".so\";\n"))
499+
             #t))
500+
         (add-after 'build-native 'repack
501+
           (lambda _
502+
             (invoke "jar" "-cf" "build/jar/arc-core.jar" "-C" "build/classes"
503+
                     ".")
504+
             #t))
505+
         (add-before 'check 'fix-test-dir
506+
           (lambda _
507+
             (substitute* "build.xml"
508+
               (("\\}/java") "}"))
509+
             #t)))))
510+
    (native-inputs
511+
     `(("java-junit" ,java-junit)))
512+
    (inputs
513+
     `(("stb_image.h"
514+
        ,(origin (method url-fetch)
515+
                 (uri (string-append
516+
                        "https://raw.githubusercontent.com/nothings/stb/"
517+
                        ;; latest commit, since there are no releases
518+
                        "b42009b3b9d4ca35bc703f5310eedc74f584be58"
519+
                        "/stb_image.h"))
520+
                 (file-name "stb_image.h-b42009b")
521+
                 (sha256
522+
                  (base32
523+
                   "132nblax05sqk0f77qc6jl03s24dwwh2s87gjx6872pwgmqhsnwf"))))))
524+
    (home-page "https://github.com/Anuken/Arc")
525+
    (synopsis "Java game development framework based off of libGDX")
526+
    (description "This package contains a development framework for Java
527+
games based on libGDX.  This is mostly used by Mindustry.")
528+
    (license license:expat)))