Skip to content

Instantly share code, notes, and snippets.

@N0rbert
Last active June 4, 2020 18:46
Show Gist options
  • Save N0rbert/2141ad87fcb91f67cad438293ec46986 to your computer and use it in GitHub Desktop.
Save N0rbert/2141ad87fcb91f67cad438293ec46986 to your computer and use it in GitHub Desktop.
Bash scripts for compilation and packaging of `gtk3-mushrooms` on Ubuntu 18.04 LTS, 19.04 and 19.10 (pre-beta). Based on https://gist.github.com/lah7/a4dec89e61ee2875406731b3cd0ae90d .
#!/bin/bash -xe
#
# This script is based on gist https://gist.github.com/lah7/a4dec89e61ee2875406731b3cd0ae90d
# by lah7. Further adoption made by Norbert.
#
# Experimental commands I used to compile gtk3-mushrooms on Ubuntu MATE 18.04 LTS.
# gtk3-mushroom patches some of GTK3's quirks.
#
# gtk3-mushrooms: https://github.com/krumelmonster/gtk3-mushrooms
#
# Based on PKGBUILD from the Arch package.
# --> THIS WAS EXPERIMENTAL. USE AT YOUR OWN RISK! <--
#
# Tested on Ubuntu MATE 18.04 LTS (ships with GTK 3.22.30) but it doesn't
# look like all the patches worked (e.g. CSD still on, but dialog buttons less padded)
#
srcdir="/tmp/gtk3-mushrooms"
gtkdir="/tmp/gtk+3.0-3.22.30"
__arch_pkg_commit="fbcc57e8a97827926b6624bb8bc570f675c7188d"
cd /tmp
# Install build dependencies (do not forget to enable `deb-src` repositories)
sudo apt-get build-dep libgtk-3-dev -y
sudo apt-get install devscripts -y
# Clone gtk3-mushrooms repository
git clone --branch 3.22.30-1 https://github.com/krumelmonster/gtk3-mushrooms.git
# Get GTK3 source code
apt-get source libgtk-3-dev
### Patches as used in PKGBUILD ###
function __patch_makefiles() {
function __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 tests examples" \
"Makefile.am"
}
function __patch_gtk_code() {
for patch_file in $srcdir/*.patch; do
patch -d "gtk" -p 3 -i "$patch_file"
done
cat "$srcdir/smaller-adwaita.css" | tee -a gtk/theme/Adwaita/gtk-contained{,-dark}.css > /dev/null
}
function prepare() {
cd "$gtkdir"
# Make building faster by skipping tests, code examples and unused elements.
__patch_makefiles
# Apply patches to GTK code.
__patch_gtk_code
# Commit local changes
# !!! Manually give a name for the patch and write changelog
dpkg-source --commit
}
function build() {
cd "$gtkdir"
debuild -uc -us
}
function package() {
cd "$gtkdir"
sudo apt-get install ../*.deb
}
prepare
build
package
#!/bin/bash -xe
#
# This script is based on gist https://gist.github.com/lah7/a4dec89e61ee2875406731b3cd0ae90d
# by lah7. Further adoption made by Norbert.
#
# Experimental commands I used to compile gtk3-mushrooms on Ubuntu MATE 19.04.
# gtk3-mushroom patches some of GTK3's quirks.
#
# gtk3-mushrooms: https://github.com/krumelmonster/gtk3-mushrooms
#
# Based on PKGBUILD from the Arch package.
# --> THIS WAS EXPERIMENTAL. USE AT YOUR OWN RISK! <--
#
# Tested on Ubuntu MATE 19.04 (ships with GTK 3.24.8) but it doesn't
# look like all the patches worked (e.g. CSD still on, but dialog buttons less padded)
#
srcdir="/tmp/gtk3-mushrooms"
gtkdir="/tmp/gtk+3.0-3.24.8"
__arch_pkg_commit="89cd85e778e9d797f97c66749e5f1d59889b7036"
cd /tmp
# Install build dependencies
sudo apt-get build-dep libgtk-3-dev -y
sudo apt-get install devscripts -y
# Clone gtk3-mushrooms repository
git clone --branch 3.24.8-1 https://github.com/krumelmonster/gtk3-mushrooms.git
# Manually remove patch with conflict (TODO, FIXME)
rm $srcdir/csd__clean-headerbar.patch
# Get GTK3 source code
apt-get source libgtk-3-dev
### Patches as used in PKGBUILD ###
function __patch_makefiles() {
function __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 tests examples" \
"Makefile.am"
}
function __patch_gtk_code() {
for patch_file in $srcdir/*.patch; do
echo
echo "--> $patch_file :"
patch --verbose -d "gtk" -p 3 -i "$patch_file"
echo
done
cat "$srcdir/smaller-adwaita.css" | tee -a gtk/theme/Adwaita/gtk-contained{,-dark}.css > /dev/null
}
function prepare() {
cd "$gtkdir"
# Make building faster by skipping tests, code examples and unused elements.
__patch_makefiles
# Apply patches to GTK code.
__patch_gtk_code
sed -i '/usr\/libexec\/installed-tests\/gtk+/d' debian/gtk-3-examples.install
sed -i '/usr\/share\/installed-tests\/gtk+/d' debian/gtk-3-examples.install
# Commit local changes
# !!! Manually give a name for the patch and write changelog
dpkg-source --commit
}
function build() {
cd "$gtkdir"
debuild -uc -us
}
function package() {
cd "$gtkdir"
sudo apt-get install ../*.deb
}
prepare
build
package
#!/bin/bash -xe
#
# This script is based on gist https://gist.github.com/lah7/a4dec89e61ee2875406731b3cd0ae90d
# by lah7. Further adoption made by Norbert.
#
# Experimental commands I used to compile gtk3-mushrooms on Ubuntu MATE 19.10 (pre beta).
# gtk3-mushroom patches some of GTK3's quirks.
#
# gtk3-mushrooms: https://github.com/krumelmonster/gtk3-mushrooms
#
# Based on PKGBUILD from the Arch package.
# --> THIS WAS EXPERIMENTAL. USE AT YOUR OWN RISK! <--
#
# Tested on Ubuntu MATE 19.10 (ships with GTK 3.24.10) but it doesn't
# look like all the patches worked (e.g. CSD still on, but dialog buttons less padded)
#
srcdir="/tmp/gtk3-mushrooms"
gtkdir="/tmp/gtk+3.0-3.24.10"
__arch_pkg_commit="89cd85e778e9d797f97c66749e5f1d59889b7036"
cd /tmp
# Install build dependencies
sudo apt-get build-dep libgtk-3-dev -y
sudo apt-get install devscripts -y
# Clone gtk3-mushrooms repository
git clone https://github.com/krumelmonster/gtk3-mushrooms.git
# Manually remove patch with conflict (TODO, FIXME)
rm $srcdir/csd__clean-headerbar.patch
# Get GTK3 source code
apt-get source libgtk-3-dev
### Patches as used in PKGBUILD ###
function __patch_makefiles() {
function __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 tests examples" \
"Makefile.am"
}
function __patch_gtk_code() {
for patch_file in $srcdir/*.patch; do
echo
echo "--> $patch_file :"
patch --verbose -d "gtk" -p 3 -i "$patch_file"
echo
done
cat "$srcdir/smaller-adwaita.css" | tee -a gtk/theme/Adwaita/gtk-contained{,-dark}.css > /dev/null
}
function prepare() {
cd "$gtkdir"
# Make building faster by skipping tests, code examples and unused elements.
__patch_makefiles
# Apply patches to GTK code.
__patch_gtk_code
sed -i '/usr\/libexec\/installed-tests\/gtk+/d' debian/gtk-3-examples.install
sed -i '/usr\/share\/installed-tests\/gtk+/d' debian/gtk-3-examples.install
# Commit local changes
# !!! Manually give a name for the patch and write changelog
dpkg-source --commit
}
function build() {
cd "$gtkdir"
debuild -uc -us
}
function package() {
cd "$gtkdir"
sudo apt-get install ../*.deb
}
prepare
build
package
#!/bin/sh -xe
#
# This script is based on gist https://gist.github.com/lah7/a4dec89e61ee2875406731b3cd0ae90d
# by lah7. Further adoption made by Norbert.
#
# Experimental commands I used to compile gtk3-mushrooms on Ubuntu MATE 20.04 LTS
# gtk3-mushroom patches some of GTK3's quirks.
#
# gtk3-mushrooms: https://github.com/krumelmonster/gtk3-mushrooms
#
# Based on PKGBUILD from the Arch package.
# --> THIS WAS EXPERIMENTAL. USE AT YOUR OWN RISK! <--
#
# Tested on Ubuntu MATE 20.04 LTS (ships with GTK 3.24.18) but it doesn't
# look like all the patches worked (e.g. CSD still on, but dialog buttons less padded)
#
srcdir="/tmp/gtk3-mushrooms"
gtkdir="/tmp/gtk+3.0-3.24.18"
__arch_pkg_commit="89cd85e778e9d797f97c66749e5f1d59889b7036"
cd /tmp
# Install build dependencies
sudo apt-get build-dep libgtk-3-dev -y
sudo apt-get install devscripts -y
# Clone gtk3-mushrooms repository
git clone https://github.com/krumelmonster/gtk3-mushrooms.git
# Manually remove patch with conflict (TODO, FIXME)
rm $srcdir/csd__clean-headerbar.patch
# Get GTK3 source code
apt-get source libgtk-3-dev
### Patches as used in PKGBUILD ###
__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 tests examples" \
"Makefile.am"
}
__patch_gtk_code() {
for patch_file in $srcdir/*.patch; do
echo
echo "--> $patch_file :"
patch --verbose -d "gtk" -p 3 -i "$patch_file"
echo
done
cat "$srcdir/smaller-adwaita.css" | tee -a gtk/theme/Adwaita/gtk-contained{,-dark}.css > /dev/null
}
prepare() {
cd "$gtkdir"
# Make building faster by skipping tests, code examples and unused elements.
__patch_makefiles
# Apply patches to GTK code.
__patch_gtk_code
sed -i '/usr\/libexec\/installed-tests\/gtk+/d' debian/gtk-3-examples.install
sed -i '/usr\/share\/installed-tests\/gtk+/d' debian/gtk-3-examples.install
# Commit local changes
# !!! Manually give a name for the patch and write changelog
dpkg-source --commit
}
build() {
cd "$gtkdir"
debuild -uc -us
}
package() {
cd "$gtkdir"
sudo apt-get install ../*.deb
}
prepare
build
package
# Optional Dockerfile for compilation of gtk3-mushrooms on Ubuntu.
# Change codename to necessary version (this file is for 20.04 LTS *focal*)
#
FROM ubuntu:focal
ENV DEBIAN_FRONTEND noninteractive
RUN echo "deb-src http://archive.ubuntu.com/ubuntu/ focal main multiverse multiverse restricted" >> /etc/apt/sources.list
RUN echo "deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main multiverse multiverse restricted" >> /etc/apt/sources.list
RUN echo "deb-src http://archive.ubuntu.com/ubuntu/ focal-security main multiverse multiverse restricted" >> /etc/apt/sources.list
RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y openssh-client mc htop nano byobu sudo && \
apt-get build-dep libgtk-3-dev -y && \
apt-get install checkinstall devscripts -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment