aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHuang Rui <vowstar@gmail.com>2022-11-03 15:09:54 +0800
committerHuang Rui <vowstar@gmail.com>2022-11-03 15:09:54 +0800
commit2174b583aaa54f035fb1a1ebbe1a64d72e21f74e (patch)
tree0a912b5f970c6faedc31108e24c4aa10d94a22fe /sci-electronics
parentdev-libs/unordered_dense: use patch to fix cmake install path (diff)
downloadguru-2174b583aaa54f035fb1a1ebbe1a64d72e21f74e.tar.gz
guru-2174b583aaa54f035fb1a1ebbe1a64d72e21f74e.tar.bz2
guru-2174b583aaa54f035fb1a1ebbe1a64d72e21f74e.zip
sci-electronics/slang: fix bugs and bump to 2.0
Signed-off-by: Huang Rui <vowstar@gmail.com>
Diffstat (limited to 'sci-electronics')
-rw-r--r--sci-electronics/slang/Manifest1
-rw-r--r--sci-electronics/slang/files/slang-2.0-fix-lib-path.patch64
-rw-r--r--sci-electronics/slang/slang-1.0.ebuild3
-rw-r--r--sci-electronics/slang/slang-2.0.ebuild67
-rw-r--r--sci-electronics/slang/slang-9999.ebuild28
5 files changed, 151 insertions, 12 deletions
diff --git a/sci-electronics/slang/Manifest b/sci-electronics/slang/Manifest
index db3d59054..37c981edb 100644
--- a/sci-electronics/slang/Manifest
+++ b/sci-electronics/slang/Manifest
@@ -1 +1,2 @@
DIST slang-1.0.tar.gz 1239664 BLAKE2B 98355987b5c355eb914dd0d38c7441d5d39b7a0259e557d9cfd6271fd35aab642db6036d55228f75522fef0c31a4c82dea4d09cdb04ea33c60d843a3ca14caf0 SHA512 25ef7f5abb1b73928f61b853db5462baf72077a47daa9419311aba1f8fdca0bd499518c2f64dfff95b3c0671e52f2b1cd37edb7d1c74fb983b74de08fe7eea37
+DIST slang-2.0.tar.gz 1026299 BLAKE2B d55e0f419e030a37ff80aef3c0b16a96ee402707c758797fea3d1914e29247d22d240693cd873f95f634438fad5b8ed65961a324c69788fc3e62f83ce0a94869 SHA512 3d18961cda7eb40877932e937364b19cfcef3127a8467fbfc70febd1d6ef8b267aeae8244355a4b0206197ef126ee5a65aa4a4fb49d0970fe6c626725b7e6b21
diff --git a/sci-electronics/slang/files/slang-2.0-fix-lib-path.patch b/sci-electronics/slang/files/slang-2.0-fix-lib-path.patch
new file mode 100644
index 000000000..8aeb228fa
--- /dev/null
+++ b/sci-electronics/slang/files/slang-2.0-fix-lib-path.patch
@@ -0,0 +1,64 @@
+From 16ef772ec581e929197eae35ef99993e4d7c8dbb Mon Sep 17 00:00:00 2001
+From: Huang Rui <vowstar@gmail.com>
+Date: Thu, 3 Nov 2022 12:04:42 +0800
+Subject: [PATCH] external/CMakeLists.txt: fix find_pkg when unordered_dense
+ installed
+
+If the user has already installed unordered_dense beforehand,
+avoid downloading and installing again.
+Applicable when the distribution has packaged unordered_dense.
+
+Signed-off-by: Huang Rui <vowstar@gmail.com>
+---
+ external/CMakeLists.txt | 22 ++++++++++++++++------
+ 1 file changed, 16 insertions(+), 6 deletions(-)
+
+diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
+index 97e0e79c7..6eb30989a 100644
+--- a/external/CMakeLists.txt
++++ b/external/CMakeLists.txt
+@@ -27,11 +27,17 @@ if((SLANG_INCLUDE_PYLIB OR BUILD_SHARED_LIBS) AND NOT fmt_FOUND)
+ set_target_properties(fmt PROPERTIES POSITION_INDEPENDENT_CODE ON)
+ endif()
+
++set(find_pkg_args "")
++if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24.0")
++ set(find_pkg_args "FIND_PACKAGE_ARGS" "2.0.0")
++endif()
++
+ FetchContent_Declare(
+ unordered_dense
+ GIT_REPOSITORY https://github.com/martinus/unordered_dense.git
+ GIT_TAG v2.0.0
+- GIT_SHALLOW ON)
++ GIT_SHALLOW ON
++ ${find_pkg_args})
+ FetchContent_MakeAvailable(unordered_dense)
+
+ if(SLANG_INCLUDE_INSTALL)
+@@ -44,10 +50,12 @@ if(SLANG_INCLUDE_INSTALL)
+ ${PROJECT_SOURCE_DIR}/external/span.hpp
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT slang_Development)
+- install(
+- DIRECTORY ${unordered_dense_SOURCE_DIR}/include/ankerl
+- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+- COMPONENT slang_Development)
++ if(NOT unordered_dense_FOUND)
++ install(
++ DIRECTORY ${unordered_dense_SOURCE_DIR}/include/ankerl
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
++ COMPONENT slang_Development)
++ endif()
+
+ if(NOT fmt_FOUND)
+ install(
+@@ -59,5 +67,7 @@ if(SLANG_INCLUDE_INSTALL)
+ PRIVATE_HEADER EXCLUDE_FROM_ALL)
+ endif()
+
+- install(TARGETS unordered_dense EXPORT slangTargets)
++ if(NOT unordered_dense_FOUND)
++ install(TARGETS unordered_dense EXPORT slangTargets)
++ endif()
+ endif()
diff --git a/sci-electronics/slang/slang-1.0.ebuild b/sci-electronics/slang/slang-1.0.ebuild
index 1e1d7d743..d788704f4 100644
--- a/sci-electronics/slang/slang-1.0.ebuild
+++ b/sci-electronics/slang/slang-1.0.ebuild
@@ -4,7 +4,7 @@
EAPI="8"
PYTHON_COMPAT=( python3_{8..11} )
-inherit cmake python-r1
+inherit cmake python-single-r1
DESCRIPTION="SystemVerilog compiler and language services"
HOMEPAGE="
@@ -42,7 +42,6 @@ src_configure() {
local mycmakeargs=(
-D CMAKE_INSTALL_LIBDIR="${EPREFIX}/usr/$(get_libdir)"
-D BUILD_SHARED_LIBS=ON
- -D SLANG_INCLUDE_PYLIB=$(usex python)
-D SLANG_INCLUDE_TESTS=$(usex test)
)
cmake_src_configure
diff --git a/sci-electronics/slang/slang-2.0.ebuild b/sci-electronics/slang/slang-2.0.ebuild
new file mode 100644
index 000000000..4a9134e0f
--- /dev/null
+++ b/sci-electronics/slang/slang-2.0.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="8"
+
+PYTHON_COMPAT=( python3_{8..11} )
+inherit cmake python-single-r1
+
+DESCRIPTION="SystemVerilog compiler and language services"
+HOMEPAGE="
+ https://sv-lang.com
+ https://github.com/MikePopoloski/slang
+"
+
+if [[ "${PV}" == "9999" ]] ; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/MikePopoloski/${PN}.git"
+else
+ SRC_URI="https://github.com/MikePopoloski/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm64 ~riscv ~x86"
+ S="${WORKDIR}/${P}"
+fi
+
+LICENSE="MIT"
+SLOT="0"
+IUSE="python test"
+REQUIRED_USE=" ${PYTHON_REQUIRED_USE} "
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ ${PYTHON_DEPS}
+ >=dev-cpp/catch-3.0.1
+ >=dev-libs/libfmt-9.1.0
+ >=dev-libs/unordered_dense-2.0.0
+ $(python_gen_cond_dep '
+ >=dev-python/pybind11-2.10[${PYTHON_USEDEP}]
+ ')
+"
+
+DEPEND="
+ ${RDEPEND}
+"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-2.0-fix-lib-path.patch"
+)
+
+src_configure() {
+ python_setup
+ # BUILD_SHARED_LIBS=OFF because of name collision
+ # https://github.com/MikePopoloski/slang/issues/646
+ local mycmakeargs=(
+ -D CMAKE_INSTALL_LIBDIR="${EPREFIX}/usr/$(get_libdir)"
+ -D BUILD_SHARED_LIBS=OFF
+ -D SLANG_INCLUDE_PYLIB=$(usex python)
+ -D SLANG_INCLUDE_TESTS=$(usex test)
+ )
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+
+ # fix python unexpected paths QA
+ mkdir -p "${D}/$(python_get_sitedir)" || die
+ mv "${D}"/usr/pyslang* "${D}/$(python_get_sitedir)" || die
+}
diff --git a/sci-electronics/slang/slang-9999.ebuild b/sci-electronics/slang/slang-9999.ebuild
index 1e1d7d743..4a9134e0f 100644
--- a/sci-electronics/slang/slang-9999.ebuild
+++ b/sci-electronics/slang/slang-9999.ebuild
@@ -4,7 +4,7 @@
EAPI="8"
PYTHON_COMPAT=( python3_{8..11} )
-inherit cmake python-r1
+inherit cmake python-single-r1
DESCRIPTION="SystemVerilog compiler and language services"
HOMEPAGE="
@@ -29,19 +29,29 @@ RESTRICT="!test? ( test )"
RDEPEND="
${PYTHON_DEPS}
- dev-libs/libfmt
+ >=dev-cpp/catch-3.0.1
+ >=dev-libs/libfmt-9.1.0
+ >=dev-libs/unordered_dense-2.0.0
+ $(python_gen_cond_dep '
+ >=dev-python/pybind11-2.10[${PYTHON_USEDEP}]
+ ')
"
DEPEND="
${RDEPEND}
"
+PATCHES=(
+ "${FILESDIR}/${PN}-2.0-fix-lib-path.patch"
+)
+
src_configure() {
python_setup
-
+ # BUILD_SHARED_LIBS=OFF because of name collision
+ # https://github.com/MikePopoloski/slang/issues/646
local mycmakeargs=(
-D CMAKE_INSTALL_LIBDIR="${EPREFIX}/usr/$(get_libdir)"
- -D BUILD_SHARED_LIBS=ON
+ -D BUILD_SHARED_LIBS=OFF
-D SLANG_INCLUDE_PYLIB=$(usex python)
-D SLANG_INCLUDE_TESTS=$(usex test)
)
@@ -50,10 +60,8 @@ src_configure() {
src_install() {
cmake_src_install
- # fix libdir path
- if [[ "$(get_libdir)" != "lib" ]] ; then
- mv "${D}"/usr/lib "${D}"/usr/"$(get_libdir)" || die
- fi
- # file collisions of internal fmt
- rm -r "${D}"/usr/include/fmt || die
+
+ # fix python unexpected paths QA
+ mkdir -p "${D}/$(python_get_sitedir)" || die
+ mv "${D}"/usr/pyslang* "${D}/$(python_get_sitedir)" || die
}