diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 367c2fe4..48bbc204 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,22 +10,25 @@ on: jobs: build-macos: - name: Build on macos - runs-on: macos-11 + name: Build on macOS (x86_64 and aarch64) + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-11, macos-14] steps: - uses: actions/checkout@v2 - name: Install build dependencies run: | brew update - brew install automake + brew install automake autoconf libtool - uses: actions/setup-java@v2 with: distribution: 'temurin' java-version: '8' cache: 'maven' - name: Build and test the package - run: mvn test + run: make compile-macosx - name: Store the build arctifacts uses: actions/upload-artifact@v3 with: diff --git a/Makefile b/Makefile index 277af45e..01d159ed 100644 --- a/Makefile +++ b/Makefile @@ -2,22 +2,30 @@ MVN := mvn COMPOSE := docker-compose VERSION := $(shell xmllint --xpath "/*/*[local-name()='version']/text()" pom.xml) -TARGET_NAR_LINUX_32 := $(addprefix target/nar/louis-$(VERSION)-i386-Linux-gpp-,executable shared) -TARGET_NAR_LINUX_64 := $(addprefix target/nar/louis-$(VERSION)-amd64-Linux-gpp-,executable shared) -TARGET_NAR_MAC_32 := $(addprefix target/nar/louis-$(VERSION)-i386-MacOSX-gpp-,executable shared) -TARGET_NAR_MAC_64 := $(addprefix target/nar/louis-$(VERSION)-x86_64-MacOSX-gpp-,executable shared) -TARGET_NAR_WIN_32 := $(addprefix target/nar/louis-$(VERSION)-i686-w64-mingw32-gpp-,executable shared) -TARGET_NAR_WIN_64 := $(addprefix target/nar/louis-$(VERSION)-x86_64-w64-mingw32-gpp-,executable shared) +TARGET_NAR_LINUX_32 := $(addprefix target/nar/louis-$(VERSION)-i386-Linux-gpp-,executable shared) +TARGET_NAR_LINUX_64 := $(addprefix target/nar/louis-$(VERSION)-amd64-Linux-gpp-,executable shared) +TARGET_NAR_MAC_32 := $(addprefix target/nar/louis-$(VERSION)-i386-MacOSX-gpp-,executable shared) +TARGET_NAR_MAC_X64 := $(addprefix target/nar/louis-$(VERSION)-x86_64-MacOSX-gpp-,executable shared) +TARGET_NAR_MAC_ARM64 := $(addprefix target/nar/louis-$(VERSION)-aarch64-MacOSX-gpp-,executable shared) +TARGET_NAR_WIN_32 := $(addprefix target/nar/louis-$(VERSION)-i686-w64-mingw32-gpp-,executable shared) +TARGET_NAR_WIN_64 := $(addprefix target/nar/louis-$(VERSION)-x86_64-w64-mingw32-gpp-,executable shared) -all : compile-linux compile-macosx compile-windows +all : compile-linux compile-windows +compile-linux : $(TARGET_NAR_LINUX_32) $(TARGET_NAR_LINUX_64) +compile-windows : $(TARGET_NAR_WIN_32) $(TARGET_NAR_WIN_64) + +ifeq ($(shell uname -s),Darwin) +all : compile-macosx +ifeq ($(shell uname -m),x86_64) +compile-macosx : $(TARGET_NAR_MAC_X64) +else +compile-macosx : $(TARGET_NAR_MAC_ARM64) +endif +endif clean : $(MVN) clean -compile-linux : $(TARGET_NAR_LINUX_32) $(TARGET_NAR_LINUX_64) -compile-macosx : $(TARGET_NAR_MAC_64) -compile-windows : $(TARGET_NAR_WIN_32) $(TARGET_NAR_WIN_64) - $(TARGET_NAR_LINUX_32) : $(COMPOSE) run debian $(MVN) test -Dos.arch=i386 @@ -25,12 +33,18 @@ $(TARGET_NAR_LINUX_64) : $(COMPOSE) run debian $(MVN) test $(TARGET_NAR_MAC_32) : - [[ "$$(uname)" == Darwin ]] + [[ "$$(uname -s)" == Darwin ]] $(MVN) test -Dos.arch=i386 -$(TARGET_NAR_MAC_64) : - [[ "$$(uname)" == Darwin && "$$(uname -m)" == x86_64 ]] +$(TARGET_NAR_MAC_X64) : + [[ "$$(uname -s)" == Darwin && "$$(uname -m)" == x86_64 ]] + $(MVN) test + +$(TARGET_NAR_MAC_ARM64) : + [[ "$$(uname)" == Darwin && "$$(uname -m)" == arm64 ]] $(MVN) test + cp target/nar/gnu/aarch64-MacOSX-gpp/target/lib/liblouis.dylib \ + target/nar/louis-$(VERSION)-aarch64-MacOSX-gpp-shared/lib/aarch64-MacOSX-gpp/shared/ $(TARGET_NAR_WIN_32) : $(COMPOSE) run debian $(MVN) test -Pcross-compile -Dhost.os=w64-mingw32 -Dos.arch=i686 diff --git a/pom.xml b/pom.xml index 50d2ca35..ca4228e9 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.liblouis louis - 3.27.0-p1 + 3.27.0-p2-SNAPSHOT nar liblouis-nar liblouis packaged in a NAR (Native ARchive). @@ -87,6 +87,9 @@ shared + + g++ +