Fixed build on MacOS X.

This commit is contained in:
LoRd_MuldeR 2022-12-05 00:19:42 +01:00
parent 661b9ce39b
commit 6308ee1cd4
5 changed files with 26 additions and 12 deletions

View File

@ -919,6 +919,10 @@ The following environment variables can be used to control the build process:
* `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`)
* `DEBUG` – set to a non-zero value in order to enable "debug" build

View File

@ -11,17 +11,14 @@ ifneq ($(ASAN),)
XLDFLAGS += -static-libasan
else
XCFLAGS = -Ofast -DNDEBUG
endif
endif
ifneq ($(firstword $(filter x86_64-%,$(DUMPMACHINE))),)
XCFLAGS += -march=x86-64 -mtune=nocona
else ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
XCFLAGS += -march=pentiumpro -mtune=intel
endif
ifneq ($(FLTO),)
XCFLAGS += -flto
endif
XLDFLAGS += -s -static
endif
endif
ifeq ($(firstword $(filter %-mingw32 %-windows-gnu %-cygwin,$(DUMPMACHINE))),)
DLL_LDFLAGS = -shared
@ -34,3 +31,16 @@ ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),)
XLDFLAGS += -Wl,--large-address-aware
endif
endif
ifneq ($(STATIC),)
XLDFLAGS += -static
endif
ifneq ($(FLTO),)
XCFLAGS += -flto
endif
ifneq ($(STRIP),)
XLDFLAGS += -Wl,--strip-all
DLL_LDFLAGS += -Wl,--strip-all
endif

View File

@ -7,8 +7,7 @@ cp -rfv "libhashset/include/"*.h "out/_next/include"
target="$(gcc -dumpmachine)"
echo -e "--------------------------------\n${target}\n--------------------------------"
make CC="gcc" clean
make CC="gcc"
make CC="gcc" STATIC=1 STRIP=1
rm -rf "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}"

View File

@ -18,8 +18,7 @@ case "${mode}" in
compiler="${target}-linux-gnu-gcc"
target="$("${compiler}" -dumpmachine)"
echo -e "--------------------------------\n${target}\n--------------------------------"
make CC="${compiler}" clean
make CC="${compiler}"
make CC="${compiler}" STRIP=1
mkdir -pv "out/lib/${target}" "out/bin/${target}"
cp -rv "libhashset/lib/"* "out/lib/${target}"
for i in example test; do
@ -34,8 +33,7 @@ case "${mode}" in
compiler="/usr/local/musl/${target}/bin/musl-gcc"
target="$("${compiler}" -dumpmachine | sed 's/-gnu/-musl/i')"
echo -e "--------------------------------\n${target}\n--------------------------------"
make CC="${compiler}" clean
make CC="${compiler}"
make CC="${compiler}" STATIC=1 STRIP=1
mkdir -pv "out/lib/${target}" "out/bin/${target}"
cp -rv "libhashset/lib/"* "out/lib/${target}"
for i in example test; do

View File

@ -8,6 +8,9 @@
#ifndef _WIN32
# include <unistd.h>
# if defined(__APPLE__) && defined(__MACH__)
# include <sys/random.h>
# endif
#endif
#define ARRAY_SIZE(X) (sizeof(X) / sizeof((X)[0U]))