summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 482eea6b6864eee877db4f5b7913dafb9d52d596 (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
# Maintainer: kleintux <reg-archlinux AT klein DOT tuxli DOT ch> 
# Contributor: Nicola Squartini <tensor5@gmail.com>

pkgname=min
pkgver=1.30.0
_electronver=24
pkgrel=1
pkgdesc='A fast, minimal browser that protects your privacy'
arch=('x86_64')
url='https://minbrowser.org/'
license=('Apache')
depends=("electron${_electronver}" 'libsecret')
makedepends=('git' 'npm')
options=(!emptydirs)
source=(https://github.com/minbrowser/min/archive/v$pkgver/$pkgname-$pkgver.tar.gz
        'min.desktop'
        'min.js'
        'icon.patch')
sha256sums=('21b89fbb5ebb260f1dd5973eafab4526d1835bbb5254f74fefb0de2dfeb49766'
            'a069caac07638ca2bafde5f96a4db646ec7484741ff9b44788c2e159b5142650'
            '58925a72ab69500d4b2b2b9fe216aca44276423dfcb337063516fb8024a01b0a'
            '3cff8e5613907c3776115ccdb14f37a4899c96874f662281a630912d893c1d87')

prepare() {
    cd $pkgname-$pkgver

    patch -Np1 -i "${srcdir}"/icon.patch
}

build() {
    cd $pkgname-$pkgver

    npm install
    npm run build
    rm -r node_modules

    npm install --production --no-optional
}

package() {
    cd $pkgname-$pkgver

    appdir=/usr/lib/${pkgname}

    install -dm755 "${pkgdir}"${appdir}
    cp -r * "${pkgdir}"${appdir}

    install -dm755 "${pkgdir}"/usr/share/icons/hicolor/256x256/apps
    mv icons/icon256.png \
        "${pkgdir}"/usr/share/icons/hicolor/256x256/apps/${pkgname}.png

    install -d "${pkgdir}/usr/bin"
    sed "s|@ELECTRON@|electron${_electronver=19}|" "${srcdir}/${pkgname}.js" \
        > "${pkgdir}/usr/bin/${pkgname}"
    chmod 755 "${pkgdir}/usr/bin/${pkgname}"

    install -Dm644 "${srcdir}"/${pkgname}.desktop \
            "${pkgdir}"/usr/share/applications/${pkgname}.desktop

    # Clean up
    rm "${pkgdir}"${appdir}/dist/build.js
    rm -r "${pkgdir}"${appdir}/icons
    rm -r "${pkgdir}"${appdir}/localization
    rm -r "${pkgdir}"${appdir}/main
    rm -r "${pkgdir}"${appdir}/scripts
    find "${pkgdir}"${appdir} \
        -name "package.json" \
            -exec sed -e "s|${srcdir}/${pkgname}|${appdir}|" \
                -i {} \; \
        -or -name ".*" -prune -exec rm -r '{}' \; \
        -or -name "*.Makefile" -exec rm '{}' \; \
        -or -name "*.h" -exec rm '{}' \; \
        -or -name "*.c" -exec rm '{}' \; \
        -or -name "*.cc" -exec rm '{}' \; \
        -or -name "*.gypi" -exec rm '{}' \; \
        -or -name "*.mk" -exec rm '{}' \; \
        -or -name "Gruntfile.js" -exec rm '{}' \; \
        -or -name "Makefile" -exec rm '{}' \; \
        -or -name "bin" -prune -exec rm -r '{}' \; \
        -or -name "bin.js" -exec rm '{}' \; \
        -or -name "bower.json" -exec rm '{}' \; \
        -or -name "cli.js" -exec rm '{}' \; \
        -or -name "cmd.js" -exec rm '{}' \; \
        -or -name "coffee" -prune -exec rm -r '{}' \; \
        -or -name "example" -prune -exec rm -r '{}' \; \
        -or -name "examples" -prune -exec rm -r '{}' \; \
        -or -name "gulpfile.js" -exec rm '{}' \; \
        -or -name "man" -prune -exec rm -r '{}' \; \
        -or -name "obj.target" -prune -exec rm -r '{}' \; \
        -or -name "scripts" -prune -exec rm -r '{}' \; \
        -or -name "test" -prune -exec rm -r '{}' \; \
        -or -name "tests" -prune -exec rm -r '{}' \;
}