[dwb] Path to disable HSTS support (fixing build failure)

Sébastien Willmann wilqu at fedoraproject.org
Sun Apr 14 10:08:22 UTC 2013


commit afac0543715b380d9d8f8e8e8ffceb2819553a23
Author: Sebastien Willmann <Sébastien Willmann sebastien.willmann at gmail.com>
Date:   Sun Apr 14 12:07:24 2013 +0200

    Path to disable HSTS support (fixing build failure)

 disable_hsts.patch |  192 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 dwb.spec           |    8 ++-
 2 files changed, 198 insertions(+), 2 deletions(-)
---
diff --git a/disable_hsts.patch b/disable_hsts.patch
new file mode 100644
index 0000000..3fd77c5
--- /dev/null
+++ b/disable_hsts.patch
@@ -0,0 +1,192 @@
+diff -r e577a59fcd63 config.mk
+--- a/config.mk	Sat Mar 30 15:03:46 2013 +0100
++++ b/config.mk	Sun Apr 07 23:19:35 2013 +0200
+@@ -146,10 +146,17 @@
+ CFLAGS += -DWITH_LIBSOUP_2_38=1
+ endif
+ 
++ifeq (${DISABLE_HSTS}, 1)
++CFLAGS += -DDISABLE_HSTS
++else 
++M4FLAGS += --define=WITH_HSTS=1
++endif
++
+ # If execinfo.h is not available, e.g. freebsd
+ ifneq (${WITHOUT_EXECINFO}, 1)
+ CFLAGS += -DHAS_EXECINFO
+ endif
++
+ CFLAGS_OPTIONS := $(CFLAGS)
+ 
+ ifeq (USEGTK3, 1) 
+diff -r e577a59fcd63 m4/settings.m4
+--- a/m4/settings.m4	Sat Mar 30 15:03:46 2013 +0100
++++ b/m4/settings.m4	Sun Apr 07 23:19:35 2013 +0200
+@@ -122,7 +122,9 @@
+ html_input(enable-java-applet, checkbox, Whether to enable java applets)
+ html_input(enable-plugins, checkbox, Whether to enable plugins)
+ html_input(enable-scripts, checkbox, Enable embedded scripting languages)
++ifdef(`WITH_HSTS', 
+ html_input(hsts, checkbox, Whether HSTS support should be enabled)
++)
+ html_input(javascript-can-access-clipboard, checkbox, Whether javascript can access the clipboard)
+ html_input(javascript-can-open-windows-automatically, checkbox, Whether javascript can open windows)
+ html_input(javascript-schemes, checkbox, Whether to allow loading url with scheme "javascript")
+diff -r e577a59fcd63 src/config.h
+--- a/src/config.h	Sat Mar 30 15:03:46 2013 +0100
++++ b/src/config.h	Sun Apr 07 23:19:35 2013 +0200
+@@ -1147,8 +1147,10 @@
+     SETTING_GLOBAL,  BOOLEAN, { .b = false }, (S_Func)dwb_set_adblock,   { 0 }, }, 
+   { { "adblocker-filterlist",                    "Path to a filterlist", },                   
+     SETTING_GLOBAL,  CHAR, { .p = NULL }, NULL,   { 0 }, }, 
++#ifndef DISABLE_HSTS
+   { { "hsts",                                    "Whether HSTS support should be enabled",},
+     SETTING_GLOBAL,  BOOLEAN, { .b = false }, (S_Func)dwb_set_hsts,       { 0 }, },
++#endif
+ #ifdef WITH_LIBSOUP_2_38 
+   { { "addressbar-dns-lookup",                               "Whether to perform a dns check for text typed into the address bar", },                   
+     SETTING_GLOBAL | SETTING_ONINIT,  BOOLEAN, { .b = false }, (S_Func)dwb_set_dns_lookup,   { 0 }, }, 
+diff -r e577a59fcd63 src/dwb.c
+--- a/src/dwb.c	Sat Mar 30 15:03:46 2013 +0100
++++ b/src/dwb.c	Sun Apr 07 23:19:35 2013 +0200
+@@ -48,7 +48,10 @@
+ #include "application.h"
+ #include "scripts.h"
+ #include "dom.h"
++
++#ifndef DISABLE_HSTS
+ #include "hsts.h"
++#endif
+ 
+ /* DECLARATIONS {{{*/
+ static DwbStatus dwb_webkit_setting(GList *, WebSettings *);
+@@ -193,6 +196,7 @@
+     g_object_set(webkit_get_default_session(), "accept-language", s->arg_local.p, NULL);
+     return STATUS_OK;
+ }/*}}}*/
++#ifndef DISABLE_HSTS
+ void
+ dwb_set_hsts(GList *gl, WebSettings *s) 
+ {
+@@ -205,6 +209,7 @@
+         hsts_deactivate();
+     }
+ }
++#endif
+ 
+ /*{{{*/
+ //static DwbStatus 
+@@ -3449,7 +3454,9 @@
+     for (GList *gl = dwb.state.views; gl; gl=gl->next) 
+         view_clean(gl);
+     
++#ifndef DISABLE_HSTS
+     hsts_end(); /* Assumes it has access to dwb.settings */
++#endif
+     for (GList *l = dwb.keymap; l; l=l->next) {
+         KeyMap *m = l->data;
+         if (m->map->prop & CP_SCRIPT) 
+@@ -4410,8 +4417,10 @@
+     dwb_check_create(dwb.files[FILES_PLUGINS_ALLOW]);
+     dwb.files[FILES_CUSTOM_KEYS]     = g_build_filename(profile_path, "custom_keys",      NULL);
+     dwb_check_create(dwb.files[FILES_CUSTOM_KEYS]);
++#ifndef DISABLE_HSTS
+     dwb.files[FILES_HSTS]            = g_build_filename(profile_path, "hsts",             NULL);
+     dwb_check_create(dwb.files[FILES_HSTS]);
++#endif
+ 
+     userscripts               = g_build_filename(path, "userscripts",   NULL);
+     dwb.files[FILES_USERSCRIPTS]     = util_check_directory(userscripts);
+@@ -4621,7 +4630,9 @@
+     dwb_init_hints(NULL, NULL);
+ 
+     dwb_soup_init();
++#ifndef DISABLE_HSTS
+     hsts_init();
++#endif
+ } /*}}}*/ /*}}}*/
+ 
+ /* FIFO {{{*/
+diff -r e577a59fcd63 src/dwb.h
+--- a/src/dwb.h	Sat Mar 30 15:03:46 2013 +0100
++++ b/src/dwb.h	Sun Apr 07 23:19:35 2013 +0200
+@@ -810,7 +810,9 @@
+   FILES_COOKIES_SESSION_ALLOW,
+   FILES_DOWNLOAD_PATH,
+   FILES_HISTORY,
++#ifndef DISABLE_HSTS
+   FILES_HSTS,
++#endif
+   FILES_KEYS,
+   FILES_MIMETYPES,
+   FILES_QUICKMARKS,
+@@ -968,7 +970,9 @@
+ 
+ gboolean dwb_entry_activate(GdkEventKey *e);
+ void dwb_set_adblock(GList *, WebSettings *);
++#ifndef DISABLE_HSTS
+ void dwb_set_hsts(GList *, WebSettings *);
++#endif
+ 
+ gboolean dwb_eval_key(GdkEventKey *);
+ gboolean dwb_eval_override_key(GdkEventKey *e, CommandProperty prop);
+diff -r e577a59fcd63 src/hsts.c
+--- a/src/hsts.c	Sat Mar 30 15:03:46 2013 +0100
++++ b/src/hsts.c	Sun Apr 07 23:19:35 2013 +0200
+@@ -15,6 +15,7 @@
+  * with this program; if not, write to the Free Software Foundation, Inc.,
+  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+  */
++#ifndef DISABLE_HSTS
+ #include <stdio.h>
+ #include <string.h>
+ #include <glib-object.h>
+@@ -920,3 +921,4 @@
+         s_init = false;
+     }
+ }
++#endif
+diff -r e577a59fcd63 src/hsts.h
+--- a/src/hsts.h	Sat Mar 30 15:03:46 2013 +0100
++++ b/src/hsts.h	Sun Apr 07 23:19:35 2013 +0200
+@@ -16,6 +16,7 @@
+  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+  */
+ 
++#ifndef DISABLE_HSTS
+ #ifndef HSTS_H
+ #define HSTS_H
+ 
+@@ -27,3 +28,4 @@
+ void hsts_deactivate();
+ 
+ #endif // HSTS_H
++#endif
+diff -r e577a59fcd63 src/util/Makefile
+--- a/src/util/Makefile	Sat Mar 30 15:03:46 2013 +0100
++++ b/src/util/Makefile	Sun Apr 07 23:19:35 2013 +0200
+@@ -8,6 +8,7 @@
+ MKTLDS=mktlds-header
+ MKTLDS_SRC=mktlds-header.c
+ 
++
+ HSTS=convert_transport_security
+ HSTS_PRELOAD=$(BASE_DIR)/$(SRCDIR)/hsts_preload.h
+ TRANSPORT_SECURITY_JSON=transport_security_state_static.json
+@@ -17,8 +18,14 @@
+ CFLAGS+=$(shell pkg-config --cflags $(LIBS))
+ LDFLAGS=$(shell pkg-config --libs $(LIBS))
+ 
++ifeq (${DISABLE_HSTS}, 1)
++OUTFILES=$(TLDS_H)
++GEN_TOOLS=$(MKTLDS)
++else
++GEN_TOOLS=$(HSTS) $(MKTLDS)
+ OUTFILES=$(HSTS_PRELOAD) $(TLDS_H)
+-GEN_TOOLS=$(HSTS) $(MKTLDS)
++endif
++
+ 
+ all: $(OUTFILES)
+ 
+
diff --git a/dwb.spec b/dwb.spec
index 5eb2d2f..e0f1d3b 100644
--- a/dwb.spec
+++ b/dwb.spec
@@ -9,6 +9,8 @@ License:        GPLv3+
 URL:            https://bitbucket.org/portix/dwb/wiki/Home
 Source0:        https://bitbucket.org/portix/dwb/downloads/%{name}-%{version}.tar.gz
 
+Patch0:         disable_hsts.patch
+
 BuildRequires:  readline-devel
 BuildRequires:  gtk3-devel
 BuildRequires:  webkitgtk3-devel
@@ -21,13 +23,14 @@ that aims to be mostly keyboard-driven.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
-make GTK=3 %{?_smp_mflags}
+make GTK=3 DISABLE_HSTS=1 %{?_smp_mflags}
 
 %install
 rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
+make install GTK=3 DISABLE_HSTS=1 DESTDIR=$RPM_BUILD_ROOT
 desktop-file-validate $RPM_BUILD_ROOT/%{_datadir}/applications/%{name}.desktop
 
 %post
@@ -51,6 +54,7 @@ update-desktop-database &> /dev/null || :
 %changelog
 * Tue Apr 02 2013 Sébastien Willmann <sebastien.willmann at gmail.com> - 2013.03.30-1
 - Update to version 2013.03.30
+- Disable HSTS support to resolve build failure
 
 * Wed Feb 13 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2012.12.03-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild


More information about the scm-commits mailing list