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

pkgname=linyaps-test-git
pkgver=1.9.13_6.r0.7990a12
pkgrel=1
pkgdesc='Next-Gen Universal Package Manager for Linux (linglong)'
arch=($CARCH)
url='https://github.com/LFRon/linyaps-generic-linux'
license=('LGPL-3.0-or-later')
provides=(
  ${pkgname%-test-git}
  linglong
)
conflicts=(
  ${pkgname%-test-git}
  linglong
)
replaces=(linglong-git)
_qt=qt6
depends=(
  sh
  curl
  fmt
  gcc-libs
  glib2
  glibc
  hicolor-icon-theme
  libcap
  libelf
  linyaps-box
  ${_qt}-base
  systemd-libs
  ostree
  yaml-cpp
)
makedepends=(
  cli11
  cmake
  fmt
  git
  gtest
  libseccomp
  ${_qt}-tools
  ninja
  nlohmann-json
  openssl
  pkgconf
  tl-expected
  vulkan-headers
)
optdepends=(
  "linyaps-web-store-installer: 玲珑(Linglong)linyaps-web-store-installer is a package installer for the Linyaps Web store."
  "linglong-pica: deb package to Linglong package tool."
  "linglong-tools: A command line helper for linglong."
  "ll-killer-go: 玲珑杀手 Go: 玲珑应用快速构建系统"
)
install=${pkgname}.install
source=(
  "${pkgname}::git+${url}.git"
  "quicktype::git+https://github.com/glideapps/quicktype.git"
  "${pkgname}.install"
)
sha256sums=('SKIP'
            'SKIP'
            '4520bd1f10204220dea4141c970436deef01e9556727772ab76e408b7de69e54')

pkgver() {
  cd "${srcdir}/${pkgname}"
  (
    set -o pipefail

    latest_tag=$(git tag --sort=-version:refname | grep -Ev '^[vV]' | head -1)
    commit_count=$(git rev-list --count "${latest_tag}..HEAD")
    commit_hash=$(git rev-parse --short=7 HEAD)

    printf "%s.r%s.%s" "${latest_tag//-/_}" "${commit_count}" "${commit_hash}" ||
      printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
  )
}

prepare() {
  git -C "${srcdir}/${pkgname}" clean -dfx
  cd ${srcdir}/${pkgname}
  git submodule init
  git config submodule.tools/quicktype.url "$srcdir/quicktype"
  git -c protocol.file.allow=always submodule update
}

build() {
  cd "${srcdir}"/${pkgname}/
  # see:https://wiki.archlinux.org/title/CMake_package_guidelines
  cmake -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBEXECDIR=lib \
    -DCPM_LOCAL_PACKAGES_ONLY=ON \
    -DLINGLONG_VERSION="$pkgver" \
    -Wno-dev \
    -B build \
    -G Ninja

  ninja -C build
}

# check() {
#   cd "${srcdir}"/${pkgname}/
#   ctest --test-dir build --output-on-failure
# }

package() {
  DESTDIR="${pkgdir}" ninja -C "${srcdir}"/${pkgname}/build install
}