summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2018-01-22 12:02:14 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2018-01-22 12:02:14 +0300
commit88430e977b0c66185c753ea9ab22c5af2861bc37 (patch)
treeffedd3c2dbf7b08eaccf2e41f373fcac06818da4
parentc8c79eff1a5aec920109218066a42d953ab6a54b (diff)
SPRIV-Tools from gentoo-gpu repo
-rw-r--r--dev-util/SPIRV-Tools/SPIRV-Tools-scm.ebuild46
-rw-r--r--dev-util/SPIRV-Tools/files/external_revision_generator.py81
-rw-r--r--dev-util/SPIRV-Tools/files/fix-multilib-9999.patch21
3 files changed, 148 insertions, 0 deletions
diff --git a/dev-util/SPIRV-Tools/SPIRV-Tools-scm.ebuild b/dev-util/SPIRV-Tools/SPIRV-Tools-scm.ebuild
new file mode 100644
index 0000000..6be89f3
--- /dev/null
+++ b/dev-util/SPIRV-Tools/SPIRV-Tools-scm.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+PYTHON_COMPAT=( python3_{4,5,6} )
+
+inherit python-any-r1 cmake-multilib
+
+DESCRIPTION="GLSL reference compiler."
+HOMEPAGE="https://github.com/KhronosGroup/SPIRV-Tools"
+
+SRC_URI=""
+EGIT_REPO_URI="https://github.com/KhronosGroup/SPIRV-Tools"
+inherit git-r3
+KEYWORDS=
+
+LICENSE="spirv-tools"
+SLOT="0/${PV}"
+IUSE=""
+
+DEPEND="${PYTHON_DEPS}"
+RDEPEND="${DEPEND}"
+
+
+
+src_unpack() {
+ git-r3_src_unpack
+ git-r3_fetch "https://github.com/KhronosGroup/SPIRV-Headers.git" \
+ "refs/heads/master"
+ git-r3_checkout "https://github.com/KhronosGroup/SPIRV-Headers.git" \
+ ${S}/external/spirv-headers
+}
+
+src_prepare() {
+ default
+
+ # Stolen from vulkan-loader
+ python ${FILESDIR}/external_revision_generator.py \
+ ${S} SPIRV_TOOLS_COMMIT_ID include/spirv-tools/spirv_tools_commit_id.h || die failed to generate commit_id header
+
+ # Hack to install generated id header
+ sed -i \
+ -e '/linker\.hpp/a \${CMAKE_CURRENT_SOURCE_DIR}\/include\/spirv-tools\/spirv_tools_commit_id\.h' \
+ CMakeLists.txt || die sed failed
+}
diff --git a/dev-util/SPIRV-Tools/files/external_revision_generator.py b/dev-util/SPIRV-Tools/files/external_revision_generator.py
new file mode 100644
index 0000000..3070117
--- /dev/null
+++ b/dev-util/SPIRV-Tools/files/external_revision_generator.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python3
+#
+# Copyright (c) 2015-2017 The Khronos Group Inc.
+# Copyright (c) 2015-2017 Valve Corporation
+# Copyright (c) 2015-2017 LunarG, Inc.
+# Copyright (c) 2015-2017 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Author: Cort Stratton <cort@google.com>
+
+import os
+import subprocess
+import sys
+
+def generate(git_binary):
+ commit_id = subprocess.check_output([git_binary, "rev-parse", "HEAD"], cwd=source_dir).decode('utf-8').strip()
+
+ # Write commit ID to output header file
+ with open(output_header_file, "w") as header_file:
+ # File Comment
+ file_comment = '// *** THIS FILE IS GENERATED - DO NOT EDIT ***\n'
+ file_comment += '// See external_revision_generator.py for modifications\n'
+ header_file.write(file_comment)
+ # Copyright Notice
+ copyright = ''
+ copyright += '\n'
+ copyright += '/***************************************************************************\n'
+ copyright += ' *\n'
+ copyright += ' * Copyright (c) 2015-2017 The Khronos Group Inc.\n'
+ copyright += ' * Copyright (c) 2015-2017 Valve Corporation\n'
+ copyright += ' * Copyright (c) 2015-2017 LunarG, Inc.\n'
+ copyright += ' * Copyright (c) 2015-2017 Google Inc.\n'
+ copyright += ' *\n'
+ copyright += ' * Licensed under the Apache License, Version 2.0 (the "License");\n'
+ copyright += ' * you may not use this file except in compliance with the License.\n'
+ copyright += ' * You may obtain a copy of the License at\n'
+ copyright += ' *\n'
+ copyright += ' * http://www.apache.org/licenses/LICENSE-2.0\n'
+ copyright += ' *\n'
+ copyright += ' * Unless required by applicable law or agreed to in writing, software\n'
+ copyright += ' * distributed under the License is distributed on an "AS IS" BASIS,\n'
+ copyright += ' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n'
+ copyright += ' * See the License for the specific language governing permissions and\n'
+ copyright += ' * limitations under the License.\n'
+ copyright += ' *\n'
+ copyright += ' * Author: Chris Forbes <chrisforbes@google.com>\n'
+ copyright += ' * Author: Cort Stratton <cort@google.com>\n'
+ copyright += ' *\n'
+ copyright += ' ****************************************************************************/\n'
+ header_file.write(copyright)
+ # Contents
+ contents = '#pragma once\n\n'
+ contents += '#define %s "%s"\n' % (symbol_name, commit_id)
+ header_file.write(contents)
+
+if __name__ == '__main__':
+ if (len(sys.argv) != 4):
+ print("Usage: %s <SOURCE_DIR> <SYMBOL_NAME> <OUTPUT_HEADER_FILE>" % sys.argv[0])
+ sys.exit(os.EX_USAGE)
+
+ source_dir = sys.argv[1]
+ symbol_name = sys.argv[2]
+ output_header_file = sys.argv[3]
+
+ # Extract commit ID from the specified source directory
+ try:
+ generate('git')
+ except WindowsError:
+ # Call git.bat on Windows for compatiblity.
+ generate('git.bat')
diff --git a/dev-util/SPIRV-Tools/files/fix-multilib-9999.patch b/dev-util/SPIRV-Tools/files/fix-multilib-9999.patch
new file mode 100644
index 0000000..17f22ca
--- /dev/null
+++ b/dev-util/SPIRV-Tools/files/fix-multilib-9999.patch
@@ -0,0 +1,21 @@
+--- ./source/CMakeLists.txt~ 2016-09-27 19:52:28.000000000 +0100
++++ ./source/CMakeLists.txt 2016-09-27 19:54:33.719443956 +0100
+@@ -191,5 +191,5 @@
+
+ install(TARGETS ${SPIRV_TOOLS}
+ RUNTIME DESTINATION bin
+- LIBRARY DESTINATION lib
+- ARCHIVE DESTINATION lib)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+--- ./tools/CMakeLists.txt~ 2016-09-27 19:52:28.000000000 +0100
++++ ./tools/CMakeLists.txt 2016-09-27 19:54:57.289681825 +0100
+@@ -49,6 +49,6 @@
+ set(SPIRV_INSTALL_TARGETS spirv-as spirv-dis spirv-val spirv-opt spirv-cfg)
+ install(TARGETS ${SPIRV_INSTALL_TARGETS}
+ RUNTIME DESTINATION bin
+- LIBRARY DESTINATION lib
+- ARCHIVE DESTINATION lib)
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ endif()