From 8b2d6e443584e400a1a0681ef52b667a187f1012 Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 20 Oct 2023 18:57:10 +0200 Subject: [PATCH 1/2] vulkan-headers: add port --- bootstrap.d/dev-util.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/bootstrap.d/dev-util.yml b/bootstrap.d/dev-util.yml index e426768fa..5b80e5010 100644 --- a/bootstrap.d/dev-util.yml +++ b/bootstrap.d/dev-util.yml @@ -220,3 +220,35 @@ packages: - args: ['make', 'install'] environ: DESTDIR: '@THIS_COLLECT_DIR@' + + - name: vulkan-headers + architecture: '@OPTION:arch@' + metadata: + summary: Vulkan Header files and API registry + description: This package provides the Vulkan header files. This is needed to compile Vulkan applications. + spdx: 'MIT' + website: 'https://github.com/KhronosGroup/Vulkan-Headers' + maintainer: "Alexander Richards " + categories: ['dev-util'] + source: + subdir: 'ports' + git: 'https://github.com/KhronosGroup/Vulkan-Headers.git' + tag: 'v1.3.269' + version: '1.3.269' + tools_required: + - system-gcc + - host-cmake + configure: + - args: + - 'cmake' + - '-GNinja' + - '-DCMAKE_TOOLCHAIN_FILE=@SOURCE_ROOT@/scripts/CMakeToolchain-@OPTION:arch-triple@.txt' + - '-DCMAKE_PREFIX=/usr' + - '-DCMAKE_INSTALL_PREFIX=/usr' + - '-DBUILD_TESTS=OFF' + - '@THIS_SOURCE_DIR@/' + build: + - args: ['ninja', 'install'] + environ: + DESTDIR: '@THIS_COLLECT_DIR@' + quiet: true From d17b857e91170774afc5ef87d15603d657dd34b5 Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 20 Oct 2023 18:59:37 +0200 Subject: [PATCH 2/2] vulkan-loader: add port --- bootstrap.d/media-libs.yml | 45 +++++++++++++++++ .../0001-Add-managarm-support.patch | 48 +++++++++++++++++++ scripts/CMakeToolchain-x86_64-managarm.txt | 1 + 3 files changed, 94 insertions(+) create mode 100644 patches/vulkan-loader/0001-Add-managarm-support.patch diff --git a/bootstrap.d/media-libs.yml b/bootstrap.d/media-libs.yml index 401404680..943ac534c 100644 --- a/bootstrap.d/media-libs.yml +++ b/bootstrap.d/media-libs.yml @@ -876,6 +876,51 @@ packages: DESTDIR: '@THIS_COLLECT_DIR@' quiet: true + - name: vulkan-loader + architecture: '@OPTION:arch@' + metadata: + summary: Vulkan Installable Client Driver (ICD) Loader + description: This package provides the Vulkan Installable Client Driver (ICD) Loader. This allows the vulkan driver to be chosen at run time, rather than requiring static configuration. + spdx: 'Apache-2.0' + website: 'https://github.com/KhronosGroup/Vulkan-Loader' + maintainer: "Alexander Richards " + categories: ['media-libs'] + source: + subdir: 'ports' + git: 'https://github.com/KhronosGroup/Vulkan-Loader.git' + tag: 'v1.3.268' + version: '1.3.268' + tools_required: + - system-gcc + - host-cmake + pkgs_required: + - mlibc + - libx11 + - libxrandr + - wayland + - wayland-protocols + # This is only required for building. + - vulkan-headers + configure: + - args: + - 'cmake' + - '-GNinja' + - '-DCMAKE_TOOLCHAIN_FILE=@SOURCE_ROOT@/scripts/CMakeToolchain-@OPTION:arch-triple@.txt' + - '-DCMAKE_INSTALL_PREFIX=/usr' + - '-DBUILD_TESTS=OFF' + - '-DBUILD_WSI_WAYLAND_SUPPORT=ON' + - '-DBUILD_WSI_XCB_SUPPORT=ON' + - '-DBUILD_WSI_XLIB_SUPPORT=ON' + - '-DVULKAN_HEADERS_INSTALL_DIR=@THIS_COLLECT_DIR@/usr' + - '-DENABLE_WERROR=OFF' + - '@THIS_SOURCE_DIR@/' + build: + - args: ['ninja'] + - args: ['ninja', 'install'] + environ: + DESTDIR: '@THIS_COLLECT_DIR@' + quiet: true + - name: sdl2 architecture: '@OPTION:arch@' metadata: diff --git a/patches/vulkan-loader/0001-Add-managarm-support.patch b/patches/vulkan-loader/0001-Add-managarm-support.patch new file mode 100644 index 000000000..83cb0098f --- /dev/null +++ b/patches/vulkan-loader/0001-Add-managarm-support.patch @@ -0,0 +1,48 @@ +From ac7c0610f26473e9fb67b158fe5a627e357d9133 Mon Sep 17 00:00:00 2001 +From: Alexander +Date: Fri, 20 Oct 2023 18:57:29 +0200 +Subject: [PATCH] Add managarm support + +--- + CMakeLists.txt | 2 +- + loader/vk_loader_platform.h | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 16e65a6..d76b471 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -100,7 +100,7 @@ elseif(ANDROID) + message(FATAL_ERROR "Android build not supported!") + elseif(APPLE) + target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_MACOS_MVK VK_USE_PLATFORM_METAL_EXT) +-elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|DragonFly|GNU") ++elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|DragonFly|GNU|managarm") + option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON) + option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON) + option(BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" ON) +diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h +index 3a8cafb..d633fa2 100644 +--- a/loader/vk_loader_platform.h ++++ b/loader/vk_loader_platform.h +@@ -42,7 +42,7 @@ + + // Set of platforms with a common set of functionality which is queried throughout the program + #if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNX__) || defined(__FreeBSD__) || \ +- defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__GNU__) ++ defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__GNU__) || defined(__managarm__) + #define COMMON_UNIX_PLATFORMS 1 + #else + #define COMMON_UNIX_PLATFORMS 0 +@@ -266,7 +266,7 @@ static inline char *loader_platform_dirname(char *path) { return dirname(path); + + // loader_platform_executable_path finds application path + name. + // Path cannot be longer than 1024, returns NULL if it is greater than that. +-#if defined(__linux__) || defined(__GNU__) ++#if defined(__linux__) || defined(__GNU__) || defined(__managarm__) + static inline char *loader_platform_executable_path(char *buffer, size_t size) { + ssize_t count = readlink("/proc/self/exe", buffer, size); + if (count == -1) return NULL; +-- +2.42.0 + diff --git a/scripts/CMakeToolchain-x86_64-managarm.txt b/scripts/CMakeToolchain-x86_64-managarm.txt index fbb10fa5b..a4abde4c3 100644 --- a/scripts/CMakeToolchain-x86_64-managarm.txt +++ b/scripts/CMakeToolchain-x86_64-managarm.txt @@ -1,5 +1,6 @@ set(CMAKE_SYSTEM_NAME managarm) +set(CMAKE_SYSTEM_PROCESSOR x86_64) set(CMAKE_FIND_ROOT_PATH $ENV{XBSTRAP_SYSROOT_DIR})