summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 58bd28e81b31c63b355e5de6ad889ace051d7b31 (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
# Maintainer: spiritomb <spiritomb@protonmail.com>
# Contributor: Chih-Hsuan Yen <yan12125@gmail.com>
# Contributor: YuutaW <i@yuuta.moe>

pkgname=rsshub-git
pkgver=r9177.93498412b
pkgrel=1
pkgdesc="Everything is RSSible"
# The built package bundles native Node.js extensions like OpenCC
arch=('x86_64')
url="https://rsshub.app/"
license=('MIT')
depends=('nodejs')
# rsshub uses yarn, and some deps (ex: re2) uses npm
makedepends=('npm' 'yarn' 'node-gyp' 'git')
optdepends=(
  'chromium: for routes using a headless browser'
)
backup=('etc/rsshub/rsshub.conf')
source=("$pkgname::git+https://github.com/DIYgod/RSSHub.git"
        "rsshub.conf"
        "rsshub.service"
        "rsshub_sysuser.conf"
        "rsshub_tmpfile.conf")
sha512sums=('SKIP'
            'f8f0e8195a05cc7cd43630a2ce3b28250279d3b4adbfa3693b57b23ea70013b9e5de8ab4905a6411152bdf0ab470d5873c11f6836fc281c8fd961f520a10f3b4'
            '7fdcbbec994bfbeab8a52f31786e1034f48f78ffcdc0de69ea23eda6bc377424be900922b87db06b834429fcaeeed4c9a2b3a3291ca4df4d1f9ad4b9fc421a17'
            '892a82aa32c0f486009eb2b620b8fd5b8674de6a36ab16d42545e64fbdb7184b7d1f2ca63d6841ec420f639bc714df88dd32c17803772aa489a4c5f12f7ec96f'
            'ae2fd7a452716fccd0f421176aba9b9971edf9a9a3f241bd023044f9bce140dfcad0777eff9d47a891264d0ea49ce9f9f7671043b44fd2bcf7c9f484c08b8449')
# clean-nm.sh leaves many empty directories
options=('!emptydirs' '!strip')

pkgver() {
    cd $pkgname
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    cd $pkgname
    # Remove unnecessary directory
    rm -rf .github
    rm -rf docs
    rm -rf test
}

build() {
    cd $pkgname
    # Not using --production here as minify-docker.js needs devDependencies.
    # Unused dependencies will be cleaned up, anyway.
    PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true yarn --cache-folder "${srcdir}/yarn-cache"

    # Cleanup node modules, as Dockerfile does.
    node ./scripts/docker/minify-docker.js
    rm -rf node_modules
    mv app-minimal/node_modules .
}

package() {
    cd $pkgname
    install -Ddm755 "$pkgdir"/opt/rsshub
    cp -R ./* "$pkgdir"/opt/rsshub/
    chown -R root:root "${pkgdir}/opt/"
    find "${pkgdir}/opt" -type d -exec chmod 755 {} +

    install -Dm640 "$srcdir"/rsshub.conf -t "$pkgdir"/etc/rsshub/

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

    # TODO: We still have several JS which contains the $srcdir
    find "$pkgdir" -type f -name package.json -print0 | xargs -0 sed -i "/_where/d"

    install -Dm644 "$srcdir"/rsshub.service -t "$pkgdir"/usr/lib/systemd/system/

    install -Dm644 "$srcdir"/rsshub_sysuser.conf -t "$pkgdir"/usr/lib/sysusers.d/

    install -Dm644 "$srcdir"/rsshub_tmpfile.conf -t "$pkgdir"/usr/lib/tmpfiles.d/
}