summaryrefslogtreecommitdiff
path: root/setup_native/source/packinfo
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-11 13:05:56 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-11 17:11:08 +0200
commite2fac98819c00b4fb50f9de9d0f32d20092f3191 (patch)
treef57c883e92a47fbea53bf3be9cb68e789ca5941f /setup_native/source/packinfo
parent8bb4cc03cf81051aa04362f2bc3a867e4bd72bd0 (diff)
fdo#53009: For msi installer, only default-select a subset of dictionaries
Change-Id: I3ee3fb5e5142ce4956776467b2ffcb19ed3b10c2
Diffstat (limited to 'setup_native/source/packinfo')
-rw-r--r--setup_native/source/packinfo/makefile.mk24
-rw-r--r--setup_native/source/packinfo/spellchecker_selection.pl68
2 files changed, 92 insertions, 0 deletions
diff --git a/setup_native/source/packinfo/makefile.mk b/setup_native/source/packinfo/makefile.mk
new file mode 100644
index 000000000000..a2c647886cf2
--- /dev/null
+++ b/setup_native/source/packinfo/makefile.mk
@@ -0,0 +1,24 @@
+# -*- 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/.
+#
+
+PRJ = ../..
+PRJNAME = setup_native
+TARGET = packinfo
+
+.INCLUDE: settings.mk
+
+ALLTAR: $(OUT)/inc/spellchecker_selection.hxx
+
+.INCLUDE: target.mk
+
+$(OUT)/inc/spellchecker_selection.hxx .ERRREMOVE : spellchecker_selection.pl \
+ spellchecker_selection.txt
+ $(PERL) -w spellchecker_selection.pl <spellchecker_selection.txt >$@
+
+# vim: set noet sw=4 ts=4:
diff --git a/setup_native/source/packinfo/spellchecker_selection.pl b/setup_native/source/packinfo/spellchecker_selection.pl
new file mode 100644
index 000000000000..b30a843e4acd
--- /dev/null
+++ b/setup_native/source/packinfo/spellchecker_selection.pl
@@ -0,0 +1,68 @@
+#
+# 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/.
+#
+
+use List::Util qw[max];
+
+@ARGV == 0 or die 'Usage: translates from stdin to stdout';
+
+my %map = ();
+my $max = 0;
+
+while (<>) {
+ next if /^\s*(#.*)?$/;
+ /^ \s* ([a-z]{2}(?:-[A-Z]{2})?) \s* = \s*
+ \"(EMPTY|[a-z]{2}(?:-[A-Z]{2})?(?:,[a-z]{2}(?:-[A-Z]{2})?)*)\" \s* $/x
+ or die "bad input line \"$_\"";
+ my $lang = $1;
+ $lang =~ tr/-/_/;
+ my $dicts = $2;
+ $dicts =~ tr/-/_/;
+ !exists($map{$lang}) or die "duplicate values for $lang";
+ if ($dicts eq 'EMPTY') {
+ @{$map{$lang}} = ();
+ } else {
+ @{$map{$lang}} = split(/,/, $dicts);
+ $max = max($max, scalar(@{$map{$lang}}));
+ }
+}
+
+++$max;
+
+print <<EOF;
+// generated by setup_native/source/packinfo/spellchecker_selection.pl
+
+#ifndef INCLUDED_SETUP_NATIVE_SOURCE_PACKINFO_SPELLCHECKER_SELECTION_HXX
+#define INCLUDED_SETUP_NATIVE_SOURCE_PACKINFO_SPELLCHECKER_SELECTION_HXX
+
+#include "sal/config.h"
+
+namespace setup_native {
+
+struct LanguageDictionaries {
+ char const * language;
+ char const * dictionaries[$max];
+};
+
+LanguageDictionaries const languageDictionaries[] = {
+EOF
+
+foreach $i (sort(keys(%map))) {
+ print(" { \"$i\", {");
+ foreach $j (sort(@{$map{$i}})) {
+ print(" \"$j\",");
+ }
+ print(" 0 } },\n");
+}
+
+print <<EOF;
+};
+
+}
+
+#endif
+EOF