Skip to content

Commit 051ef3f

Browse files
committed
Enable Cygwin build
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
1 parent d2d80e7 commit 051ef3f

File tree

2 files changed

+99
-10
lines changed

2 files changed

+99
-10
lines changed

Diff for: .github/workflows/build.yml

+60
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 testlist/${{matrix.boards}}.dat"

Diff for: cibuild.sh

+39-10
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 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="gen-romfs kconfig-frontends arm-gcc-toolchain"
58+
;;
4759
esac
4860

4961
function add_path {
@@ -115,6 +127,9 @@ function kconfig-frontends {
115127
add_path $prebuilt/kconfig-frontends/bin
116128

117129
if [ ! -f "$prebuilt/kconfig-frontends/bin/kconfig-conf" ]; then
130+
if [ ! -d "$tools" ]; then
131+
git clone https://bitbucket.org/nuttx/tools.git $tools
132+
fi
118133
cd $tools/kconfig-frontends
119134
./configure --prefix=$prebuilt/kconfig-frontends \
120135
--disable-kconfig --disable-nconf --disable-qconf \
@@ -142,22 +157,33 @@ function bloaty {
142157

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

146163
if [ ! -f "$prebuilt/gcc-arm-none-eabi/bin/arm-none-eabi-gcc" ]; then
147-
local flavor
164+
cd $prebuilt
165+
local filename
148166
case $os in
149167
Darwin)
150-
flavor=mac
151-
;;
168+
filename="$releasebase-mac.tar.bz2"
169+
wget --quiet $urlbase/$filename
170+
tar jxf $filename
171+
mv $releasebase gcc-arm-none-eabi
172+
;;
152173
Linux)
153-
flavor=x86_64-linux
174+
filename="$releasebase-x86_64.tar.bz2"
175+
wget --quiet $urlbase/$filename
176+
tar jxf $filename
177+
mv $releasebase gcc-arm-none-eabi
178+
;;
179+
Cygwin)
180+
filename="$releasebase-win32.zip"
181+
wget --quiet $urlbase/$filename
182+
mkdir -p gcc-arm-none-eabi
183+
unzip -qq $filename -d ./gcc-arm-none-eabi
154184
;;
155185
esac
156-
cd $prebuilt
157-
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
158-
tar jxf gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
159-
mv gcc-arm-none-eabi-9-2019-q4-major gcc-arm-none-eabi
160-
rm gcc-arm-none-eabi-9-2019-q4-major-${flavor}.tar.bz2
186+
rm $filename
161187
fi
162188
arm-none-eabi-gcc --version
163189
}
@@ -391,6 +417,9 @@ function run_builds {
391417
Linux)
392418
ncpus=`grep -c ^processor /proc/cpuinfo`
393419
;;
420+
Cygwin)
421+
ncpus=`grep -c ^processor /proc/cpuinfo`
422+
;;
394423
esac
395424

396425
options+="-j $ncpus"

0 commit comments

Comments
 (0)