git » gtk4.git » main » tree

[main] / PKGBUILD

# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Maintainer: Fabian Bornschein <fabiscafe@archlinux.org>

pkgbase=gtk4
pkgname=(
  gtk4
  gtk4-demos
  gtk4-docs
#  gtk-update-icon-cache
)
pkgver=4.14.3
pkgrel=2
epoch=1
pkgdesc="GObject-based multi-platform GUI toolkit"
url="https://www.gtk.org/"
arch=(armv7h)
license=(LGPL-2.1-or-later)
depends=(
  adwaita-icon-theme
  cairo
  cantarell-fonts
  dconf
  desktop-file-utils
  fontconfig
  fribidi
  gcc-libs
  gdk-pixbuf2
  glib2
  graphene
#  gst-plugins-bad-libs
  harfbuzz
  iso-codes
#  libcloudproviders
  libcolord
  libcups
  libegl
  libepoxy
  libgl
  libjpeg
  libpng
  librsvg
  libtiff
  libx11
  libxcursor
  libxdamage
  libxext
  libxfixes
  libxi
  libxinerama
  libxkbcommon
  libxrandr
  libxrender
  pango
  shared-mime-info
#  tracker3
  wayland
  libdrm
)
makedepends=(
  docbook-xsl
  gi-docgen
  git
  gobject-introspection
  meson
  python-docutils
  python-gobject
  sassc
  shaderc
#  vulkan-headers
  wayland-protocols
)
#checkdepends=(
#  gst-plugin-pipewire
#  gst-plugins-base
#  mutter
#  noto-fonts
#  pipewire
#  python-pydbus
#  vulkan-swrast
#  weston
#  wireplumber
#)
source=(
  "git+https://gitlab.gnome.org/GNOME/gtk.git#tag=$pkgver"
  gtk-update-icon-cache.{hook,script}
  gtk4-querymodules.{hook,script}
  0001-HACK-Don-t-use-objcopy-for-resource-embedding.patch
)
b2sums=('f49b3e0ae9be2b37589f49bbeaee7a7b1132c47fe9750c81b426559b9634a7ba1d64a22d87fe6e030cb49f2c4ad551cd233c6c757d32cb4f1e4a96b76cf1d750'
        '136bdb410c46daf769175e8e8837286576391797a4762b8cf388217e893dd6c5087c5c91c347cbdf7d3e9dcd2c978c2fb275b5af1f3425c9f7979fbc65a81324'
        '6bcd839ef82296d864587e0cc7acc0145bdea8e5235af304747cf3c0e564c2757cc67c0373dc044bec83dccfc57dc899546c2fccea96cff2bba22f09978a3814'
        'dd589bd1ad2b13f0e06f6899776a083f20a1aac24d4308d666ffd0d1cff38457b8257b8366f92e767b4233b3d86b6b54fa50339faf84c4801a824986366dce30'
        '4b90eb8d582509b09aab401313d4399cc139ad21b5dd7d45d79860d0764c7494c60714e0794e09823e51d1894ac032a994f27d79d1499abf24ee6f59bdb0c243'
        '39335dc6f3809efb51a43f5791c6585e1b715c9d22f400b3b6dace407a8c32693438b4f435eae848ce3273ace6d07f9eb2c3cf52ed1ff9de8755301a1eeb5a50')

prepare() {
  cd gtk

  # Allow -fcf-protection to work
  # https://gitlab.gnome.org/GNOME/gtk/-/issues/6153
  git apply -3 ../0001-HACK-Don-t-use-objcopy-for-resource-embedding.patch
}

build() {
  local meson_options=(
    -D broadway-backend=false
    -D cloudproviders=disabled
    -D colord=enabled
    -D documentation=true
    -D man-pages=true
    -D tracker=disabled
    -Dvulkan=disabled
    # yadda yadda required, this is a cyclical dependency, yank it out
    -Dmedia-gstreamer=disabled
  )

  CFLAGS+=" -DG_DISABLE_CAST_CHECKS"
  arch-meson gtk build "${meson_options[@]}"
  meson compile -C build
}

check() (
  return 0
  export XDG_RUNTIME_DIR="$PWD/runtime-dir" WAYLAND_DISPLAY=wayland-5

  mkdir -p -m 700 "$XDG_RUNTIME_DIR"
  weston --backend=headless-backend.so --socket=$WAYLAND_DISPLAY --idle-time=0 &
  _w=$!

  trap "kill $_w; wait" EXIT

  # Test: GTK / templates fails - ignore it for now.
  sed -i "s/{ 'name': 'templates' }/#{ 'name': 'templates' }/g" gtk/testsuite/gtk/meson.build

  # Comparison tests fail, because thes depend on driver and how mesa was build
  # https://gitlab.gnome.org/GNOME/gtk/-/issues/6383
  meson test -C build --print-errorlogs --no-suite=headless --timeout-multiplier=3 ||:
)

_pick() {
  local p="$1" f d; shift
  for f; do
    d="$srcdir/$p/${f#$pkgdir/}"
    mkdir -p "$(dirname "$d")"
    mv "$f" "$d"
    rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
  done
}

package_gtk4() {
  depends+=(
    bash
    glibc
#    gst-plugins-base-libs
#    gstreamer
#    gtk-update-icon-cache
   # vulkan-icd-loader
    )
  optdepends=('evince: Default print preview command')
  provides=(libgtk-4.so)

  meson install -C build --destdir "$pkgdir"

  install -Dm644 /dev/stdin "$pkgdir/usr/share/gtk-4.0/settings.ini" <<END
[Settings]
gtk-icon-theme-name = Adwaita
gtk-theme-name = Adwaita
gtk-font-name = Cantarell 11
END

  install -Dt "$pkgdir/usr/share/libalpm/hooks" -m644 gtk4-querymodules.hook
  install -D gtk4-querymodules.script "$pkgdir/usr/share/libalpm/scripts/gtk4-querymodules"

  cd "$pkgdir"

  _pick demo usr/bin/gtk4-{demo,demo-application,icon-browser,node-editor,print-editor,widget-factory}
  _pick demo usr/share/applications/org.gtk.{Demo4,IconBrowser4,PrintEditor4,WidgetFactory4,gtk4.NodeEditor}.desktop
  _pick demo usr/share/glib-2.0/schemas/org.gtk.Demo4.gschema.xml
  _pick demo usr/share/icons/hicolor/*/apps/org.gtk.{Demo4,IconBrowser4,PrintEditor4,WidgetFactory4,gtk4.NodeEditor}[-.]*
  _pick demo usr/share/man/man1/gtk4-{demo,demo-application,icon-browser,node-editor,widget-factory}.1
  _pick demo usr/share/metainfo/org.gtk.{Demo4,IconBrowser4,PrintEditor4,WidgetFactory4,gtk4.NodeEditor}.appdata.xml

  _pick docs usr/share/doc

  # Built by GTK 4, shared with GTK 3
  _pick guic usr/bin/gtk4-update-icon-cache
  _pick guic usr/share/man/man1/gtk4-update-icon-cache.1
}

package_gtk4-demos() {
  pkgdesc+=" (demo applications)"
  depends=(
    cairo
    dconf
    gdk-pixbuf2
    glib2
    glibc
    graphene
    gtk4
    harfbuzz
    hicolor-icon-theme
    libepoxy
    librsvg
    pango
    )
  mv demo/* "$pkgdir"
}

package_gtk4-docs() {
  pkgdesc+=" (documentation)"
  depends=()
  mv docs/* "$pkgdir"
}

package_gtk-update-icon-cache() {
  pkgdesc="GTK icon cache updater"
  depends=(
    bash
    gdk-pixbuf2
    glib2
    glibc
    hicolor-icon-theme
    librsvg
    )

  mv guic/* "$pkgdir"
  ln -s gtk4-update-icon-cache "$pkgdir/usr/bin/gtk-update-icon-cache"
  ln -s gtk4-update-icon-cache.1 "$pkgdir/usr/share/man/man1/gtk-update-icon-cache.1"

  install -Dt "$pkgdir/usr/share/libalpm/hooks" -m644 gtk-update-icon-cache.hook
  install -D gtk-update-icon-cache.script "$pkgdir/usr/share/libalpm/scripts/gtk-update-icon-cache"
}

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