build 915 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env bash
  2. #
  3. # On rpm, you'll need:
  4. #
  5. # * java-devel
  6. # * javapackages-tools
  7. # * ecj
  8. #
  9. dirs=(bin lib src)
  10. name="weka-clustering.jar"
  11. weka_version="3.8.6"
  12. weka_version_hyphen="3-8-6"
  13. [[ -f $name ]] && mv "$name" "$name.bk"
  14. [[ -d src ]] || (echo "This script requires the input java files in src"; exit)
  15. rm -rf bin
  16. for d in "${dirs[@]}"; do
  17. [[ -d $d ]] || mkdir "$d"
  18. done
  19. # Download and extract weka.jar to the lib dir
  20. wget -qO temp.zip "https://sourceforge.net/projects/weka/files/weka-${weka_version_hyphen%-*}/$weka_version/weka-$weka_version_hyphen.zip/download" &&
  21. unzip -o -j temp.zip weka-$weka_version_hyphen/weka.jar -d lib &&
  22. rm temp.zip
  23. javac -cp lib/*.jar -d bin src/*.java
  24. # Build the classes from source java
  25. # ecj -17 -classpath lib/weka.jar -d bin src &&
  26. # Add weka classes to the bin
  27. unzip -o lib/weka.jar -d bin &&
  28. # Create the jar file from the classes
  29. jar cvf "$name" -C bin .