pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

stable-diffusion.cpp: add new package



Module Name:	pkgsrc-wip
Committed By:	Thomas Klausner <wiz%NetBSD.org@localhost>
Pushed By:	wiz
Date:		Fri Jun 19 17:28:32 2026 +0200
Changeset:	a622ffef3b52a78e55f0c36d8252c9338c007f2c

Modified Files:
	Makefile
Added Files:
	stable-diffusion.cpp/DESCR
	stable-diffusion.cpp/Makefile
	stable-diffusion.cpp/PLIST
	stable-diffusion.cpp/distinfo
	stable-diffusion.cpp/patches/patch-ggml_CMakeLists.txt

Log Message:
stable-diffusion.cpp: add new package

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=a622ffef3b52a78e55f0c36d8252c9338c007f2c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                                           |  1 +
 stable-diffusion.cpp/DESCR                         |  3 ++
 stable-diffusion.cpp/Makefile                      | 54 ++++++++++++++++++++++
 stable-diffusion.cpp/PLIST                         |  5 ++
 stable-diffusion.cpp/distinfo                      | 15 ++++++
 .../patches/patch-ggml_CMakeLists.txt              | 31 +++++++++++++
 6 files changed, 109 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index 294042ee9a..0128310ce8 100644
--- a/Makefile
+++ b/Makefile
@@ -5546,6 +5546,7 @@ SUBDIR+=	ssid
 SUBDIR+=	ssiv-git
 SUBDIR+=	ssu
 SUBDIR+=	st-term-git
+SUBDIR+=	stable-diffusion.cpp
 SUBDIR+=	stackdriver-collectd
 SUBDIR+=	stacks
 SUBDIR+=	stalwart
diff --git a/stable-diffusion.cpp/DESCR b/stable-diffusion.cpp/DESCR
new file mode 100644
index 0000000000..47bfa48bfa
--- /dev/null
+++ b/stable-diffusion.cpp/DESCR
@@ -0,0 +1,3 @@
+Diffusion model (SD, Flux, Wan, ...) inference in pure C/C++
+
+This supports LLMs for creating pictures and videos.
diff --git a/stable-diffusion.cpp/Makefile b/stable-diffusion.cpp/Makefile
new file mode 100644
index 0000000000..3e3de9e627
--- /dev/null
+++ b/stable-diffusion.cpp/Makefile
@@ -0,0 +1,54 @@
+# $NetBSD$
+
+DISTNAME=	master-709-92a3b73
+PKGNAME=	${GITHUB_PROJECT}-${DISTNAME:S/master-//:C/-[0-9a-z]*$//}
+CATEGORIES=	devel graphics
+MASTER_SITES=	${MASTER_SITE_GITHUB:=leejet/}
+GITHUB_PROJECT=	stable-diffusion.cpp
+GITHUB_TAG=	master-709-92a3b73
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	https://github.com/leejet/stable-diffusion.cpp/
+COMMENT=	Diffusion model inference in pure C/C++
+LICENSE=	mit
+
+WRKSRC=		${WRKDIR}/${GITHUB_PROJECT}-${DISTNAME}
+USE_LANGUAGES=	c c++
+USE_TOOLS+=	pkg-config
+
+CMAKE_CONFIGURE_ARGS+=	-DSD_USE_SYSTEM_WEBP=ON
+CMAKE_CONFIGURE_ARGS+=	-DGGML_BLAS=ON
+CMAKE_CONFIGURE_ARGS+=	-DGGML_BLAS_VENDOR=OpenBLAS
+CMAKE_CONFIGURE_ARGS+=	-DBLAS_LIBRARIES=${CBLAS_LIBS:Q}
+# the libwebm source code provides neither .pc nor .cmake files for auto-detection
+# so we need to use the git submodule
+#CMAKE_CONFIGURE_ARGS+=	-DSD_USE_SYSTEM_WEBM=ON
+#CMAKE_CONFIGURE_ARGS+=	-DWEBM_INCLUDE_DIR=${BUILDLINK_PREFIX.libwebm}/include
+#CMAKE_CONFIGURE_ARGS+=	-DWEBM_LIBRARY=${BUILDLINK_PREFIX.libwebm}/lib/libwebm.so
+
+BLAS_INDEX64=		yes
+BLAS_ACCEPTED=		openblas_pthread #openblas_openmp
+BLAS_C_INTERFACE=	yes
+
+SUBST_CLASSES+=		findblas
+SUBST_STAGE.findblas=	pre-configure
+SUBST_MESSAGE.findblas=	Fixing libpci soname
+SUBST_FILES.findblas+=	ggml/src/ggml-blas/CMakeLists.txt
+SUBST_SED.findblas+=	-e 's,DepBLAS openblas64,DepBLAS ${BLAS_PC},'
+
+# upstream always uses the latest commit; for pkgsrc use git head
+# commits as of packaging date, update them when updating this package
+GITHUB_SUBMODULES+=	leejet ggml 3af5f5760e19a96427f5f7a93b79cbdf3d4b265b ggml
+GITHUB_SUBMODULES+=	leejet sdcpp-webui c4bce3d6b3f236614cca21014f076083b7270ba8 examples/server/frontend
+GITHUB_SUBMODULES+=	webmproject libwebm 6184f4484a826724b5293837134ab9492261b941 thirdparty/libwebm
+
+# didn't find the proper place in CMakeLists.txt to disable installing this library
+post-install:
+	${RM} ${DESTDIR}${PREFIX}/lib/libggml-blas.a
+	${RM} ${DESTDIR}${PREFIX}/lib/libggml-cpu.a
+
+.include "../../graphics/libwebp/buildlink3.mk"
+#.include "../../wip/libwebm/buildlink3.mk"
+.include "../../devel/cmake/build.mk"
+.include "../../mk/blas.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/stable-diffusion.cpp/PLIST b/stable-diffusion.cpp/PLIST
new file mode 100644
index 0000000000..2e18b6495c
--- /dev/null
+++ b/stable-diffusion.cpp/PLIST
@@ -0,0 +1,5 @@
+@comment $NetBSD$
+bin/sd-cli
+bin/sd-server
+include/stable-diffusion.h
+lib/libstable-diffusion.a
diff --git a/stable-diffusion.cpp/distinfo b/stable-diffusion.cpp/distinfo
new file mode 100644
index 0000000000..c8d51cbc31
--- /dev/null
+++ b/stable-diffusion.cpp/distinfo
@@ -0,0 +1,15 @@
+$NetBSD$
+
+BLAKE2s (leejet-ggml-3af5f5760e19a96427f5f7a93b79cbdf3d4b265b.tar.gz) = fe6bb6af031acfb504044ea591d75adbe394c438d1b3d83ac2a39596c68be55f
+SHA512 (leejet-ggml-3af5f5760e19a96427f5f7a93b79cbdf3d4b265b.tar.gz) = f12f7e91dc473775d4ed55756580ec4b8f9b65e88b2b35cbb5728367974618eb8cb6afa2e7a8ea2341d1857e9ed0a691964865aff5a392437277618a39a4ce13
+Size (leejet-ggml-3af5f5760e19a96427f5f7a93b79cbdf3d4b265b.tar.gz) = 3167114 bytes
+BLAKE2s (leejet-sdcpp-webui-c4bce3d6b3f236614cca21014f076083b7270ba8.tar.gz) = cc3b7416fd27254dcf1cc86947194667af6855701cd356ecdbc8a18c60b75247
+SHA512 (leejet-sdcpp-webui-c4bce3d6b3f236614cca21014f076083b7270ba8.tar.gz) = 11a245bd2e0f700d21d17071261b6d105dc0c8b3338a94b953d2c0f2ee12fb1c0fd6d704b666af5728e3fa7d2611441a481b58fe96fa284cdcc9441718df37b9
+Size (leejet-sdcpp-webui-c4bce3d6b3f236614cca21014f076083b7270ba8.tar.gz) = 31280 bytes
+BLAKE2s (master-709-92a3b73.tar.gz) = 0f956a700e80a58df7bf519ec03c05edd8a733314d0fd97c5605cbb2f498ea13
+SHA512 (master-709-92a3b73.tar.gz) = 7ebbf4588c8c90e38e9d5d0a9201ebf01d4b668fc7b8957d58b0623836cddc14524928e0b7c525866ddec85f24ae7718c60b081590033a2015bd7639c7309288
+Size (master-709-92a3b73.tar.gz) = 107895122 bytes
+BLAKE2s (webmproject-libwebm-6184f4484a826724b5293837134ab9492261b941.tar.gz) = b2e8edec43ed3e29cbe9a440db93ec26503b476e8b5692d4474cd18d849c6ace
+SHA512 (webmproject-libwebm-6184f4484a826724b5293837134ab9492261b941.tar.gz) = 2a6f0537fe72803821fcef5652ae1558ab056fb3e5f5ca9ce7c218389cf5c06c514d7b3dfdcd86a8e0e9c88d47648ef47f13f197ded210d73750979b8123ad53
+Size (webmproject-libwebm-6184f4484a826724b5293837134ab9492261b941.tar.gz) = 502935 bytes
+SHA1 (patch-ggml_CMakeLists.txt) = 0d6e54711f56cb55ef4173c24034ef7e9856dfe7
diff --git a/stable-diffusion.cpp/patches/patch-ggml_CMakeLists.txt b/stable-diffusion.cpp/patches/patch-ggml_CMakeLists.txt
new file mode 100644
index 0000000000..c196d0b22f
--- /dev/null
+++ b/stable-diffusion.cpp/patches/patch-ggml_CMakeLists.txt
@@ -0,0 +1,31 @@
+$NetBSD$
+
+Do not install ggml library, it's linked statically anyway.
+Avoids problems with other ggml users like llama.cpp or whisper.cpp
+
+--- ggml/CMakeLists.txt.orig	2026-06-19 14:42:33.777397117 +0000
++++ ggml/CMakeLists.txt
+@@ -344,8 +344,8 @@ set_target_properties(ggml PROPERTIES PUBLIC_HEADER "$
+ #if (GGML_METAL)
+ #    set_target_properties(ggml PROPERTIES RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/src/ggml-metal.metal")
+ #endif()
+-install(TARGETS ggml LIBRARY PUBLIC_HEADER)
+-install(TARGETS ggml-base LIBRARY)
++#install(TARGETS ggml LIBRARY PUBLIC_HEADER)
++#install(TARGETS ggml-base LIBRARY)
+ 
+ if (GGML_STANDALONE)
+     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ggml.pc.in
+@@ -413,9 +413,9 @@ message(STATUS "ggml commit:  ${GGML_BUILD_COMMIT}")
+ message(STATUS "ggml version: ${GGML_INSTALL_VERSION}")
+ message(STATUS "ggml commit:  ${GGML_BUILD_COMMIT}")
+ 
+-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ggml-config.cmake
+-              ${CMAKE_CURRENT_BINARY_DIR}/ggml-version.cmake
+-        DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ggml)
++#install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ggml-config.cmake
++#              ${CMAKE_CURRENT_BINARY_DIR}/ggml-version.cmake
++#        DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ggml)
+ 
+ if (MSVC)
+     set(MSVC_WARNING_FLAGS


Home | Main Index | Thread Index | Old Index