Skip to content

Commit bb42d72

Browse files
committed
Enable Cygwin build
1 parent 732c33b commit bb42d72

File tree

2 files changed

+99
-10
lines changed

2 files changed

+99
-10
lines changed

.github/workflows/build.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,63 @@ jobs:
144144
ccache -M 400M
145145
ccache -c
146146
147+
cygwin:
148+
runs-on: windows-latest
149+
150+
strategy:
151+
matrix:
152+
boards: [arm-12, sim]
153+
154+
steps:
155+
- run: git config --global core.autocrlf false
156+
- name: Checkout nuttx repo
157+
uses: actions/checkout@v2
158+
with:
159+
repository: apache/incubator-nuttx
160+
path: nuttx
161+
fetch-depth: 0
162+
163+
- name: Fetch nuttx tags
164+
run: |
165+
cd nuttx
166+
git fetch --tags
167+
168+
- name: Checkout apps repo
169+
uses: actions/checkout@v2
170+
with:
171+
repository: apache/incubator-nuttx-apps
172+
path: apps
173+
fetch-depth: 0
174+
175+
- name: Checkout testing repo
176+
uses: actions/checkout@v2
177+
with:
178+
repository: apache/incubator-nuttx-testing
179+
path: testing
180+
181+
- name: Restore tools cache
182+
id: cache-tools
183+
uses: actions/cache@v2
184+
env:
185+
cache-name: ${{ runner.os }}-cache-tools
186+
with:
187+
path: prebuilt
188+
key: ${{ runner.os }}-tools-${{ hashFiles('./testing/cibuild.sh') }}
189+
190+
- name: Install cygwin base packages with chocolatey
191+
shell: pwsh
192+
run: |
193+
choco install --no-progress cygwin --version 3.1.4
194+
choco install cyg-get
195+
- name: Install NuutX Build Requirements for Cygwin
196+
run: |
197+
cyg-get make gcc-core gcc-g++ flex git bison byacc gperf gdb unzip awk `
198+
automake-1.15 autoconf wget xxd libmpc-devel libncurses-devel `
199+
libmpfr-devel zlib-devel
200+
- name: Set Cygwin PATH env
201+
run: |
202+
echo '::set-env name=PATH::C:\tools\cygwin\bin;C:\tools\cygwin\usr\bin'
203+
- name: Run builds
204+
shell: cmd
205+
run: |
206+
C:\tools\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -c "cd testing &&./cibuild.sh -i -x testlist/${{matrix.boards}}.dat"

cibuild.sh

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,18 @@ nuttx=$WORKSPACE/nuttx
3232
apps=$WORKSPACE/apps
3333
tools=$WORKSPACE/tools
3434
prebuilt=$WORKSPACE/prebuilt
35-
os=$(uname -s)
3635
EXTRA_PATH=
3736

37+
38+
kernel="$(uname -s)"
39+
case $kernel in
40+
Linux*) os=Linux;;
41+
Darwin*) os=Darwin;;
42+
CYGWIN*) os=Cygwin;;
43+
MINGW*) os=MinGw;;
44+
*) os="UNKNOWN:$kernel"
45+
esac
46+
3847
case $os in
3948
Darwin)
4049
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"
@@ -44,6 +53,9 @@ case $os in
4453
Linux)
4554
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"
4655
;;
56+
Cygwin)
57+
install="kconfig-frontends arm-gcc-toolchain"
58+
;;
4759
esac
4860

4961
function add_path {
@@ -126,6 +138,9 @@ function kconfig-frontends {
126138
add_path $prebuilt/kconfig-frontends/bin
127139

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

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

157174
if [ ! -f "$prebuilt/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then
158-
local flavor
175+
cd $prebuilt
176+
local filename
159177
case $os in
160178
Darwin)
161-
flavor=mac
162-
;;
179+
filename="$releasebase-mac.tar.bz2"
180+
wget --quiet $urlbase/$filename
181+
tar jxf $filename
182+
mv $releasebase gcc-arm-none-eabi
183+
;;
163184
Linux)
164-
flavor=x86_64-linux
185+
filename="$releasebase-x86_64.tar.bz2"
186+
wget --quiet $urlbase/$filename
187+
tar jxf $filename
188+
mv $releasebase gcc-arm-none-eabi
189+
;;
190+
Cygwin)
191+
filename="$releasebase-win32.zip"
192+
wget --quiet $urlbase/$filename
193+
mkdir -p gcc-arm-none-eabi
194+
unzip -qq $filename -d ./gcc-arm-none-eabi
165195
;;
166196
esac
167-
cd $prebuilt
168-
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
169-
tar jxf gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
170-
mv gcc-arm-none-eabi-9-2019-q4-major gcc-arm-none-eabi
171-
rm gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
197+
rm $filename
172198
fi
173199
arm-none-eabi-gcc --version
174200
}
@@ -402,6 +428,9 @@ function run_builds {
402428
Linux)
403429
ncpus=`grep -c ^processor /proc/cpuinfo`
404430
;;
431+
Cygwin)
432+
ncpus=`grep -c ^processor /proc/cpuinfo`
433+
;;
405434
esac
406435

407436
options+="-j $ncpus"

0 commit comments

Comments
 (0)