summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4247f4c7112e82cc9e100531a98741ce0a01fd9b (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# SPDX-License-Identifier: AGPL-3.0
#
# Maintainer: Pellegrino Prevete (dvorak) <pellegrinoprevete@gmail.com>
# Maintainer: Truocolo <truocolo@aol.com>

# shellcheck disable=SC2034
_git=true
_offline=false
_proj="hip"
_pkg="grub"
_pkgname="arch-${_pkg}"
pkgname="${_pkgname}-git"
pkgver=0.1.1.1.1.1
pkgrel=1
_pkgdesc=(
  'Produces a standalone GRUB binary'
  'compatible with Arch Linux.'
)
pkgdesc="${_pkgdesc[*]}"
arch=(
  'any'
)
license=(
  'AGPL3'
)
_gh="https://github.com"
_arch="https://gitlab.archlinux.org"
_arch_ns="tallero"
_gh_ns="themartiancompany"
_ns="${_gh_ns}"
_http="${_gh}"
url="${_http}/${_ns}/${_pkgname}"
_local="file://${HOME}/${_pkgname}"
depends=(
  "${_pkg}"
  bash
)
makedepends=(
  "make"
)
groups=(
  "${_proj}"
)
checkdepends=(
  'shellcheck'
)
optdepends=(
  'luks-tools: Format LUKS volume in a GRUB compatible format'  
  'shfmt: Indent mkgrubcfg output'  
)
provides=(
  "${_pkgname}=${pkgver}"
  "mk${_pkg}=${pkgver}"
)
conflicts=(
  "${_pkgname}"
)
sha256sums=()
source=()
_url="${url}.git"
_branch="master"
[[ "${_offline}" == true ]] && \
  _url="${_local}"
[[ "${_git}" == true ]] && \
  makedepends+=(
    'git'
  ) && \
  source+=(
    "${_pkgname}::git+${_url}"
  ) && \
  sha256sums+=(
    'SKIP'
  )
[[ "${_git}" == false ]] && \
  source+=(
    "${pkgname}-${pkgver}.tar.gz::${url}/${_branch}.tar.gz"
  ) && \
  sha256sums+=(
    "SKIP"
  )

_parse_ver() {
  local \
    _pkgver="${1}" \
    _out="" \
    _ver \
    _rev \
    _commit
  _ver="$( \
    echo \
      "${_pkgver}" | \
      awk \
        -F '+' \
        '{print $1}')"
  _rev="$( \
    echo \
      "${_pkgver}" | \
      awk \
        -F '+' \
        '{print $2}')"
  _commit="$( \
    echo \
      "${_pkgver}" | \
      awk \
        -F '+' \
        '{print $3}')"
  _out=${_ver}
  if [[ "${_rev}" != "" ]]; then
    _out+=".r${_rev}"
  fi
  if [[ "${_commit}" != "" ]]; then
    _out+=".${_commit}"
  fi
  echo \
    "${_out}"
}

pkgver() {
  local \
    _pkgver
  cd \
    "${_pkgname}" || \
    exit
  _pkgver="$( \
    git \
      describe \
        --tags | \
      sed \
        's/-/+/g')"
  _parse_ver \
    "${_pkgver}"
}

check() {
  make \
    -k check \
    -C \
      "${_pkgname}"
}

# shellcheck disable=SC2154
package() {
  make \
    DESTDIR="${pkgdir}" \
    PREFIX="/usr" \
    install \
      -C \
        "${_pkgname}"
}

# vim:set sw=2 sts=-1 et: