build-package.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. set -e
  3. #(c) jmonkeyengine.org
  4. #This script creates SFX binaries of the JDK for the specified platform
  5. #Author Normen Hansen
  6. #gather options
  7. os="$1"
  8. source="$2"
  9. if [ -z "$1" ]; then
  10. echo "No platform supplied"
  11. echo "Specify a platform like macosx, windows-x86, linux-x64 and a source like /path/to/jdk/home"
  12. echo "If no source is specified, local/jdk-(platform) will be used"
  13. exit 1
  14. fi
  15. if [ -z "$2" ]; then
  16. source="local/jdk-$os"
  17. fi
  18. if [ ! -d "$source" ]; then
  19. echo "Source JDK directory $source was not found, specify another source folder as second parameter or copy the needed JDK to $source"
  20. exit 1
  21. fi
  22. unzipsfxname="unzipsfx/unzipsfx-$os"
  23. if [ ! -f "$unzipsfxname" ]; then
  24. echo "No unzipsfx for platform $os found at $unzipsfxname, cannot continue"
  25. exit 1
  26. fi
  27. suffix="bin"
  28. if [[ "$os" == *"windows"* ]]; then
  29. suffix="exe"
  30. fi
  31. name="jdk-$os.$suffix"
  32. echo "Creating SFX JDK package $name for $os with source $source."
  33. #code logic
  34. rm -rf $name
  35. cp -r $source ./jdk_tmp
  36. cd jdk_tmp/jre
  37. pack200 -J-Xmx1024m lib/rt.jar.pack.gz lib/rt.jar
  38. rm -rf lib/rt.jar
  39. cd ..
  40. zip -9 -r -y -q ../jdk_tmp_sfx.zip .
  41. cd ..
  42. cat $unzipsfxname jdk_tmp_sfx.zip > $name
  43. chmod +x $name
  44. rm -rf jdk_tmp
  45. rm -rf jdk_tmp_sfx.zip