summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3c41e96c5beef3d99a23082ede83b080168b6aa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Maintainer: Claudia Pellegrino <aur ät cpellegrino.de>
# Contributor: xiretza <xiretza+aur@xiretza.xyz>

_pkgname=amaranth
pkgname="python-$_pkgname-git"
pkgver=0.6.0.dev0.r72.g590cba1d
pkgrel=1
pkgdesc="A modern hardware definition language and toolchain based on Python (formerly nMigen)"
arch=(any)
url="https://github.com/amaranth-lang/amaranth"
license=('BSD-2-Clause')
depends=(
  'python'
  'python-jinja'
  'python-jschon'
  'python-pyvcd'
)
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-packaging'
  'python-pdm-backend'
  'python-pyproject-patcher'
  'python-setuptools-scm'
  'python-wheel'
)
optdepends=('python-paramiko: for remote builds')
checkdepends=('python-pytest' 'symbiyosys-git' 'yices' 'yosys>0.16')
provides=("python-nmigen=$pkgver" "python-$_pkgname=$pkgver")
conflicts=('python-nmigen' "python-$_pkgname")
replaces=('python-nmigen-git')
source=("git+$url.git")
sha256sums=('SKIP')

pkgver() {
  cd "$_pkgname"

  git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare()
{
  cd "$_pkgname"

  echo >&2 'Fixing package qualifier'
  sed -i -e "s/pdm\\.backend\\._vendor\\.//" pdm_build.py

  echo >&2 'Unpinning dependency version'
  export pkgver
  python << 'EOF'
from pyproject_patcher import patch_in_place
with patch_in_place('pyproject.toml') as toml:
    toml.strip_build_system_dependency_constraint('pdm-backend')
EOF
}

build() {
  cd "$_pkgname"
  python -m build --wheel --no-isolation
}

check() {
  cd "$_pkgname"
  PYTHONPATH=. pytest
}

package() {
  cd "$_pkgname"

  python -m installer --destdir="$pkgdir" dist/*.whl

  install -Dm 644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}