make.sh: add new option 'macos-universal' to build MacOS universal binaries
This commit is contained in:
parent
c61aff1dbe
commit
6f5e59be73
4
Makefile
4
Makefile
|
@ -105,10 +105,14 @@ ifeq ($(IS_APPLE),1)
|
||||||
EXT = dylib
|
EXT = dylib
|
||||||
VERSION_EXT = $(API_MAJOR).$(EXT)
|
VERSION_EXT = $(API_MAJOR).$(EXT)
|
||||||
$(LIBNAME)_LDFLAGS += -dynamiclib -install_name lib$(LIBNAME).$(VERSION_EXT) -current_version $(PKG_MAJOR).$(PKG_MINOR).$(PKG_EXTRA) -compatibility_version $(PKG_MAJOR).$(PKG_MINOR)
|
$(LIBNAME)_LDFLAGS += -dynamiclib -install_name lib$(LIBNAME).$(VERSION_EXT) -current_version $(PKG_MAJOR).$(PKG_MINOR).$(PKG_EXTRA) -compatibility_version $(PKG_MAJOR).$(PKG_MINOR)
|
||||||
|
ifeq ($(MACOS_UNIVERSAL),yes)
|
||||||
$(LIBNAME)_LDFLAGS += -m32 -arch i386 -m64 -arch x86_64
|
$(LIBNAME)_LDFLAGS += -m32 -arch i386 -m64 -arch x86_64
|
||||||
|
endif
|
||||||
AR_EXT = a
|
AR_EXT = a
|
||||||
UNICORN_CFLAGS += -fvisibility=hidden
|
UNICORN_CFLAGS += -fvisibility=hidden
|
||||||
|
ifeq ($(MACOS_UNIVERSAL),yes)
|
||||||
UNICORN_CFLAGS += -m32 -arch i386 -m64 -arch x86_64
|
UNICORN_CFLAGS += -m32 -arch i386 -m64 -arch x86_64
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
# Cygwin?
|
# Cygwin?
|
||||||
IS_CYGWIN := $(shell $(CC) -dumpmachine | grep -i cygwin | wc -l)
|
IS_CYGWIN := $(shell $(CC) -dumpmachine | grep -i cygwin | wc -l)
|
||||||
|
|
|
@ -58,6 +58,11 @@ To build Unicorn on *nix (such as MacOSX, Linux, *BSD, Solaris):
|
||||||
|
|
||||||
$ ./make.sh
|
$ ./make.sh
|
||||||
|
|
||||||
|
On Mac OS, to build universal binaries including both 32-bit & 64-bit code,
|
||||||
|
replace above command with:
|
||||||
|
|
||||||
|
$ ./make.sh macos-universal
|
||||||
|
|
||||||
- Unicorn requires Python 2.x to compile. If Python 2.x is not the default
|
- Unicorn requires Python 2.x to compile. If Python 2.x is not the default
|
||||||
Python interpreter, ensure that the appropriate option is set:
|
Python interpreter, ensure that the appropriate option is set:
|
||||||
|
|
||||||
|
|
7
make.sh
7
make.sh
|
@ -41,6 +41,12 @@ build() {
|
||||||
${MAKE}
|
${MAKE}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
build_macos_universal() {
|
||||||
|
[ "$UNAME" = Darwin ] && LIBARCHS="i386 x86_64"
|
||||||
|
MACOS_UNIVERSAL=yes \
|
||||||
|
${MAKE}
|
||||||
|
}
|
||||||
|
|
||||||
build_cross() {
|
build_cross() {
|
||||||
[ "$UNAME" = Darwin ] && LIBARCHS="i386 x86_64"
|
[ "$UNAME" = Darwin ] && LIBARCHS="i386 x86_64"
|
||||||
CROSS=$1
|
CROSS=$1
|
||||||
|
@ -97,6 +103,7 @@ export CC INSTALL_BIN PREFIX PKGCFGDIR LIBDIRARCH LIBARCHS CFLAGS LDFLAGS
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"" ) build;;
|
"" ) build;;
|
||||||
|
"macos-universal" ) build_macos_universal;;
|
||||||
"asan" ) asan;;
|
"asan" ) asan;;
|
||||||
"default" ) build;;
|
"default" ) build;;
|
||||||
"install" ) install;;
|
"install" ) install;;
|
||||||
|
|
Loading…
Reference in New Issue