cad/py-amaranth: New port: Amaranth hardware definition language

This commit is contained in:
Yuri Victorovich 2023-07-28 00:44:49 -07:00
parent adb5a7c4bd
commit 9c44a991eb
5 changed files with 112 additions and 0 deletions

View file

@ -103,6 +103,7 @@
SUBDIR += pcb
SUBDIR += pcb-rnd
SUBDIR += pdnmesh
SUBDIR += py-amaranth
SUBDIR += py-cadquery
SUBDIR += py-cocotb
SUBDIR += py-cq-editor

59
cad/py-amaranth/Makefile Normal file
View file

@ -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>

3
cad/py-amaranth/distinfo Normal file
View file

@ -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

View file

@ -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

12
cad/py-amaranth/pkg-descr Normal file
View file

@ -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.