Skip to content

create install script for linux #45

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

Merged
merged 2 commits into from
Sep 12, 2022
Merged
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ Arduino Core API module for zephyr leverages the power of Zephyr under an Arduin
west update
```

* **Note:** For ***Linux users only*** there exists an ``install.sh`` script in this project that can be run to quickly link the ArduinoCore-API to this module.
If you are able to run that script successfully then you can skip the next steps.

* To "complete" the core you need to copy or symlink the api folder from the [ArduinoCore-API](https://github.com/arduino/ArduinoCore-API.git) repo to the target's ``cores/arduino`` folder:
```sh
$ git clone git@github.com:arduino/ArduinoCore-API # Any location
Expand All @@ -36,6 +39,9 @@ $ ln -s /<your>/<location>/ArduinoCore-API/api cores/arduino/.
The `cores` folder can be found at `~/zephyrproject/modules/lib/Arduino-Zephyr-API/cores`.

**Known Bug(s):**

__NOTE:__ You can skip this step as well if you ran ``install.sh``.

* While compiling with the ArduinoCore-API `WCharacter.h` produces many errors. The include of that file needs to be deleted from `cores/arduino/api/ArduinoAPI.h` (it is unused in this port.) We are looking into resolving the issue.

**Maintainers**:
Expand Down
33 changes: 33 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
set -e;

printf '%s\n' "Before running this script, make sure of the following:"
printf '%s\n' "1. You have zephyr installed properly on your system."
printf '%s\n' "2. Updated west.yml in zephyr and run west update to pull this module in proper location."
printf '%s\n' "If you meet the above criteria, please enter [yY]Yes and if not, then [nN]No."
read answer;

if [ "$answer" != "${answer#[Yy]}" ] ;then
printf '%s\n' "Yes";
else
printf '%s\n' "No";
exit 1;
fi

API_FOLDER=~/.ArduinoCore-API
if [ ! -d "$API_FOLDER" ] ; then
printf '%s\n' "Cloning ArduinoCore API in $API_FOLDER";
git clone git@github.com:arduino/ArduinoCore-API ~/.ArduinoCore-API;
else
printf '%s\n' "API Folder already exists, skipping clone...";
fi

printf '%s\n' "Commenting out WCharacter.h because it fails to build properly";
sed '/WCharacter.h/ s/./\/\/ &/' ~/.ArduinoCore-API/api/ArduinoAPI.h > ~/.ArduinoCore-API/api/tmpArduinoAPI.h ;
mv ~/.ArduinoCore-API/api/tmpArduinoAPI.h ~/.ArduinoCore-API/api/ArduinoAPI.h ;

printf '%s\n' "Linking...";
ln -sf ~/.ArduinoCore-API/api cores/arduino/. ;

printf '%s\n' "Module Successfully setup...";