Skip to content

Cygwin configuration #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions WindowsBuild.txt
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions arduino
Empty file modified build/windows/launcher/launch4j/bin/ld.exe
100644 → 100755
Empty file.
Empty file modified build/windows/launcher/launch4j/bin/windres.exe
100644 → 100755
Empty file.
Empty file modified clean.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions libraries/Flutter
Submodule Flutter added at 9caf2b
85 changes: 63 additions & 22 deletions setup.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -76,16 +99,24 @@ 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
echo " $(tput setaf 2)found$(tput sgr0) Flutter Arduino Library"
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
}

Expand All @@ -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
}

Expand All @@ -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

}
Expand Down