git: df7cb4adce8d - main - finance/chiapos: New port Chia proof of space

Adriaan de Groot adridg at FreeBSD.org
Sun Oct 3 20:43:58 UTC 2021


The branch main has been updated by adridg:

URL: https://cgit.FreeBSD.org/ports/commit/?id=df7cb4adce8d56adad5a334ad3821b1259dd29da

commit df7cb4adce8d56adad5a334ad3821b1259dd29da
Author:     Adriaan de Groot <adridg at FreeBSD.org>
AuthorDate: 2021-10-03 20:39:03 +0000
Commit:     Adriaan de Groot <adridg at FreeBSD.org>
CommitDate: 2021-10-03 20:43:55 +0000

    finance/chiapos: New port Chia proof of space
    
    Patch from the PR applied basically unchanged, except
    I cleaned up for current standards and added NOT_FOR_ARCHS
    to avoid i386 altogether (where the port won't work).
    
    PR:             256509
    Obtained from:  risner at stdio.com (maintainer)
---
 finance/Makefile                           |  1 +
 finance/chiapos/Makefile                   | 52 +++++++++++++++++
 finance/chiapos/distinfo                   |  7 +++
 finance/chiapos/files/Hellman-Makefile     | 14 +++++
 finance/chiapos/files/patch-CMakeLists.txt | 89 ++++++++++++++++++++++++++++++
 finance/chiapos/files/patch-setup.py       | 30 ++++++++++
 finance/chiapos/pkg-descr                  | 10 ++++
 7 files changed, 203 insertions(+)

diff --git a/finance/Makefile b/finance/Makefile
index be57d20aafca..963b62995e9c 100644
--- a/finance/Makefile
+++ b/finance/Makefile
@@ -21,6 +21,7 @@
     SUBDIR += aqbanking
     SUBDIR += beancount
     SUBDIR += beanie
+    SUBDIR += chiapos
     SUBDIR += cointop
     SUBDIR += electrum
     SUBDIR += expense
diff --git a/finance/chiapos/Makefile b/finance/chiapos/Makefile
new file mode 100644
index 000000000000..fb99ea712873
--- /dev/null
+++ b/finance/chiapos/Makefile
@@ -0,0 +1,52 @@
+PORTNAME=	chiapos
+DISTVERSION=	1.0.3
+CATEGORIES=	finance
+MASTER_SITES=	CHEESESHOP
+DISTFILES=	${DISTNAME}${EXTRACT_SUFX}
+
+MAINTAINER=	risner at stdio.com
+COMMENT=	Chia proof of space plotting, proving, and verifying (cmake part)
+
+LICENSE=	APACHE20 BSD2CLAUSE MIT
+LICENSE_COMB=	multi
+LICENSE_FILE_APACHE20=	${WRKSRC}/LICENSE
+LICENSE_FILE_BSD2CLAUSE=	${WRKSRC}/lib/FiniteStateEntropy/LICENSE
+LICENSE_FILE_MIT=	${WRKSRC}/MIT-LICENSES
+LICENSE_DISTFILES_APACHE20=	${DISTNAME}${EXTRACT_SUFX}
+LICENSE_DISTFILES_BSD2CLAUSE=	${DISTNAME}${EXTRACT_SUFX}
+LICENSE_DISTFILES_MIT=		${DISTNAME}${EXTRACT_SUFX} ${DISTFILE_c} \
+				${DISTFILE_g}
+
+NOT_FOR_ARCHS=	i386
+
+USES=		cmake:noninja
+USE_GITHUB=	nodefault
+GH_TUPLE=	jarro2783:cxxopts:302302b30839505703d37fb82f536c53cf9172fa:c/src-ext/cxxopts \
+		gulrak:filesystem:4e21ab305794f5309a1454b4ae82ab9a0f5e0d25:g/src-ext/gulrak
+CMAKE_ARGS+=	-DCOMPILER_CXXFLAGS="${CXXFLAGS}" \
+		-DCOMPILER_FLAGS="${CFLAGS}"
+PLIST_FILES=	bin/ProofOfSpace \
+		bin/RunTests
+
+post-extract:
+# This example is experimental, currently broken (upstream) and unnecessary.
+# The placeholder Makefile is for when/if they release a future fixed version.
+	@${CP} ${FILESDIR}/Hellman-Makefile ${WRKSRC}/hellman_example/Makefile
+# Remove extraneous unused files to prevent confusion
+	@${RM} ${WRKSRC}/lib/FiniteStateEntropy/fetch-content-CMakeLists.txt
+	@${RM} ${WRKSRC}/pyproject.toml
+# Concatenate the MIT licenses
+	@( ${ECHO_MSG} "uint128_t license:"; \
+		${CAT} ${WRKSRC}/uint128_t/LICENSE; \
+		${ECHO_MSG} ""; ${ECHO_MSG} ""; \
+		${ECHO_MSG} "cxxopts license:"; \
+		${CAT} ${WRKSRC}/src-ext/cxxopts/LICENSE; \
+		${ECHO_MSG} ""; ${ECHO_MSG} ""; \
+		${ECHO_MSG} "gulrak license:"; \
+		${CAT} ${WRKSRC}/src-ext/gulrak/LICENSE ) \
+			> ${WRKSRC}/MIT-LICENSES
+
+do-test: stage
+	${WRKDIR}/.build/RunTests
+
+.include <bsd.port.mk>
diff --git a/finance/chiapos/distinfo b/finance/chiapos/distinfo
new file mode 100644
index 000000000000..004b2ba0e031
--- /dev/null
+++ b/finance/chiapos/distinfo
@@ -0,0 +1,7 @@
+TIMESTAMP = 1623067298
+SHA256 (chiapos-1.0.3.tar.gz) = d987b481a3acbff1e0d77eb713af8d99ecec2bd11c2c465528a5078a433686bd
+SIZE (chiapos-1.0.3.tar.gz) = 1291513
+SHA256 (jarro2783-cxxopts-302302b30839505703d37fb82f536c53cf9172fa_GH0.tar.gz) = 74e21646f3278243c9466665794d45410e63453ab7f3652acdae1d62efc4b21d
+SIZE (jarro2783-cxxopts-302302b30839505703d37fb82f536c53cf9172fa_GH0.tar.gz) = 89640
+SHA256 (gulrak-filesystem-4e21ab305794f5309a1454b4ae82ab9a0f5e0d25_GH0.tar.gz) = fef3e809d584b77fd3ec677bd0d40cbe6737bbb3dbb1570fe1b2025262ea82c2
+SIZE (gulrak-filesystem-4e21ab305794f5309a1454b4ae82ab9a0f5e0d25_GH0.tar.gz) = 175696
diff --git a/finance/chiapos/files/Hellman-Makefile b/finance/chiapos/files/Hellman-Makefile
new file mode 100644
index 000000000000..e44416fad87f
--- /dev/null
+++ b/finance/chiapos/files/Hellman-Makefile
@@ -0,0 +1,14 @@
+all: HellmanAttacks
+
+OBJ = aes.o bits.o calculate_bucket.o cxxopts.o encoding.o hellman.o picosha2.o plotter_disk.o pos_constants.o prover_disk.o sort_on_disk.o util.o verifier.o
+
+.SUFFIXES:.hpp .o
+
+.hpp.o:
+	$(CC) -c $(CXXFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
+
+HellmanAttacks: ${OBJ}
+	${CC} -o HellmanAttacks ${OBJ}
+
+clean:
+	rm -f HellmanAttacks ${OBJ}
diff --git a/finance/chiapos/files/patch-CMakeLists.txt b/finance/chiapos/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..a81293d75db6
--- /dev/null
+++ b/finance/chiapos/files/patch-CMakeLists.txt
@@ -0,0 +1,89 @@
+--- CMakeLists.txt.orig	2021-05-28 02:40:44 UTC
++++ CMakeLists.txt
+@@ -14,29 +14,7 @@ endif()
+ project(chiapos C CXX ASM)
+ 
+ # CMake 3.14+
+-include(FetchContent)
+ 
+-FetchContent_Declare(
+-  pybind11-src
+-  GIT_REPOSITORY https://github.com/pybind/pybind11.git
+-  GIT_TAG        v2.6.2
+-)
+-FetchContent_MakeAvailable(pybind11-src)
+-
+-FetchContent_Declare(
+-  cxxopts
+-  GIT_REPOSITORY https://github.com/jarro2783/cxxopts.git
+-  GIT_TAG        v2.2.1
+-)
+-FetchContent_MakeAvailable(cxxopts)
+-
+-FetchContent_Declare(
+-  gulrak
+-  GIT_REPOSITORY https://github.com/gulrak/filesystem.git
+-  GIT_TAG        v1.5.6
+-)
+-FetchContent_MakeAvailable(gulrak)
+-
+ set(FSE_LIB ${CMAKE_CURRENT_SOURCE_DIR}/lib/FiniteStateEntropy/lib)
+ set(FSE_FILES
+     ${FSE_LIB}/fse_compress.c
+@@ -48,8 +26,8 @@ set(FSE_FILES
+ include_directories(
+   ${INCLUDE_DIRECTORIES}
+   ${CMAKE_CURRENT_SOURCE_DIR}/../lib/include
+-  ${cxxopts_SOURCE_DIR}/include
+-  ${gulrak_SOURCE_DIR}/include/ghc
++  ${CMAKE_CURRENT_SOURCE_DIR}/src-ext/cxxopts/include
++  ${CMAKE_CURRENT_SOURCE_DIR}/src-ext/gulrak/include/ghc
+   ${CMAKE_CURRENT_SOURCE_DIR}/../lib/FiniteStateEntropy/lib
+   ${CMAKE_CURRENT_SOURCE_DIR}/src
+   ${CMAKE_CURRENT_SOURCE_DIR}/test
+@@ -130,8 +108,6 @@ set(BLAKE3_SRC
+ )
+ ENDIF()
+ 
+-pybind11_add_module(chiapos ${CMAKE_CURRENT_SOURCE_DIR}/python-bindings/chiapos.cpp src/chacha8.c ${BLAKE3_SRC})
+-
+ add_executable(ProofOfSpace
+     src/cli.cpp
+     src/chacha8.c
+@@ -145,33 +121,30 @@ add_executable(RunTests
+     ${BLAKE3_SRC}
+ )
+ 
++install(TARGETS ProofOfSpace DESTINATION bin)
++install(TARGETS RunTests DESTINATION bin)
++
+ find_package(Threads REQUIRED)
+ 
+ add_library(uint128 STATIC uint128_t/uint128_t.cpp)
+ target_include_directories(uint128 PUBLIC uint128_t)
+ 
+ target_compile_features(fse PUBLIC cxx_std_17)
+-target_compile_features(chiapos PUBLIC cxx_std_17)
+ target_compile_features(RunTests PUBLIC cxx_std_17)
+ 
+ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+-  target_link_libraries(chiapos PRIVATE fse Threads::Threads)
+   target_link_libraries(ProofOfSpace fse Threads::Threads)
+   target_link_libraries(RunTests fse Threads::Threads)
+ elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
+-  target_link_libraries(chiapos PRIVATE fse Threads::Threads)
+   target_link_libraries(ProofOfSpace fse Threads::Threads)
+   target_link_libraries(RunTests fse Threads::Threads)
+ elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+-  target_link_libraries(chiapos PRIVATE fse Threads::Threads)
+   target_link_libraries(ProofOfSpace fse Threads::Threads)
+   target_link_libraries(RunTests fse Threads::Threads)
+ elseif (MSVC)
+-  target_link_libraries(chiapos PRIVATE fse Threads::Threads uint128)
+   target_link_libraries(ProofOfSpace fse Threads::Threads uint128)
+   target_link_libraries(RunTests fse Threads::Threads uint128)
+ else()
+-  target_link_libraries(chiapos PRIVATE fse stdc++fs Threads::Threads)
+   target_link_libraries(ProofOfSpace fse stdc++fs Threads::Threads)
+   target_link_libraries(RunTests fse stdc++fs Threads::Threads)
+ endif()
diff --git a/finance/chiapos/files/patch-setup.py b/finance/chiapos/files/patch-setup.py
new file mode 100644
index 000000000000..89dd1339a6b5
--- /dev/null
+++ b/finance/chiapos/files/patch-setup.py
@@ -0,0 +1,30 @@
+--- setup.py.orig	2021-05-28 02:40:44 UTC
++++ setup.py
+@@ -107,9 +100,6 @@ ext_modules = [
+             "src/chacha8.c",
+         ],
+         include_dirs=[
+-            # Path to pybind11 headers
+-            get_pybind_include(),
+-            get_pybind_include(user=True),
+             "src",
+             "uint128_t",
+             ".",
+@@ -202,6 +192,7 @@ if platform.system() == "Windows":
+ else:
+     setup(
+         name="chiapos",
++        version="1.0.3",
+         author="Mariano Sorgente",
+         author_email="mariano at chia.net",
+         description="Chia proof of space plotting, proving, and verifying (wraps C++)",
+@@ -209,8 +200,7 @@ else:
+         python_requires=">=3.7",
+         long_description=open("README.md").read(),
+         long_description_content_type="text/markdown",
+-        url="https://github.com/Chia-Network/chiavdf",
+-        ext_modules=[CMakeExtension("chiapos", ".")],
++        url="https://github.com/Chia-Network/chiapos",
+         cmdclass=dict(build_ext=CMakeBuild),
+         zip_safe=False,
+     )
diff --git a/finance/chiapos/pkg-descr b/finance/chiapos/pkg-descr
new file mode 100644
index 000000000000..d88a8323eb64
--- /dev/null
+++ b/finance/chiapos/pkg-descr
@@ -0,0 +1,10 @@
+Chia's proof of space is written in C++. Includes a plotter, prover, and
+verifier. It exclusively runs on 64 bit architectures. Read the Proof of
+Space document to learn about what proof of space is and how it works.
+
+Notes:
+i386 is not supported, and would be too slow for practical use if supported.
+
+This port is for the cmake build (binaries).
+
+WWW: https://github.com/Chia-Network/chiapos


More information about the dev-commits-ports-all mailing list