summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d35043732600ea72ad0c981a0fa13ab613ef6737 (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
# Maintainer: Vaargk <s30vm63qa at mozmail dot com>
_realname=Sync-my-L2P
pkgname=sync-my-l2p
pkgver=2.5.1
pkgrel=7
pkgdesc="Sync the Moodle instance of RWTH Aachen University."
arch=('x86_64')
url="https://github.com/rwthmoodle/Sync-my-L2P"
license=('LGPL3')
depends=('qt5-base' 'hicolor-icon-theme')
source=("$_realname-$pkgver.tar.gz::https://github.com/rwthmoodle/$_realname/archive/refs/tags/v${pkgver}a.tar.gz"
        "https://github.com/rwthmoodle/$_realname/releases/download/v${pkgver}a/SyncMyL2P-$pkgver-linux.AppImage")
sha256sums=('6412609ec2d56de4adcd714161b8ffd846e8d3f8ba4fedd764059a51561482fd'
            'dcc97bc11b8c05b3b984fda8062c906a7a0f101828d3e95e7f997b9328bd5c40')

prepare() {
    # Setup client_id
    chmod +x SyncMyL2P-$pkgver-linux.AppImage
    ./SyncMyL2P-$pkgver-linux.AppImage --appimage-extract usr/bin/$_realname
    client_id=$(strings squashfs-root/usr/bin/$_realname | grep .apps.rwth-aachen.de)
    sed --in-place "s/\(#define CLIENTID\) .*/\1 \"$client_id\"/g; /#error ERROR: NO CLIENTID IN CLIENTID.H DEFINED/d" $_realname-${pkgver}a/include/clientId.h
}

build() {
    cd $_realname-${pkgver}a

    qmake-qt5 $_realname.pro \
        PREFIX=/usr \
        QMAKE_CFLAGS="${CFLAGS}" \
        QMAKE_CXXFLAGS="${CXXFLAGS}" \
        QMAKE_LFLAGS="${LDFLAGS}"

    make
}

package() {
    cd $_realname-${pkgver}a

    # Binary
    install -D -m0755 bin/$_realname "$pkgdir"/usr/bin/$_realname

    # Desktop entry
    install -D -m0644 linux/$_realname.desktop "$pkgdir"/usr/share/applications/$_realname.desktop

    # Icons
    mkdir --parents "$pkgdir"/usr/share/icons && cp --recursive linux/hicolor "$pkgdir"/usr/share/icons/
    chmod --recursive 755 "$pkgdir"/usr/share/icons/hicolor
}