summaryrefslogtreecommitdiff
path: root/sci-misc/stable-diffusion-cpp/stable-diffusion-cpp-9999.ebuild
diff options
context:
space:
mode:
authorroot <root@alpha.trunkmasters.com>2026-06-04 05:48:38 -0500
committerroot <root@alpha.trunkmasters.com>2026-06-04 05:48:38 -0500
commitbfd9c39e4712ebdb442d4ca0673061faed1e70e1 (patch)
tree0d7a74b4463ee387f9cf9368ceb1b757f694f72a /sci-misc/stable-diffusion-cpp/stable-diffusion-cpp-9999.ebuild
parentf716a9fe6455d39eef01e718aae68dae61c19704 (diff)
downloadbaldeagleos-repo-bfd9c39e4712ebdb442d4ca0673061faed1e70e1.tar.gz
baldeagleos-repo-bfd9c39e4712ebdb442d4ca0673061faed1e70e1.tar.xz
baldeagleos-repo-bfd9c39e4712ebdb442d4ca0673061faed1e70e1.zip
Revert "Adding metadata"
This reverts commit f716a9fe6455d39eef01e718aae68dae61c19704.
Diffstat (limited to 'sci-misc/stable-diffusion-cpp/stable-diffusion-cpp-9999.ebuild')
-rw-r--r--sci-misc/stable-diffusion-cpp/stable-diffusion-cpp-9999.ebuild149
1 files changed, 149 insertions, 0 deletions
diff --git a/sci-misc/stable-diffusion-cpp/stable-diffusion-cpp-9999.ebuild b/sci-misc/stable-diffusion-cpp/stable-diffusion-cpp-9999.ebuild
new file mode 100644
index 000000000000..e301a0baf3bd
--- /dev/null
+++ b/sci-misc/stable-diffusion-cpp/stable-diffusion-cpp-9999.ebuild
@@ -0,0 +1,149 @@
+# Copyright 2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ROCM_VERSION="6.3"
+
+inherit cmake cuda rocm linux-info
+
+DESCRIPTION="Diffusion model(SD,Flux,Wan,Qwen Image,Z-Image,...) inference in pure C/C++"
+HOMEPAGE="https://github.com/leejet/stable-diffusion.cpp"
+
+if [[ ${PV} == *9999* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/leejet/stable-diffusion.cpp.git"
+else
+ MY_PV="b${PV#0_pre}"
+ SRC_URI="https://github.com/leejet/stable-diffusion.cpp/archive/refs/tags/${MY_PV}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}/stable-diffusion-cpp-${MY_PV}"
+ KEYWORDS="~amd64"
+fi
+
+LICENSE="MIT"
+SLOT="0"
+CPU_FLAGS_X86=( avx avx2 f16c )
+
+IUSE="openblas blis rocm cuda opencl vulkan flexiblas webm webp wmma"
+
+REQUIRED_USE="
+ ?? (
+ openblas
+ blis
+ flexiblas
+ )
+ webm? (
+ webp
+ )
+ wmma? (
+ rocm
+ )
+"
+
+CDEPEND="
+ openblas? ( sci-libs/openblas:= )
+ blis? ( sci-libs/blis:= )
+ flexiblas? ( sci-libs/flexiblas:= )
+ rocm? (
+ >=dev-util/hip-${ROCM_VERSION}:=
+ >=sci-libs/hipBLAS-${ROCM_VERSION}:=
+ wmma? (
+ >=sci-libs/rocWMMA-${ROCM_VERSION}:=
+ )
+ )
+ cuda? ( dev-util/nvidia-cuda-toolkit:= )
+ webp? ( media-libs/libwebp )
+ webm? ( media-libs/libwebm )
+"
+DEPEND="${CDEPEND}
+ opencl? ( dev-util/opencl-headers )
+ vulkan? ( dev-util/vulkan-headers )
+"
+RDEPEND="${CDEPEND}
+ dev-python/numpy
+ opencl? ( dev-libs/opencl-icd-loader )
+ vulkan? ( media-libs/vulkan-loader )
+"
+BDEPEND="media-libs/shaderc"
+
+pkg_setup() {
+ if use rocm; then
+ linux-info_pkg_setup
+ if linux-info_get_any_version && linux_config_exists; then
+ if ! linux_chkconfig_present HSA_AMD_SVM; then
+ ewarn "To use ROCm/HIP, you need to have HSA_AMD_SVM option enabled in your kernel."
+ fi
+ fi
+ fi
+}
+
+src_prepare() {
+ use cuda && cuda_src_prepare
+ cmake_src_prepare
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DCMAKE_SKIP_BUILD_RPATH=ON
+ -DSD_BUILD_SHARED_LIBS=OFF
+ -DSD_SERVER_BUILD_FRONTEND=OFF # requires pnpm and network access
+ -DGGML_NATIVE=0 # don't set march
+ -DGGML_RPC=ON
+ -DGENTOO_REMOVE_CMAKE_BLAS_HACK=ON
+ -DSD_CUDA=$(usex cuda)
+ -DSD_OPENCL=$(usex opencl)
+ -DSD_WEBP=$(usex webp)
+ -DSD_USE_SYSTEM_WEBP=$(usex webp)
+ -DSD_WEBM=$(usex webm)
+ -DSD_USE_SYSTEM_WEBM=$(usex webm)
+ -DSD_VULKAN=$(usex vulkan)
+
+ # avoid clashing with whisper.cpp
+ -DCMAKE_INSTALL_LIBDIR="${EPREFIX}/usr/$(get_libdir)/stable-diffusion.cpp"
+ -DCMAKE_INSTALL_RPATH="${EPREFIX}/usr/$(get_libdir)/stable-diffusion.cpp"
+ )
+
+ if use openblas ; then
+ mycmakeargs+=(
+ -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
+ )
+ fi
+
+ if use blis ; then
+ mycmakeargs+=(
+ -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=FLAME
+ )
+ fi
+
+ if use flexiblas; then
+ mycmakeargs+=(
+ -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=FlexiBLAS
+ )
+ fi
+
+ if use cuda; then
+ local -x CUDAHOSTCXX="$(cuda_gccdir)"
+ # tries to recreate dev symlinks
+ cuda_add_sandbox
+ addpredict "/dev/char/"
+ fi
+
+ if use rocm; then
+ rocm_use_hipcc
+ mycmakeargs+=(
+ -DSD_HIPBLAS=ON -DAMDGPU_TARGETS=$(get_amdgpu_flags) -DGPU_TARGETS=$(get_amdgpu_flags)
+ -DGGML_HIP_ROCWMMA_FATTN=$(usex wmma)
+ )
+ fi
+
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+
+ # avoid clashing with whisper.cpp
+ rm -rf "${ED}/usr/include"
+
+ find "${ED}" -name "*.a" -delete || die
+}