diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 924d397..b287cdb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,6 +59,32 @@ jobs: path: | hicolor + mac: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + .github/workflows/install-deps.sh + + - name: Build and test + run: | + make test + + - name: Bundle dynamic libraries + run: | + dylibbundler --bundle-deps --create-dir --fix-file hicolor + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: hicolor-macos-arm64 + path: | + hicolor + libs/ + windows: runs-on: windows-latest steps: diff --git a/.github/workflows/install-deps.sh b/.github/workflows/install-deps.sh index 7cb1562..25eed3a 100755 --- a/.github/workflows/install-deps.sh +++ b/.github/workflows/install-deps.sh @@ -1,6 +1,10 @@ #! /bin/sh set -e +if [ "$(uname)" = Darwin ]; then + brew install dylibbundler tcl-tk +fi + if [ "$(uname)" = Linux ]; then apt-get install -y graphicsmagick pkgconf fi diff --git a/GNUmakefile b/GNUmakefile index f5bf5b7..ed022ad 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,9 +1,17 @@ +PLATFORM ?= $(shell uname) + +ifeq ($(PLATFORM), Darwin) + PLATFORM_CFLAGS ?= +else + PLATFORM_CFLAGS ?= -static -Wl,--gc-sections +endif + LIBPNG_CFLAGS ?= $(shell pkg-config --cflags libpng) LIBPNG_LIBS ?= $(shell pkg-config --libs libpng) ZLIB_CFLAGS ?= $(shell pkg-config --cflags zlib) ZLIB_LIBS ?= $(shell pkg-config --libs zlib) -CFLAGS ?= -g -O3 -static -ffunction-sections -fdata-sections -Wl,--gc-sections -Wall -Wextra $(LIBPNG_CFLAGS) $(ZLIB_CFLAGS) +CFLAGS ?= -g -O3 $(PLATFORM_CFLAGS) -ffunction-sections -fdata-sections -Wall -Wextra $(LIBPNG_CFLAGS) $(ZLIB_CFLAGS) LIBS ?= $(LIBPNG_LIBS) $(ZLIB_LIBS) -lm PREFIX ?= /usr/local diff --git a/README.md b/README.md index fcb316c..fb3b617 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,16 @@ fi gmake test ``` +### macOS + +Install [Homebrew](https://brew.sh/). +Run the following commands in a clone of the HiColor repository. + +```sh +brew install libpng tcl-tk +make test +``` + ### NetBSD ```sh