Skip to content

Commit 3ceba0b

Browse files
committed
build/CI/packaging: automatically set deployment target on MacOS
1 parent 278f8a2 commit 3ceba0b

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

configure.ac

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,17 @@ AC_LIB_PREFIX()
7171

7272
CPPFLAGS="-D_GNU_SOURCE ${CPPFLAGS}"
7373

74-
# Mac OS X requires _DARWIN_C_SOURCE for valloc(3) to be visible
75-
case "${host_cpu}-${host_os}" in
76-
*-darwin*) CPPFLAGS="-D_DARWIN_C_SOURCE ${CPPFLAGS}";;
77-
esac
74+
AM_CONDITIONAL([IS_MACOS], [test "$host_os" = "darwin"])
75+
76+
if test "$host_os" = "darwin"; then
77+
# MacOS requires _DARWIN_C_SOURCE for valloc(3) to be visible
78+
CPPFLAGS="-D_DARWIN_C_SOURCE ${CPPFLAGS}"
79+
# LuaJIT also requires MACOSX_DEPLOYMENT_TARGET to be set on MacOS
80+
if test -z "$MACOSX_DEPLOYMENT_TARGET"; then
81+
MACOSX_DEPLOYMENT_TARGET="$(sw_vers -productVersion)"
82+
fi
83+
AC_SUBST(MACOSX_DEPLOYMENT_TARGET, $MACOSX_DEPLOYMENT_TARGET)
84+
fi
7885

7986
# Build optimized or debug version ?
8087
# First check for gcc and g++

third_party/luajit/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
EXTRA_DIST = luajit
1818

19+
if IS_MACOS
20+
export MACOSX_DEPLOYMENT_TARGET := @MACOSX_DEPLOYMENT_TARGET@
21+
endif
22+
1923
all-local: $(builddir)/lib/libluajit-5.1.a
2024

2125
# LuaJIT does not support VPATH builds

0 commit comments

Comments
 (0)