diff --git a/WindowsBuild.txt b/WindowsBuild.txt new file mode 100644 index 0000000..ddb0db5 --- /dev/null +++ b/WindowsBuild.txt @@ -0,0 +1,24 @@ +1. Download Cygwin x86 +2. Select the following packages: +a. git +b. make +c. mingw-gcc-core +d. gcc-g++ +e. mingw-gcc-g++ +f. coreutils +g. nano +h. ncurses +i. apt-cyg – Apt/dpkg support +3. Download and install ant (http://ant.apache.org/) in Windows +a. Copy to C:\ant +4. Download and install a Java JDK in Windows as well. Ensure that the JAVA_HOME in Cygwin points to this location +5. Download and install the Windows GCC ARM Embedded toolchain (https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q3-update/+download/gcc-arm-none-eabi-4_7-2013q3-20130916-win32.exe) +6. Enter the following entries in ~/.bashrc at the bottom +a. export JAVA_HOME="/cygdrive/c/Program Files (x86)/Java/jdk1.8.0_45" +b. export ANT_HOME=/cygdrive/c/ant/ +c. PATH=$PATH:/cygdrive/c/ant/bin/ +d. PATH=$PATH:"/cygdrive/c/Program Files (x86)/Java/jdk1.8.0_45/bin" +e. PATH=$PATH:"/cygdrive/c/Program Files (x86)/GNU Tools ARM Embedded/4.7 2013q3/arm-none-eabi/bin" +7. Clone the ArduinoCodebase modifications inside Cygwin +8. Change to the ArdiunoCodebase/libraries directory and clone the FlutterWireless repository there. +9. Run setup.sh diff --git a/arduino b/arduino new file mode 120000 index 0000000..324d2d1 --- /dev/null +++ b/arduino @@ -0,0 +1 @@ +/home/jody/Downloads/ArduinoCodebase/build/linux/work/arduino \ No newline at end of file diff --git a/build/windows/launcher/launch4j/bin/ld.exe b/build/windows/launcher/launch4j/bin/ld.exe old mode 100644 new mode 100755 diff --git a/build/windows/launcher/launch4j/bin/windres.exe b/build/windows/launcher/launch4j/bin/windres.exe old mode 100644 new mode 100755 diff --git a/clean.sh b/clean.sh old mode 100644 new mode 100755 diff --git a/libraries/Flutter b/libraries/Flutter new file mode 160000 index 0000000..9caf2b6 --- /dev/null +++ b/libraries/Flutter @@ -0,0 +1 @@ +Subproject commit 9caf2b69669c57b3358959811a23971229d87895 diff --git a/setup.sh b/setup.sh old mode 100644 new mode 100755 index dea9ee2..d12e9f2 --- a/setup.sh +++ b/setup.sh @@ -1,13 +1,24 @@ #!/bin/bash -SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" +if ! [[ `uname -s` =~ ^CYGWIN* ]]; then + SCRIPT_DIR="$(pwd)" +else + SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" +fi + user=$(who am i | awk '{print $1}') #gets the original user (even if sudo is used) function main() { - requireSudo + if ! [[ `uname -s` =~ ^CYGWIN* ]]; then + requireSudo + fi + installRequiredPackages installArmToolchain - fixPortIssue + + if ! [[ `uname -s` =~ ^CYGWIN* ]]; then + fixPortIssue + fi #copyFlutterLibraryFromBundle #TODO use git instead #cloneFlutterLibrary #clone flutter from git @@ -58,10 +69,22 @@ function rebuildIDE() function buildIDE() { if [ ! -e ./arduino ] then - sudo -u $user ant -f $SCRIPT_DIR/build/build.xml + if [[ `uname -s` =~ ^CYGWIN* ]]; then + chmod +x ./build/windows/launcher/launch4j/bin/ld.exe + chmod +x ./build/windows/launcher/launch4j/bin/windres.exe + ant -f ./build/build.xml + else + sudo -u $user ant -f $SCRIPT_DIR/build/build.xml + fi + if [ $? -eq 0 ] then - ln -s $SCRIPT_DIR/build/linux/work/arduino . + if [[ `uname -s` =~ ^CYGWIN* ]]; then + ln -s ./build/linux/work/arduino . + else + ln -s $SCRIPT_DIR/build/linux/work/arduino . + fi + echo " $(tput setaf 2)installed$(tput sgr0) Arduino IDE Symbolic Link" else return 1 @@ -76,7 +99,12 @@ function buildIDE() { function copyFlutterLibraryFromBundle() { sketchbook=`getSketchbookPath` librariesFolder="$sketchbook/libraries" - sudo -u $user mkdir -p $librariesFolder + if [[ `uname -s` =~ ^CYGWIN* ]]; then + mkdir -p $librariesFolder + else + sudo -u $user mkdir -p $librariesFolder + fi + flutterFolder="$librariesFolder/Flutter" if [ -e "$flutterFolder" ] then @@ -84,8 +112,11 @@ function copyFlutterLibraryFromBundle() { else promptYesOrDie "The Flutter library for Arduino will be copied into $librariesFolder." echo " $(tput setaf 4)installing$(tput sgr0) Flutter" - - sudo -u $user cp -r $SCRIPT_DIR/Flutter $librariesFolder/ + if [[ `uname -s` =~ ^CYGWIN* ]]; then + cp -r ./Flutter $librariesFolder/ + else + sudo -u $user cp -r $SCRIPT_DIR/Flutter $librariesFolder/ + fi fi } @@ -100,8 +131,12 @@ function cloneFlutterLibrary() { else promptYesOrDie "The Flutter library for Arduino will be cloned into $librariesFolder." echo " $(tput setaf 4)installing$(tput sgr0) Flutter" - - sudo -u $user git clone $flutterGit + + if [[ `uname -s` =~ ^CYGWIN* ]]; then + git clone $flutterGit + else + sudo -u $user git clone $flutterGit + fi fi } @@ -126,19 +161,25 @@ function promptYesOrDie() { } function installArmToolchain() { - dpkg -s gcc-arm-none-eabi > /dev/null 2>&1 - if [[ $? -ne 0 ]] - then - repo=ppa:terry.guo/gcc-arm-embedded - echo "Flutter requires the ARM toolchain." - echo "To install it, $repo will be added to your sources.lst" - promptYesOrDie "Install the ARM toolchain?" - echo " $(tput setaf 4)installing$(tput sgr0) gcc-arm-none-eabi" - add-apt-repository $repo - apt-get update - apt-get install gcc-arm-none-eabi -y + if [[ `uname -s` =~ ^CYGWIN* ]]; then + if ! eabi_loc="$(type -P arm-none-eabi-gcc)" || [ -z "$eabi_loc" ]; then + echo "Please install an ARM GCC Toolchain for Cygwin" + fi else - echo " $(tput setaf 2)found$(tput sgr0) gcc-arm-none-eabi" + dpkg -s gcc-arm-none-eabi > /dev/null 2>&1 + if [[ $? -ne 0 ]] + then + repo=ppa:terry.guo/gcc-arm-embedded + echo "Flutter requires the ARM toolchain." + echo "To install it, $repo will be added to your sources.lst" + promptYesOrDie "Install the ARM toolchain?" + echo " $(tput setaf 4)installing$(tput sgr0) gcc-arm-none-eabi" + add-apt-repository $repo + apt-get update + apt-get install gcc-arm-none-eabi -y + else + echo " $(tput setaf 2)found$(tput sgr0) gcc-arm-none-eabi" + fi fi }