summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 335b3a554c4bb023b640be3dfe3573e777014ced (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
# Maintainer: dreieck (https://aur.archlinux.org/account/dreieck)

_pkgname=imgui
pkgname="${_pkgname}-git"
pkgver=1.91.6+57.r8580.20250109.0b8ff4b23
pkgrel=3
pkgdesc="Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies."
license=('MIT')
arch=(
  'x86_64'
  'i686'
  'aarch64'
  'armv6h'
  'armv7h'
)
url="https://github.com/ocornut/imgui"
depends=(
  'gcc-libs'
  'glibc'
)
makedepends=(
  'cmake'
  'git'
)
provides=("${_pkgname}=${pkgver}")
conflicts=("${_pkgname}")
source=(
  "${_pkgname}::git+${url}.git"
  "${_pkgname}_CMakeLists.txt::https://github.com/microsoft/vcpkg/raw/refs/heads/master/ports/imgui/CMakeLists.txt"
  "${_pkgname}_imgui-config.cmake.in::https://github.com/microsoft/vcpkg/raw/refs/heads/master/ports/imgui/imgui-config.cmake.in"
)
sha256sums=(
  'SKIP'
  'SKIP'
  'SKIP'
)

prepare () {
  cd "${srcdir}"

  cp "${_pkgname}_CMakeLists.txt"        "${_pkgname}/CMakeLists.txt"
  cp "${_pkgname}_imgui-config.cmake.in" "${_pkgname}/imgui-config.cmake.in"

  cd "${srcdir}/${_pkgname}"
  git log > git.log
}

pkgver() {
  cd "${srcdir}/${_pkgname}"

  _ver="$(git describe --tags | sed -E -e 's|^[vV]||' -e 's|\-g[0-9a-f]*$||' | tr '-' '+')"
  _rev="$(git rev-list --count HEAD)"
  _date="$(git log -1 --date=format:"%Y%m%d" --format="%ad")"
  _hash="$(git rev-parse --short HEAD)"

  if [ -z "${_ver}" ]; then
    error "Version could not be determined."
    return 1
  else
    printf '%s' "${_ver}.r${_rev}.${_date}.${_hash}"
  fi
}

build() {
  cd "${_pkgname}"
  cmake \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_SHARED_LIBS=ON \
    -S. \
    -B cmake-build-shared
  cmake --build cmake-build-shared
}

package() {
  cd "${_pkgname}"
  make -C cmake-build-shared DESTDIR="$pkgdir" install

  install -Dvm644 -t "${pkgdir}/usr/share/doc/${_pkgname}"     git.log docs/*
  install -Dvm644 -t "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE.txt
}

# vim:set ts=2 sw=2 et: