View | Details | Raw Unified | Return to bug 256427 | Differences between
and this patch

Collapse All | Expand All

(-)b/finance/py-chiapos/Makefile (+55 lines)
Added Link Here
1
# $FreeBSD$
2
3
PORTNAME=	chiapos
4
DISTVERSION=	1.0.3
5
CATEGORIES=	finance python
6
MASTER_SITES=	CHEESESHOP
7
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
8
DISTFILES=	${DISTNAME}${EXTRACT_SUFX}
9
10
MAINTAINER=	risner@stdio.com
11
COMMENT=	Chia proof of space plotting, proving, and verifying (wraps C++)
12
13
LICENSE=	APACHE20 BSD2CLAUSE MIT
14
LICENSE_COMB=	multi
15
LICENSE_FILE_APACHE20=	${WRKSRC}/LICENSE
16
LICENSE_FILE_BSD2CLAUSE=	${WRKSRC}/lib/FiniteStateEntropy/LICENSE
17
LICENSE_FILE_MIT=	${WRKSRC}/MIT-LICENSES
18
LICENSE_DISTFILES_APACHE20=	${DISTNAME}${EXTRACT_SUFX}
19
LICENSE_DISTFILES_BSD2CLAUSE=	${DISTNAME}${EXTRACT_SUFX}
20
LICENSE_DISTFILES_MIT=		${DISTNAME}${EXTRACT_SUFX} ${DISTFILE_c} \
21
				${DISTFILE_g}
22
23
BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}setuptools_scm>=3.5.0:devel/py-setuptools_scm@${PY_FLAVOR} \
24
		${PYTHON_SITELIBDIR}/pybind11:devel/py-pybind11@${PY_FLAVOR}
25
TEST_DEPENDS=	mypy:devel/py-mypy@${PY_FLAVOR} \
26
		flake8:devel/py-flake8@${PY_FLAVOR} \
27
		py.test:devel/py-pytest@${PY_FLAVOR}
28
29
USES=		python:3.7+
30
USE_GITHUB=	nodefault
31
GH_TUPLE=	jarro2783:cxxopts:302302b30839505703d37fb82f536c53cf9172fa:c/src-ext/cxxopts \
32
		gulrak:filesystem:4e21ab305794f5309a1454b4ae82ab9a0f5e0d25:g/src-ext/gulrak
33
USE_PYTHON=	autoplist concurrent distutils
34
35
PYDISTUTILS_INSTALLARGS+=	--skip-build
36
37
post-extract:
38
# Remove extraneous unused files to prevent confusion
39
	@${RM} ${WRKSRC}/lib/FiniteStateEntropy/fetch-content-CMakeLists.txt
40
	@${RM} ${WRKSRC}/pyproject.toml
41
# Concatenate the MIT licenses
42
	@( ${ECHO_MSG} "uint128_t license:"; \
43
		${CAT} ${WRKSRC}/uint128_t/LICENSE; \
44
		${ECHO_MSG} ""; ${ECHO_MSG} ""; \
45
		${ECHO_MSG} "cxxopts license:"; \
46
		${CAT} ${WRKSRC}/src-ext/cxxopts/LICENSE; \
47
		${ECHO_MSG} ""; ${ECHO_MSG} ""; \
48
		${ECHO_MSG} "gulrak license:"; \
49
		${CAT} ${WRKSRC}/src-ext/gulrak/LICENSE ) \
50
			> ${WRKSRC}/MIT-LICENSES
51
52
do-test: stage
53
	@(cd ${WRKSRC}; ${LOCALBASE}/bin/py.test ./tests -s -v)
54
55
.include <bsd.port.mk>
(-)b/finance/py-chiapos/distinfo (+7 lines)
Added Link Here
1
TIMESTAMP = 1623067298
2
SHA256 (chiapos-1.0.3.tar.gz) = d987b481a3acbff1e0d77eb713af8d99ecec2bd11c2c465528a5078a433686bd
3
SIZE (chiapos-1.0.3.tar.gz) = 1291513
4
SHA256 (jarro2783-cxxopts-302302b30839505703d37fb82f536c53cf9172fa_GH0.tar.gz) = 74e21646f3278243c9466665794d45410e63453ab7f3652acdae1d62efc4b21d
5
SIZE (jarro2783-cxxopts-302302b30839505703d37fb82f536c53cf9172fa_GH0.tar.gz) = 89640
6
SHA256 (gulrak-filesystem-4e21ab305794f5309a1454b4ae82ab9a0f5e0d25_GH0.tar.gz) = fef3e809d584b77fd3ec677bd0d40cbe6737bbb3dbb1570fe1b2025262ea82c2
7
SIZE (gulrak-filesystem-4e21ab305794f5309a1454b4ae82ab9a0f5e0d25_GH0.tar.gz) = 175696
(-)b/finance/py-chiapos/files/patch-CMakeLists.txt (+94 lines)
Added Link Here
1
--- CMakeLists.txt.orig	2021-05-28 02:40:44 UTC
2
+++ CMakeLists.txt
3
@@ -14,29 +14,8 @@ endif()
4
 project(chiapos C CXX ASM)
5
 
6
 # CMake 3.14+
7
-include(FetchContent)
8
+include(${CMAKE_INSTALL_PREFIX}/share/cmake/pybind11/pybind11Config.cmake)
9
 
10
-FetchContent_Declare(
11
-  pybind11-src
12
-  GIT_REPOSITORY https://github.com/pybind/pybind11.git
13
-  GIT_TAG        v2.6.2
14
-)
15
-FetchContent_MakeAvailable(pybind11-src)
16
-
17
-FetchContent_Declare(
18
-  cxxopts
19
-  GIT_REPOSITORY https://github.com/jarro2783/cxxopts.git
20
-  GIT_TAG        v2.2.1
21
-)
22
-FetchContent_MakeAvailable(cxxopts)
23
-
24
-FetchContent_Declare(
25
-  gulrak
26
-  GIT_REPOSITORY https://github.com/gulrak/filesystem.git
27
-  GIT_TAG        v1.5.6
28
-)
29
-FetchContent_MakeAvailable(gulrak)
30
-
31
 set(FSE_LIB ${CMAKE_CURRENT_SOURCE_DIR}/lib/FiniteStateEntropy/lib)
32
 set(FSE_FILES
33
     ${FSE_LIB}/fse_compress.c
34
@@ -48,8 +27,8 @@ set(FSE_FILES
35
 include_directories(
36
   ${INCLUDE_DIRECTORIES}
37
   ${CMAKE_CURRENT_SOURCE_DIR}/../lib/include
38
-  ${cxxopts_SOURCE_DIR}/include
39
-  ${gulrak_SOURCE_DIR}/include/ghc
40
+  ${CMAKE_CURRENT_SOURCE_DIR}/src-ext/cxxopts/include
41
+  ${CMAKE_CURRENT_SOURCE_DIR}/src-ext/gulrak/include/ghc
42
   ${CMAKE_CURRENT_SOURCE_DIR}/../lib/FiniteStateEntropy/lib
43
   ${CMAKE_CURRENT_SOURCE_DIR}/src
44
   ${CMAKE_CURRENT_SOURCE_DIR}/test
45
@@ -132,19 +111,6 @@ ENDIF()
46
 
47
 pybind11_add_module(chiapos ${CMAKE_CURRENT_SOURCE_DIR}/python-bindings/chiapos.cpp src/chacha8.c ${BLAKE3_SRC})
48
 
49
-add_executable(ProofOfSpace
50
-    src/cli.cpp
51
-    src/chacha8.c
52
-    ${BLAKE3_SRC}
53
-)
54
-
55
-add_executable(RunTests
56
-    tests/test-main.cpp
57
-    tests/test.cpp
58
-    src/chacha8.c
59
-    ${BLAKE3_SRC}
60
-)
61
-
62
 find_package(Threads REQUIRED)
63
 
64
 add_library(uint128 STATIC uint128_t/uint128_t.cpp)
65
@@ -152,29 +118,15 @@ target_include_directories(uint128 PUBLIC uint128_t)
66
 
67
 target_compile_features(fse PUBLIC cxx_std_17)
68
 target_compile_features(chiapos PUBLIC cxx_std_17)
69
-target_compile_features(RunTests PUBLIC cxx_std_17)
70
 
71
 if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
72
   target_link_libraries(chiapos PRIVATE fse Threads::Threads)
73
-  target_link_libraries(ProofOfSpace fse Threads::Threads)
74
-  target_link_libraries(RunTests fse Threads::Threads)
75
 elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
76
   target_link_libraries(chiapos PRIVATE fse Threads::Threads)
77
-  target_link_libraries(ProofOfSpace fse Threads::Threads)
78
-  target_link_libraries(RunTests fse Threads::Threads)
79
 elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
80
   target_link_libraries(chiapos PRIVATE fse Threads::Threads)
81
-  target_link_libraries(ProofOfSpace fse Threads::Threads)
82
-  target_link_libraries(RunTests fse Threads::Threads)
83
 elseif (MSVC)
84
   target_link_libraries(chiapos PRIVATE fse Threads::Threads uint128)
85
-  target_link_libraries(ProofOfSpace fse Threads::Threads uint128)
86
-  target_link_libraries(RunTests fse Threads::Threads uint128)
87
 else()
88
   target_link_libraries(chiapos PRIVATE fse stdc++fs Threads::Threads)
89
-  target_link_libraries(ProofOfSpace fse stdc++fs Threads::Threads)
90
-  target_link_libraries(RunTests fse stdc++fs Threads::Threads)
91
 endif()
92
-
93
-enable_testing()
94
-add_test(NAME RunTests COMMAND RunTests)
(-)b/finance/py-chiapos/files/patch-setup.py (+95 lines)
Added Link Here
1
--- setup.py.orig	2021-05-28 02:40:44 UTC
2
+++ setup.py
3
@@ -6,6 +6,11 @@ import platform
4
 import subprocess
5
 
6
 from setuptools import setup, setuptools, Extension
7
+if platform.machine() == "amd64":
8
+    # Patch the unix compiler to accept ASM
9
+    from distutils.unixccompiler import UnixCCompiler
10
+    UnixCCompiler.src_extensions.append('.S')
11
+    del UnixCCompiler
12
 from setuptools.command.build_ext import build_ext
13
 from distutils.version import LooseVersion
14
 
15
@@ -87,24 +92,34 @@ class get_pybind_include(object):
16
 
17
         return pybind11.get_include(self.user)
18
 
19
+fse = ('fse', {'sources': [
20
+    "lib/FiniteStateEntropy/lib/entropy_common.c",
21
+    "lib/FiniteStateEntropy/lib/fse_compress.c",
22
+    "lib/FiniteStateEntropy/lib/fse_decompress.c",
23
+    "lib/FiniteStateEntropy/lib/hist.c"]})
24
 
25
+if platform.machine() == "amd64":
26
+    blake = ('blake', {'sources': [
27
+	"src/b3/blake3.c",
28
+	"src/b3/blake3_portable.c",
29
+	"src/b3/blake3_dispatch.c",
30
+        "src/b3/blake3_avx2_x86-64_unix.S",
31
+        "src/b3/blake3_avx512_x86-64_unix.S",
32
+        "src/b3/blake3_sse41_x86-64_unix.S"]})
33
+else:
34
+    blake = ('blake', {'sources': [
35
+	"src/b3/blake3.c",
36
+	"src/b3/blake3_portable.c",
37
+	"src/b3/blake3_dispatch.c"]})
38
+
39
+chacha = ('chacha', {'sources': ["src/chacha8.c"]})
40
+
41
 ext_modules = [
42
     Extension(
43
         "chiapos",
44
         [
45
-            "lib/FiniteStateEntropy/lib/entropy_common.c",
46
-            "lib/FiniteStateEntropy/lib/fse_compress.c",
47
-            "lib/FiniteStateEntropy/lib/fse_decompress.c",
48
-            "lib/FiniteStateEntropy/lib/hist.c",
49
             "python-bindings/chiapos.cpp",
50
             "uint128_t/uint128_t.cpp",
51
-            "src/b3/blake3.c",
52
-            "src/b3/blake3_portable.c",
53
-            "src/b3/blake3_dispatch.c",
54
-            "src/b3/blake3_avx2.c",
55
-            "src/b3/blake3_avx512.c",
56
-            "src/b3/blake3_sse41.c",
57
-            "src/chacha8.c",
58
         ],
59
         include_dirs=[
60
             # Path to pybind11 headers
61
@@ -161,6 +176,12 @@ class BuildExt(build_ext):
62
         "unix": [""],
63
     }
64
 
65
+    if "WITH_DEBUG" in os.environ:
66
+        c_opts["unix"] += ["-g"]
67
+        l_opts["unix"] += ["-g"]
68
+    else:
69
+        l_opts["unix"] += ["-s"]
70
+
71
     if sys.platform == "darwin":
72
         darwin_opts = ["-stdlib=libc++", "-mmacosx-version-min=10.14"]
73
         c_opts["unix"] += darwin_opts
74
@@ -202,6 +223,7 @@ if platform.system() == "Windows":
75
 else:
76
     setup(
77
         name="chiapos",
78
+        version="1.0.3",
79
         author="Mariano Sorgente",
80
         author_email="mariano@chia.net",
81
         description="Chia proof of space plotting, proving, and verifying (wraps C++)",
82
@@ -209,8 +231,10 @@ else:
83
         python_requires=">=3.7",
84
         long_description=open("README.md").read(),
85
         long_description_content_type="text/markdown",
86
-        url="https://github.com/Chia-Network/chiavdf",
87
-        ext_modules=[CMakeExtension("chiapos", ".")],
88
-        cmdclass=dict(build_ext=CMakeBuild),
89
+        url="https://github.com/Chia-Network/chiapos",
90
+        scripts=['tools/parse_disk.py'],
91
+        libraries=[fse, blake, chacha],
92
+        ext_modules=ext_modules,
93
+        cmdclass={"build_ext": BuildExt},
94
         zip_safe=False,
95
     )
(-)b/finance/py-chiapos/pkg-descr (+10 lines)
Added Link Here
1
Chia's proof of space is written in C++. Includes a plotter, prover, and
2
verifier. It exclusively runs on 64 bit architectures. Read the Proof of
3
Space document to learn about what proof of space is and how it works.
4
5
Notes:
6
i386 is not supported, and would be too slow for practical use if supported.
7
8
This port is for the Python module (library).
9
10
WWW: https://github.com/Chia-Network/chiapos

Return to bug 256427