# Maintainer: PktSurf <smlinux@pktsurf.in>
app=gtk2
version=2.24.32
build=1sml
homepage="https://www.gtk.org/"
download="https://gitlab.gnome.org/GNOME/gtk/-/archive/$version/gtk-$version.tar.bz2"
desc="GObject-based multi-platform GUI toolkit (legacy)"
requires="desktop-file-utils fribidi libxcomposite libxcursor libxdamage libxi libxinerama libxcb libxrandr fontconfig freetype pango harfbuzz graphite2 cairo atk gdk-pixbuf"

prepbuilddir() {
  mkandenterbuilddir
  rm -rf "gtk+-$version"

  tar xf $srcdir/gtk+-$version.tar.?z
  cd "gtk+-$version"
  fixbuilddirpermissions

  autoreconf
  applypatch $srcdir/gtk2-fixdso.patch
  applypatch $srcdir/xid-collision-debug.patch
}

build() {
  ./configure \
    --prefix="" \
    --libdir=/lib \
    --disable-cups \
    --enable-xkb \
    --disable-gtk-doc \
    --disable-gtk-doc-html \
    --disable-gtk-doc-pdf 

  make || /etc/rc.d/rc.gtk
  make
  make install DESTDIR=$pkg

  cp COPYING $pkgdocs/

  # Don't clobber im-multipress.conf
  mv $pkg/etc/gtk-2.0/im-multipress.conf $pkg/etc/gtk-2.0/im-multipress.conf.new 

  # Install a basic gtkrc
  mkdir -p $pkg/share/gtk-2.0
  echo 'gtk-theme-name="GTK+"' > $pkg/share/gtk-2.0/gtkrc
  echo 'gtk-icon-theme-name="Adwaita"' >> $pkg/share/gtk-2.0/gtkrc
  echo 'gtk-fallback-icon-theme = "Tango"' >> $pkg/share/gtk-2.0/gtkrc

  mkfinalpkg
}

sha512sums="
27b7ce8e9f4e3c6613a2d7a9427968ccba71dae4f6c5531a6daf8192bd3f04292dc8a9c33dd5fad3317e45779dded0915cc8e96fd8f0594d70cc556c3e2b8ea6  gtk+-2.24.32.tar.lz
03579690728a2d15d537031de0ed7d4bec539936f00cf956efb012a5cd3fd34d7b751dd276a77d36ac3bb947ce9bed0f888b097037c0d4184b27ba9e32ac7357  gtk-icontheme-fallback.patch
95f28633a5164a2a9fec45ee1aa80bd1c07e0c5a7ac8d770b9c74af0909b7286b823eb634aa384cad609dc8799d2e6c9e8392c2732b9093076fdf94b4f6878b7  gtk2-fixdso.patch
89e3223c86731a76b12d39245f1ec4cf8b4860ab1d11d74a10e5deb0db302f20b4bb5d9034da1d8aeb96369dbdeddcdd2f28943270dc501476c694562b960159  xid-collision-debug.patch
"
