summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8a7410793fbd7c806e7bb80c4be1502665220f1f (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
# Maintainer: MojArch

pkgname=git-credential-manager
pkgver=3.0.2
pkgrel=1
pkgdesc="A secure Git credential helper built on .NET"
arch=('x86_64')
url="https://github.com/git-ecosystem/git-credential-manager"
license=('MIT')
depends=('krb5' 'zlib' 'libsecret')
makedepends=('dotnet-sdk-10.0' 'clang' 'gcc' 'git' 'dpkg' 'fontconfig')
checkdepends=('git')
conflicts=(git-credential-manager-bin)
options=(!strip !debug)

source=(
    "${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz"
)
sha512sums=('f8fbdd5b9f00bdc0372458e8048428633754b1fa2f329a458c23e8863b89b8de7ddcd9a03fbfb966e2cdaf528fb2fe5a9e3f3817ec38fa004c36851a06ce432e')

build() {
    cd "${pkgname}-${pkgver}"

    export DOTNET_CLI_HOME="${srcdir}/.dotnet"
    export HOME="${srcdir}/.home"
    export DOTNET_NOLOGO=1
    export DOTNET_CLI_TELEMETRY_OPTOUT=1

    mkdir -p "$DOTNET_CLI_HOME" "$HOME"

    local rid='linux-x64'

    # Build the Linux distribution, not the solution.
    # This runs the upstream publish, package and archive steps.
    dotnet build build/linux \
        --configuration Release \
        --runtime "$rid" \
        -p:Version="$pkgver" \
        -p:NuGetAudit=false
}

package() {
    cd "${pkgname}-${pkgver}"

    local publish_dir="out/publish/git-credential-manager/release_linux-x64"

    if [[ ! -d "$publish_dir" ]]; then
        error "Published output directory not found: $publish_dir"
        error "Available publish directories:"
        find out/publish -maxdepth 3 -type d -print 2>/dev/null || true
        return 1
    fi

    if [[ ! -f "$publish_dir/git-credential-manager" ]]; then
        error "Expected executable not found in $publish_dir"
        find "$publish_dir" -maxdepth 2 -type f -print
        return 1
    fi

    install -d "$pkgdir/usr/lib/$pkgname"
    install -d "$pkgdir/usr/bin"
    install -d "$pkgdir/usr/share/licenses/$pkgname"

    # Install the complete published payload, including any required
    # companion files produced by the distribution build.
    cp -a "$publish_dir/." "$pkgdir/usr/lib/$pkgname/"

    chmod 755 "$pkgdir/usr/lib/$pkgname/git-credential-manager"

    ln -s "/usr/lib/$pkgname/git-credential-manager" \
        "$pkgdir/usr/bin/git-credential-manager"

    install -Dm644 LICENSE \
        "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}