Skip to content

Commit

Permalink
Fix compilation on macOS 14+ and M1 arch
Browse files Browse the repository at this point in the history
  • Loading branch information
dciabrin committed Jan 3, 2025
1 parent a32ff22 commit 3d9cac4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: >
brew install autoconf automake bison boost bzip2 coreutils gawk
libtool make pkg-config readline texinfo expat flex gettext
gmp gnu-sed libmpc mpfr ncurses xz zlib
gmp gnu-sed libmpc mpfr ncurses xz zlib zstd
- name: Build
run: ./.github/scripts/build.sh
Expand Down
38 changes: 19 additions & 19 deletions .github/workflows/build-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ on:
branches-ignore:
- 'master'
jobs:
linux:
name: Linux build
runs-on: ubuntu-latest
env:
PREFIX: "/usr"
GNU_MIRROR: "https://mirror.checkdomain.de/gnu"
NEWLIB_MIRROR: "https://ftp.gwdg.de/pub/linux/sources.redhat.com"
steps:
- name: Checkout
uses: actions/checkout@v2
# linux:
# name: Linux build
# runs-on: ubuntu-latest
# env:
# PREFIX: "/usr"
# GNU_MIRROR: "https://mirror.checkdomain.de/gnu"
# NEWLIB_MIRROR: "https://ftp.gwdg.de/pub/linux/sources.redhat.com"
# steps:
# - name: Checkout
# uses: actions/checkout@v2

- name: Dependencies
run: >
sudo apt-get install pkg-config gcc g++ flex bison gawk
gettext bzip2 lzma xz-utils libboost-dev libexpat1-dev
libgc-dev libgmp-dev zlib1g-dev libipt-dev libmpc-dev
libmpfr-dev libncurses5-dev libreadline-dev texinfo
# - name: Dependencies
# run: >
# sudo apt-get install pkg-config gcc g++ flex bison gawk
# gettext bzip2 lzma xz-utils libboost-dev libexpat1-dev
# libgc-dev libgmp-dev zlib1g-dev libipt-dev libmpc-dev
# libmpfr-dev libncurses5-dev libreadline-dev texinfo

- name: Build
run: ./.github/scripts/build.sh
# - name: Build
# run: ./.github/scripts/build.sh

macos:
name: macOS build
Expand All @@ -40,7 +40,7 @@ jobs:
run: >
brew install autoconf automake bison boost bzip2 coreutils gawk
libtool make pkg-config readline texinfo expat flex gettext
gmp gnu-sed libmpc mpfr ncurses xz zlib
gmp gnu-sed libmpc mpfr ncurses xz zlib zstd
- name: Build
run: ./.github/scripts/build.sh
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019-2022 Damien Ciabrini
# Copyright (c) 2019-2025 Damien Ciabrini
# This file is part of ngdevkit
#
# ngdevkit is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -91,12 +91,21 @@ GDB_PKG_CONFIG_PATH=
ifeq ($(shell uname -s),Darwin)
HOMEBREW_PREFIX=$(shell PATH="$$PATH:/opt/homebrew/bin:/usr/local/bin" brew --prefix)

CFLAGS=-I$(HOMEBREW_PREFIX)/include
CXXFLAGS=-I$(HOMEBREW_PREFIX)/include
CPPFLAGS=-I$(HOMEBREW_PREFIX)/include
LDFLAGS=-L$(HOMEBREW_PREFIX)/lib -Wl,-rpath,$(HOMEBREW_PREFIX)/lib
EXTRA_BUILD_CMD=export CFLAGS="$$CFLAGS $(CFLAGS)" CXXFLAGS="$$CXXFLAGS $(CXXFLAGS)" CPPFLAGS="$$CPPFLAGS $(CPPFLAGS)" LDFLAGS="$$LDFLAGS $(LDFLAGS)"

GCC_C_BUILD_FLAGS+=-DHAVE_SETLOCALE
GCC_CXX_BUILD_FLAGS+=-DHAVE_SETLOCALE

GDB_C_BUILD_FLAGS+=-I$(HOMEBREW_PREFIX)/opt/readline/include
GDB_CXX_BUILD_FLAGS+=-I$(HOMEBREW_PREFIX)/opt/readline/include
GDB_LD_BUILD_FLAGS+=-L$(HOMEBREW_PREFIX)/opt/readline/lib
GDB_PKG_CONFIG_PATH+=$(HOMEBREW_PREFIX)/opt/readline/lib/pkgconfig

REALPATH=grealpath
REALPATH=$(HOMEBREW_PREFIX)/bin/grealpath
endif


Expand Down

0 comments on commit 3d9cac4

Please sign in to comment.