Skip to content

Make Linux build static #75

Make Linux build static

Make Linux build static #75

Workflow file for this run

name: Build minichlink
on: [push, pull_request]
# push:
# paths:
# - minichlink/**
# pull_request:
# paths:
# - minichlink/**
jobs:
build-minichlink:
strategy:
fail-fast: false
matrix:
# See https://github.com/actions/runner-images?tab=readme-ov-file#available-images
# "macos-13" is Intel-based (x64)
# "macos-14" is ARM64 based
os: [ubuntu-latest, macos-13 , macos-14]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install Dependencies (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get update && sudo apt-get install -y build-essential make libusb-1.0-0-dev libudev-dev mingw-w64-x86-64-dev gcc-mingw-w64-x86-64
# we don't need to brew install libusb on Mac, actually preinstalled on the runner! :)
- name: Build (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
cd minichlink
make clean
LDFLAGS=-static make V=1 -j3
- name: Build (Mac 13 Intel)
if: ${{ matrix.os == 'macos-13' }}
run: |
cd minichlink
make clean
make V=1 -j3
otool -L ./minichlink
LIBUSB_PATH="/usr/local/opt/libusb/lib/libusb-1.0.0.dylib"
echo "LIBUSB PATH Is: $LIBUSB_PATH"
cp $LIBUSB_PATH .
install_name_tool -change $LIBUSB_PATH "@executable_path/./libusb-1.0.0.dylib" ./minichlink
otool -L ./minichlink
- name: Build (Mac 14 ARM)
if: ${{ matrix.os == 'macos-14' }}
run: |
cd minichlink
make clean
make V=1 -j3
otool -L ./minichlink
LIBUSB_PATH="/opt/homebrew/opt/libusb/lib/libusb-1.0.0.dylib"
echo "LIBUSB PATH Is: $LIBUSB_PATH"
cp $LIBUSB_PATH .
install_name_tool -change $LIBUSB_PATH "@executable_path/./libusb-1.0.0.dylib" ./minichlink
otool -L ./minichlink
# we cross-compile the Windows binaries from Linux
- name: Build (for Windows)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
cd minichlink
OS=Windows_NT make clean
OS=Windows_NT make V=1 -j3 minichlink.exe
- name: "Pack (Linux)"
if: ${{ matrix.os == 'ubuntu-latest' }}
run: tar czf minichlink.tar.gz -C minichlink minichlink minichlink.so 99-minichlink.rules
- name: "Pack (Mac)"
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' }}
run: tar czf minichlink.tar.gz -C minichlink minichlink libusb-1.0.0.dylib
# no packing needed for Windows as it's .exe only
- name: "Upload minichlink (Linux)"
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v4
with:
name: minichlink (Linux)
path: minichlink.tar.gz
- name: "Upload minichlink (MacOS 13 Intel)"
if: ${{ matrix.os == 'macos-13' }}
uses: actions/upload-artifact@v4
with:
name: minichlink (MacOS 13 Intel)
path: minichlink.tar.gz
- name: "Upload minichlink (MacOs 14 ARM64)"
if: ${{ matrix.os == 'macos-14' }}
uses: actions/upload-artifact@v4
with:
name: minichlink (MacOS 14 ARM64)
path: minichlink.tar.gz
- name: "Upload minichlink (Windows)"
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v4
with:
name: minichlink (Windows)
path: |
minichlink/minichlink.exe
minichlink/libusb-1.0.dll