From 4809aaa93c268e31423fe3081a2f4e163b8bb893 Mon Sep 17 00:00:00 2001 From: "D. Bohdan" Date: Fri, 4 Oct 2024 16:10:13 +0000 Subject: [PATCH] ci(github): add macOS --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ .github/workflows/install-deps.sh | 4 ++++ GNUmakefile | 10 +++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 924d397..5a39665 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,6 +59,31 @@ 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 + windows: runs-on: windows-latest steps: diff --git a/.github/workflows/install-deps.sh b/.github/workflows/install-deps.sh index 8114e13..ae4df7c 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 libpng 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