Skip to content

Build MacOS

Build MacOS #14

Workflow file for this run

# Manually started action to build Picotool and OpenOCD for Mac and upload to an artifact
name: Build MacOS
on: [workflow_dispatch]
jobs:
build:
runs-on: macos-12
steps:
- uses: actions/checkout@v4
with:
submodules: false
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '13.1.0'
- name: Build Picotool
run: |
uname -a
brew update
brew install bash libtool automake libusb hidapi cmake
# Get the SDK ready
git clone https://github.com/raspberrypi/pico-sdk.git
cd pico-sdk
git checkout 2.0.0
git submodule update --init
cd ..
# Check out this branch
git clone https://github.com/raspberrypi/picotool.git
cd picotool
git checkout 2.0.0
export gitrev=$(git rev-parse --short HEAD)
export pioarch=darwin_x86_64
export piotup=x86_64-apple-darwin20.4
# Build!
mkdir build
cd build
cmake -DPICO_SDK_PATH=../../pico-sdk -S .. -B .
make -j
strip picotool
# Package
mkdir /tmp/picotool
cp -a /usr/local/Cellar/libusb/*/lib/*.dylib /tmp/picotool/.
cp -a picotool /tmp/picotool/.
cp -a ../LICENSE.TXT /tmp/picotool/.
cp -a ../README.md /tmp/picotool/.
# Make dylibs relative
otool -L /tmp/picotool/picotool
(cwd=$(pwd); cd /tmp/picotool; bash $cwd/../../macos-relative-dylibs.sh)
otool -L /tmp/picotool/picotool
# Create tarball
echo -e '{\n "description": "picotool-utility",\n "name": "tool-picotool-rp2040-earlephilhower",\n "system": [ "'$pioarch'" ],\n "url": "https://github.com/earlephilhower/pico-quick-toolchain",\n "version": "5.120300.'$(date +%y%m%d)'"\n}' > /tmp/picotool/package.json
pushd /tmp; zip -9r /tmp/$piotup.picotool-$gitrev.$(date +%y%m%d).zip picotool; popd
tar cvf ../../picotool.darwin-x86_64.tar -C /tmp /tmp/$piotup.picotool-$gitrev.$(date +%y%m%d).zip
- name: Upload Picotool
uses: actions/upload-artifact@v4
with:
name: picotool.darwin-x86_64.tar
path: picotool.darwin-x86_64.tar
- name: Build OpenOCD
run: |
uname -a
brew update
brew install bash libtool automake libusb hidapi
git clone https://github.com/raspberrypi/openocd.git
pushd openocd
git checkout sdk-2.0.0
export gitrev=$(git rev-parse --short HEAD)
export pioarch=darwin_x86_64
export piotup=x86_64-apple-darwin20.4
# Remove TEXI warning
grep -v raggedright doc/openocd.texi > p2
mv p2 doc/openocd.texi
bash bootstrap
./configure --prefix=/tmp/openocd --enable-picoprobe --enable-cmsis-dap-v2 --enable-cmsis-dap \
--disable-dummy --disable-rshim --disable-ftdi --disable-stlink --disable-ti-icdi \
--disable-ulink --disable-usb-blaster-2 --disable-ft232r --disable-vsllink \
--disable-xds110 --disable-osbdm --disable-opendous --disable-aice --disable-usbprog \
--disable-rlink --disable-armjtagew --disable-nulink --disable-kitprog \
--disable-usb-blaster --disable-presto --disable-openjtag --disable-jlink \
--disable-parport --disable-parport-ppdev --disable-parport-giveio --disable-jtag_vpi \
--disable-jtag_dpi --disable-amtjtagaccel --disable-zy1000-master --disable-zy1000 \
--disable-ioutil --disable-bcm2835gpio --disable-imx_gpio --disable-ep93xx \
--disable-at91rm9200 --disable-gw16012 --disable-oocd_trace --disable-buspirate \
--disable-sysfsgpio --disable-xlnx-pcie-xvc --disable-minidriver-dummy \
--disable-remote-bitbang --disable-werror
make -j
make install
popd
cp -a /usr/local/Cellar/hidapi/*/lib/*.dylib /tmp/openocd/bin/.
cp -a /usr/local/Cellar/libusb/*/lib/*.dylib /tmp/openocd/bin/.
cp -a /usr/local/Cellar/capstone/*/lib/*.dylib /tmp/openocd/bin/.
# Make dylibs relative
otool -L /tmp/openocd/bin/openocd
(cwd=$(pwd); cd /tmp/openocd/bin; bash $cwd/macos-relative-dylibs.sh)
otool -L /tmp/openocd/bin/openocd
echo -e '{\n "description": "picotool-utility",\n "name": "tool-openocd-rp2040-earlephilhower",\n "system": [ "'$pioarch'" ],\n "url": "https://github.com/earlephilhower/pico-quick-toolchain",\n "version": "5.120300.'$(date +%y%m%d)'"\n}' > /tmp/openocd/package.json
pushd /tmp; zip -9r /tmp/$piotup.openocd-$gitrev.$(date +%y%m%d).zip openocd; popd
tar cvf openocd.darwin-x86_64.tar -C /tmp /tmp/$piotup.openocd-$gitrev.$(date +%y%m%d).zip
- name: Upload OpenOCD
uses: actions/upload-artifact@v4
with:
name: openocd.darwin-x86_64.tar
path: openocd.darwin-x86_64.tar