Browse Source

Kept you waiting, huh?

Finally flesh out the autobuild script for the Android builder.
Coburn 2 years ago
parent
commit
ea2cdd5e8e
1 changed files with 61 additions and 2 deletions
  1. 61 2
      AutoBuild/linux-androidndk.sh

+ 61 - 2
AutoBuild/linux-androidndk.sh

@@ -1,3 +1,62 @@
 #!/bin/bash
-# Stubbed.
-exit 0
+echo "Executing autobuild process for ENet-CSharp repository"
+echo "Script written by SoftwareGuy (https://github.com/SoftwareGuy)"
+
+echo "Retreiving paths"
+WORKFILEPATH=`readlink -f "${BASH_SOURCE:-$0}"`
+WORKPATH=`dirname "$WORKFILEPATH"`
+SOURCEDIR=`dirname "$WORKPATH/../Source/Native/jni"`
+OUTPUTDIR="$WORKPATH/Out"
+DUMP="$HOME/Dump"
+
+echo ""
+echo "Script is located at '$WORKFILEPATH'"
+echo "Script directory is located at '$WORKPATH'"
+echo "Source code should be located at '$SOURCEDIR'"
+echo "Grabbing tools if they don't exist already..."
+echo ""
+
+if [ ! -d $DUMP ]; then
+        mkdir $HOME/Dump
+fi
+
+if [ ! -f "$DUMP/android-ndk-r25c-linux.zip" ]; then
+        wget https://dl.google.com/android/repository/android-ndk-r25c-linux.zip -O "$DUMP/android-ndk-r25c-linux.zip"
+
+        if [ $? -ne 0 ]; then
+                echo "Failure: Tools download failed. Aborting!"
+                exit 1
+        fi
+fi
+
+cd "$DUMP"
+
+if [ ! -d "$DUMP/android-ndk-r25c" ]; then
+        echo "Unpacking tools..."
+        unzip -o android-ndk-r25c-linux.zip
+
+        if [ $? -ne 0 ]; then
+                echo "Failure: Tools unpack failed. Aborting!"
+                exit 1
+        fi
+fi
+
+PATH="$DUMP/android-ndk-r25c:$PATH"
+cd $SOURCEDIR
+
+echo "Output directory is set to '$OUTPUTDIR'."
+echo "Compile: ENet Native (Non-debug version)"
+if [ ! -d "$OUTPUTDIR/Release" ]; then
+        mkdir -p "$OUTPUTDIR/Release"
+fi
+NDK_LIBS_OUT="$OUTPUTDIR/Release" ndk-build
+
+echo "Compile: ENet Native (Debug version)"
+if [ ! -d "$OUTPUTDIR/Debug" ]; then
+        mkdir -p "$OUTPUTDIR/Debug"
+fi
+NDK_LIBS_OUT="$OUTPUTDIR/Debug" ENET_DEBUG=1 ndk-build
+
+echo ""
+echo "Complete!"
+exit 0