summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6a9bebdc5f318378d8560ef19b0c16bac272d5b3 (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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# Maintainer:

# options
: ${_build_qt5:=true}
: ${_build_qt6:=true}

_pkgname="darkly"
pkgbase="$_pkgname-git"
pkgver=0.5.13.r7.g5dd83d9
pkgrel=1
pkgdesc="Modern style for KDE/Qt applications"
url="https://github.com/Bali10050/Darkly"
arch=('x86_64' 'aarch64')
license=("GPL-2.0-or-later")

makedepends=(
  'cmake'
  'extra-cmake-modules'
  'git'
  'ninja'
)

options=('!emptydirs')

_pkgsrc="$_pkgname"
source=("$_pkgsrc"::"git+$url.git#branch=Darkly")
sha256sums=('SKIP')

pkgver() {
  cd "$_pkgsrc"
  git describe --long --tags --abbrev=7 --exclude='*[a-zA-Z][a-zA-Z]*' \
    | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g'
}

build() {
  if [[ "${_build_qt5::1}" == "t" ]]; then
    _build_qt5
    _package_qt5
  fi

  if [[ "${_build_qt6::1}" == "t" ]]; then
    _build_qt6
    _package_qt6
  fi
}

# KF5/Qt5
_depends_qt5=(
  'frameworkintegration5'
  'hicolor-icon-theme'
  'kcmutils5'
  'kconfigwidgets5'
  'kiconthemes5'
  'kirigami2'
  'kwindowsystem5'
)

_build_qt5() (
  local _cmake_options=(
    -B build_qt5
    -S "$_pkgsrc"
    -G Ninja
    -DCMAKE_BUILD_TYPE=None
    -DBUILD_QT5=ON
    -DBUILD_QT6=OFF
    -DBUILD_TESTING=OFF
    -Wno-dev
  )

  cmake "${_cmake_options[@]}"
  cmake --build build_qt5
)

_package_qt5() (
  local _pkgdir="$srcdir/fakeinstall_qt5"
  install -dm755 "$_pkgdir"
  DESTDIR="$_pkgdir" cmake --install build_qt5

  rm -rf "$_pkgdir/usr/share/color-schemes/Darkly.colors"
  rm -rf "$_pkgdir/usr/share/kstyle/themes/darkly.themerc"
)

# KF6/Qt6
_depends_qt6=(
  'frameworkintegration'
  'hicolor-icon-theme'
  'kcmutils'
  'kcolorscheme'
  'kconfig'
  'kcoreaddons'
  'kdecoration'
  'kguiaddons'
  'kiconthemes'
  'kwindowsystem'
  'qt6-declarative'
)

_build_qt6() (
  local _cmake_options=(
    -B build_qt6
    -S "$_pkgsrc"
    -G Ninja
    -DCMAKE_BUILD_TYPE=None
    -DBUILD_QT5=OFF
    -DBUILD_QT6=ON
    -DBUILD_TESTING=OFF
    -Wno-dev
  )

  cmake "${_cmake_options[@]}"
  cmake --build build_qt6
)

_package_qt6() (
  local _pkgdir="$srcdir/fakeinstall_qt6"
  install -dm755 "$_pkgdir"
  DESTDIR="$_pkgdir" cmake --install build_qt6

  rm -rf "$_pkgdir/usr/lib/cmake"
)

# execute
if [[ "${_build_qt5::1}" == "t" ]]; then
  depends+=("${_depends_qt5[@]}")

  pkgname+=("$_pkgname-qt5-git")

  package_darkly-qt5-git() {
    pkgdesc="Modern style for KF5/Qt5 applications"

    depends=(
      "$_pkgname-qt6-git"
      "${_depends_qt5[@]}"
    )
    optdepends+=("$_pkgname-qt6-git: KF5/Qt5 support")

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

    local _pkgdir="$srcdir/fakeinstall_qt5"
    mv "$_pkgdir"/* "$pkgdir/"

    chmod u=rwX,g=rX,o=rX -R "$pkgdir"
  }
fi

if [[ "${_build_qt6::1}" == "t" ]]; then
  depends+=("${_depends_qt6[@]}")

  pkgname+=("$_pkgname-qt6-git")

  package_darkly-qt6-git() {
    pkgdesc="Modern style for KF6/Qt6 applications"

    depends=("${_depends_qt6[@]}")

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

    local _pkgdir="$srcdir/fakeinstall_qt6"
    mv "$_pkgdir"/* "$pkgdir/"

    chmod u=rwX,g=rX,o=rX -R "$pkgdir"
  }
fi