Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions mk/spksrc.compile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ endif

compile_msg:
@$(MSG) "Compiling for $(NAME)"
ifeq ($(filter cross spk python,$(shell basename $(dir $(abspath $(CURDIR))))),)
@$(MSG) $$(date +%Y%m%d-%H%M%S) MAKELEVEL: $(MAKELEVEL), PARALLEL_MAKE: $(PARALLEL_MAKE), ARCH: $(shell basename $(CURDIR)), NAME: $(NAME) >> $(PSTAT_LOG)
else
@$(MSG) $$(date +%Y%m%d-%H%M%S) MAKELEVEL: $(MAKELEVEL), PARALLEL_MAKE: $(PARALLEL_MAKE), ARCH: $(ARCH)-$(TCVERSION), NAME: $(NAME) >> $(PSTAT_LOG)
endif

pre_compile_target: compile_msg

Expand Down
25 changes: 24 additions & 1 deletion mk/spksrc.cross-cc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,31 @@ include ../../mk/spksrc.install.mk
plist: install
include ../../mk/spksrc.plist.mk

all: install plist
###

# Define _all as a real target that does the work
.PHONY: _all
_all: install plist

# all wraps _all with logging
.PHONY: all
.DEFAULT_GOAL := all

all:
@mkdir -p $(WORK_DIR)
@if [ -z "$$LOGGING_ENABLED" ]; then \
export LOGGING_ENABLED=1 ; \
bash -o pipefail -c ' \
{ \
$(MSG) $$(date +%Y%m%d-%H%M%S) MAKELEVEL: $(MAKELEVEL), PARALLEL_MAKE: $(PARALLEL_MAKE), ARCH: $(ARCH)-$(TC_VERS), NAME: $(NAME) | tee -a $(PSTAT_LOG) ; \
$(MAKE) -f $(firstword $(MAKEFILE_LIST)) _all ; \
} > >(tee -a $(WORK_DIR)/../build-$(ARCH)-$(TC_VERS).log) 2>&1 ; \
[ ! $${PIPESTATUS[0]} -eq 0 ] && ($(MSG) $$(date +%Y%m%d-%H%M%S) MAKELEVEL: $(MAKELEVEL), PARALLEL_MAKE: $(PARALLEL_MAKE), ARCH: $(ARCH)-$(TC_VERS), NAME: $(NAME) - FAILED | tee -a $(PSTAT_LOG); exit 1) || true' ; \
else \
$(MAKE) -f $(firstword $(MAKEFILE_LIST)) _all ; \
fi

####

### For arch-* and all-<supported|latest>
include ../../mk/spksrc.supported.mk
Expand Down
7 changes: 6 additions & 1 deletion mk/spksrc.cross-cmake-toolchainfile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# Per-dependency configuration for CMake build
CMAKE_TOOLCHAIN_FILE_NAME = $(ARCH)-toolchain.cmake
CMAKE_TOOLCHAIN_FILE_WRK = $(WORK_DIR)/tc_vars.cmake
CMAKE_TOOLCHAIN_FILE_PKG = $(WORK_DIR)/$(PKG_DIR)/$(CMAKE_TOOLCHAIN_FILE_NAME)
CMAKE_TOOLCHAIN_FILE_PKG = $(CMAKE_BUILD_DIR)/$(CMAKE_TOOLCHAIN_FILE_NAME)


ifeq ($(strip $(CMAKE_USE_TOOLCHAIN_FILE)),ON)
CMAKE_ARGS += -DCMAKE_TOOLCHAIN_FILE=$(CMAKE_TOOLCHAIN_FILE_PKG)
Expand All @@ -16,6 +17,10 @@ RUN_CMAKE = cd $(WORK_DIR)/$(PKG_DIR) && env $(ENV_CMAKE)

.PHONY: $(CMAKE_TOOLCHAIN_FILE_PKG)
$(CMAKE_TOOLCHAIN_FILE_PKG):
ifeq ($(wildcard $(CMAKE_BUILD_DIR)),)
@$(MSG) Creating CMake build directory: $(CMAKE_BUILD_DIR)
@mkdir --parents $(CMAKE_BUILD_DIR)
endif
@$(MSG) Generating $(CMAKE_TOOLCHAIN_FILE_PKG)
env $(MAKE) --no-print-directory cmake_pkg_toolchain > $(CMAKE_TOOLCHAIN_FILE_PKG) 2>/dev/null;

Expand Down
49 changes: 8 additions & 41 deletions mk/spksrc.cross-cmake.mk
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Build CMake programs
#
# This makefile extends spksrc.cross-cc.mk with CMake-specific functionality
#
# prerequisites:
# - cross/module depends on cmake
#
# remarks:
# - most content is taken from spksrc.cross-cc.mk and modified for cmake
#

# Common makefiles
include ../../mk/spksrc.common.mk
Expand Down Expand Up @@ -37,7 +36,7 @@ include ../../mk/spksrc.directories.mk
# cmake specific configurations
include ../../mk/spksrc.cross-cmake-env.mk

# meson toolchain-file usage definition
# cmake toolchain-file usage definition
include ../../mk/spksrc.cross-cmake-toolchainfile.mk

# configure using cmake
Expand All @@ -51,7 +50,7 @@ CMAKE_SOURCE_DIR = $(CMAKE_BASE_DIR)
endif

ifeq ($(strip $(CMAKE_USE_NINJA)),1)
include ../../mk/spksrc.cross-ninja.mk
include ../../mk/spksrc.ninja.mk
else
# compile
ifeq ($(strip $(COMPILE_TARGET)),)
Expand All @@ -73,39 +72,7 @@ endif

###

include ../../mk/spksrc.pre-check.mk

include ../../mk/spksrc.cross-env.mk

include ../../mk/spksrc.download.mk

include ../../mk/spksrc.depend.mk

checksum: download
include ../../mk/spksrc.checksum.mk

extract: checksum depend
include ../../mk/spksrc.extract.mk

patch: extract
include ../../mk/spksrc.patch.mk

configure: patch
include ../../mk/spksrc.configure.mk

compile: configure
include ../../mk/spksrc.compile.mk

install: compile
include ../../mk/spksrc.install.mk

plist: install
include ../../mk/spksrc.plist.mk

all: install plist

###

# CMake specific targets
.PHONY: cmake_configure_target
cmake_configure_target: $(CMAKE_TOOLCHAIN_FILE_PKG)
@$(MSG) - CMake configure
Expand All @@ -126,7 +93,6 @@ cmake_configure_target: $(CMAKE_TOOLCHAIN_FILE_PKG)
# default compile:
cmake_compile_target:
@$(MSG) - CMake compile
@$(MSG) $$(date +%Y%m%d-%H%M%S) MAKELEVEL: $(MAKELEVEL), PARALLEL_MAKE: $(PARALLEL_MAKE), ARCH: $(ARCH)-$(TCVERSION), NAME: $(NAME) >> $(PSTAT_LOG)
$(RUN_CMAKE) cmake --build $(CMAKE_BUILD_DIR) -j $(NCPUS)

.PHONY: cmake_install_target
Expand All @@ -148,6 +114,7 @@ cmake_post_install_target:
@$(MSG) - CMake post-install \(clean\)
$(RUN_CMAKE) cmake --build $(CMAKE_BUILD_DIR) --target clean

###

### For arch-* and all-<supported|latest>
include ../../mk/spksrc.supported.mk
# Include base cross-cc makefile for common functionality
include ../../mk/spksrc.cross-cc.mk
52 changes: 13 additions & 39 deletions mk/spksrc.cross-dotnet.mk
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Build dotnet programs
#
# This makefile extends spksrc.cross-cc.mk with .NET-specific functionality
#
# prerequisites:
# - cross/module depends on native/dotnet only
# - module does not require kernel (REQUIRE_KERNEL)
#
# remarks:
# - Restriction for minimal DSM version is not supported (toolchains are not used for dotnet builds)
# - CONFIGURE_TARGET is not supported/bypassed
# - most content is taken from spksrc.go.mk and modified for dotnet build and install
#
# NOTE: Don't strip the self-contained binary!
# aka don't use 'bin' for the PLIST use 'rsc' instead.
Expand Down Expand Up @@ -52,51 +53,24 @@ ifeq ($(strip $(INSTALL_TARGET)),)
INSTALL_TARGET = nop
endif

# default dotnet publish:
# https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish
dotnet_compile_target:
@$(MSG) - Compile with dotnet publish
$(RUN) dotnet publish $(DOTNET_PACKAGE_NAME) $(DOTNET_BUILD_ARGS)

#####

ifneq ($(REQUIRE_KERNEL),)
@$(error dotnet modules cannot build when REQUIRE_KERNEL is set)
endif

include ../../mk/spksrc.pre-check.mk

include ../../mk/spksrc.cross-env.mk

include ../../mk/spksrc.download.mk

include ../../mk/spksrc.depend.mk

checksum: download
include ../../mk/spksrc.checksum.mk
###

extract: checksum depend
include ../../mk/spksrc.extract.mk

patch: extract
include ../../mk/spksrc.patch.mk

configure: patch
include ../../mk/spksrc.configure.mk

compile: configure
include ../../mk/spksrc.compile.mk

install: compile
include ../../mk/spksrc.install.mk

plist: install
include ../../mk/spksrc.plist.mk

all: install plist
# .NET specific targets
.PHONY: dotnet_compile_target

# default dotnet publish:
# https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish
dotnet_compile_target:
@$(MSG) - Compile with dotnet publish
$(RUN) dotnet publish $(DOTNET_PACKAGE_NAME) $(DOTNET_BUILD_ARGS)

### For arch-* and all-<supported|latest>
include ../../mk/spksrc.supported.mk
###

####
# Include base cross-cc makefile for common functionality
include ../../mk/spksrc.cross-cc.mk
15 changes: 12 additions & 3 deletions mk/spksrc.cross-meson.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Build CMake programs
# Build Meson programs
#
# This makefile extends spksrc.cross-cc.mk with Meson-specific functionality
#
# prerequisites:
# - cross/module depends on meson + ninja
Expand Down Expand Up @@ -29,6 +31,8 @@ endif
# Common directories (must be set after ARCH_SUFFIX)
include ../../mk/spksrc.directories.mk

###

# meson specific configurations
include ../../mk/spksrc.cross-meson-env.mk

Expand All @@ -41,8 +45,11 @@ CONFIGURE_TARGET = meson_configure_target
endif

# call-up ninja build process
include ../../mk/spksrc.cross-ninja.mk
include ../../mk/spksrc.ninja.mk

###

# Meson specific targets
.PHONY: meson_configure_target

# default meson configure:
Expand All @@ -55,5 +62,7 @@ meson_configure_target: $(MESON_CROSS_FILE_PKG)
@$(MSG) meson setup $(MESON_BUILD_DIR) -Dprefix=$(INSTALL_PREFIX) $(CONFIGURE_ARGS)
$(RUN_MESON) meson setup $(MESON_BUILD_DIR) -Dprefix=$(INSTALL_PREFIX) $(CONFIGURE_ARGS)

# call-up regular build process
###

# Include base cross-cc makefile for common functionality
include ../../mk/spksrc.cross-cc.mk
48 changes: 10 additions & 38 deletions mk/spksrc.cross-rust.mk
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Build rust programs
#
# This makefile extends spksrc.cross-cc.mk with Rust-specific functionality
#
# prerequisites:
# - module does not require kernel (REQUIRE_KERNEL)
#
# remarks:
# - most content is taken from spksrc.cc.mk and modified for rust
# - CONFIGURE_TARGET is not supported (used for rust target installation)
# - build and install is done in one step
#
Expand Down Expand Up @@ -62,6 +63,11 @@ ifneq ($(strip $(CARGO_BUILD_ARGS)),)
CARGO_INSTALL_ARGS += $(CARGO_BUILD_ARGS)
endif

###

# Rust specific targets
.PHONY: rust_install_target

# Default build with rust and install with cargo
# The cargo call uses tc_vars.mk RUSTUP_TOOLCHAIN variable
# overriding definition using +stable or +$(RUSTUP_TOOLCHAIN)
Expand All @@ -72,41 +78,7 @@ rust_install_target:
@$(RUN) echo cargo +$(TC_RUSTUP_TOOLCHAIN) install $(CARGO_INSTALL_ARGS) --target $(RUST_TARGET)
@$(RUN) cargo +$(TC_RUSTUP_TOOLCHAIN) install $(CARGO_INSTALL_ARGS) --target $(RUST_TARGET)

#####

include ../../mk/spksrc.pre-check.mk

include ../../mk/spksrc.cross-env.mk

include ../../mk/spksrc.download.mk

include ../../mk/spksrc.depend.mk

checksum: download
include ../../mk/spksrc.checksum.mk

extract: checksum depend
include ../../mk/spksrc.extract.mk

patch: extract
include ../../mk/spksrc.patch.mk

configure: patch
include ../../mk/spksrc.configure.mk

compile: configure
include ../../mk/spksrc.compile.mk

install: compile
include ../../mk/spksrc.install.mk

plist: install
include ../../mk/spksrc.plist.mk

all: install plist


### For arch-* and all-<supported|latest>
include ../../mk/spksrc.supported.mk
###

####
# Include base cross-cc makefile for common functionality
include ../../mk/spksrc.cross-cc.mk
5 changes: 5 additions & 0 deletions mk/spksrc.directories.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ DISTRIB_DIR = $(BASE_DISTRIB_DIR)
endif

ifndef WORK_DIR
ifndef ARCH_SUFFIX
WORK_DIR := $(CURDIR)/work-native
else
WORK_DIR := $(CURDIR)/work$(ARCH_SUFFIX)
endif
export WORK_DIR
endif
Comment on lines 24 to +31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems the breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup it is...


ifndef INSTALL_DIR
INSTALL_DIR = $(WORK_DIR)/install
Expand Down
Loading