summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9868dfdfd4fc97eb35c13f6c87779ae808eec5e9 (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
# Maintainer: taotieren <admin@taotieren.com>

pkgname=protocol-tool-git
_pkgname=ProtocolTool
pkgver=6a21a5a
pkgrel=1
pkgdesc="一款可配置的协议解析工具"
arch=('any')
url="https://gitee.com/mzy2364/protocol-tool"
license=('MIT')
provides=(${_pkgname})
conflicts=(${pkgname%-git})
#replaces=(${pkgname})
depends=('qt5-script')
makedepends=('git' 'qt5-script' 'qt5-tools')
backup=()
options=('!strip')
install=
source=("${pkgname%-git}::git+${url}.git")
sha256sums=('SKIP')

pkgver() {
    cd "${srcdir}/${pkgname%-git}/"
#     git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
    git describe --always --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
    cd ${srcdir}/${pkgname%-git}/
    qmake ${_pkgname}.pro
    make
}

package() {
    install -dm755 "${pkgdir}/usr/bin/" \
                   "${pkgdir}/usr/share/${pkgname%-git}/"

    cd ${srcdir}/${pkgname%-git}/
    cp --preserve=mode -r ${_pkgname} default.js "${pkgdir}/usr/share/${pkgname%-git}/"

    install -Dm0755 /dev/stdin "${pkgdir}/usr/bin/${pkgname%-git}" << EOF
#!/bin/env bash

cd /usr/share/${pkgname%-git}
./${_pkgname}
EOF

    install -Dm0755 /dev/stdin "${pkgdir}/usr/share/applications/com.gitee.mzy2364.protocol_tool.desktop" << EOF
[Desktop Entry]
Version=1.0
Type=Application

Name=protocol-tool
Comment=一款可配置的协议解析工具
Categories=Development;Qt;

Icon=protocol-tool
Exec=protocol-tool
Terminal=false

EOF

    install -Dm0755 /dev/stdin "${pkgdir}/usr/share/metainfo/com.gitee.mzy2364.protocol_tool.metainfo.xml" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
  <id>com.gitee.mzy2364.protocol_tool</id>

  <name>protocol-tool</name>
  <summary>一款可配置的协议解析工具</summary>

  <metadata_license>MIT</metadata_license>
  <project_license>MIT</project_license>

  <description>
    <p>
      一款可配置的协议解析工具
    </p>
  </description>

  <launchable type="desktop-id">com.gitee.mzy2364.protocol_tool.desktop</launchable>
</component>
EOF

    install -Dm0644 "${srcdir}/${pkgname%-git}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname%-git}/LICENSE"
    install -Dm0644 "${srcdir}/${pkgname%-git}/logo.png" "${pkgdir}/usr/share/pixmaps/${pkgname%-git}.png"
}