Skip to content

Commit

Permalink
Add macOS universal library build support
Browse files Browse the repository at this point in the history
  • Loading branch information
RyeMutt committed Nov 19, 2024
1 parent ebe4392 commit bd7453c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build:
strategy:
matrix:
os: [windows-2022, macos-12, ubuntu-22.04]
os: [windows-2022, macos-15, ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- name: Setup Homebrew Packages
Expand All @@ -21,7 +21,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get -y install autoconf automake autopoint gettext
- uses: secondlife/action-autobuild@v4
- uses: secondlife/action-autobuild@v5
release:
needs: build
runs-on: [ubuntu-latest]
Expand Down
41 changes: 27 additions & 14 deletions build-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pushd "$HUNSPELL_SOURCE_DIR"
mkdir -p "$stage/lib/release"

if [ "$AUTOBUILD_ADDRSIZE" = 32 ]
then
then
debbitdir=msvc/Debug/libhunspell
relbitdir=msvc/Release/libhunspell
else
Expand All @@ -77,18 +77,31 @@ pushd "$HUNSPELL_SOURCE_DIR"
# force regenerate autoconf
autoreconf -fvi

mkdir -p "build_release"
pushd "build_release"
CFLAGS="$plainopts" CXXFLAGS="$opts" \
../configure --prefix="$stage" --libdir="$stage/lib/release" --enable-static --disable-shared
make -j$AUTOBUILD_CPU_COUNT
make install

# conditionally run unit tests
if [ "${DISABLE_UNIT_TESTS:-0}" = "0" ]; then
make check
fi
popd
export MACOSX_DEPLOYMENT_TARGET="$LL_BUILD_DARWIN_DEPLOY_TARGET"

for arch in x86_64 arm64 ; do
ARCH_ARGS="-arch $arch"
opts="${TARGET_OPTS:-$ARCH_ARGS $LL_BUILD_RELEASE}"
cc_opts="$(remove_cxxstd $opts)"
ld_opts="$ARCH_ARGS"

mkdir -p "build_$arch"
pushd "build_$arch"
CFLAGS="$cc_opts" \
CXXFLAGS="$opts" \
LDFLAGS="$ld_opts" \
../configure --prefix="$stage" --libdir="$stage/lib/release/$arch" --enable-static --disable-shared --host=$arch-apple-darwin
make -j$AUTOBUILD_CPU_COUNT
make install

# conditionally run unit tests
if [ "${DISABLE_UNIT_TESTS:-0}" = "0" ]; then
make check -j$AUTOBUILD_CPU_COUNT
fi
popd
done

lipo -create -output ${stage}/lib/release/libhunspell-1.7.a ${stage}/lib/release/x86_64/libhunspell-1.7.a ${stage}/lib/release/arm64/libhunspell-1.7.a
;;
linux*)
# Default target per --address-size
Expand All @@ -107,7 +120,7 @@ pushd "$HUNSPELL_SOURCE_DIR"

# conditionally run unit tests
if [ "${DISABLE_UNIT_TESTS:-0}" = "0" ]; then
make check
make check -j$AUTOBUILD_CPU_COUNT
fi
popd
;;
Expand Down

0 comments on commit bd7453c

Please sign in to comment.