Skip to content
Snippets Groups Projects
PKGBUILD 4.6 KiB
Newer Older
Philip Müller's avatar
Philip Müller committed
# Maintainer: Bernhard Landauer <oberon@manjaro.org>
# Maintainer: Tomasz Gąsior <tomaszgasior.pl>

_repo=gtk3-mushrooms
__arch_pkg_commit=a97a4614dfdb3a2f0c97ed58f94385ecc9b16b1e

_pkgname=lib32-gtk3
pkgname=$_pkgname-classic
pkgver=3.22.30
pkgrel=5.1
Philip Müller's avatar
Philip Müller committed
pkgdesc="GTK3 patched for classic desktops like MATE/XFCE (see README)."
url="https://github.com/TomaszGasior/gtk3-mushrooms"
_archgit=https://git.archlinux.org/svntogit/community.git/plain/trunk
conflicts=($_pkgname)
provides=($_pkgname=$pkgver)
arch=(x86_64)
license=(LGPL)
depends=(
    adwaita-icon-theme
    cantarell-fonts
    gtk3-classic
    lib32-at-spi2-atk
    lib32-colord
    lib32-dbus
    lib32-dconf
    lib32-gdk-pixbuf2
    lib32-json-glib
    lib32-libcanberra
    lib32-libcups
    lib32-libepoxy
    lib32-librsvg
    lib32-libxcomposite
    lib32-libxcursor
    lib32-libxdamage
    lib32-libxinerama
    lib32-libxkbcommon
    lib32-libxrandr
    lib32-mesa
    lib32-pango
    lib32-rest
    lib32-wayland
    )
makedepends=(
    'git'
    'gcc-multilib'
    'gobject-introspection'
    'gtk-doc'
    'sassc'
    )
source=(
    # GTK source code.
    "https://download.gnome.org/sources/gtk+/${pkgver%.*}/gtk+-$pkgver.tar.xz"
Bernhard Landauer's avatar
Bernhard Landauer committed
	# Temporary. Will be removed with next GTK3 release.
	"upstream_transparent_window_bg_1._patch::https://github.com/GNOME/gtk/commit/2ce63a86ba689aa41eb47409c889c469497478b0.patch"
	"upstream_transparent_window_bg_2._patch::https://github.com/GNOME/gtk/commit/01d1bc3c75fd0eff5665f5b9c690c5e1e6c65f13.patch"

Philip Müller's avatar
Philip Müller committed
    "gtk-query-immodules-3.0-32.hook::$_archgit/gtk-query-immodules-3.0-32.hook?h=packages/$_pkgname&id=$__arch_pkg_commit"
    # gtk3-mushrooms patches
    "git+$url.git"
    # trayicons background patch https://github.com/TomaszGasior/gtk3-mushrooms/issues/12
    'fixes__gtktrayicon-background.patch'
Philip Müller's avatar
Philip Müller committed
)
sha256sums=('a1a4a5c12703d4e1ccda28333b87ff462741dc365131fbc94c218ae81d9a6567'
Bernhard Landauer's avatar
Bernhard Landauer committed
            'ceb95c0952ccd3ded84cd55a2386a33edac91597052b077d12fa4a3cc62a1612'
            '68e3ea59140ee565a146fff2db2d2e2ed99536bbad8ba818bee124325d516e01'
Philip Müller's avatar
Philip Müller committed
            '4ac8112ac7e6fa879756e1eeb89b5efa0825ba00e5b05469913b256f86a37608'
            'SKIP'
            '57086d7b73b8631bf1a44ff1db255333e8244ae6bd2c1617d540397f78790f7b')
Philip Müller's avatar
Philip Müller committed

__patch_makefiles() {
    __replace_string_in_file() {
        sed -i".bak" "s/$1/$2/" "$3"
        rm "$3.bak"
    }

    __replace_string_in_file \
        "SRC_SUBDIRS = gdk gtk libgail-util modules demos tests testsuite examples" \
        "SRC_SUBDIRS = gdk gtk libgail-util modules demos" \
        "Makefile.am"

    __replace_string_in_file \
        "SUBDIRS = po po-properties \$(SRC_SUBDIRS) docs m4macros build" \
        "SUBDIRS = po \$(SRC_SUBDIRS) m4macros build" \
        "Makefile.am"

    __replace_string_in_file \
        "SUBDIRS = gtk-demo widget-factory icon-browser" \
        "SUBDIRS = widget-factory" \
        "demos/Makefile.am"

	__replace_string_in_file \
		"gtk-update-icon-cache" \
		"" \
		"gtk/Makefile.am"
}

__patch_gtk_code() {
    for patch_file in $srcdir/$_repo/*.patch; do
        patch -d "gtk" -p3 -i "$patch_file"
    done

    cat "$srcdir/$_repo/smaller-adwaita.css" | tee -a gtk/theme/Adwaita/gtk-contained{,-dark}.css > /dev/null
}

prepare() {
    cd "$srcdir/gtk+-$pkgver"
Philip Müller's avatar
Philip Müller committed

    # Make building faster by skipping tests, code examples and unused elements.
    __patch_makefiles

    # Apply patches to GTK code.
    __patch_gtk_code

Bernhard Landauer's avatar
Bernhard Landauer committed
	# Temporary. Will be removed with next GTK3 release.
	patch -p 1 -i "$srcdir/upstream_transparent_window_bg_1._patch"
	patch -p 1 -i "$srcdir/upstream_transparent_window_bg_2._patch"
    patch -p 1 -i "$srcdir/fixes__gtktrayicon-background.patch"
Philip Müller's avatar
Philip Müller committed

    NOCONFIGURE=1 ./autogen.sh
}

build() {
    cd "gtk+-$pkgver"

    export CC='gcc -m32'
    export CXX='/bin/false'
    export PKG_CONFIG_PATH='/usr/lib32/pkgconfig'

    CXX=/bin/false ./configure \
      --prefix=/usr \
      --libdir=/usr/lib32 \
      --sysconfdir=/etc \
      --localstatedir=/var \
      --enable-x11-backend \
      --enable-wayland-backend \
      --disable-schemas-compile \
      --disable-gtk-doc-html \
      --disable-libcanberra

    # https://bugzilla.gnome.org/show_bug.cgi?id=655517
    sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
    make
}

package() {
    cd "gtk+-$pkgver"

    make DESTDIR="$pkgdir" install

    mv "${pkgdir}"/usr/bin/gtk-query-immodules-3.0{,-32}
    mv "${pkgdir}"/usr/bin/gtk-query-settings{,-32}
    rm "${pkgdir}"/usr/bin/{gtk-{builder-tool,encode-symbolic-svg,launch},gtk3-widget-factory}
    rm -rf "${pkgdir}"/{etc,usr/{include,share}}

    install -Dm 644 ../gtk-query-immodules-3.0-32.hook "${pkgdir}"/usr/share/libalpm/hooks/gtk-query-immodules-3.0-32.hook
Bernhard Landauer's avatar
Bernhard Landauer committed
}