summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f151c5607b46eaf80bb85c7e51e932586a6d90d6 (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
75
76
77
78
79
80
# Maintainer: Andreas Wendleder <gonsolo@gmail.com>
pkgname=python-librelane
pkgver=3.0.0.dev50.r1.gb1ef9cb
pkgrel=1
pkgdesc="An infrastructure for implementing chip design flows (successor to OpenLane)."
arch=('any')
url="https://github.com/librelane/librelane"
license=('Apache-2.0')

depends=(
    'abc'
    'klayout'
    'python'
    'python-ciel'
    'python-cloup'
    'python-deprecated'
    'python-httpx'
    'python-libparse'
    'python-lxml'
    'python-psutil'
    'python-pyyaml'
    'python-rapidfuzz'
    'python-rich'
    'python-semver'
    'python-yamlcore'
    'tk'
    'yosys'
)

makedepends=(
    'git'
    'python-setuptools'
    'python-setuptools-scm'
    'python-pip'
    'python-build'
    'python-installer'
    'python-wheel'
)

provides=("python-librelane-git")
conflicts=("python-librelane-git")

source=("librelane::git+https://github.com/librelane/librelane.git#branch=dev")
sha256sums=('SKIP')

pkgver() {
    cd "$srcdir/librelane"
    git describe --long --tags --abbrev=7 | sed 's/^v//;s/\([^-]*-\)g/r\1g/;s/-/./g'
}

build() {
    cd "$srcdir/librelane"
    export SETUPTOOLS_SCM_PRETEND_VERSION=$(git describe --long --tags --abbrev=7 | sed 's/^v//;s/-/+/')
    python -m build --wheel --no-isolation
}

package() {
    cd "$srcdir/librelane"

    local _wheel=$(ls dist/*.whl)
    python -m installer --destdir="$pkgdir" "$_wheel"

    # Fix for Yosys synthesis pathing
    install -d "$pkgdir/usr/bin"
    ln -sf abc "$pkgdir/usr/bin/yosys-abc"

    # Clean up Python artifacts
    local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
    PYTHON_SITE_PACKAGES="${pkgdir}${site_packages}"

    if [ -d "$PYTHON_SITE_PACKAGES" ]; then
        find "$PYTHON_SITE_PACKAGES" -name "__pycache__" -type d -exec rm -rf {} +
        find "$PYTHON_SITE_PACKAGES" -name "direct_url.json" -delete
    fi

    # Install the license file - using the new pkgname variable
    install -Dm644 License -t "$pkgdir/usr/share/licenses/$pkgname/"

    chmod -R g-w "$pkgdir"
}