unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#51072] [PATCH] gnu: Add Weka
@ 2021-10-07  8:42 Foo Chuan Wei
  2022-10-30 15:34 ` Maxime Devos
  0 siblings, 1 reply; 2+ messages in thread
From: Foo Chuan Wei @ 2021-10-07  8:42 UTC (permalink / raw)
  To: 51072

* gnu/packages/machine-learning.scm (weka): New public variable.
---
 gnu/packages/machine-learning.scm | 40 +++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 029422677a..98412894b0 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -40,6 +40,7 @@
   #:use-module (guix download)
   #:use-module (guix svn-download)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system ocaml)
   #:use-module (guix build-system python)
@@ -65,6 +66,7 @@
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages image)
+  #:use-module (gnu packages java)
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages llvm)
@@ -2934,3 +2936,41 @@ Note: currently this package does not provide GPU support.")
      "Hmmlearn is a set of algorithms for unsupervised learning and inference
 of Hidden Markov Models.")
     (license license:bsd-3)))
+
+(define-public weka
+  (package
+    (name "weka")
+    (version "3.9.5")
+    (source (origin
+              (method url-fetch)
+              (uri "mirror://sourceforge/weka/weka-3-9/3.9.5/weka-3-9-5.zip")
+              (sha256
+                (base32
+                  "0scnqk4zysdp9hv7w2rgz3pwkqirszj8pfv94drkhlnyc9cz9kf6"))))
+    (build-system copy-build-system)
+    (native-inputs `(("unzip" ,unzip)))
+    (inputs `(("jre" ,icedtea)))
+    (arguments '(#:install-plan '(("." "share/weka/"))
+                 #:phases
+                 (modify-phases %standard-phases
+                   (add-after 'install 'make-wrapper
+                     (lambda* (#:key inputs outputs #:allow-other-keys)
+                       (let* ((out (assoc-ref outputs "out"))
+                              (wrapper (string-append out "/bin/weka")))
+                         (mkdir-p (string-append out "/bin"))
+                         (with-output-to-file wrapper
+                         (lambda _
+                           (display
+                             (string-append
+                               "#!/bin/sh\n\n"
+                               (assoc-ref inputs "jre") "/bin/java -jar "
+                               out "/share/weka/weka.jar \"$@\"\n"))))
+                         (chmod wrapper #o555))
+                       #t)))))
+    (synopsis "Machine learning algorithms for data mining tasks")
+    (description
+      "Weka is a collection of machine learning algorithms in Java.
+It contains tools for data preparation, classification, regression,
+clustering, association rules mining, and visualization.")
+    (home-page "https://www.cs.waikato.ac.nz/ml/weka/")
+    (license license:gpl3+)))

base-commit: ce83883f3d8bf6e6d25091acd018a8236a5754e1
-- 
2.25.1





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [bug#51072] [PATCH] gnu: Add Weka
  2021-10-07  8:42 [bug#51072] [PATCH] gnu: Add Weka Foo Chuan Wei
@ 2022-10-30 15:34 ` Maxime Devos
  0 siblings, 0 replies; 2+ messages in thread
From: Maxime Devos @ 2022-10-30 15:34 UTC (permalink / raw)
  To: 51072, Foo Chuan Wei


[-- Attachment #1.1.1: Type: text/plain, Size: 1674 bytes --]

 >+              (uri 
"mirror://sourceforge/weka/weka-3-9/3.9.5/weka-3-9-5.zip")

These isn't source code, these are binaries (*).  With the exception of 
the bootstrap seeds, things in Guix must be built from source (and even 
then, we still can build them from source, with "guix build 
bootstrap-tarballs").

Looking at the git repository, it appears to use Ant, and we have an 
ant-build-system, so unless there are complicated dependencies, it 
should be feasible.

 >+    (native-inputs `(("unzip" ,unzip)))
 >+    (inputs `(("jre" ,icedtea)))

Nowadays you can avoid input labels with (native-inputs (list unzip))
and (inputs (list icedtea)).

 >+                           (display
 >+                             (string-append
 >+                               "#!/bin/sh\n\n"
 >+                               (assoc-ref inputs "jre") "/bin/java -jar "
 >+                               out "/share/weka/weka.jar \"$@\"\n"))))
 >+                         (chmod wrapper #o555))

Do (search-input-file inputs "bin/java") to avoid depending on input 
labels.  Also, you are using /bin/sh (which IIUC will be patched to 
/gnu/store/.../bin/sh), but for such patching to work, you need to have 
bash-minimal (or bash) in the inputs -- while bash-minimal is an 
implicit (native-)input of many build systems, it isn't a regular 
implicit input, at least for copy-build-system, so this wouldn't work
when cross-compiling, so I propose to add bash-minimal to the inputs.

 > +                       #t)))))

Trailing #t are obsolete nowadays.

(*) At least, I expect them to be; the download is in-progress.

Greetings,
Maxime.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-30 15:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-07  8:42 [bug#51072] [PATCH] gnu: Add Weka Foo Chuan Wei
2022-10-30 15:34 ` Maxime Devos

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).