diff options
author | Christoph Haag | 2019-03-18 14:54:36 +0100 |
---|---|---|
committer | Christoph Haag | 2019-03-18 14:54:36 +0100 |
commit | 071cf9aa1c28805dd877f048cfb19fbe323247a5 (patch) | |
tree | 429ca03c0a2bb68aa4ba539f4e52882df008857a | |
download | aur-071cf9aa1c28805dd877f048cfb19fbe323247a5.tar.gz |
initial commit
-rw-r--r-- | .SRCINFO | 20 | ||||
-rw-r--r-- | PKGBUILD | 55 | ||||
-rw-r--r-- | support_installing_the_loader.diff | 160 |
3 files changed, 235 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..057fbd40e915 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,20 @@ +# Generated by mksrcinfo v8 +# Mon Mar 18 13:54:30 UTC 2019 +pkgbase = openxr-loader-git + pkgdesc = OpenXR Loader and headers + pkgver = r10.baf2a4f + pkgrel = 1 + url = https://github.com/KhronosGroup/OpenXR-SDK + arch = i686 + arch = x86_64 + license = apache + provides = openxr-loader + source = openxr-loader::git+https://github.com/KhronosGroup/OpenXR-SDK.git + source = support_installing_the_loader.diff + md5sums = SKIP + md5sums = b1d87379ab956887007a607de7b2b8af + +pkgname = openxr-loader-git + +pkgname = openxr-headers-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..c7fa48e0ce6a --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,55 @@ +# Maintainer: Christoph Haag <christoph.haag@collabora.com> + +pkgname=("openxr-loader-git" "openxr-headers-git") +_dirname="openxr-loader" +pkgver=r10.baf2a4f +pkgrel=1 +pkgdesc='OpenXR Loader and headers' +arch=('i686' 'x86_64') +url='https://github.com/KhronosGroup/OpenXR-SDK' +depends=() +provides=("openxr-loader") +makedepend=('cmake' 'git') +license=('apache') +source=("$_dirname::git+https://github.com/KhronosGroup/OpenXR-SDK.git" + "support_installing_the_loader.diff") +md5sums=('SKIP' + 'b1d87379ab956887007a607de7b2b8af') + +#options=('debug' '!strip') + +prepare() { + cd "$_dirname" + git apply -vvv "$srcdir"/support_installing_the_loader.diff +} + +pkgver() { + cd "$_dirname" + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +build() { + mkdir -p "$_dirname"-build + cd "$_dirname"-build + cmake \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTS=OFF \ + -DPRESENTATION_BACKEND=xlib \ + -DDYNAMIC_LOADER=ON \ + ../"$_dirname" + make +} + +package_openxr-loader-git() { + cd "$_dirname"-build + make DESTDIR="$pkgdir" install openxr_loader +} + +package_openxr-headers-git() { + cd "$_dirname"-build + # TODO install target for headers + install -d "$pkgdir"/usr/include/openxr/ + cp -ra include/openxr/*.h "$pkgdir"/usr/include/openxr/ +} diff --git a/support_installing_the_loader.diff b/support_installing_the_loader.diff new file mode 100644 index 000000000000..ef1270cd1039 --- /dev/null +++ b/support_installing_the_loader.diff @@ -0,0 +1,160 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d0bd4a78..b3112e49 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -22,7 +22,9 @@ + cmake_minimum_required(VERSION 3.0) + project(OPENXR) + ++# Enable IDE GUI folders. "Helper targets" that don't have interesting source code should set their FOLDER property to this + set_property(GLOBAL PROPERTY USE_FOLDERS ON) ++set(LOADER_HELPER_FOLDER "Helper Targets") + set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "") + + add_subdirectory(include) +@@ -40,3 +42,13 @@ if(BASH_COMMAND) + USES_TERMINAL) + endif() + endif() ++ ++# uninstall target ++if(NOT TARGET uninstall) ++ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/cmake/cmake_uninstall.cmake.in" ++ "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" ++ IMMEDIATE ++ @ONLY) ++ add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) ++ set_target_properties(uninstall PROPERTIES FOLDER ${LOADER_HELPER_FOLDER}) ++endif() +diff --git a/src/api_layers/CMakeLists.txt b/src/api_layers/CMakeLists.txt +index 143938fc..dfddd3fe 100644 +--- a/src/api_layers/CMakeLists.txt ++++ b/src/api_layers/CMakeLists.txt +@@ -170,7 +170,7 @@ else() + gen_xr_layer_json( + ${CMAKE_CURRENT_BINARY_DIR}/XrApiLayer_api_dump.json + api_dump +- ${CMAKE_CURRENT_BINARY_DIR}/libXrApiLayer_api_dump.so ++ libXrApiLayer_api_dump.so + 1 + "API Layer to record api calls as they occur" + "" +@@ -182,7 +182,7 @@ else() + gen_xr_layer_json( + ${CMAKE_CURRENT_BINARY_DIR}/XrApiLayer_core_validation.json + core_validation +- ${CMAKE_CURRENT_BINARY_DIR}/libXrApiLayer_core_validation.so ++ libXrApiLayer_core_validation.so + 1 + "API Layer to record api calls as they occur" + "" +@@ -213,3 +213,13 @@ add_custom_target(core_validation_json_file DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/XrApiLayer_core_validation.json + ) + ++# Install explicit layers on Linux ++set(TARGET_NAMES ++ XrApiLayer_api_dump ++ XrApiLayer_core_validation) ++if(CMAKE_SYSTEM_NAME STREQUAL "Windows") ++else() ++ foreach(TARGET_NAME ${TARGET_NAMES}) ++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.json DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/openxr/${MAJOR}/api_layers/explicit.d) ++ endforeach() ++endif() +diff --git a/src/common/platform_utils.hpp b/src/common/platform_utils.hpp +index 92621a85..d6c9fccb 100644 +--- a/src/common/platform_utils.hpp ++++ b/src/common/platform_utils.hpp +@@ -79,22 +79,23 @@ static inline void PlatformUtilsFreeEnv(char* val) { + } + + // Prefix for the Linux/Apple global runtime JSON file name +-static const std::string rt_dir_prefix = "/usr/local/share/openxr/"; + static const std::string rt_filename = "/active_runtime.json"; + +-static inline bool PlatformGetGlobalRuntimeFileName(uint16_t major_version, std::string& file_name) { ++static inline bool PlatformGetGlobalRuntimeFileName(uint16_t major_version, std::string rt_dir_prefix, std::string& file_name) { + file_name = rt_dir_prefix; ++ file_name += "/openxr/"; + file_name += std::to_string(major_version); + file_name += rt_filename; + return true; + } + +-static inline bool PlatformLockGlobalRuntimeFile(uint16_t major_version, GlobalRuntimeFile& global_rt_file) { ++static inline bool PlatformLockGlobalRuntimeFile(uint16_t major_version, std::string rt_dir_prefix, ++ GlobalRuntimeFile& global_rt_file) { + bool success = false; + try { + global_rt_file = {}; + // Get the filename +- if (PlatformGetGlobalRuntimeFileName(major_version, global_rt_file.file_name)) { ++ if (PlatformGetGlobalRuntimeFileName(major_version, rt_dir_prefix, global_rt_file.file_name)) { + // Initialize the global runtime file info + // Open a file descriptor to the file. + global_rt_file.file_descriptor = open(global_rt_file.file_name.c_str(), O_RDWR); +@@ -245,11 +246,11 @@ static inline void PlatformUtilsFreeEnv(char *val) { + } + + // Prefix for the Linux/Apple global runtime JSON file name +-static const std::string rt_dir_prefix = "/usr/local/share/openxr/"; + static const std::string rt_filename = "/active_runtime.json"; + +-static inline bool PlatformGetGlobalRuntimeFileName(uint16_t major_version, std::string &file_name) { ++static inline bool PlatformGetGlobalRuntimeFileName(uint16_t major_version, std::string rt_dir_prefix, std::string &file_name) { + file_name = rt_dir_prefix; ++ file_name += "/openxr/"; + file_name += std::to_string(major_version); + file_name += rt_filename; + return true; +diff --git a/src/loader/CMakeLists.txt b/src/loader/CMakeLists.txt +index 94c87c8d..bd82e9a1 100644 +--- a/src/loader/CMakeLists.txt ++++ b/src/loader/CMakeLists.txt +@@ -22,6 +22,8 @@ + include(GenerateExportHeader) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS false) + ++include(GNUInstallDirs) ++ + find_package(PythonInterp 3 REQUIRED) + + set(LOADER_NAME openxr_loader) +@@ -98,6 +100,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + PRIVATE FALLBACK_CONFIG_DIRS="${FALLBACK_CONFIG_DIRS}" + PRIVATE FALLBACK_DATA_DIRS="${FALLBACK_DATA_DIRS}" + PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}" ++ PRIVATE DATADIR="${CMAKE_INSTALL_FULL_DATADIR}" + ) + if(NOT(CMAKE_INSTALL_FULL_SYSCONFDIR STREQUAL "/etc")) + target_compile_definitions(openxr_loader PRIVATE EXTRASYSCONFDIR="/etc") +@@ -108,6 +111,13 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + + add_custom_target(lib${LOADER_NAME}.so.${MAJOR}.${MINOR} ALL + COMMAND ${CMAKE_COMMAND} -E create_symlink lib${LOADER_NAME}.so.${MAJOR}.${MINOR}.${PATCH} lib${LOADER_NAME}.so.${MAJOR}.${MINOR}) ++ install(TARGETS ${LOADER_NAME} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) ++ set(XR_API_VERSION "${MAJOR}.${MINOR}") ++ configure_file("openxr.pc.in" "openxr.pc" @ONLY) ++ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/openxr.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") + # Always link MSVCRT libraries dynamically + foreach(configuration in CMAKE_C_FLAGS_DEBUG +diff --git a/src/loader/manifest_file.cpp b/src/loader/manifest_file.cpp +index e311fbc3..153aeb2d 100644 +--- a/src/loader/manifest_file.cpp ++++ b/src/loader/manifest_file.cpp +@@ -656,8 +656,9 @@ XrResult RuntimeManifestFile::FindManifestFiles(ManifestFileType type, + "", "RuntimeManifestFile::findManifestFiles - found too many default runtime files in registry"); + } + #else ++ std::string global_rt_prefix = std::string(DATADIR); + std::string global_rt_filename; +- PlatformGetGlobalRuntimeFileName(XR_VERSION_MAJOR(XR_CURRENT_API_VERSION), global_rt_filename); ++ PlatformGetGlobalRuntimeFileName(XR_VERSION_MAJOR(XR_CURRENT_API_VERSION), global_rt_prefix, global_rt_filename); + filenames.push_back(global_rt_filename); + #endif + std::string info_message = "RuntimeManifestFile::FindManifestFiles - using global runtime file "; |