From 11d41e980a5e2d5a4f75183af422a99a79692fc4 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 3 Nov 2013 20:07:33 +0200 Subject: fdo#70393: move languagetool to a subdir of external Change-Id: I402682f21d16c3069d5b6885bd75998bd2e16b3f Reviewed-on: https://gerrit.libreoffice.org/6544 Reviewed-by: David Tardon Tested-by: David Tardon --- .../languagetool/ExtensionPackage_LanguageTool.mk | 14 ++ .../languagetool/ExternalProject_languagetool.mk | 42 ++++++ .../languagetool/JLanguageTool-1.4.0-no-hc.patch | 22 ++++ external/languagetool/JLanguageTool-1.7.0.patch | 141 +++++++++++++++++++++ external/languagetool/Makefile | 7 + external/languagetool/MessageBox-apichange.patch | 30 +++++ external/languagetool/Module_languagetool.mk | 22 ++++ external/languagetool/README | 5 + .../languagetool/UnpackedTarball_languagetool.mk | 22 ++++ 9 files changed, 305 insertions(+) create mode 100644 external/languagetool/ExtensionPackage_LanguageTool.mk create mode 100644 external/languagetool/ExternalProject_languagetool.mk create mode 100644 external/languagetool/JLanguageTool-1.4.0-no-hc.patch create mode 100644 external/languagetool/JLanguageTool-1.7.0.patch create mode 100644 external/languagetool/Makefile create mode 100644 external/languagetool/MessageBox-apichange.patch create mode 100644 external/languagetool/Module_languagetool.mk create mode 100644 external/languagetool/README create mode 100644 external/languagetool/UnpackedTarball_languagetool.mk (limited to 'external/languagetool') diff --git a/external/languagetool/ExtensionPackage_LanguageTool.mk b/external/languagetool/ExtensionPackage_LanguageTool.mk new file mode 100644 index 000000000000..3b685d707449 --- /dev/null +++ b/external/languagetool/ExtensionPackage_LanguageTool.mk @@ -0,0 +1,14 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_ExtensionPackage_ExtensionPackage,LanguageTool,$(call gb_UnpackedTarball_get_dir,languagetool)/dist/LanguageTool.oxt)) + +$(eval $(call gb_ExtensionPackage_use_external_project,LanguageTool,languagetool)) + +# vim: set noet sw=4 ts=4: diff --git a/external/languagetool/ExternalProject_languagetool.mk b/external/languagetool/ExternalProject_languagetool.mk new file mode 100644 index 000000000000..20ebdf576fec --- /dev/null +++ b/external/languagetool/ExternalProject_languagetool.mk @@ -0,0 +1,42 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_ExternalProject_ExternalProject,languagetool)) + +$(eval $(call gb_ExternalProject_register_targets,languagetool,\ + build \ +)) + +$(eval $(call gb_ExternalProject_use_jars,languagetool,\ + juh \ + jurt \ + ridl \ + unoil \ +)) + +$(call gb_ExternalProject_get_state_target,languagetool,build) : + cd "$(call gb_UnpackedTarball_get_dir,languagetool)" && \ + $(ICECREAM_RUN) "$(ANT)" \ + -q \ + -f build.xml \ + -Dbuild.label="build-$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)" \ + $(if $(filter yes,$(JAVACISGCJ))\ + ,-Dbuild.compiler=gcj \ + ,-Dant.build.javac.source=$(JAVA_SOURCE_VER) \ + -Dant.build.javac.target=$(JAVA_TARGET_VER) \ + ) \ + $(if $(debug),-Dbuild.debug="on") \ + -Dext.ooo.juh.lib="$(call gb_Jar_get_target,juh)" \ + -Dext.ooo.jurt.lib="$(call gb_Jar_get_target,jurt)" \ + -Dext.ooo.ridl.lib="$(call gb_Jar_get_target,ridl)" \ + -Dext.ooo.unoil.lib="$(call gb_Jar_get_target,unoil)" \ + dist && \ + touch $@ + +# vim: set noet sw=4 ts=4: diff --git a/external/languagetool/JLanguageTool-1.4.0-no-hc.patch b/external/languagetool/JLanguageTool-1.4.0-no-hc.patch new file mode 100644 index 000000000000..4337ec6eb697 --- /dev/null +++ b/external/languagetool/JLanguageTool-1.4.0-no-hc.patch @@ -0,0 +1,22 @@ +--- misc/build/JLanguageTool-1.7.0/build.xml 2012-02-29 22:18:05.118789546 +0100 ++++ misc/build/JLanguageTool-1.7.0/build.xml 2012-02-29 22:17:02.385235706 +0100 +@@ -82,7 +82,6 @@ + + + +- + + + +--- misc/build/JLanguageTool-1.7.0/openoffice/Linguistic.xcu 2011-06-26 20:29:43.000000000 +0200 ++++ misc/build/JLanguageTool-1.7.0/openoffice/Linguistic.xcu 2012-02-29 22:17:25.551071099 +0100 +@@ -27,9 +27,6 @@ + + %origin%/images/dialog.png + +- +- %origin%/images/dialogh.png +- + + + diff --git a/external/languagetool/JLanguageTool-1.7.0.patch b/external/languagetool/JLanguageTool-1.7.0.patch new file mode 100644 index 000000000000..782b683af79e --- /dev/null +++ b/external/languagetool/JLanguageTool-1.7.0.patch @@ -0,0 +1,141 @@ +diff -Naur misc/build/JLanguageTool-1.7.0/build.xml misc/build/JLanguageTool-1.7.0_patched/build.xml +--- misc/build/JLanguageTool-1.7.0/build.xml 2012-06-25 08:22:35.000000000 +0200 ++++ misc/build/JLanguageTool-1.7.0_patched/build.xml 2012-06-25 09:27:39.077442000 +0200 +@@ -29,7 +29,9 @@ + + + +- ++ ++ ++ + + + +@@ -442,11 +444,11 @@ + + + +- ++ + + + +- ++ + + + +@@ -651,7 +653,6 @@ + + + +- + + + +@@ -678,7 +678,7 @@ + + + +- ++ + + + +diff -Naur misc/build/JLanguageTool-1.7.0/openoffice/components.rdb misc/build/JLanguageTool-1.7.0_patched/openoffice/components.rdb +--- misc/build/JLanguageTool-1.7.0/openoffice/components.rdb 1970-01-01 01:00:00.000000000 +0100 ++++ misc/build/JLanguageTool-1.7.0_patched/openoffice/components.rdb 2012-06-25 10:26:23.183633100 +0200 +@@ -0,0 +1,9 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff -Naur misc/build/JLanguageTool-1.7.0/openoffice/META-INF/manifest.xml misc/build/JLanguageTool-1.7.0_patched/openoffice/META-INF/manifest.xml +--- misc/build/JLanguageTool-1.7.0/openoffice/META-INF/manifest.xml 2012-06-25 08:22:34.000000000 +0200 ++++ misc/build/JLanguageTool-1.7.0_patched/openoffice/META-INF/manifest.xml 2012-06-25 09:39:56.751738000 +0200 +@@ -2,8 +2,8 @@ + + +- ++ + +diff -Naur misc/build/JLanguageTool-1.7.0/openoffice/description.xml misc/build/JLanguageTool-1.7.0_patched/openoffice/description.xml +--- misc/build/JLanguageTool-1.7.0/openoffice/description.xml 2012-06-25 08:22:35.000000000 +0200 ++++ misc/build/JLanguageTool-1.7.0_patched/openoffice/description.xml 2012-06-25 10:29:48.520591800 +0200 +@@ -21,7 +21,7 @@ + LanguageTool. 开源的语言检查工具 + LanguageTool. Reizher reizhskrivadurel frank. + +- ++ + + + +diff -Naur misc/build/JLanguageTool-1.7.0/src/java/org/languagetool/gui/Configuration.java misc/build/JLanguageTool-1.7.0_patched/src/java/org/languagetool/gui/Configuration.java +--- misc/build/JLanguageTool-1.7.0/src/java/org/languagetool/gui/Configuration.java 2012-06-25 08:21:31.000000000 +0200 ++++ misc/build/JLanguageTool-1.7.0_patched/src/java/org/languagetool/gui/Configuration.java 2012-06-25 09:31:40.737466400 +0200 +@@ -23,6 +23,7 @@ + import java.io.FileNotFoundException; + import java.io.FileOutputStream; + import java.io.IOException; ++import java.lang.ClassLoader; + import java.util.*; + + import org.languagetool.Language; +@@ -142,7 +143,18 @@ + + final String motherTongueStr = (String) props.get(MOTHER_TONGUE_CONFIG_KEY); + if (motherTongueStr != null) { +- motherTongue = Language.getLanguageForShortName(motherTongueStr); ++ // FIXME: hack to disable the functionality for JRE 1.5 ++ // javax.xml.bind.JAXBException is part of JRE 1.6 ++ boolean isJRE15 = false; ++ try { ++ ClassLoader cl = ClassLoader.getSystemClassLoader(); ++ cl.loadClass("javax.xml.bind.JAXBException"); ++ } catch (ClassNotFoundException e) { ++ isJRE15 = true; ++ } ++ if (!isJRE15) { ++ motherTongue = Language.getLanguageForShortName(motherTongueStr); ++ } + } + + final String autoDetectStr = (String) props.get(AUTO_DETECT_CONFIG_KEY); +diff -Naur misc/build/JLanguageTool-1.7.0/src/java/org/languagetool/openoffice/Main.java misc/build/JLanguageTool-1.7.0_patched/src/java/org/languagetool/openoffice/Main.java +--- misc/build/JLanguageTool-1.7.0/src/java/org/languagetool/openoffice/Main.java 2012-06-25 08:21:28.000000000 +0200 ++++ misc/build/JLanguageTool-1.7.0_patched/src/java/org/languagetool/openoffice/Main.java 2012-06-25 09:36:03.778528700 +0200 +@@ -24,6 +24,7 @@ + * @author Marcin Miłkowski + */ + import java.io.File; ++import java.lang.ClassLoader; + import java.util.ArrayList; + import java.util.Arrays; + import java.util.Comparator; +@@ -494,6 +495,14 @@ + */ + @Override + public final Locale[] getLocales() { ++ // FIXME: hack to disable the functionality for JRE 1.5 ++ // javax.xml.bind.JAXBException is part of JRE 1.6 ++ try { ++ ClassLoader cl = ClassLoader.getSystemClassLoader(); ++ cl.loadClass("javax.xml.bind.JAXBException"); ++ } catch (ClassNotFoundException e) { ++ return new Locale[0]; ++ } + try { + int dims = 0; + for (final Language element : Language.LANGUAGES) { diff --git a/external/languagetool/Makefile b/external/languagetool/Makefile new file mode 100644 index 000000000000..e4968cf85fb6 --- /dev/null +++ b/external/languagetool/Makefile @@ -0,0 +1,7 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/external/languagetool/MessageBox-apichange.patch b/external/languagetool/MessageBox-apichange.patch new file mode 100644 index 000000000000..ceea259b88ac --- /dev/null +++ b/external/languagetool/MessageBox-apichange.patch @@ -0,0 +1,30 @@ +--- misc/build/JLanguageTool-1.7.0/src/java/org/languagetool/openoffice/OOoAboutDialog.java 2013-07-11 13:33:26.681387525 +0100 ++++ misc/build/JLanguageTool-1.7.0/src/java/org/languagetool/openoffice/OOoAboutDialog.java 2013-07-11 13:34:46.666424549 +0100 +@@ -19,6 +19,7 @@ + package org.languagetool.openoffice; + + import com.sun.star.awt.Rectangle; ++import com.sun.star.awt.MessageBoxType; + import com.sun.star.awt.XMessageBox; + import com.sun.star.awt.XMessageBoxFactory; + import com.sun.star.awt.XWindowPeer; +@@ -49,16 +50,14 @@ + .getString("guiMenuAbout")); + final XMessageBoxFactory messageBoxFactory = (XMessageBoxFactory) UnoRuntime + .queryInterface(XMessageBoxFactory.class, winPeer.getToolkit()); +- final Rectangle messageBoxRectangle = new Rectangle(); + final XMessageBox box = messageBoxFactory + .createMessageBox( + winPeer, +- messageBoxRectangle, +- "infobox", ++ MessageBoxType.INFOBOX, + 0, + aboutDialogTitle, + getAboutText()); + box.execute(); + } + +-} +\ No newline at end of file ++} diff --git a/external/languagetool/Module_languagetool.mk b/external/languagetool/Module_languagetool.mk new file mode 100644 index 000000000000..0574d55d6856 --- /dev/null +++ b/external/languagetool/Module_languagetool.mk @@ -0,0 +1,22 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Module_Module,languagetool)) + +ifneq ($(ENABLE_JAVA),) +ifneq ($(filter LANGUAGETOOL,$(BUILD_TYPE)),) +$(eval $(call gb_Module_add_targets,languagetool,\ + ExternalProject_languagetool \ + ExtensionPackage_LanguageTool \ + UnpackedTarball_languagetool \ +)) +endif +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/languagetool/README b/external/languagetool/README new file mode 100644 index 000000000000..72d70412b641 --- /dev/null +++ b/external/languagetool/README @@ -0,0 +1,5 @@ +Style and grammar checker for various languages written in Java, from [http://www.languagetool.org/] + +Shipping this is a compile-time option for LibreOffice, but our +downloadable builds use the light-weight lightproof grammer checker +instead to avoid the Java bootstrapping performance issues. \ No newline at end of file diff --git a/external/languagetool/UnpackedTarball_languagetool.mk b/external/languagetool/UnpackedTarball_languagetool.mk new file mode 100644 index 000000000000..05f9e000b145 --- /dev/null +++ b/external/languagetool/UnpackedTarball_languagetool.mk @@ -0,0 +1,22 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_UnpackedTarball_UnpackedTarball,languagetool)) + +$(eval $(call gb_UnpackedTarball_set_tarball,languagetool,$(LANGUAGETOOL_TARBALL))) + +$(eval $(call gb_UnpackedTarball_set_patchlevel,languagetool,3)) + +$(eval $(call gb_UnpackedTarball_add_patches,languagetool,\ + external/languagetool/JLanguageTool-1.7.0.patch \ + external/languagetool/JLanguageTool-1.4.0-no-hc.patch \ + external/languagetool/MessageBox-apichange.patch \ +)) + +# vim: set noet sw=4 ts=4: -- cgit