mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-28 18:28:49 +08:00
mdbx-build: SunOS/Solaris/OpenIndiana support, etc.
This commit is contained in:
parent
5af02290e6
commit
a7e0b3ccdf
@ -161,6 +161,9 @@ if(MDBX_BUILD_SHARED_LIBRARY)
|
||||
if(WIN32)
|
||||
target_link_libraries(mdbx PRIVATE ntdll.lib)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Solaris")
|
||||
target_link_libraries(mdbx PRIVATE kstat)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# static library used for tools, to avoid rpath/dll-path troubles
|
||||
@ -176,6 +179,9 @@ endif()
|
||||
if(WIN32)
|
||||
target_link_libraries(mdbx-static INTERFACE ntdll.lib)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Solaris")
|
||||
target_link_libraries(mdbx-static INTERFACE kstat)
|
||||
endif()
|
||||
|
||||
# mdbx-tools
|
||||
foreach(TOOL mdbx_chk mdbx_copy mdbx_stat mdbx_dump mdbx_load)
|
||||
|
10
GNUmakefile
10
GNUmakefile
@ -21,11 +21,13 @@ suffix ?=
|
||||
CC ?= gcc
|
||||
LD ?= ld
|
||||
MDBX_OPTIONS ?= -DNDEBUG=1
|
||||
CFLAGS ?= -Os -g3 -Wall -Werror -Wextra -Wpedantic -ffunction-sections -fPIC -fvisibility=hidden -std=gnu11 -pthread -Wno-error=attributes
|
||||
CFLAGS ?= -O2 -g -Wall -Werror -Wextra -Wpedantic -ffunction-sections -fPIC -fvisibility=hidden -std=gnu11 -pthread -Wno-error=attributes
|
||||
# -Wno-tautological-compare
|
||||
|
||||
# LY: '--no-as-needed,-lrt' for ability to built with modern glibc, but then run with the old
|
||||
LDFLAGS ?= $(shell $(LD) --help 2>/dev/null | grep -q -- --gc-sections && echo '-Wl,--gc-sections,-z,relro,-O1')$(shell $(LD) --help 2>/dev/null | grep -q -- -dead_strip && echo '-Wl,-dead_strip')
|
||||
# HITH: Try append '--no-as-needed,-lrt' for ability to built with modern glibc, but then run with the old.
|
||||
LIBS ?= $(shell uname | grep -qi SunOS && echo "-lkstat") $(shell uname | grep -qi -e Darwin -e OpenBSD || echo "-lrt")
|
||||
|
||||
LDFLAGS ?= $(shell $(LD) --help 2>/dev/null | grep -q -- --gc-sections && echo '-Wl,--gc-sections,-z,relro,-O1')$(shell $(LD) --help 2>/dev/null | grep -q -- -dead_strip && echo '-Wl,-dead_strip') $(LIBS)
|
||||
EXE_LDFLAGS ?= -pthread
|
||||
|
||||
################################################################################
|
||||
@ -209,7 +211,7 @@ mdbx-static.o: src/elements/config.h src/elements/version.c src/alloy.c $(ALLOY_
|
||||
dist: libmdbx-sources-$(MDBX_VERSION_SUFFIX).tar.gz $(lastword $(MAKEFILE_LIST))
|
||||
|
||||
libmdbx-sources-$(MDBX_VERSION_SUFFIX).tar.gz: $(addprefix dist/, $(DIST_SRC) $(DIST_EXTRA)) $(addprefix dist/man1/,$(MANPAGES))
|
||||
tar -c -a -f $@ --owner=0 --group=0 -C dist $(DIST_SRC) $(DIST_EXTRA) \
|
||||
tar -c --owner=0 --group=0 -C dist $(DIST_SRC) $(DIST_EXTRA) -f - | gzip -c > $@ \
|
||||
&& rm dist/@tmp-shared_internals.inc
|
||||
|
||||
dist/mdbx.h: mdbx.h src/elements/version.c $(lastword $(MAKEFILE_LIST))
|
||||
|
6
Makefile
6
Makefile
@ -1,3 +1,5 @@
|
||||
all check test dist: Makefile
|
||||
@CC=$(CC) CXX=$(CXX) `which gmake || which gnumake || echo 'echo "GNU Make is required"'` $(MAKEFLAGS) -f GNUmakefile $@
|
||||
|
||||
@CC=$(CC) \
|
||||
CXX=`if test -n "$(CXX)" && which "$(CXX)" > /dev/null; then echo "$(CXX)"; elif test -n "$(CCC)" && which "$(CCC)" > /dev/null; then echo "$(CCC)"; else echo "c++"; fi` \
|
||||
`which gmake || which gnumake || echo 'echo "GNU Make is required"; exit 2;'` \
|
||||
$(MAKEFLAGS) -f GNUmakefile $@
|
||||
|
@ -101,6 +101,10 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Solaris")
|
||||
target_link_libraries(mdbx ${MDBX_LIBDEP_MODE} kstat)
|
||||
endif()
|
||||
|
||||
set_target_properties(mdbx PROPERTIES
|
||||
INTERPROCEDURAL_OPTIMIZATION $<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>
|
||||
C_STANDARD ${MDBX_C_STANDARD} C_STANDARD_REQUIRED ON
|
||||
|
Loading…
x
Reference in New Issue
Block a user