Skip to content

Commit b8462be

Browse files
jrtc27quark17
authored andcommitted
Support building on Arm-based Macs
No substantive changes needed other than yices's build system needing yet more hand-holding.
1 parent e76c56f commit b8462be

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

platform.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
MACHTYPE = $(shell $(TOP)/platform.sh machtype)
2020
export MACHTYPE
2121

22-
ifneq ($(MACHTYPE), $(findstring $(MACHTYPE), x86_64 i386 i486 i586 i686 ppc64le aarch64 armv7l))
22+
ifneq ($(MACHTYPE), $(findstring $(MACHTYPE), x86_64 i386 i486 i586 i686 ppc64le aarch64 arm64 armv7l))
2323
$(error MACHTYPE environment not recognized: $(MACHTYPE))
2424
endif
2525

@@ -46,7 +46,7 @@ ifeq ($(MACHTYPE), $(findstring $(MACHTYPE), x86_64))
4646
CFLAGS ?= -m64
4747
CXXFLAGS ?= -m64
4848
else
49-
ifeq ($(MACHTYPE), $(findstring $(MACHTYPE), ppc64le aarch64 armv7l))
49+
ifeq ($(MACHTYPE), $(findstring $(MACHTYPE), ppc64le aarch64 arm64 armv7l))
5050
else
5151
$(error MACHTYPE environment not recognized: $(MACHTYPE))
5252
endif

src/vendor/yices/v2.6/Makefile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ YICES_SRC=$(REPONAME)
99
YICES_INST=$(abspath $(PWD)/$(REPONAME)-inst)
1010

1111
ifeq ($(OSTYPE), Darwin)
12-
# On macOS we need to work around two yices build issues:
12+
# On macOS we need to work around three yices build issues:
1313
# 1. yices explicitly sets the install_name for libyices.2.dylib to be
1414
# the absolute install path. For cases where yices knows the correct
1515
# install path of the library, this makes sense, but for bsc, we don't want
@@ -20,7 +20,19 @@ ifeq ($(OSTYPE), Darwin)
2020
# depend on Homebrew. Instead, statically link libgmp into libyices.
2121
# Note that we must statically link by using the archive file as Apple's ld
2222
# doesn't understand -Bstatic.
23-
LIBGMPA=$(shell pkg-config --variable=libdir gmp)/libgmp.a
23+
# 3. yices searches a hard-coded list of paths, which does not include
24+
# /opt/homebrew as used on Arm-based Macs, so we must manually pass the
25+
# directories to configure so it doesn't fail. Note that --with-static-gmp
26+
# is broken; the initial check succeeds, but it later unconditionally tries
27+
# an AC_CHECK_LIB(gmp, ...) and so tries to link with -lgmp, which will fail
28+
# if the library search path doesn't include the library, at which point
29+
# passing the option serves no purpose.
30+
INCLUDEDIRGMP=$(shell pkg-config --variable=includedir gmp)
31+
LIBDIRGMP=$(shell pkg-config --variable=libdir gmp)
32+
CONFIGURE_ENV= \
33+
CPPFLAGS="$${CPPFLAGS:+$$CPPFLAGS }-I$(INCLUDEDIRGMP)" \
34+
LDFLAGS="$${LDFLAGS:+$$LDFLAGS }-L$(LIBDIRGMP)"
35+
LIBGMPA=$(LIBDIRGMP)/libgmp.a
2436
BUILD_ARGS=libyices_install_name=libyices.2.dylib LIBS=$(LIBGMPA)
2537
endif
2638

@@ -32,7 +44,7 @@ install:
3244
ifeq ($(YICES_STUB),)
3345
(cd $(YICES_SRC) ; \
3446
autoconf ; \
35-
./configure --prefix=$(YICES_INST) ; \
47+
$(CONFIGURE_ENV) ./configure --prefix=$(YICES_INST) ; \
3648
$(MAKE) $(BUILD_ARGS); \
3749
$(MAKE) install \
3850
)

0 commit comments

Comments
 (0)