summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 178aed9f9ee3c97fd5c415d6f48b32bdb61af2bc (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
# Maintainer: Zhang Hua<zhanghua.00 at qq dot com>
# Contributor: Alejandro Quisbert <alejandropqc at protonmail dot com>
# Contributor: Ali Molaei <ali dot molaei at protonmail dot com> 

pkgname=mongosh-git
pkgver=1.5.4.r11.g1db42a4c
pkgrel=3
pkgdesc="The MongoDB Shell."
arch=("x86_64" "aarch64")
depends=("krb5")
makedepends=("npm" "python" "git" "procps-ng")
provides=("mongosh" "mongosh-bin")
conflicts=("mongosh" "mongosh-bin")
url="https://github.com/mongodb-js/mongosh"
license=("Apache" "MPL" "custom:Customer Agreement")
source=("git+${url}.git")
sha256sums=('SKIP')

pkgver(){
    cd "${srcdir}/mongosh"
    git describe --tags --long | sed 's/v//;s/-/.r/;s/-/./g'
}
build(){
    cd "${srcdir}/mongosh"
    npm run bootstrap
    npm install --save-dev pretty-repl
    ./node_modules/.bin/lerna version ${pkgver%%.r*} \
        --no-changelog --no-push --exact --no-git-tag-version --yes
    SEGMENT_API_KEY=makepkg npm run compile-exec 
    # Anything except empty string in key is OK. But I am not sure the actual meaning of this.
    case ${CARCH} in
        x86_64)
            _arch=x64
            ;;
        aarch64)
            _arch=arm64
            ;;
        *)
            _arch=
            ;;
    esac
    npm run evergreen-release package -- --build-variant=linux-${_arch}
    install -Dm644 tmp/crypt-store/linux-${_arch}/mongodb-linux-none-${_arch}-stable-enterprise/LICENSE-Enterprise.txt \
        "LICENSE-Customer Agreement.txt"
}
# check(){
#     cd "${srcdir}/mongosh"
#     ./node_modules/.bin/lerna run test --scope @mongosh/cli-repl
# }
package(){
    cd "${srcdir}/mongosh"
    install -Dm755 dist/mongosh "${pkgdir}/usr/bin/mongosh"
    install -Dm644 tmp/mongosh_crypt_v1.so "${pkgdir}/usr/lib/mongosh_crypt_v1.so"
    install -Dm644 tmp/manpage/mongosh.1.gz "${pkgdir}/usr/share/man/man1/mongosh.1.gz"
    install -Dm644 "LICENSE-Customer Agreement.txt" "${pkgdir}/usr/share/licenses/mongosh/LICENSE-Customer Agreement.txt"
}