git: 9c44a991ebea - main - cad/py-amaranth: New port: Amaranth hardware definition language
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 28 Jul 2023 07:45:25 UTC
The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=9c44a991ebeafa6a7a936a1d4b2971bbff650cee commit 9c44a991ebeafa6a7a936a1d4b2971bbff650cee Author: Yuri Victorovich <yuri@FreeBSD.org> AuthorDate: 2023-07-28 07:44:49 +0000 Commit: Yuri Victorovich <yuri@FreeBSD.org> CommitDate: 2023-07-28 07:45:19 +0000 cad/py-amaranth: New port: Amaranth hardware definition language --- cad/Makefile | 1 + cad/py-amaranth/Makefile | 59 ++++++++++++++++++++++++++++++ cad/py-amaranth/distinfo | 3 ++ cad/py-amaranth/files/patch-pyproject.toml | 37 +++++++++++++++++++ cad/py-amaranth/pkg-descr | 12 ++++++ 5 files changed, 112 insertions(+) diff --git a/cad/Makefile b/cad/Makefile index 33ad61a3cdd6..bdb5c4d15857 100644 --- a/cad/Makefile +++ b/cad/Makefile @@ -103,6 +103,7 @@ SUBDIR += pcb SUBDIR += pcb-rnd SUBDIR += pdnmesh + SUBDIR += py-amaranth SUBDIR += py-cadquery SUBDIR += py-cocotb SUBDIR += py-cq-editor diff --git a/cad/py-amaranth/Makefile b/cad/py-amaranth/Makefile new file mode 100644 index 000000000000..5c7a2cdd8790 --- /dev/null +++ b/cad/py-amaranth/Makefile @@ -0,0 +1,59 @@ +PORTNAME= amaranth +DISTVERSIONPREFIX= v +DISTVERSION= 0.3-160 +DISTVERSIONSUFFIX= -gb952005 +CATEGORIES= cad python +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} + +MAINTAINER= yuri@FreeBSD.org +COMMENT= Amaranth hardware definition language +WWW= https://amaranth-lang.org/docs/amaranth/latest/ + +LICENSE= BSD3CLAUSE + +BUILD_DEPENDS= ${PY_SETUPTOOLS} \ + ${PYTHON_PKGNAMEPREFIX}setuptools_scm>0:devel/py-setuptools_scm@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR} +RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}Jinja2>=3.0:devel/py-Jinja2@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}pyvcd>0:cad/py-pyvcd@${PY_FLAVOR} + +USES= python +USE_PYTHON= pep517 autoplist pytest + +USE_GITHUB= yes +GH_ACCOUNT= amaranth-lang + +NO_ARCH= yes + +# workaround for https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272771 +PEP517_INSTALL_CMD= ${PYTHON_CMD} -m installer --destdir ${STAGEDIR} --prefix ${PREFIX} ${BUILD_WRKSRC}/dist/${PORTNAME:C|[-_]+|_|g}-${DISTVERSION:S/-/.post/}*.whl + +post-patch: + @${REINPLACE_CMD} \ + -e 's|from setuptools_scm.git import parse as parse_git|return "v${DISTVERSION}"|' \ + ${WRKSRC}/setup.py + @${REINPLACE_CMD} \ + -e 's|%%VERSION%%|${DISTVERSION}|' \ + ${WRKSRC}/pyproject.toml + +do-install: # workaround for https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272771 + @${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} + @cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PEP517_INSTALL_CMD} + @${PYTHON_CMD} -B ${PORTSDIR}/Mk/Scripts/strip_RECORD.py \ + ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/${PORTNAME:C|[-_]+|_|g}-${DISTVERSION:S/-/.post/}*.dist-info/RECORD >> ${_PYTHONPKGLIST} + @${REINPLACE_CMD} \ + -e '/\.pyc$$/d' \ + -e 's|^|${PYTHONPREFIX_SITELIBDIR}/|' \ + -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../etc/|etc/|' \ + -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../bin/|bin/|' \ + -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../include/|include/|' \ + -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../lib/|lib/|' \ + -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../libdata/|libdata/|' \ + -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../libexec/|libexec/|' \ + -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../man/|man/|' \ + -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../sbin/|sbin/|' \ + -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../share/|share/|' \ + ${_PYTHONPKGLIST} + @cd ${STAGEDIR}${PREFIX} && ${FIND} lib -name '*.pyc' >> ${_PYTHONPKGLIST} + +.include <bsd.port.mk> diff --git a/cad/py-amaranth/distinfo b/cad/py-amaranth/distinfo new file mode 100644 index 000000000000..4bb3f520c209 --- /dev/null +++ b/cad/py-amaranth/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1690525544 +SHA256 (amaranth-lang-amaranth-v0.3-160-gb952005_GH0.tar.gz) = 8bdab7fbd10dc07d99a383316b2503dd00733b6dd99e787e0ffe4cb27f8eb112 +SIZE (amaranth-lang-amaranth-v0.3-160-gb952005_GH0.tar.gz) = 261933 diff --git a/cad/py-amaranth/files/patch-pyproject.toml b/cad/py-amaranth/files/patch-pyproject.toml new file mode 100644 index 000000000000..00ed445714f6 --- /dev/null +++ b/cad/py-amaranth/files/patch-pyproject.toml @@ -0,0 +1,37 @@ +--- pyproject.toml.orig 2023-07-27 13:04:20 UTC ++++ pyproject.toml +@@ -1,12 +1,13 @@ + # Project metadata + + [project] +-dynamic = ["version", "urls"] ++dynamic = ["urls"] + + name = "amaranth" + description = "Amaranth hardware definition language" + authors = [{name = "Amaranth HDL contributors"}] + license = {file = "LICENSE.txt"} ++version = "%%VERSION%%" + + requires-python = "~=3.8" + dependencies = [ +@@ -26,7 +27,7 @@ amaranth-rpc = "amaranth.rpc:main" + # Build system configuration + + [build-system] +-requires = ["wheel", "setuptools>=67.0", "setuptools_scm[toml]>=6.2"] ++requires = ["wheel", "setuptools>0", "setuptools_scm[toml]>=6.2"] + build-backend = "setuptools.build_meta" + + [tool.setuptools] +@@ -36,8 +37,8 @@ build-backend = "setuptools.build_meta" + # Add a workaround to improve experience for people upgrading from old checkouts. + packages = ["amaranth"] + +-[tool.setuptools_scm] +-local_scheme = "node-and-timestamp" ++#[tool.setuptools_scm] ++#local_scheme = "node-and-timestamp" + + # Development workflow configuration + diff --git a/cad/py-amaranth/pkg-descr b/cad/py-amaranth/pkg-descr new file mode 100644 index 000000000000..870e34a8dffc --- /dev/null +++ b/cad/py-amaranth/pkg-descr @@ -0,0 +1,12 @@ +The Amaranth project provides an open-source toolchain for developing hardware +based on synchronous digital logic using the Python programming language, as +well as evaluation board definitions, a System on Chip toolkit, and more. It +aims to be easy to learn and use, reduce or eliminate common coding mistakes, +and simplify the design of complex hardware with reusable components. + +The Amaranth toolchain consists of the Amaranth hardware definition language, +the standard library, the simulator, and the build system, covering all steps of +a typical FPGA development workflow. At the same time, it does not restrict the +designer's choice of tools: existing industry-standard (System)Verilog or VHDL +code can be integrated into an Amaranth-based design flow, or, conversely, +Amaranth code can be integrated into an existing Verilog-based design flow.