linux-androidndk.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/bash
  2. echo "Executing autobuild process for ENet-CSharp repository"
  3. echo "Script written by SoftwareGuy (https://github.com/SoftwareGuy)"
  4. echo "Retreiving paths"
  5. WORKFILEPATH=`readlink -f "${BASH_SOURCE:-$0}"`
  6. WORKPATH=`dirname "$WORKFILEPATH"`
  7. SOURCEDIR=`dirname "$WORKPATH/../Source/Native/jni"`
  8. OUTPUTDIR="$WORKPATH/Out"
  9. DUMP="$HOME/Dump"
  10. echo ""
  11. echo "Script is located at '$WORKFILEPATH'"
  12. echo "Script directory is located at '$WORKPATH'"
  13. echo "Source code should be located at '$SOURCEDIR'"
  14. echo "Grabbing tools if they don't exist already..."
  15. echo ""
  16. if [ ! -d $DUMP ]; then
  17. mkdir $DUMP
  18. fi
  19. if [ ! -f "$DUMP/android-ndk-r25c-linux.zip" ]; then
  20. wget https://dl.google.com/android/repository/android-ndk-r25c-linux.zip -O "$DUMP/android-ndk-r25c-linux.zip"
  21. if [ $? -ne 0 ]; then
  22. echo "Failure: Tools download failed. Aborting!"
  23. exit 1
  24. fi
  25. fi
  26. cd "$DUMP"
  27. if [ ! -d "$DUMP/android-ndk-r25c" ]; then
  28. echo "Unpacking tools..."
  29. unzip -o android-ndk-r25c-linux.zip
  30. if [ $? -ne 0 ]; then
  31. echo "Failure: Tools unpack failed. Aborting!"
  32. exit 1
  33. fi
  34. fi
  35. PATH="$DUMP/android-ndk-r25c:$PATH"
  36. cd $SOURCEDIR
  37. echo "Output directory is set to '$OUTPUTDIR'."
  38. echo "Compile: ENet Native (Non-debug version)"
  39. if [ ! -d "$OUTPUTDIR/Release" ]; then
  40. mkdir -p "$OUTPUTDIR/Release"
  41. fi
  42. NDK_LIBS_OUT="$OUTPUTDIR/Release" ndk-build
  43. echo "Compile: ENet Native (Debug version)"
  44. if [ ! -d "$OUTPUTDIR/Debug" ]; then
  45. mkdir -p "$OUTPUTDIR/Debug"
  46. fi
  47. NDK_LIBS_OUT="$OUTPUTDIR/Debug" ENET_DEBUG=1 ndk-build
  48. echo ""
  49. echo "Complete!"
  50. exit 0