aboutsummarylogtreecommitdiffstats
path: root/do-mushrooms.sh
blob: a732d64f1b645b1f30a97a08bdfead13b4c9156d (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
#!/bin/bash

# This script is used to apply Mushroom's patches to GTK source code.

# Current working directory should be set to main directory of GTK source code.
# Script should be placed beside patches files.

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 "SUBDIRS += cloudprint" "" "modules/printbackends/Makefile.am"
	_replace_string_in_file "SUBDIRS += cups" 	    "" "modules/printbackends/Makefile.am"
	_replace_string_in_file "gtk-update-icon-cache" "" "gtk/Makefile.am"
}

patch_gtk_code()
{
	patches_dir=$(dirname `realpath "$0"`)

	for patch_file in $patches_dir/*.patch; do
		patch -d "gtk" -p 3 -i "$patch_file"
	done

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

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

# Apply patches to GTK code.
patch_gtk_code