summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5cdd7cb095425964d012252961a93273d6054c83 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Maintainer: "Amhairghin" Oscar Garcia Amor (https://ogarcia.me)

pkgbase=rucio
pkgname=('rucio' 'rucio-daemon' 'rucio-cli' 'rucio-bootstrap')
pkgver=0.40.0
pkgrel=1
pkgdesc='Decentralized peer-to-peer file sharing over libp2p, with eMule/Kad2 compatibility'
arch=('x86_64' 'aarch64')
url='https://github.com/ogarcia/rucio'
license=('GPL-3.0-or-later')
makedepends=('cargo' 'git' 'rust' 'rust-wasm' 'trunk')
options=('!buildflags')
source=("${pkgbase}-${pkgver}::git+https://github.com/ogarcia/rucio.git#tag=${pkgver}"
        "${pkgbase}-system.service"
        "${pkgbase}-user.service"
        "${pkgbase}-bootstrap.service")
b2sums=('83367225f0db91bbb0a72cb8a14894209331ea934808711eb75ee6e31f30d3f205768d050ee3252ea4a2a94a4c4729a4dde1d6c74359ab6fb9d3e2d80823ad3b'
        '7906f2c641558dea0d6314b4609943b41e9a9bf5d64e83de688b95e2610074e298e9b87b1421729924807bf317277f87c8ebf2a39268bfaa75568fd34606296d'
        'a3c04268a6909af624a572331b021cf1d83621ea2156379739a9c851e54d672a2280a73784e53830163a9aa7a7e4bad7995fb3328d1c41fc509cabede342ccff'
        'e12e4f4f91b5bf50669a83ff570796350b19c1c321ba13f0138b8fcbbfb3a92a6a17e31f65c439c34219dc80ee4b7e284a25a7d73bcd0ee7085c3716d4163086')

prepare() {
  cd "${pkgbase}-${pkgver}"
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
  cd "$pkgbase-$pkgver"
  export CARGO_TARGET_DIR=target

  # Build the Leptos frontend first: the complete binary embeds it via rust-embed
  ( cd rucio-web && trunk build --release )

  # Complete client: fat binary with eMule + embedded web panel
  cargo build --frozen --release -p rucio --features emule-compat,web-ui

  # Server only: daemon with eMule support
  cargo build --frozen --release -p rucio-daemon --features emule-compat

  # Standalone CLI: no daemon, no web, no libp2p
  cargo build --frozen --release -p rucio-cli

  # Bootstrap server: DHT bootstrap node
  cargo build --frozen --release -p rucio-bootstrap --features indexer
}

package_rucio() {
  pkgdesc='Decentralized P2P file sharing - complete client (daemon + CLI + web panel + eMule)'
  depends=('gcc-libs')
  provides=('ruciod')
  conflicts=('rucio-daemon')

  cd "${pkgbase}-${pkgver}"

  # fat binary: `ruciod` runs the daemon, `rucio` runs the CLI
  install -Dm755 target/release/rucio "${pkgdir}/usr/bin/rucio"
  ln -s rucio "${pkgdir}/usr/bin/ruciod"

  # services
  install -D -m644 "${srcdir}/${pkgbase}-system.service" \
    "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
  install -D -m644 "${srcdir}/${pkgbase}-user.service" \
    "${pkgdir}/usr/lib/systemd/user/${pkgname}.service"

  install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
}

package_rucio-daemon() {
  pkgdesc='Decentralized P2P file sharing - stand alone daemon'
  optdepends=('nginx: serve via reverse-proxy')
  provides=('ruciod')
  conflicts=('rucio')

  cd "${pkgbase}-${pkgver}"

  # server only
  install -Dm755 target/release/ruciod "${pkgdir}/usr/bin/ruciod"

  # service
  install -D -m644 "${srcdir}/${pkgbase}-system.service" \
    "${pkgdir}/usr/lib/systemd/system/${pkgbase}.service"
}

package_rucio-cli() {
  pkgdesc='Decentralized P2P file sharing - standalone command-line client'
  depends=('gcc-libs')

  cd "${pkgbase}-${pkgver}"

  # lightweight client only
  install -Dm755 target/release/rucio-cli "${pkgdir}/usr/bin/rucio-cli"
}

package_rucio-bootstrap() {
  pkgdesc='Decentralized P2P file sharing - DHT bootstrap node'
  depends=('gcc-libs')

  cd "${pkgbase}-${pkgver}"

  # bootstrap server
  install -Dm755 target/release/rucio-bootstrap \
    "${pkgdir}/usr/bin/rucio-bootstrap"

  # service
  install -D -m644 "${srcdir}/${pkgbase}-bootstrap.service" \
    "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
}