Fixed build on MacOS X.
This commit is contained in:
parent
661b9ce39b
commit
6308ee1cd4
@ -919,6 +919,10 @@ The following environment variables can be used to control the build process:
|
|||||||
|
|
||||||
* `CC` – specifies the C compiler (default is `cc`)
|
* `CC` – specifies the C compiler (default is `cc`)
|
||||||
|
|
||||||
|
* `STRIP` – set to a non-zero value in order to *strip* the generated binaries
|
||||||
|
|
||||||
|
* `STATIC` – set to a non-zero value in order to enable *static* linking
|
||||||
|
|
||||||
* `FLTO` – set to a non-zero value in order to enable *link-time optimizer* (`-flto`)
|
* `FLTO` – set to a non-zero value in order to enable *link-time optimizer* (`-flto`)
|
||||||
|
|
||||||
* `DEBUG` – set to a non-zero value in order to enable "debug" build
|
* `DEBUG` – set to a non-zero value in order to enable "debug" build
|
||||||
|
22
config.mk
22
config.mk
@ -11,17 +11,14 @@ ifneq ($(ASAN),)
|
|||||||
XLDFLAGS += -static-libasan
|
XLDFLAGS += -static-libasan
|
||||||
else
|
else
|
||||||
XCFLAGS = -Ofast -DNDEBUG
|
XCFLAGS = -Ofast -DNDEBUG
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(firstword $(filter x86_64-%,$(DUMPMACHINE))),)
|
ifneq ($(firstword $(filter x86_64-%,$(DUMPMACHINE))),)
|
||||||
XCFLAGS += -march=x86-64 -mtune=nocona
|
XCFLAGS += -march=x86-64 -mtune=nocona
|
||||||
else ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
|
else ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
|
||||||
XCFLAGS += -march=pentiumpro -mtune=intel
|
XCFLAGS += -march=pentiumpro -mtune=intel
|
||||||
endif
|
endif
|
||||||
ifneq ($(FLTO),)
|
|
||||||
XCFLAGS += -flto
|
|
||||||
endif
|
|
||||||
XLDFLAGS += -s -static
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(firstword $(filter %-mingw32 %-windows-gnu %-cygwin,$(DUMPMACHINE))),)
|
ifeq ($(firstword $(filter %-mingw32 %-windows-gnu %-cygwin,$(DUMPMACHINE))),)
|
||||||
DLL_LDFLAGS = -shared
|
DLL_LDFLAGS = -shared
|
||||||
@ -34,3 +31,16 @@ ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
|
|||||||
XLDFLAGS += -Wl,--large-address-aware
|
XLDFLAGS += -Wl,--large-address-aware
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(STATIC),)
|
||||||
|
XLDFLAGS += -static
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(FLTO),)
|
||||||
|
XCFLAGS += -flto
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(STRIP),)
|
||||||
|
XLDFLAGS += -Wl,--strip-all
|
||||||
|
DLL_LDFLAGS += -Wl,--strip-all
|
||||||
|
endif
|
||||||
|
@ -7,8 +7,7 @@ cp -rfv "libhashset/include/"*.h "out/_next/include"
|
|||||||
|
|
||||||
target="$(gcc -dumpmachine)"
|
target="$(gcc -dumpmachine)"
|
||||||
echo -e "--------------------------------\n${target}\n--------------------------------"
|
echo -e "--------------------------------\n${target}\n--------------------------------"
|
||||||
make CC="gcc" clean
|
make CC="gcc" STATIC=1 STRIP=1
|
||||||
make CC="gcc"
|
|
||||||
rm -rf "out/_next/lib/${target}" "out/_next/bin/${target}"
|
rm -rf "out/_next/lib/${target}" "out/_next/bin/${target}"
|
||||||
mkdir -pv "out/_next/lib/${target}" "out/_next/bin/${target}"
|
mkdir -pv "out/_next/lib/${target}" "out/_next/bin/${target}"
|
||||||
cp -rv "libhashset/lib/"* "out/_next/lib/${target}"
|
cp -rv "libhashset/lib/"* "out/_next/lib/${target}"
|
||||||
|
@ -18,8 +18,7 @@ case "${mode}" in
|
|||||||
compiler="${target}-linux-gnu-gcc"
|
compiler="${target}-linux-gnu-gcc"
|
||||||
target="$("${compiler}" -dumpmachine)"
|
target="$("${compiler}" -dumpmachine)"
|
||||||
echo -e "--------------------------------\n${target}\n--------------------------------"
|
echo -e "--------------------------------\n${target}\n--------------------------------"
|
||||||
make CC="${compiler}" clean
|
make CC="${compiler}" STRIP=1
|
||||||
make CC="${compiler}"
|
|
||||||
mkdir -pv "out/lib/${target}" "out/bin/${target}"
|
mkdir -pv "out/lib/${target}" "out/bin/${target}"
|
||||||
cp -rv "libhashset/lib/"* "out/lib/${target}"
|
cp -rv "libhashset/lib/"* "out/lib/${target}"
|
||||||
for i in example test; do
|
for i in example test; do
|
||||||
@ -34,8 +33,7 @@ case "${mode}" in
|
|||||||
compiler="/usr/local/musl/${target}/bin/musl-gcc"
|
compiler="/usr/local/musl/${target}/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}" clean
|
make CC="${compiler}" STATIC=1 STRIP=1
|
||||||
make CC="${compiler}"
|
|
||||||
mkdir -pv "out/lib/${target}" "out/bin/${target}"
|
mkdir -pv "out/lib/${target}" "out/bin/${target}"
|
||||||
cp -rv "libhashset/lib/"* "out/lib/${target}"
|
cp -rv "libhashset/lib/"* "out/lib/${target}"
|
||||||
for i in example test; do
|
for i in example test; do
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
# if defined(__APPLE__) && defined(__MACH__)
|
||||||
|
# include <sys/random.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ARRAY_SIZE(X) (sizeof(X) / sizeof((X)[0U]))
|
#define ARRAY_SIZE(X) (sizeof(X) / sizeof((X)[0U]))
|
||||||
|
Loading…
Reference in New Issue
Block a user