Added build helper script for MacOS X.
This commit is contained in:
parent
e48efa984a
commit
c6ecc3c813
24
config.mk
24
config.mk
@ -1,3 +1,8 @@
|
|||||||
|
UNAME := $(strip $(shell uname))
|
||||||
|
ifeq ($(UNAME),)
|
||||||
|
$(error Operating system could not be detected!)
|
||||||
|
endif
|
||||||
|
|
||||||
DUMPMACHINE := $(strip $(shell $(CC) -dumpmachine))
|
DUMPMACHINE := $(strip $(shell $(CC) -dumpmachine))
|
||||||
ifeq ($(DUMPMACHINE),)
|
ifeq ($(DUMPMACHINE),)
|
||||||
$(error C compiler could not be detected!)
|
$(error C compiler could not be detected!)
|
||||||
@ -20,16 +25,21 @@ else ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
|
|||||||
XCFLAGS += -march=pentiumpro -mtune=intel
|
XCFLAGS += -march=pentiumpro -mtune=intel
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(firstword $(filter %-mingw32 %-windows-gnu %-cygwin,$(DUMPMACHINE))),)
|
ifneq ($(firstword $(filter %-mingw32 %-windows-gnu %-cygwin,$(DUMPMACHINE))),)
|
||||||
DLL_LDFLAGS = -shared
|
|
||||||
DLL_SUFFIX := .so
|
|
||||||
else
|
|
||||||
DLL_LDFLAGS = -shared -Wl,--out-implib,$@.a
|
DLL_LDFLAGS = -shared -Wl,--out-implib,$@.a
|
||||||
EXE_SUFFIX := .exe
|
EXE_SUFFIX := .exe
|
||||||
DLL_SUFFIX := .dll
|
DLL_SUFFIX := .dll
|
||||||
ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
|
ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
|
||||||
XLDFLAGS += -Wl,--large-address-aware
|
XLDFLAGS += -Wl,--large-address-aware
|
||||||
endif
|
endif
|
||||||
|
else
|
||||||
|
ifneq ($(findstring -apple-darwin,$(DUMPMACHINE)),)
|
||||||
|
DLL_LDFLAGS = -dynamiclib
|
||||||
|
DLL_SUFFIX := .dylib
|
||||||
|
else
|
||||||
|
DLL_LDFLAGS = -shared
|
||||||
|
DLL_SUFFIX := .so
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(STATIC),)
|
ifneq ($(STATIC),)
|
||||||
@ -45,8 +55,12 @@ ifneq ($(STRIP),)
|
|||||||
DLL_LDFLAGS += -Wl,--strip-all
|
DLL_LDFLAGS += -Wl,--strip-all
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(firstword $(filter MINGW32_NT-% MINGW64_NT-% CYGWIN_NT-%,$(shell uname))),)
|
ifneq ($(firstword $(filter MINGW32_NT-% MINGW64_NT-% CYGWIN_NT-%,$(UNAME))),)
|
||||||
ENV_LDPATH := PATH
|
ENV_LDPATH := PATH
|
||||||
else
|
else
|
||||||
|
ifneq ($(firstword $(UNAME)),Darwin)
|
||||||
ENV_LDPATH := LD_LIBRARY_PATH
|
ENV_LDPATH := LD_LIBRARY_PATH
|
||||||
|
else
|
||||||
|
ENV_LDPATH := DYLD_LIBRARY_PATH
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -14,8 +14,8 @@ cp -rfv "libhashset/include/"*.h "out/include"
|
|||||||
|
|
||||||
case "${mode}" in
|
case "${mode}" in
|
||||||
gnu)
|
gnu)
|
||||||
for target in i686 x86_64 aarch64; do
|
for cpu in i686 x86_64 aarch64; do
|
||||||
compiler="${target}-linux-gnu-gcc"
|
compiler="${cpu}-linux-gnu-gcc"
|
||||||
target="$("${compiler}" -dumpmachine)"
|
target="$("${compiler}" -dumpmachine)"
|
||||||
echo -e "--------------------------------\n${target}\n--------------------------------"
|
echo -e "--------------------------------\n${target}\n--------------------------------"
|
||||||
make CC="${compiler}" STRIP=1
|
make CC="${compiler}" STRIP=1
|
||||||
@ -29,8 +29,8 @@ case "${mode}" in
|
|||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
musl)
|
musl)
|
||||||
for target in i686 x86_64 arm64; do
|
for cpu in i686 x86_64 arm64; do
|
||||||
compiler="/usr/local/musl/${target}/bin/musl-gcc"
|
compiler="/usr/local/musl/${cpu}/bin/musl-gcc"
|
||||||
target="$("${compiler}" -dumpmachine | sed 's/-gnu/-musl/i')"
|
target="$("${compiler}" -dumpmachine | sed 's/-gnu/-musl/i')"
|
||||||
echo -e "--------------------------------\n${target}\n--------------------------------"
|
echo -e "--------------------------------\n${target}\n--------------------------------"
|
||||||
make CC="${compiler}" STATIC=1 STRIP=1
|
make CC="${compiler}" STATIC=1 STRIP=1
|
||||||
|
19
etc/utils/build-macos.sh
Executable file
19
etc/utils/build-macos.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
set -e
|
||||||
|
cd -- "${0:a:h}/../../"
|
||||||
|
|
||||||
|
mkdir -pv "out/include"
|
||||||
|
cp -rfv "libhashset/include/"*.h "out/include"
|
||||||
|
|
||||||
|
for cpu in x86_64 aarch64; do
|
||||||
|
target="${cpu}-apple-darwin"
|
||||||
|
echo -e "--------------------------------\n${target}\n--------------------------------"
|
||||||
|
make CC="cc -target ${target}"
|
||||||
|
mkdir -pv "out/lib/${target}" "out/bin/${target}"
|
||||||
|
cp -rv "libhashset/lib/"* "out/lib/${target}"
|
||||||
|
for i in example test; do
|
||||||
|
for j in hash-set hash-map; do
|
||||||
|
cp -fv "${i}/${j}/bin/${i}-${j}" "out/bin/${target}"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user