summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: eb4e82896c007aea4199b93d99030b4cb7e2594f (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Maintainer: Thomas Schneider <thomas@brainfuck.space>

pkgbase=ente
_pkgbase=ente-photos
pkgname=(ente-server ente-web) 
pkgver=0.9.53
pkgrel=0
pkgdesc="End to End Encrypted alternative to Google Photos" 
arch=('x86_64')
url="https://github.com/ente-io/ente"
license=('AGPLv3')
depends=('libsodium')
makedepends=('go' 'git' 'nodejs-lts-iron' 'yarn')
source=("${_pkgbase}-$pkgver.tar.gz::$url/archive/refs/tags/photos-v${pkgver}.tar.gz"
        "ente-museum.service"
        "sysusers.conf"
        "tmpfiles.conf"
        "ente-web-nginx-example.conf"
        "git+https://github.com/ente-io/PhotoSwipe.git"
        "git+https://github.com/abhinavkgrd/ffmpeg.wasm.git")
backup=('etc/ente/configurations/local.yaml')
sha256sums=('94b8b8722b46a20c47023a3008bded65cd62c7889e9fa64e5e8d8359b48bd293'
            'd632886a9068ee4a2cdd6bccbd7cf87dc196660b45a0888d5b50f4565365af1c'
            '49f07f3e3519b242b12aaa7d8d10c5e1fa934a6ccdf8bfda0bd41c55654c37c2'
            'eb8f5dbec1e34ef68b733cb73d93cb854e81fea278727b5f914dab2d578371e0'
            '84e916a1fef6ee1367572b09e8aba10a61222792faf13f758d31e66263dc8e51'
            'SKIP'
            'SKIP')

prepare() {
    # they use git submodules both repos haven't been updated in over 3 years
    # I could only use a stable release on ffmpeg-wasm
#    rm -rf "$srcdir/$pkgbase-v$pkgver/web/apps/photos/thirdparty/ffmpeg-wasm"
#    cp -a ${srcdir}/ffmpeg.wasm-0.10.1 "$srcdir/$pkgbase-v$pkgver/web/apps/photos/thirdparty/ffmpeg-wasm"
#    git clone https://github.com/ente-io/PhotoSwipe.git "$srcdir/$pkgbase-v$pkgver/web/apps/photos/thirdparty/photoswipe" || echo Already pulled
#    git clone https://github.com/abhinavkgrd/ffmpeg.wasm.git "$srcdir/$pkgbase-v$pkgver/web/apps/photos/thirdparty/ffmpeg-wasm" || echo I should solve this correctly some time in the future
#    cd "$srcdir/$pkgbase-v$pkgver/web/apps/photos/thirdparty/photoswipe"
#    git checkout single-thread
     cd "${srcdir}/${_pkgbase}-v${pkgver}"
#     git init
#     git submodule init
#     git config submodule.web/apps/photos/thirdparty/ffmpeg-wasm.url "${srcdir}/ffmpeg.wasm"
#     git config submodule.web/apps/photos/thirdparty/photoswipe.url "${srcdir}/PhotoSwipe"
#     git -c protocol.file.allow=always submodule update
     rm -rf web/apps/photos/thirdparty/ffmpeg-wasm
     rm -rf web/apps/photos/thirdparty/photoswipe
     git clone "${srcdir}/ffmpeg.wasm" web/apps/photos/thirdparty/ffmpeg-wasm
     git clone "${srcdir}/PhotoSwipe" web/apps/photos/thirdparty/photoswipe
     # Ugly patch
#     sed 's/^\(\s\+mt:\)/\/\/\1/' -i "${srcdir}/${_pkgbase}-v${pkgver}/web/apps/photos/src/worker/ffmpeg.worker.ts"
     sed 's/^\(\s\+mt:\)/\/\/\1/' -i "${srcdir}/${_pkgbase}-v${pkgver}/web/packages/new/photos/services/ffmpeg/worker.ts"
#     /web/apps/photos/src/worker/ffmpeg.worker.ts"
#     cd "${srcdir}/${_pkgbase}-v${pkgver}/web/apps/photos/thirdparty/ffmpeg-wasm"
     
}

build() {
    cd "$srcdir/${_pkgbase}-v${pkgver}/server"
    echo "Build musem"
#    export CGO_ENABLED=0
    export GOOS=linux
    go mod tidy
    go build -o museum cmd/museum/main.go
# web
    echo "Build web"
    cd "$srcdir/${_pkgbase}-v$pkgver/web"
    git submodule update --init --recursive
    yarn install
    yarn next telemetry disable
#    NEXT_PUBLIC_ENTE_ENDPOINT=http://localhost:8080 yarn build
#    NEXT_PUBLIC_ENTE_ENDPOINT=http://localhost:8080 yarn build:photos
    if [ "$NEXT_PUBLIC_ENTE_ENDPOINT" ];then
        echo "Using $NEXT_PUBLIC_ENTE_ENDPOINT"
        yarn build:photos
    else
        NEXT_PUBLIC_ENTE_ENDPOINT=/api yarn build:photos
    fi
}

package_ente-server() {
    pkgdesc="End to End Encrypted alternative to Google Photos - Server component"
    optdepends=('postgresql'  'minio')

    cd "$srcdir/${_pkgbase}-v$pkgver/server"

    mkdir -p "$pkgdir/etc/ente/configurations/" "$pkgdir/etc/ente/migrations/" "$pkgdir/etc/ente/mail-templates/"
    # Install the binary
    install -Dm755 museum "$pkgdir/usr/bin/museum"

    # Install configurations
    install -Dm644 configurations/* "$pkgdir/etc/ente/configurations/"

    # Install migrations
    install -Dm644 migrations/* "$pkgdir/etc/ente/migrations/"

    # Install mail templates
    install -Dm644 mail-templates/* "$pkgdir/etc/ente/mail-templates/"

    # Install LICENSE file
#    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/${_pkgbase}/LICENSE"

    # Create systemd service
    install -vDm644 "${srcdir}/ente-museum.service" "$pkgdir/etc/systemd/system/ente-museum.service"
    install -vDm644 "${srcdir}/tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
    install -vDm644 "${srcdir}/sysusers.conf" "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
}

package_ente-web() {
    pkgdesc="End to End Encrypted alternative to Google Photos - Web component"
    optdepends=('nginx')

    cd "$srcdir/${_pkgbase}-v$pkgver/web/apps/photos/out"

    mkdir -p "$pkgdir/usr/share/webapps/ente" "${pkgdir}/usr/lib/ente/"
    # Install the web component
    cp -r * "$pkgdir/usr/share/webapps/ente"  # This should be changed to a more robust installation method

    # Install nginx configuration
#  install -Dm644 nginx/ente.conf "$pkgdir/etc/nginx/sites-available/ente.conf"
    install -vDm644 ${srcdir}/ente-web-nginx-example.conf "${pkgdir}/usr/lib/ente/"
}