mirror of
https://github.com/Interlisp/maiko.git
synced 2026-03-19 08:05:12 +00:00
Including all suggestions made by Gemeni code check. Now includes linking to libbsd (if requested) only if glibc < version 2.38 since glibc >= 2.38 includes strlcat and friends.
This commit is contained in:
@@ -540,12 +540,27 @@ IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/../" CACHE PATH "Installation prefix" FORCE)
|
||||
ENDIF()
|
||||
execute_process(
|
||||
COMMAND sh -c "echo $(../bin/osversion).$(../bin/machinetype)"
|
||||
OUTPUT_VARIABLE release_dir
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMAND sh "${CMAKE_SOURCE_DIR}/bin/osversion"
|
||||
OUTPUT_VARIABLE os_ver
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE res
|
||||
)
|
||||
INSTALL(TARGETS lde DESTINATION ${release_dir})
|
||||
if(NOT res EQUAL 0)
|
||||
message(FATAL_ERROR "osversion script failed")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND sh "${CMAKE_SOURCE_DIR}/bin/machinetype"
|
||||
OUTPUT_VARIABLE machine_type
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE res
|
||||
)
|
||||
if(NOT res EQUAL 0)
|
||||
message(FATAL_ERROR "machinetype script failed")
|
||||
endif()
|
||||
|
||||
set(release_dir "${os_ver}.${machine_type}")INSTALL(TARGETS lde DESTINATION ${release_dir})
|
||||
|
||||
IF(MAIKO_DISPLAY_X11)
|
||||
INSTALL(TARGETS ldex ldeinit DESTINATION ${release_dir})
|
||||
ENDIF()
|
||||
|
||||
@@ -2,11 +2,17 @@
|
||||
|
||||
include linux-compiler.mk
|
||||
|
||||
BSD_CFLAGS :=
|
||||
BSD_LDFLAGS :=
|
||||
ifeq ($(USE_LIBBSD),T)
|
||||
include linux-libbsd.mk
|
||||
else
|
||||
BSD_CFLAGS :=
|
||||
BSD_LDFLAGS :=
|
||||
# Use LIBBSD - but only if glibc < 2.38
|
||||
# Because we only need strlcat, strlcpy and friends from libbsd
|
||||
# and they are included in glibc from 2.38 on.
|
||||
GLIBC_VERSION := $(shell ldd --version | head -1 | sed -e "s/^.*\([0-9]\.[0-9][0-9]\)/\\1/")
|
||||
GLIBC_CHECK := $(shell echo "$(GLIBC_VERSION) >= 2.38" | bc)
|
||||
ifneq ($(GLIBC_CHECK),1)
|
||||
include linux-libbsd.mk
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(USE_DISPLAY),x)
|
||||
@@ -26,7 +32,12 @@ OPTFLAGS ?= -O2 -g3
|
||||
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE) $(BSD_CFLAGS) $(ADDITIONAL_DFLAGS)
|
||||
|
||||
LDFLAGS = $(XLDFLAGS) -lc -lm $(BSD_LDFLAGS)
|
||||
LDELDFLAGS = $(XLDFLAGS) -lc -lm $(BSD_LDFLAGS)
|
||||
|
||||
ifeq ($(USE_DISPLAY),x)
|
||||
LDELDFLAGS = $(XLDFLAGS) -lc -lm $(BSD_LDFLAGS)
|
||||
else
|
||||
LDELDFLAGS = -lc -lm $(BSD_LDFLAGS)
|
||||
endif
|
||||
|
||||
OBJECTDIR = ../$(RELEASENAME)/
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
ifneq ($(MAKECMDGOALS),cleanup)
|
||||
|
||||
CHK_PKG_CONFIG := $(shell command -v pkg-config)
|
||||
CHK_PKG_CONFIG := $(shell /bin/sh -c "command -v pkg-config")
|
||||
ifeq ($(CHK_PKG_CONFIG),)
|
||||
# pkg-config not found, print an error
|
||||
$(error "pkg-config not found. Please install it to build this project.")
|
||||
@@ -12,13 +12,15 @@ ifneq ($(MAKECMDGOALS),clean)
|
||||
|
||||
CHK_LIBBSD_DEV := $(shell pkg-config --exists libbsd-overlay && echo true)
|
||||
ifneq ($(CHK_LIBBSD_DEV),true)
|
||||
$(error "libbsd-dev (or libbsd-devel) package not found. Please install it to build this project.")
|
||||
$(error "libbsd-dev (or libbsd-devel) package not found. Please install it to build this project.")
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
BSD_CFLAGS = $(shell pkg-config --cflags libbsd-overlay)
|
||||
BSD_CFLAGS := $(shell pkg-config --cflags libbsd-overlay)
|
||||
|
||||
BSD_LDFLAGS := $(shell pkg-config --libs libbsd-overlay)
|
||||
|
||||
endif # clean
|
||||
endif # cleanup
|
||||
|
||||
BSD_LDFLAGS = $(shell pkg-config --libs libbsd-overlay)
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Options for Linux, Intel 386/486 and SDL
|
||||
|
||||
GCC_CFLAGS := -m64 $(GCC_CFLAGS)
|
||||
CLANG_CFLAGS := -m64 $(CLANG_CFLAGS)
|
||||
GCC_CFLAGS := -m32 $(GCC_CFLAGS)
|
||||
CLANG_CFLAGS := -m32 $(CLANG_CFLAGS)
|
||||
USE_DISPLAY=sdl
|
||||
USE_LIBBSD=T
|
||||
|
||||
|
||||
Reference in New Issue
Block a user