summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3e80fc1b269504dd3451774f8e3cf1b49eaf730c (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
# Maintainer:  Marcell Meszaros < marcell.meszaros AT runbox.eu >
# Contributor: Alexey D. <lq07829icatm at rambler.ru>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

pkgname='ark-git'
_basename="${pkgname%-git}"
pkgver=22.04.1.r57.g6037bcd0
pkgrel=1
pkgdesc='Compressed archive manager from KDE Gear'
arch=('i686' 'x86_64')
url="https://apps.kde.org/${_basename}/"
license=('GPL')
groups=('kde-applications' 'kde-utilities')
depends=(
  'hicolor-icon-theme'
  'kitemmodels'
  'kparts'
  'kpty'
  'libarchive'
  'libzip'
)
makedepends=(
  'cmake'
  'extra-cmake-modules'
  'git'
  'kdoctools'
  'python'
)
optdepends=(
  'lrzip: LRZ format support'
  'lzop: LZO format support'
  'p7zip: 7Z format support'
  'unrar: RAR decompression support'
  'unarchiver: alternative support for RAR and multipart ZIP formats'
  'unzip: legacy extraction support for single-part ZIP files'
  'zip: legacy compression support for single-part ZIP files'
)
provides=("${_basename}=${pkgver}")
conflicts=("${_basename}")
source=("git+https://invent.kde.org/utilities/${_basename}.git")
b2sums=('SKIP')

pkgver() {
  cd "${_basename}"

  # Generate git tag based version. Count only proper v#.#* [#=number] tags.
  local _gitversion=$(git describe --long --tags --match 'v[0-9][0-9.][0-9.]*' | sed -e 's|^v||' | tr '[:upper:]' '[:lower:]') 

  # Format git-based version for pkgver
  echo "${_gitversion}" | sed \
    -e 's|^\([0-9][0-9.]*\)-\([a-zA-Z]\+\)|\1\2|' \
    -e 's|\([0-9]\+-g\)|r\1|' \
    -e 's|-|.|g'
}

prepare() {
  printf 'Configuring external build flags for CMake...\n'
  printf '# Adding CPPFLAGS to CFLAGS, CXXFLAGS; otherwise CMake might ignore the former.\n'

  export CFLAGS+=" ${CPPFLAGS}" # CMake ignores CPPFLAGS
  export CXXFLAGS+=" ${CPPFLAGS}" # CMake ignores CPPFLAGS

  printf '# Adding LDFLAGS to CMake LINKER_FLAGS_INIT vars, otherwise CMake might ignore the former.\n\n'

  printf 'Configuring CMake build...\n'
  cmake -B build -S "${_basename}" \
    -DCMAKE_BUILD_TYPE='RelWithDebInfo' \
    -DCMAKE_EXE_LINKER_FLAGS_INIT="${LDFLAGS}" \
    -DCMAKE_SHARED_LINKER_FLAGS_INIT="${LDFLAGS}" \
    -DCMAKE_MODULE_LINKER_FLAGS_INIT="${LDFLAGS}" \
    -DCMAKE_INSTALL_PREFIX='/usr' \
    -DBUILD_TESTING='OFF'
}

build() {
  cmake --build build
}

package() {
  DESTDIR="${pkgdir}" cmake --install build
}