Skip to content

Commit

Permalink
Enable Cygwin build
Browse files Browse the repository at this point in the history
  • Loading branch information
btashton committed Sep 23, 2020
1 parent 732c33b commit 2bf71c6
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 10 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,63 @@ jobs:
ccache -M 400M
ccache -c
cygwin:
runs-on: windows-latest

strategy:
matrix:
boards: [arm-12, sim]

steps:
- run: git config --global core.autocrlf false
- name: Checkout nuttx repo
uses: actions/checkout@v2
with:
repository: apache/incubator-nuttx
path: nuttx
fetch-depth: 0

- name: Fetch nuttx tags
run: |
cd nuttx
git fetch --tags
- name: Checkout apps repo
uses: actions/checkout@v2
with:
repository: apache/incubator-nuttx-apps
path: apps
fetch-depth: 0

- name: Checkout testing repo
uses: actions/checkout@v2
with:
repository: apache/incubator-nuttx-testing
path: testing

- name: Restore tools cache
id: cache-tools
uses: actions/cache@v2
env:
cache-name: ${{ runner.os }}-cache-tools
with:
path: prebuilt
key: ${{ runner.os }}-tools-${{ hashFiles('./testing/cibuild.sh') }}

- name: Install cygwin base packages with chocolatey
shell: pwsh
run: |
choco install --no-progress cygwin --version 3.1.4
choco install cyg-get
- name: Install NuutX Build Requirements for Cygwin
run: |
cyg-get make gcc-core gcc-g++ flex git bison byacc gperf gdb unzip awk `
automake-1.15 autoconf wget xxd libmpc-devel libncurses-devel `
libmpfr-devel zlib-devel
- name: Set Cygwin PATH env
run: |
echo '::set-env name=PATH::C:\tools\cygwin\bin;C:\tools\cygwin\usr\bin'
- name: Run builds
shell: cmd
run: |
C:\tools\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -c "cd testing &&./cibuild.sh -i -x testlist/${{matrix.boards}}.dat"
49 changes: 39 additions & 10 deletions cibuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,18 @@ nuttx=$WORKSPACE/nuttx
apps=$WORKSPACE/apps
tools=$WORKSPACE/tools
prebuilt=$WORKSPACE/prebuilt
os=$(uname -s)
EXTRA_PATH=


kernel="$(uname -s)"
case $kernel in
Linux*) os=Linux;;
Darwin*) os=Darwin;;
CYGWIN*) os=Cygwin;;
MINGW*) os=MinGw;;
*) os="UNKNOWN:$kernel"
esac

case $os in
Darwin)
install="python-tools u-boot-tools discoteq-flock elf-toolchain gen-romfs kconfig-frontends arm-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain avr-gcc-toolchain c-cache binutils"
Expand All @@ -44,6 +53,9 @@ case $os in
Linux)
install="python-tools gen-romfs gperf kconfig-frontends arm-gcc-toolchain mips-gcc-toolchain riscv-gcc-toolchain xtensa-esp32-gcc-toolchain rx-gcc-toolchain c-cache"
;;
Cygwin)
install="gen-romfs kconfig-frontends arm-gcc-toolchain"
;;
esac

function add_path {
Expand Down Expand Up @@ -126,6 +138,9 @@ function kconfig-frontends {
add_path $prebuilt/kconfig-frontends/bin

if [ ! -f "$prebuilt/kconfig-frontends/bin/kconfig-conf" ]; then
if [ ! -d "$tools" ]; then
git clone https://bitbucket.org/nuttx/tools.git $tools
fi
cd $tools/kconfig-frontends
./configure --prefix=$prebuilt/kconfig-frontends \
--disable-kconfig --disable-nconf --disable-qconf \
Expand Down Expand Up @@ -153,22 +168,33 @@ function bloaty {

function arm-gcc-toolchain {
add_path $prebuilt/gcc-arm-none-eabi/bin
urlbase="https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/"
releasebase="gcc-arm-none-eabi-9-2019-q4-major"

if [ ! -f "$prebuilt/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then
local flavor
cd $prebuilt
local filename
case $os in
Darwin)
flavor=mac
;;
filename="$releasebase-mac.tar.bz2"
wget --quiet $urlbase/$filename
tar jxf $filename
mv $releasebase gcc-arm-none-eabi
;;
Linux)
flavor=x86_64-linux
filename="$releasebase-x86_64.tar.bz2"
wget --quiet $urlbase/$filename
tar jxf $filename
mv $releasebase gcc-arm-none-eabi
;;
Cygwin)
filename="$releasebase-win32.zip"
wget --quiet $urlbase/$filename
mkdir -p gcc-arm-none-eabi
unzip -qq $filename -d ./gcc-arm-none-eabi
;;
esac
cd $prebuilt
wget --quiet https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
tar jxf gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
mv gcc-arm-none-eabi-9-2019-q4-major gcc-arm-none-eabi
rm gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
rm $filename
fi
arm-none-eabi-gcc --version
}
Expand Down Expand Up @@ -402,6 +428,9 @@ function run_builds {
Linux)
ncpus=`grep -c ^processor /proc/cpuinfo`
;;
Cygwin)
ncpus=`grep -c ^processor /proc/cpuinfo`
;;
esac

options+="-j $ncpus"
Expand Down

0 comments on commit 2bf71c6

Please sign in to comment.