summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 70d067d9eee82adca9a764eb801da5a6bb1e9166 (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
152
153
154
155
156
# Maintainer: xiota / aur.chaotic.cx
# Maintainer: Mattia Basaglia <glax@dragon.best>
# Contributor: Sythelux Rikd <dersyth@gmail.com>

# options
: ${_pkgtype:=git}

# basic info
_pkgname="glaxnimate"
pkgname="$_pkgname${_pkgtype:+-$_pkgtype}"
pkgver=0.5.4.r38.g67203af3
pkgrel=1
pkgdesc="Simple vector animation program"
_url="https://gitlab.com/mattbas/glaxnimate"
url="https://glaxnimate.mattbas.org/"
license=('GPL3')
arch=('x86_64' 'i686' 'armv7h' 'aarch64' 'riscv32' 'riscv64')

# main package
_main_package() {
  depends=(
    'ffmpeg'
    'hicolor-icon-theme'
    'libarchive'
    'potrace'
    'python'
    'qt6-base'
    'qt6-imageformats'
    'qt6-svg'
    'qt6-tools'
    'zlib'
  )
  makedepends=(
    'clang'
    'cmake'
    'gcc'
    'git'
    'make'
    'qt6-declarative'
  )

  if [ x"$pkgname" == x"$_pkgname" ] ; then
    _main_stable
  else
    _main_git
  fi

  # submodules
  _source_glaxnimate
}

# stable package
_main_stable() {
  _url="https://gitlab.com/mattbas/glaxnimate"

  _pkgsrc="$_pkgname"
  source+=("$_pkgsrc"::"git+$_url.git#tag=${pkgver%%.r*}")
  sha256sums+=('SKIP')

  pkgver() {
    local _pkgver="${pkgver%%.r*}"
    echo "${_pkgver:?}"
  }
}

# git package
_main_git() {
  url="${_url:?}"

  provides=("$_pkgname")
  conflicts=("$_pkgname")

  _pkgsrc="$_pkgname"
  source+=("$_pkgsrc"::"git+$_url.git")
  sha256sums+=('SKIP')

  pkgver() {
    cd "$_pkgsrc"
    local _pkgver=$(
      git describe --long --tags --exclude='*[a-zA-Z][a-zA-Z]*' 2>/dev/null \
        | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g'
    )

    echo "${_pkgver:?}"
  }
}

# submodules
_source_glaxnimate() {
  source+=(
    'kde.breeze-icons'::'git+https://github.com/KDE/breeze-icons.git'
    'mattbas.cmake-lib'::'git+https://gitlab.com/mattbas/CMake-Lib.git'
    'mattbas.python-lottie'::'git+https://gitlab.com/mattbas/python-lottie.git'
    'mattbas.qt-color-widgets'::'git+https://gitlab.com/mattbas/Qt-Color-Widgets.git'
    'mattbas.qt-history-lineedit'::'git+https://gitlab.com/mattbas/Qt-History-LineEdit.git'
    'pybind.pybind11'::'git+https://github.com/pybind/pybind11.git'
    'rpavlik.cmake-modules'::'git+https://github.com/rpavlik/cmake-modules.git'
  )
  sha256sums+=(
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
  )

  _prepare_glaxnimate() (
    cd "$_pkgsrc"
    local -A _submodules=(
      ['kde.breeze-icons']='data/icons/breeze-icons'
      ['mattbas.cmake-lib']='cmake'
      ['mattbas.python-lottie']='data/lib/python-lottie'
      ['mattbas.qt-color-widgets']='external/Qt-Color-Widgets'
      ['mattbas.qt-history-lineedit']='external/Qt-History-LineEdit'
      ['pybind.pybind11']='external/QtAppSetup/external/pybind11'
      ['rpavlik.cmake-modules']='external/cmake-modules'
    )
    _submodule_update
  )
}

# common functions
prepare() {
  _submodule_update() {
    for key in ${!_submodules[@]} ; do
      git submodule init "${_submodules[${key}]}"
      git submodule set-url "${_submodules[${key}]}" "${srcdir}/${key}"
      git -c protocol.file.allow=always submodule update "${_submodules[${key}]}"
    done
  }

  _prepare_glaxnimate
}

build() {
  local _cmake_options=(
    -B build
    -S "$_pkgsrc"
    -DCMAKE_BUILD_TYPE=Release
    -DCMAKE_INSTALL_PREFIX='/usr'
    -Wno-dev
  )

  cmake "${_cmake_options[@]}"
  cmake --build build
  cmake --build build --target translations
}

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

# execute
_main_package