Skip to content

Commit

Permalink
Fix C++ flags on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
dargueta committed Sep 21, 2024
1 parent 0d3ca9e commit e5d087c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
32 changes: 17 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,23 @@
LUAROCKS = luarocks
get_luarocks_var = $(shell $(LUAROCKS) config variables.$1)

BUSTED := $(call get_luarocks_var,SCRIPTS_DIR)/busted
CC := $(call get_luarocks_var,CC)
CXXFLAGS := $(call get_luarocks_var,CFLAGS)
CURL := $(call get_luarocks_var,CURL)
LD := $(call get_luarocks_var,LD)
LIBFLAG := $(call get_luarocks_var,LIBFLAG)
LIB_EXTENSION := $(call get_luarocks_var,LIB_EXTENSION)
LUA := $(call get_luarocks_var,LUA)
LUA_DIR := $(call get_luarocks_var,LUA_DIR)
LUA_INCDIR := $(call get_luarocks_var,LUA_INCDIR)
LUA_LIBDIR := $(call get_luarocks_var,LUA_LIBDIR)
LUA_VERSION := $(call get_luarocks_var,LUA_VERSION)
MKDIR := $(call get_luarocks_var,MKDIR)
OBJ_EXTENSION := $(call get_luarocks_var,OBJ_EXTENSION)
UNICORN_INCDIR = /usr/include
ifndef CALLED_FROM_LUAROCKS
BUSTED := $(call get_luarocks_var,SCRIPTS_DIR)/busted
CC := $(call get_luarocks_var,CC)
CXXFLAGS := $(call get_luarocks_var,CFLAGS)
CURL := $(call get_luarocks_var,CURL)
LD := $(call get_luarocks_var,LD)
LIBFLAG := $(call get_luarocks_var,LIBFLAG)
LIB_EXTENSION := $(call get_luarocks_var,LIB_EXTENSION)
LUA := $(call get_luarocks_var,LUA)
LUA_DIR := $(call get_luarocks_var,LUA_DIR)
LUA_INCDIR := $(call get_luarocks_var,LUA_INCDIR)
LUA_LIBDIR := $(call get_luarocks_var,LUA_LIBDIR)
LUA_VERSION := $(call get_luarocks_var,LUA_VERSION)
MKDIR := $(call get_luarocks_var,MKDIR)
OBJ_EXTENSION := $(call get_luarocks_var,OBJ_EXTENSION)
UNICORN_INCDIR = /usr/include
endif

################################################################################

Expand Down
9 changes: 8 additions & 1 deletion unicorn-2.2.1-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ test = {
"LUAROCKS=$(SCRIPTS_DIR)/luarocks",
"OBJ_EXTENSION=$(OBJ_EXTENSION)",
"MKDIR=$(MKDIR)",
-- The following are needed but not provided by LuaRocks
-- The following are needed for building the tests, but aren't provided by
-- LuaRocks when testing.
"LUA_INCDIR=$(LUA_DIR)/include",
"LUA_LIBDIR=$(LUA_DIR)/lib",
-- "UNICORN_INCDIR=$(UNICORN_INCDIR)",
-- "UNICORN_LIBDIR=$(UNICORN_LIBDIR)",
-- "PTHREAD_LIBDIR=$(PTHREAD_LIBDIR)",
"CALLED_FROM_LUAROCKS=1",
},
}

Expand All @@ -78,6 +80,7 @@ build = {
LUAROCKS = "$(SCRIPTS_DIR)/luarocks",
OBJ_EXTENSION = "$(OBJ_EXTENSION)",
LUA_VERSION = "$(LUA_VERSION)",
CALLED_FROM_LUAROCKS = "1",
},
build_variables = {
CC = "$(CC)",
Expand All @@ -97,3 +100,7 @@ build = {
INST_LIBDIR = "$(LIBDIR)",
},
}

-- Clang on MacOS needs to be explicitly told to use the C++11 standard, since it defaults
-- to C++03 or thereabouts.
build.platforms.macos.build_variables.CXXFLAGS = "$(CFLAGS) -std=c++11"

0 comments on commit e5d087c

Please sign in to comment.