Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
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
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
10 changes: 4 additions & 6 deletions mk/spksrc.native-cc.mk
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Common makefiles
include ../../mk/spksrc.common.mk
include ../../mk/spksrc.directories.mk

# Force build in native tool directory, not cross directory.
WORK_DIR := $(CURDIR)/work-native

# Package dependent
URLS = $(PKG_DIST_SITE)/$(PKG_DIST_NAME)
Expand All @@ -17,10 +13,12 @@ endif
DIST_FILE = $(DISTRIB_DIR)/$(LOCAL_FILE)
DIST_EXT = $(PKG_EXT)

#####
# Setup common directories
include ../../mk/spksrc.directories.mk

.NOTPARALLEL:
#####

# native specific environment
include ../../mk/spksrc.native-env.mk

include ../../mk/spksrc.download.mk
Expand Down
4 changes: 4 additions & 0 deletions mk/spksrc.native-cmake-env.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ ifeq ($(strip $(CMAKE_DESTDIR)),)
CMAKE_DESTDIR = $(INSTALL_DIR)
endif

ifeq ($(strip $(CMAKE_BASE_DIR)),)
CMAKE_BASE_DIR = $(WORK_DIR)/$(PKG_DIR)
endif

# set default build directory
ifeq ($(strip $(CMAKE_BUILD_DIR)),)
CMAKE_BUILD_DIR = $(WORK_DIR)/$(PKG_DIR)/build
Expand Down
23 changes: 13 additions & 10 deletions mk/spksrc.native-cmake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

# Common makefiles
include ../../mk/spksrc.common.mk
include ../../mk/spksrc.directories.mk

# cmake specific configurations
include ../../mk/spksrc.native-cmake-env.mk

# Force build in native tool directrory, not cross directory.
WORK_DIR := $(CURDIR)/work-native

# Package dependend
URLS = $(PKG_DIST_SITE)/$(PKG_DIST_NAME)
Expand All @@ -26,13 +19,24 @@ endif
DIST_FILE = $(DISTRIB_DIR)/$(LOCAL_FILE)
DIST_EXT = $(PKG_EXT)

# Setup common directories
include ../../mk/spksrc.directories.mk

# cmake specific configurations
include ../../mk/spksrc.native-cmake-env.mk

#####

# configure using cmake
ifeq ($(strip $(CONFIGURE_TARGET)),)
CONFIGURE_TARGET = cmake_configure_target
endif

# source directory
ifeq ($(strip $(CMAKE_SOURCE_DIR)),)
CMAKE_SOURCE_DIR = $(CMAKE_BASE_DIR)
endif

# install
ifeq ($(strip $(CMAKE_DIR)),)
CMAKE_DIR = $(WORK_DIR)/$(PKG_DIR)
Expand All @@ -54,8 +58,6 @@ endif

###

.NOTPARALLEL:

# native specific environment
include ../../mk/spksrc.native-env.mk

Expand Down Expand Up @@ -102,9 +104,10 @@ cmake_configure_target:
@$(MSG) - Use DESTDIR = $(CMAKE_USE_DESTDIR)
@$(MSG) - Path DESTDIR = $(CMAKE_DESTDIR)
@$(MSG) - Path BUILD_DIR = $(CMAKE_BUILD_DIR)
@$(MSG) - Path CMAKE_SOURCE_DIR = $(CMAKE_SOURCE_DIR)
$(RUN) rm -rf CMakeCache.txt CMakeFiles
$(RUN) mkdir --parents $(CMAKE_BUILD_DIR)
cd $(CMAKE_BUILD_DIR) && env $(ENV) cmake $(CMAKE_ARGS) $(CMAKE_DIR)
cd $(CMAKE_BUILD_DIR) && env $(ENV) cmake -S $(CMAKE_SOURCE_DIR) -B $(CMAKE_BUILD_DIR) $(CMAKE_ARGS) $(ADDITIONAL_CMAKE_ARGS) $(CMAKE_DIR)

.PHONY: cmake_compile_target

Expand Down
5 changes: 0 additions & 5 deletions mk/spksrc.native-install.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
include ../../mk/spksrc.common.mk
include ../../mk/spksrc.directories.mk

# Force build in native tool directory, not cross directory.
WORK_DIR := $(CURDIR)/work-native

# Package dependent
URLS = $(PKG_DIST_SITE)/$(PKG_DIST_NAME)
NAME = $(PKG_NAME)
Expand All @@ -33,8 +30,6 @@ endif

#####

.NOTPARALLEL:

include ../../mk/spksrc.native-env.mk

include ../../mk/spksrc.download.mk
Expand Down
9 changes: 3 additions & 6 deletions mk/spksrc.native-meson.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

# Common makefiles
include ../../mk/spksrc.common.mk
include ../../mk/spksrc.directories.mk

# Force build in native tool directrory, not cross directory.
WORK_DIR := $(CURDIR)/work-native

# Package dependend
URLS = $(PKG_DIST_SITE)/$(PKG_DIST_NAME)
Expand All @@ -23,6 +19,9 @@ endif
DIST_FILE = $(DISTRIB_DIR)/$(LOCAL_FILE)
DIST_EXT = $(PKG_EXT)

# Setup common directories
include ../../mk/spksrc.directories.mk

#####

# configure using meson
Expand All @@ -32,8 +31,6 @@ endif

###

.NOTPARALLEL:

include ../../mk/spksrc.native-env.mk

# meson specific configurations
Expand Down
18 changes: 18 additions & 0 deletions native/Khronos-SPIRV-Headers/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
PKG_NAME = SPIRV-Headers
PKG_VERS = 1.4.328.1
PKG_EXT = tar.gz
PKG_DIST_NAME = vulkan-sdk-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags
PKG_DIR = $(PKG_NAME)-vulkan-sdk-$(PKG_VERS)

HOMEPAGE = https://github.com/KhronosGroup/SPIRV-Headers
COMMENT = Machine-readable files for the SPIR-V Registry
LICENSE = Copyright (c) 2015-2024 The Khronos Group Inc.

POST_EXTRACT_TARGET = SPIRV-Headers_post_extract_target

include ../../mk/spksrc.native-cmake.mk

.PHONY: SPIRV-Headers_post_extract_target
SPIRV-Headers_post_extract_target:
@cd $(WORK_DIR) && ln -s $(PKG_DIR) $(PKG_NAME)
3 changes: 3 additions & 0 deletions native/Khronos-SPIRV-Headers/digests
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vulkan-sdk-1.4.328.1.tar.gz SHA1 02be25135fc1b806feca839b6eb7520153bfb015
vulkan-sdk-1.4.328.1.tar.gz SHA256 602364ab7bf404a7f352df7da5c645f1c4558a9c92616f8ee33422b04d5e35b7
vulkan-sdk-1.4.328.1.tar.gz MD5 fe65ef52a13a0f6d20c065208cd9efab
35 changes: 35 additions & 0 deletions native/Khronos-SPIRV-Tools/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
PKG_NAME = SPIRV-Tools
PKG_VERS = 2025.4
PKG_EXT = tar.gz
PKG_DIST_NAME = v$(PKG_VERS).$(PKG_EXT)
PKG_DIST_FILE = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

HOMEPAGE = https://github.com/KhronosGroup/SPIRV-Tools
COMMENT = The SPIR-V Tools project provides an API and commands for processing SPIR-V modules.
LICENSE = Apache-2.0 license

DEPENDS = native/Khronos-SPIRV-Headers

POST_EXTRACT_TARGET = SPIRV-Tools_post_extract_target

CMAKE_ARGS += -DSPIRV_WERROR=OFF
CMAKE_ARGS += -DSPIRV_TOOLS_BUILD_STATIC=OFF
CMAKE_ARGS += -DSPIRV-Headers_SOURCE_DIR=$(STAGING_INSTALL_PREFIX)

PRE_DEPEND_TARGET = pre_toto
POST_DEPEND_TARGET = post_toto

#include ../../mk/spksrc.native-cc.mk
include ../../mk/spksrc.native-cmake.mk

.PHONY: SPIRV-Tools_post_extract_target
SPIRV-Tools_post_extract_target:
@cd $(WORK_DIR) && ln -s $(PKG_DIR) $(PKG_NAME)

pre_toto:
@$(MSG) pre-WORK_DIR: $(WORK_DIR)

post_toto:
@$(MSG) post-WORK_DIR: $(WORK_DIR)
3 changes: 3 additions & 0 deletions native/Khronos-SPIRV-Tools/digests
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPIRV-Tools-2025.4.tar.gz SHA1 1f2fc401f6987620cb3c2cf47076ec419e974f07
SPIRV-Tools-2025.4.tar.gz SHA256 d256aa82de849bdce4b05060081dadcc9145c2173a056e8531f649f8975e582e
SPIRV-Tools-2025.4.tar.gz MD5 ccccf07408ba65e3a2abd821af789f4b
75 changes: 54 additions & 21 deletions native/llvm-14.0-build/Makefile
Original file line number Diff line number Diff line change
@@ -1,46 +1,79 @@
PKG_NAME = llvm
PKG_VERS = 14.0.5
PKG_VERS_MAJ = $(firstword $(subst ., ,$(PKG_VERS)))
PKG_EXT = tar.xz
PKG_DIST_NAME = $(PKG_NAME)-project-$(PKG_VERS).src.$(PKG_EXT)
PKG_DIST_SITE = https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERS)
PKG_LLVM_MAJ = 14
PKG_VERS = $(PKG_LLVM_MAJ).0.5
PKG_EXT = tar.gz
PKG_DIST_NAME = v$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/refs/tags
PKG_DIST_FILE = SPIRV-LLVM-Translator-$(PKG_VERS).$(PKG_EXT)
PKG_DIR = $(PKG_NAME)-project-$(PKG_VERS).src

# REMARKS:
# Since it takes a huge amount of resources to build this, we started to host the
# Since it takes a huge amount of resources to build this, we started to host the
# output on https://github.com/SynoCommunity/spksrc/releases/tag/native%2Fllvm
#
#
# This Makefile is to build the native llvm
# and has one additional target to build the archive (make build-archive)
#
#
# The main reason to build llvm from source is, that other prebuilt packages
# do not contain the binary "clang-tblgen" that is mandatory to build cross/llvm-14.0.
# do not contain mandatory binaries to build cross/llvm-14.0.
#
# Native binaries: clang-tblgen, llvm-tblgen, llvm-spirv

DEPENDS =
HOMEPAGE = https://github.com/KhronosGroup/SPIRV-LLVM-Translator
COMMENT = Tool and library for translation between LLVM IR and SPIR-V
LICENSE = Apache-2.0 with LLVM-exception

HOMEPAGE = https://llvm.org/
COMMENT = The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
LICENSE = Apache License v2.0 with LLVM Exceptions
BUILD_DEPENDS = cross/llvm-project-140.src
DEPENDS = native/Khronos-SPIRV-Headers
DEPENDS = native/Khronos-SPIRV-Tools

POST_INSTALL_TARGET = llvm_post_install
CMAKE_USE_NINJA = 1
POST_EXTRACT_TARGET = llvm_post_extract_target
POST_INSTALL_TARGET = llvm_post_install_target

# Using LLVM project source need to change to llvm sub-directory
CMAKE_DIR = $(WORK_DIR)/$(PKG_DIR)/llvm
# Using various LLVM project sources needs a top-level master directory
CMAKE_BUILD_DIR = $(WORK_DIR)/llvm.build
CMAKE_SOURCE_DIR = $(WORK_DIR)/llvm-project/llvm

CMAKE_ARGS += -DLLVM_TARGETS_TO_BUILD=X86
CMAKE_ARGS += -DCMAKE_BUILD_TYPE=MinSizeRel
CMAKE_ARGS += -DLLVM_ENABLE_ASSERTIONS=ON
CMAKE_ARGS += -DLLVM_BUILD_LLVM_DYLIB=ON
CMAKE_ARGS += -DLLVM_LINK_LLVM_DYLIB=ON
CMAKE_ARGS += -DBUILD_SHARED_LIBS=OFF
CMAKE_ARGS += -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON
CMAKE_ARGS += -DLLVM_ENABLE_PROJECTS='clang'
CMAKE_ARGS += -DLLVM_TARGETS_TO_BUILD=X86
CMAKE_ARGS += -DLLVM_EXTERNAL_PROJECTS='llvm-spirv'
CMAKE_ARGS += -DLLVM_ENABLE_PROJECTS='clang;lld'
CMAKE_ARGS += -DLLVM_ENABLE_RUNTIMES='libclc'
CMAKE_ARGS += -DLIBCLC_TARGETS_TO_BUILD="spirv-mesa3d-;spirv64-mesa3d-"

# Points towards proper source and include dirs
CMAKE_ARGS += -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=$(STAGING_INSTALL_PREFIX)/include/spirv
CMAKE_ARGS += -DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR=$(WORK_DIR)/SPIRV-LLVM-Translator

# Assertions are internal checks to help find bugs
CMAKE_ARGS += -DLLVM_ENABLE_ASSERTIONS=OFF

# BUILD_SHARED_LIBS is only recommended for use by LLVM developers
CMAKE_ARGS += -DBUILD_SHARED_LIBS=OFF

# Disable benchmarks and tests
CMAKE_ARGS += -DLLVM_INCLUDE_BENCHMARKS=OFF
CMAKE_ARGS += -DLLVM_INCLUDE_TESTS=OFF
CMAKE_ARGS += -DLLVM_BUILD_TESTS=OFF
CMAKE_ARGS += -DLLVM_INCLUDE_GO_TESTS=OFF

# Disable lit testing framework (requires patch as well to fully disable)
CMAKE_ARGS += -DLLVM_INCLUDE_UTILS=OFF

include ../../mk/spksrc.native-cmake.mk

.PHONY: llvm_post_install
llvm_post_install:
# Create symlink for LLVM to find the translator
llvm_post_extract_target:
@cd $(WORK_DIR) && ln -sf SPIRV-LLVM-Translator-$(PKG_VERS) SPIRV-LLVM-Translator
@cd $(WORK_DIR)/llvm-project/llvm/projects && ln -sf ../../../$(PKG_DIR) llvm-spirv

.PHONY: llvm_post_install_target
llvm_post_install_target:
$(RUN) install -m 755 build/bin/clang-tblgen $(STAGING_INSTALL_PREFIX)/bin/clang-tblgen
@cd $(STAGING_INSTALL_PREFIX)/bin && ln -sf clang-$(PKG_VERS_MAJ) clang-tool
$(RUN) install -m 755 build/bin/llvm-config $(STAGING_INSTALL_PREFIX)/bin/llvm-config
Expand Down
6 changes: 3 additions & 3 deletions native/llvm-14.0-build/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
llvm-project-14.0.5.src.tar.xz SHA1 6f4fdf8bf943ab2ae362739e7c7e1524f3470c77
llvm-project-14.0.5.src.tar.xz SHA256 c9d27903ba3883c476a83cd515e36e1e07b0585db55692835de11385d9e3c8fa
llvm-project-14.0.5.src.tar.xz MD5 8fe06cfbec46c304f725db6beba18f35
SPIRV-LLVM-Translator-14.0.5.tar.gz SHA1 600ad63e786ed00ea29e0e5963793439db8f2d66
SPIRV-LLVM-Translator-14.0.5.tar.gz SHA256 57d0bcf14a5aa7d7052f48936d339f35831773d0368bbae092b28bc93377d26f
SPIRV-LLVM-Translator-14.0.5.tar.gz MD5 42a27c59e8e42ada24f6cbe8e72f0190