diff -urN libreoffice-5.3.3.2-orig/Repository.mk libreoffice-5.3.3.2/Repository.mk
--- libreoffice-5.3.3.2-orig/Repository.mk	2017-05-04 01:46:29 +0900
+++ libreoffice-5.3.3.2/Repository.mk	2017-06-01 18:21:32 +0900
@@ -215,7 +215,7 @@
 	scd \
 	scfilt \
 	scui \
-	wpftcalc \
+	$(if $(filter YES,$(BUILD_OLD_DOC_FILTERS)),wpftcalc) \
 	$(if $(ENABLE_COINMP)$(ENABLE_LPSOLVE),solver) \
 	$(call gb_Helper_optional,SCRIPTING,vbaobj) \
 ))
@@ -223,7 +223,7 @@
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,graphicfilter, \
 	svgfilter \
 	flash \
-	wpftdraw \
+	$(if $(filter YES,$(BUILD_OLD_DOC_FILTERS)),wpftdraw) \
 	graphicfilter \
 ))
 
@@ -243,7 +243,7 @@
 	placeware \
 	PresenterScreen \
 	PresentationMinimizer \
-	wpftimpress \
+	$(if $(filter YES,$(BUILD_OLD_DOC_FILTERS)),wpftimpress) \
 ))
 
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,onlineupdate, \
@@ -418,7 +418,7 @@
 	$(if $(USING_X11), \
 		vclplug_gen \
 	) \
-	writerperfect \
+	$(if $(filter YES,$(BUILD_OLD_DOC_FILTERS)),writerperfect) \
 	xmlscript \
 	xmlfa \
 	xmlfd \
@@ -478,7 +478,7 @@
 	swui \
 	t602filter \
 	$(call gb_Helper_optional,SCRIPTING,vbaswobj) \
-	wpftwriter \
+	$(if $(filter YES,$(BUILD_OLD_DOC_FILTERS)),wpftwriter) \
 	writerfilter \
 ))
 
@@ -950,7 +950,7 @@
 	$(if $(ENABLE_ONLINE_UPDATE),updchk) \
 	uui \
 	vcl \
-	writerperfect \
+	$(if $(filter YES,$(BUILD_OLD_DOC_FILTERS)),writerperfect) \
 	wzi \
 	xmlsec \
 	xsltdlg \
@@ -998,7 +998,7 @@
 	$(if $(ENABLE_TELEPATHY),tubes) \
 	uui \
 	vcl \
-	writerperfect \
+	$(if $(filter YES,$(BUILD_OLD_DOC_FILTERS)),writerperfect) \
 	xmlsec \
 ))
 
diff -urN libreoffice-5.3.3.2-orig/RepositoryExternal.mk libreoffice-5.3.3.2/RepositoryExternal.mk
--- libreoffice-5.3.3.2-orig/RepositoryExternal.mk	2017-05-04 01:46:29 +0900
+++ libreoffice-5.3.3.2/RepositoryExternal.mk	2017-06-01 18:21:32 +0900
@@ -1591,6 +1591,7 @@
 endif # DISABLE_OPENSSL
 
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
 ifneq ($(SYSTEM_CDR),)
 
 define gb_LinkTarget__use_cdr
@@ -1616,6 +1617,7 @@
 endef
 
 endif # SYSTEM_CDR
+endif # BUILD_OLD_DOC_FILTERS
 
 
 ifneq ($(SYSTEM_EBOOK),)
@@ -1653,6 +1655,7 @@
 endif # SYSTEM_EBOOK
 
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
 ifneq ($(SYSTEM_ETONYEK),)
 
 define gb_LinkTarget__use_etonyek
@@ -1714,8 +1717,10 @@
 endif
 
 endif # SYSTEM_ETONYEK
+endif # BUILD_OLD_DOC_FILTER
 
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
 ifneq ($(SYSTEM_FREEHAND),)
 
 define gb_LinkTarget__use_freehand
@@ -1749,8 +1754,10 @@
 endef
 
 endif # SYSTEM_FREEHAND
+endif # BUILD_OLD_DOC_FILTERS
 
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
 ifneq ($(SYSTEM_ODFGEN),)
 
 define gb_LinkTarget__use_odfgen
@@ -1804,6 +1811,7 @@
 endif
 
 endif # SYSTEM_ODFGEN
+endif # BUILD_OLD_DOC_FILTERS
 
 
 ifneq ($(SYSTEM_REVENGE),)
@@ -1872,6 +1880,7 @@
 endif # SYSTEM_REVENGE
 
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
 ifneq ($(SYSTEM_ABW),)
 
 define gb_LinkTarget__use_abw
@@ -1903,8 +1912,10 @@
 endef
 
 endif # SYSTEM_ABW
+endif # BUILD_OLD_DOC_FILTERS
 
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
 ifneq ($(SYSTEM_MSPUB),)
 
 define gb_LinkTarget__use_mspub
@@ -1931,8 +1942,10 @@
 endef
 
 endif # SYSTEM_MSPUB
+endif # BUILD_OLD_DOC_FILTERS
 
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
 ifneq ($(SYSTEM_PAGEMAKER),)
 
 define gb_LinkTarget__use_pagemaker
@@ -1964,6 +1977,7 @@
 endef
 
 endif # SYSTEM_PAGEMAKER
+endif # BUILD_OLD_DOC_FILTERS
 
 
 ifneq ($(SYSTEM_ZMF),)
@@ -1999,6 +2013,7 @@
 endif # SYSTEM_ZMF
 
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
 ifneq ($(SYSTEM_VISIO),)
 
 define gb_LinkTarget__use_visio
@@ -2025,8 +2040,10 @@
 endef
 
 endif # SYSTEM_VISIO
+endif # BUILD_OLD_DOC_FILTERS
 
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
 ifneq ($(SYSTEM_WPD),)
 
 define gb_LinkTarget__use_wpd
@@ -2090,8 +2107,10 @@
 endif # MSC
 
 endif # SYSTEM_WPD
+endif # BUILD_OLD_DOC_FILTERS
 
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
 ifneq ($(SYSTEM_WPG),)
 
 define gb_LinkTarget__use_wpg
@@ -2145,8 +2164,10 @@
 endif # MSC
 
 endif # SYSTEM_WPG
+endif # BUILD_OLD_DOC_FILTERS
 
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
 ifneq ($(SYSTEM_WPS),)
 
 define gb_LinkTarget__use_wps
@@ -2201,8 +2222,10 @@
 endif # MSC
 
 endif # SYSTEM_WPS
+endif # BUILD_OLD_DOC_FILTERS
 
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
 ifneq ($(SYSTEM_MWAW),)
 
 define gb_LinkTarget__use_mwaw
@@ -2256,7 +2279,9 @@
 endif # MSC
 
 endif # SYSTEM_MWAW
+endif # BUILD_OLD_DOC_FILTERS
 
+ifeq ($(BUILD_OLD_DOC_FILTERS),YES)
 ifneq ($(SYSTEM_STAROFFICE),)
 
 define gb_LinkTarget__use_staroffice
@@ -2310,6 +2335,7 @@
 endif # MSC
 
 endif # SYSTEM_STAROFFICE
+endif # BUILD_OLD_DOC_FILTERS
 
 
 ifneq ($(SYSTEM_LCMS2),)
diff -urN libreoffice-5.3.3.2-orig/config_host.mk.in libreoffice-5.3.3.2/config_host.mk.in
--- libreoffice-5.3.3.2-orig/config_host.mk.in	2017-05-04 01:46:29 +0900
+++ libreoffice-5.3.3.2/config_host.mk.in	2017-06-01 18:21:32 +0900
@@ -48,6 +48,7 @@
 export BUILD_TYPE=@BUILD_TYPE@
 export BUILD_UNOWINREG=@BUILD_UNOWINREG@
 export BUILD_VER_STRING=@BUILD_VER_STRING@
+export BUILD_OLD_DOC_FILTERS=@BUILD_OLD_DOC_FILTERS@
 export BUILD_X64=@BUILD_X64@
 export BZIP2_CFLAGS=$(gb_SPACE)@BZIP2_CFLAGS@
 export BZIP2_LIBS=$(gb_SPACE)@BZIP2_LIBS@
diff -urN libreoffice-5.3.3.2-orig/configure.ac libreoffice-5.3.3.2/configure.ac
--- libreoffice-5.3.3.2-orig/configure.ac	2017-05-04 01:46:29 +0900
+++ libreoffice-5.3.3.2/configure.ac	2017-06-01 18:21:32 +0900
@@ -869,6 +869,7 @@
     enable_coinmp=yes
     enable_lpsolve=no
     enable_report_builder=no
+    enable_old_doc_filters=no
     with_theme="tango"
     test_cups=no
     test_dbus=no
@@ -1670,6 +1671,11 @@
         [Specify external thesaurus dir.]),
 ,)
 
+AC_ARG_ENABLE(old-doc-filters,
+    AS_HELP_STRING([--disable-old-doc-filters],
+        [Don't include import/export filters for old document formats.]),,
+    [enable_old_doc_filters=yes])
+
 AC_ARG_WITH(system-zlib,
     AS_HELP_STRING([--with-system-zlib],
         [Use zlib already on system.]),,
@@ -7859,6 +7865,13 @@
 fi
 AC_SUBST([ENABLE_EOT])
 
+if test "$enable_old_doc_filters" = "no"; then
+    BUILD_OLD_DOC_FILTERS=NO
+else
+    BUILD_OLD_DOC_FILTERS=YES
+fi
+AC_SUBST(BUILD_OLD_DOC_FILTERS)
+
 dnl ===================================================================
 dnl Check for DLP libs
 dnl ===================================================================
@@ -7868,44 +7881,122 @@
 )
 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
 
-libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libodfgen to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_ODFGEN=
+else
+    libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
+fi
 
-AS_IF([test "$COM" = "MSC"],
-      [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
-      [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
-)
-libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libwpd to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_WPD=NO
+else
+    AS_IF([test "$COM" = "MSC"],
+          [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
+          [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
+    )
+    libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
+fi
 
-libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libwpg to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_WPG=NO
+else
+    libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
+fi
 
-libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
-libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.4])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libwps to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_WPS=
+else
+    libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
+    libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.4])
+fi
 
-libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libvisio to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_VISIO=
+else
+    libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
+fi
 
-libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libcdr to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_CDR=
+else
+    libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
+fi
 
-libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libmspub to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_MSPUB=
+else
+    libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
+fi
 
-libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
-libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.9])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libmwaw to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_MWAW=
+else
+    libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
+    libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.9])
+fi
 
-libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
-libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.5])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libetonyek to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_ETONYEK=
+else
+    libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
+    libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.5])
+fi
 
-libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libfreehand to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_FREEHAND=
+else
+    libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
+fi
 
 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
 
-libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libabw to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_ABW=
+else
+    libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
+fi
 
-libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libpagemaker to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_PAGEMAKER=
+else
+    libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
+fi
 
 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
 
-libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
-libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.2])
+if test "$BUILD_OLD_DOC_FILTERS" = "NO"; then
+    AC_MSG_CHECKING([which libstaroffice to use])
+    AC_MSG_RESULT([none])
+    SYSTEM_STAROFFICE=
+else
+    libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
+    libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.2])
+fi
 
 dnl ===================================================================
 dnl Check for system libcmis
diff -urN libreoffice-5.3.3.2-orig/postprocess/Rdb_services.mk libreoffice-5.3.3.2/postprocess/Rdb_services.mk
--- libreoffice-5.3.3.2-orig/postprocess/Rdb_services.mk	2017-05-04 01:46:29 +0900
+++ libreoffice-5.3.3.2/postprocess/Rdb_services.mk	2017-06-01 18:21:32 +0900
@@ -120,10 +120,12 @@
 		sccomp/source/solver/lpsolvesolver \
 	) \
 	writerfilter/util/writerfilter \
-	writerperfect/source/draw/wpftdraw \
-	writerperfect/source/impress/wpftimpress \
-	writerperfect/source/writer/wpftwriter \
-	writerperfect/source/calc/wpftcalc \
+	$(if $(filter YES,$(BUILD_OLD_DOC_FILTERS)), \
+		writerperfect/source/draw/wpftdraw \
+		writerperfect/source/impress/wpftimpress \
+		writerperfect/source/writer/wpftwriter \
+		writerperfect/source/calc/wpftcalc \
+	) \
 	$(if $(filter MACOSX,$(OS)), \
 		$(call gb_Helper_optional,AVMEDIA,avmedia/source/macavf/avmediaMacAVF) \
 		$(if $(filter TRUE,$(ENABLE_MACOSX_SANDBOX)),, \
diff -urN libreoffice-5.3.3.2-orig/scp2/InstallModule_ooo.mk libreoffice-5.3.3.2/scp2/InstallModule_ooo.mk
--- libreoffice-5.3.3.2-orig/scp2/InstallModule_ooo.mk	2017-05-04 01:46:29 +0900
+++ libreoffice-5.3.3.2/scp2/InstallModule_ooo.mk	2017-06-01 18:21:32 +0900
@@ -18,6 +18,7 @@
 ))
 
 $(eval $(call gb_InstallModule_define_if_set,scp2/ooo,\
+	BUILD_OLD_DOC_FILTERS \
 	ENABLE_GTK \
 	ENABLE_SYSTRAY_GTK \
 	ENABLE_GTK3 \
diff -urN libreoffice-5.3.3.2-orig/scp2/source/ooo/file_ooo.scp libreoffice-5.3.3.2/scp2/source/ooo/file_ooo.scp
--- libreoffice-5.3.3.2-orig/scp2/source/ooo/file_ooo.scp	2017-05-04 01:46:29 +0900
+++ libreoffice-5.3.3.2/scp2/source/ooo/file_ooo.scp	2017-06-01 18:21:32 +0900
@@ -217,7 +217,9 @@
 #endif
 UI_FILELIST(uui, "UIConfig/uui.filelist")
 UI_FILELIST(vcl, "UIConfig/vcl.filelist")
+#ifdef BUILD_OLD_DOC_FILTERS
 UI_FILELIST(writerperfect, "UIConfig/writerperfect.filelist")
+#endif
 UI_FILELIST(xmlsec, "UIConfig/xmlsec.filelist")
 
 UI_FILELIST_ALL_LANG(basicide, modules/BasicIDE)
diff -urN libreoffice-5.3.3.2-orig/scp2/source/ooo/file_resource_ooo.scp libreoffice-5.3.3.2/scp2/source/ooo/file_resource_ooo.scp
--- libreoffice-5.3.3.2-orig/scp2/source/ooo/file_resource_ooo.scp	2017-05-04 01:46:29 +0900
+++ libreoffice-5.3.3.2/scp2/source/ooo/file_resource_ooo.scp	2017-06-01 18:22:16 +0900
@@ -91,7 +91,9 @@
 
 STD_RES_FILE( gid_File_Res_Vcl, vcl )
 
+#ifdef BUILD_OLD_DOC_FILTERS
 STD_RES_FILE( gid_File_Res_Writerperfect, writerperfect )
+#endif
 
 STD_RES_FILE( gid_File_Res_Wzi, wzi )
 
diff -urN libreoffice-5.3.3.2-orig/writerperfect/Module_writerperfect.mk libreoffice-5.3.3.2/writerperfect/Module_writerperfect.mk
--- libreoffice-5.3.3.2-orig/writerperfect/Module_writerperfect.mk	2017-05-04 01:46:29 +0900
+++ libreoffice-5.3.3.2/writerperfect/Module_writerperfect.mk	2017-06-01 18:21:32 +0900
@@ -19,6 +19,8 @@
 
 $(eval $(call gb_Module_Module,writerperfect))
 
+ifneq (NO,$(BUILD_OLD_DOC_FILTERS))
+
 $(eval $(call gb_Module_add_targets,writerperfect,\
 	Library_wpftcalc \
 	Library_wpftdraw \
@@ -44,4 +46,6 @@
 	StaticLibrary_writerperfect_importtestbase \
 ))
 
+endif
+
 # vim: set noet sw=4 ts=4:
