summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 22b72324a81cc8752a6d296e796adcbd66d9d060 (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
# Maintainer: Glucy2 <glucy-2@outlook.com>
_pkgname=sast-evento
pkgname=${_pkgname}-git

pkgver=2.0.74.5.g90c7df7
pkgrel=1
pkgdesc='An event management system developed and used by NJUPT SAST (git package)'
license=("${srcdir}/sast-evento/LICENSE")
provides=("${_pkgname}")
conflicts=("${_pkgname}" "${_pkgname}-bin")

makedepends=(
    'git'
    'base-devel'
    'cmake'
    'qt5-base'
    'boost'
    'nlohmann-json'
    'spdlog'
    'liburing'
    'libsecret'
    'tomlplusplus'
    'autoconf-archive'
    'libxcb'
    'libxrender'
    'libxi'
    'libxkbcommon'
    'libxkbcommon-x11'
    )
depends=('boost' 'qt6-base' 'slint-cpp-bin')
arch=('x86_64')

url="https://github.com/NJUPT-SAST/sast-evento"

pkgver() {
    cd "${srcdir}/sast-evento"
    git --no-pager describe --tags --exclude "v[0-9]*[._][0-9]*[._][0-9]*-[0-9]*" \
        --always --dirty --long | sed 's/-/./g'
}

prepare() {
    rm -rf "${srcdir}/sast-evento/build" "${srcdir}/build"
    if [[
        -d "${srcdir}/sast-evento"

        &&
        
        $(git -C "${srcdir}/sast-evento" config --get remote.origin.url) \
            = "https://github.com/NJUPT-SAST/sast-evento.git"
        
        &&

        $(git -C "${srcdir}/sast-evento" branch --show-current) = "dev"
         ]] ; then
        
        cd "${srcdir}/sast-evento"
        git pull
        git submodule update --init --recursive
    else
        rm -rf "${srcdir}/sast-evento"
        cd "${srcdir}"
        git clone --recursive -b dev https://github.com/NJUPT-SAST/sast-evento.git
    fi
}

build() {
    cd "${srcdir}/sast-evento"
    cmake -B build \
        -DSLINT_FEATURE_RENDERER_SKIA=ON \
        -DSLINT_FEATURE_RENDERER_FEMTOVG=OFF \
        -DSlint_DIR=${srcdir}/Slint-cpp-${_slintver}-Linux-x86_64/lib/cmake/Slint
    cmake --build build
    cmake --install ./build --prefix "${srcdir}/build"
}

package() {
    rm "${srcdir}/build/sast-evento-version.txt"
    install -Dm755 -t "${pkgdir}/usr/bin" "${srcdir}/build/bin/"*
    install -Dm644 -t "${pkgdir}/usr/lib" "${srcdir}/build/lib/"*
    install -Dm644 "${srcdir}/build/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    cp -r "${srcdir}/build/include" "${pkgdir}/usr/"
    cp -r "${srcdir}/build/locale" "${pkgdir}/usr/share/locale/"
    mkdir -p "${pkgdir}/usr/share/applications"
    cat > "${pkgdir}/usr/share/applications/${pkgname}.desktop" << EOF
[Desktop Entry]
Name=SAST Evento
Version=$pkgver
Comment=An event management system developed and used by NJUPT SAST
Exec=sast-evento
Icon=sast-evento
Terminal=false
Type=Application
Categories=Education;
Terminal=false
EOF
    chmod 644 "${pkgdir}/usr/share/applications/${pkgname}.desktop"
    install -Dm644 "${srcdir}/sast-evento/ui/assets/image/icon/evento.svg" \
        "${pkgdir}/usr/share/icons/hicolor/scalable/apps/sast-evento.svg"
}