Skip to content

Instantly share code, notes, and snippets.

@alphapapa
Last active January 26, 2022 03:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alphapapa/c17c1098da70c587dd4d75bbc4af1236 to your computer and use it in GitHub Desktop.
Save alphapapa/c17c1098da70c587dd4d75bbc4af1236 to your computer and use it in GitHub Desktop.
Patch Firefox 49.0.2 to build with Gtk2
This 1) adjusts the Mozilla mozconfig.gtk file according
to the comments in it, and 2) removes a directory from
the debian/firefox.install.in file that comes up empty
when building with Gtk2, which then causes the package
build to fail due to trying to include files from an
empty directory (don't ask me why the gtk2 directory
is empty when built with Gtk2).
---
build/unix/mozconfig.gtk | 25 +------------------------
debian/firefox.install.in | 1 -
2 files changed, 1 insertion(+), 25 deletions(-)
diff --git a/build/unix/mozconfig.gtk b/build/unix/mozconfig.gtk
index 46a34b8..9c4726d 100644
--- a/build/unix/mozconfig.gtk
+++ b/build/unix/mozconfig.gtk
@@ -1,26 +1,3 @@
# To do try builds with Gtk+2, uncomment the following line, and remove
# everything after that.
-#ac_add_options --enable-default-toolkit=cairo-gtk2
-
-TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
-
-# $TOOLTOOL_DIR/gtk3 comes from tooltool, and must be included in the tooltool manifest.
-if [ -z "$PKG_CONFIG_LIBDIR" ]; then
- echo PKG_CONFIG_LIBDIR must be set >&2
- exit 1
-fi
-export PKG_CONFIG_SYSROOT_DIR="$TOOLTOOL_DIR/gtk3"
-export PKG_CONFIG_PATH="$TOOLTOOL_DIR/gtk3/usr/local/lib/pkgconfig"
-PKG_CONFIG="$TOOLTOOL_DIR/gtk3/usr/local/bin/pkg-config"
-export PATH="$TOOLTOOL_DIR/gtk3/usr/local/bin:${PATH}"
-# Ensure cairo, gdk-pixbuf, etc. are not taken from the system installed packages.
-LDFLAGS="-L$TOOLTOOL_DIR/gtk3/usr/local/lib ${LDFLAGS}"
-ac_add_options --enable-default-toolkit=cairo-gtk3
-
-# Set things up to use Gtk+3 from the tooltool package
-mk_add_options "export FONTCONFIG_PATH=$TOOLTOOL_DIR/gtk3/usr/local/etc/fonts"
-mk_add_options "export PANGO_SYSCONFDIR=$TOOLTOOL_DIR/gtk3/usr/local/etc"
-mk_add_options "export PANGO_LIBDIR=$TOOLTOOL_DIR/gtk3/usr/local/lib"
-mk_add_options "export GDK_PIXBUF_MODULE_FILE=$TOOLTOOL_DIR/gtk3/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
-mk_add_options "export GDK_PIXBUF_MODULEDIR=$TOOLTOOL_DIR/gtk3/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders"
-mk_add_options "export LD_LIBRARY_PATH=$TOOLTOOL_DIR/gtk3/usr/local/lib"
+ac_add_options --enable-default-toolkit=cairo-gtk2
diff --git a/debian/firefox.install.in b/debian/firefox.install.in
index 846e386..b669921 100644
--- a/debian/firefox.install.in
+++ b/debian/firefox.install.in
@@ -11,7 +11,6 @@
# GRE files (except for dictionaries/, which we symlink elsewhere)
@MOZ_LIBDIR@/defaults
@MOZ_LIBDIR@/gmp-clearkey
-@MOZ_LIBDIR@/gtk2
@MOZ_LIBDIR@/*.dat
@MOZ_LIBDIR@/omni.ja
@MOZ_LIBDIR@/*.so
--
2.7.4
This file overrides the Mozilla-supplied build configuration
when building with Debian tools. I'm not sure if this is the only
change needed, or if the ones in the first patch are also necessary.
IIRC this was not necessary back around Firefox version 47. I guess
Debian/Ubuntu changed the packaging or something. It seems to be
changing and getting more complicated all the time.
So, in the end, to build with Gtk2, I'm not sure whether only the Debian
packaging needs to be adjusted, or if both the Debian packaging and the
Firefox source itself needs to be adjusted. But both of these patches
combined seem to work.
---
debian/config/mozconfig.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/debian/config/mozconfig.in b/debian/config/mozconfig.in
index 2ef6442..1b4825b 100644
--- a/debian/config/mozconfig.in
+++ b/debian/config/mozconfig.in
@@ -78,3 +78,6 @@ ac_add_options --enable-system-ffi
# Coulson (chris.coulson@canonical.com) for more info
ac_add_options --with-google-api-keyfile=@TOPSRCDIR@/debian/ga
ac_add_options --with-google-oauth-api-keyfile=@TOPSRCDIR@/debian/go
+
+# Switch to Gtk2 (line comes from build/unix/mozconfig.gtk)
+ac_add_options --enable-default-toolkit=cairo-gtk2
--
2.7.4
@msjyoo
Copy link

msjyoo commented Feb 11, 2017

None of the files changed existed on the APT source package Firefox 51 (unstable)? :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment