[PATCH] tweak build

Caolán McNamara caolanm at redhat.com
Wed Feb 15 04:55:11 PST 2012


---
 l10ntools/inc/l10ntools/HelpIndexer.hxx       |   71 +++++++++++++++++++++++++
 l10ntools/inc/l10ntools/dllapi.h              |   49 +++++++++++++++++
 l10ntools/prj/d.lst                           |    2 +
 l10ntools/source/help/HelpIndexer.cxx         |   22 +++++++-
 l10ntools/source/help/HelpIndexer.hxx         |   69 ------------------------
 l10ntools/source/help/HelpIndexer_main.cxx    |    2 +-
 l10ntools/source/help/makefile.mk             |   20 +++----
 xmlhelp/source/cxxhelp/provider/databases.cxx |    2 +-
 xmlhelp/source/cxxhelp/provider/makefile.mk   |    2 -
 xmlhelp/util/makefile.mk                      |    1 +
 10 files changed, 153 insertions(+), 87 deletions(-)
 create mode 100644 l10ntools/inc/l10ntools/HelpIndexer.hxx
 create mode 100644 l10ntools/inc/l10ntools/dllapi.h
 delete mode 100644 l10ntools/source/help/HelpIndexer.hxx

diff --git a/l10ntools/inc/l10ntools/HelpIndexer.hxx b/l10ntools/inc/l10ntools/HelpIndexer.hxx
new file mode 100644
index 0000000..ac034b5
--- /dev/null
+++ b/l10ntools/inc/l10ntools/HelpIndexer.hxx
@@ -0,0 +1,71 @@
+#ifndef HELPINDEXER_HXX
+#define HELPINDEXER_HXX
+
+#include <l10ntools/dllapi.h>
+
+#include <CLucene/StdHeader.h>
+#include <CLucene.h>
+
+#include <rtl/ustring.hxx>
+#include <set>
+
+// I assume that TCHAR is defined as wchar_t throughout
+
+class L10N_DLLPUBLIC HelpIndexer {
+	private:
+		rtl::OUString d_lang;
+		rtl::OUString d_module;
+		rtl::OUString d_captionDir;
+		rtl::OUString d_contentDir;
+		rtl::OUString d_indexDir;
+		rtl::OUString d_error;
+		std::set<rtl::OUString> d_files;
+
+	public:
+
+	/**
+	 * @param lang Help files language.
+	 * @param module The module of the helpfiles.
+	 * @param captionDir The directory to scan for caption files.
+	 * @param contentDir The directory to scan for content files.
+	 * @param indexDir The directory to write the index to.
+	 */
+	HelpIndexer(rtl::OUString const &lang, rtl::OUString const &module,
+		rtl::OUString const &captionDir, rtl::OUString const &contentDir,
+		rtl::OUString const &indexDir);
+
+	/**
+	 * Run the indexer.
+	 * @return true if index successfully generated.
+	 */
+	bool indexDocuments();
+
+	/**
+	 * Get the error string (empty if no error occurred).
+	 */
+	rtl::OUString const & getErrorMessage();
+
+	private:
+
+	/**
+	 * Scan the caption & contents directories for help files.
+	 */
+	bool scanForFiles();
+
+	/**
+	 * Scan for files in the given directory.
+	 */
+	bool scanForFiles(rtl::OUString const &path);
+
+	/**
+	 * Fill the Document with information on the given help file.
+	 */
+	bool helpDocument(rtl::OUString const & fileName, lucene::document::Document *doc);
+
+	/**
+	 * Create a reader for the given file, and create an "empty" reader in case the file doesn't exist.
+	 */
+	lucene::util::Reader *helpFileReader(rtl::OUString const & path);
+};
+
+#endif
diff --git a/l10ntools/inc/l10ntools/dllapi.h b/l10ntools/inc/l10ntools/dllapi.h
new file mode 100644
index 0000000..184a590
--- /dev/null
+++ b/l10ntools/inc/l10ntools/dllapi.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _L10N_DLLAPI_H
+#define _L10N_DLLAPI_H
+
+#include "sal/config.h"
+#include "sal/types.h"
+
+#if defined L10N_DLLIMPLEMENTATION
+#define L10N_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define L10N_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#if defined UNX && ! defined MACOS
+#define L10N_PLUGIN_PUBLIC L10N_DLLPUBLIC
+#else
+#define L10N_PLUGIN_PUBLIC SAL_DLLPRIVATE
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/prj/d.lst b/l10ntools/prj/d.lst
index 174bb6c..44cf5f0 100644
--- a/l10ntools/prj/d.lst
+++ b/l10ntools/prj/d.lst
@@ -44,8 +44,10 @@ mkdir: %_DEST%\bin\help\com\sun\star\help
 ..\scripts\propex.bat %_DEST%\bin\propex.bat
 ..\scripts\propmerge %_DEST%\bin\propmerge
 ..\inc\export.hxx %_DEST%\inc\l10ntools\export.hxx
+..\inc\l10ntools\dllapi.h %_DEST%\inc\l10ntools\dllapi.h
 ..\inc\l10ntools\directory.hxx %_DEST%\inc\l10ntools\directory.hxx
 ..\inc\l10ntools\file.hxx %_DEST%\inc\l10ntools\file.hxx
+..\inc\l10ntools\HelpIndexer.hxx %_DEST%\inc\l10ntools\HelpIndexer.hxx
 ..\source\filter\merge\FCFGMerge.cfg  %_DEST%\inc\l10ntools\FCFGMerge.cfg
 
 ..\%__SRC%\lib\transex.lib %_DEST%\lib\transex.lib
diff --git a/l10ntools/source/help/HelpIndexer.cxx b/l10ntools/source/help/HelpIndexer.cxx
index f86d265..b54814a 100644
--- a/l10ntools/source/help/HelpIndexer.cxx
+++ b/l10ntools/source/help/HelpIndexer.cxx
@@ -1,4 +1,4 @@
-#include "HelpIndexer.hxx"
+#include <l10ntools/HelpIndexer.hxx>
 
 #define TODO
 
@@ -100,11 +100,27 @@ bool HelpIndexer::scanForFiles(rtl::OUString const & path) {
 	return true;
 }
 
+std::vector<TCHAR> OUStringToTCHARVec(rtl::OUString const &rStr)
+{
+    //UTF-16
+    if (sizeof(wchar_t) == sizeof(sal_Unicode))
+        return std::vector<TCHAR>(rStr.getStr(), rStr.getStr() + rStr.getLength());
+
+    //UTF-32
+    std::vector<TCHAR> aRet;
+    for (sal_Int32 nStrIndex = 0; nStrIndex < rStr.getLength();)
+    {
+        const sal_uInt32 nCode = rStr.iterateCodePoints(&nStrIndex);
+        aRet.push_back(nCode);
+    }
+    return aRet;
+}
+
 bool HelpIndexer::helpDocument(rtl::OUString const & fileName, Document *doc) {
 	// Add the help path as an indexed, untokenized field.
 	rtl::OUString path = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#HLP#")) + d_module + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + fileName;
-	// FIXME: the (TCHAR*) cast is a problem, because TCHAR does not match sal_Unicode
-	doc->add(*new Field(_T("path"), (TCHAR*)path.getStr(), Field::STORE_YES | Field::INDEX_UNTOKENIZED));
+	std::vector<TCHAR> aPath(OUStringToTCHARVec(path));
+	doc->add(*new Field(_T("path"), &aPath[0], Field::STORE_YES | Field::INDEX_UNTOKENIZED));
 
 	// Add the caption as a field.
 	rtl::OUString captionPath = d_captionDir + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + fileName;
diff --git a/l10ntools/source/help/HelpIndexer.hxx b/l10ntools/source/help/HelpIndexer.hxx
deleted file mode 100644
index 833e5e7..0000000
--- a/l10ntools/source/help/HelpIndexer.hxx
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef HELPINDEXER_HXX
-#define HELPINDEXER_HXX
-
-#include <CLucene/StdHeader.h>
-#include <CLucene.h>
-
-#include <rtl/ustring.hxx>
-#include <set>
-
-// I assume that TCHAR is defined as wchar_t throughout
-
-class HelpIndexer {
-	private:
-		rtl::OUString d_lang;
-		rtl::OUString d_module;
-		rtl::OUString d_captionDir;
-		rtl::OUString d_contentDir;
-		rtl::OUString d_indexDir;
-		rtl::OUString d_error;
-		std::set<rtl::OUString> d_files;
-
-	public:
-
-	/**
-	 * @param lang Help files language.
-	 * @param module The module of the helpfiles.
-	 * @param captionDir The directory to scan for caption files.
-	 * @param contentDir The directory to scan for content files.
-	 * @param indexDir The directory to write the index to.
-	 */
-	HelpIndexer(rtl::OUString const &lang, rtl::OUString const &module,
-		rtl::OUString const &captionDir, rtl::OUString const &contentDir,
-		rtl::OUString const &indexDir);
-
-	/**
-	 * Run the indexer.
-	 * @return true if index successfully generated.
-	 */
-	bool indexDocuments();
-
-	/**
-	 * Get the error string (empty if no error occurred).
-	 */
-	rtl::OUString const & getErrorMessage();
-
-	private:
-
-	/**
-	 * Scan the caption & contents directories for help files.
-	 */
-	bool scanForFiles();
-
-	/**
-	 * Scan for files in the given directory.
-	 */
-	bool scanForFiles(rtl::OUString const &path);
-
-	/**
-	 * Fill the Document with information on the given help file.
-	 */
-	bool helpDocument(rtl::OUString const & fileName, lucene::document::Document *doc);
-
-	/**
-	 * Create a reader for the given file, and create an "empty" reader in case the file doesn't exist.
-	 */
-	lucene::util::Reader *helpFileReader(rtl::OUString const & path);
-};
-
-#endif
diff --git a/l10ntools/source/help/HelpIndexer_main.cxx b/l10ntools/source/help/HelpIndexer_main.cxx
index 3d69630..ecea928 100644
--- a/l10ntools/source/help/HelpIndexer_main.cxx
+++ b/l10ntools/source/help/HelpIndexer_main.cxx
@@ -1,4 +1,4 @@
-#include "HelpIndexer.hxx"
+#include <l10ntools/HelpIndexer.hxx>
 
 #include <string>
 #include <iostream>
diff --git a/l10ntools/source/help/makefile.mk b/l10ntools/source/help/makefile.mk
index 1283535..2ae3232 100644
--- a/l10ntools/source/help/makefile.mk
+++ b/l10ntools/source/help/makefile.mk
@@ -29,13 +29,15 @@ PRJ		= ..$/..
 PRJNAME = l10ntools
 TARGET  = HelpLinker
 LIBBASENAME = helplinker
-PACKAGE = com$/sun$/star$/help
 TARGETTYPE=CUI
+ENABLE_EXCEPTIONS=TRUE
 
 # --- Settings -----------------------------------------------------
 
 .INCLUDE : settings.mk
 .INCLUDE : helplinker.pmk
+
+CFLAGS+=-DL10N_DLLIMPLEMENTATION
  
 .IF "$(SYSTEM_LIBXSLT)" == "YES"
 CFLAGS+= $(LIBXSLT_CFLAGS)
@@ -52,18 +54,14 @@ CFLAGS+=-DSYSTEM_EXPAT
 
 OBJFILES=\
         $(OBJ)$/HelpLinker.obj \
-        $(OBJ)$/HelpCompiler.obj
-SLOFILES=\
-        $(SLO)$/HelpLinker.obj \
-        $(SLO)$/HelpCompiler.obj
-
-EXCEPTIONSFILES=\
-        $(OBJ)$/HelpLinker.obj \
         $(OBJ)$/HelpCompiler.obj \
         $(OBJ)$/HelpIndexer.obj \
-        $(OBJ)$/HelpIndexer_main.obj \
+        $(OBJ)$/HelpIndexer_main.obj
+
+SLOFILES=\
         $(SLO)$/HelpLinker.obj \
-        $(SLO)$/HelpCompiler.obj
+        $(SLO)$/HelpCompiler.obj \
+        $(SLO)$/HelpIndexer.obj
 
 .IF "$(OS)" == "MACOSX" && "$(CPU)" == "P" && "$(COM)" == "GCC"
 # There appears to be a GCC 4.0.1 optimization error causing _file:good() to
@@ -100,7 +98,7 @@ SHL1IMPLIB	=i$(LIBBASENAME)
 SHL1IMPLIB	=$(LIBBASENAME)$(DLLPOSTFIX)
 .ENDIF
 SHL1DEF		=$(MISC)$/$(SHL1TARGET).def
-SHL1STDLIBS =$(SALLIB) $(BERKELEYLIB) $(XSLTLIB) $(EXPATASCII3RDLIB)
+SHL1STDLIBS =$(SALLIB) $(BERKELEYLIB) $(XSLTLIB) $(EXPATASCII3RDLIB) $(PKGCONFIG_LIBS)
 SHL1USE_EXPORTS	=ordinal
 
 DEF1NAME	=$(SHL1TARGET) 
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index ccc74da..bef8ae5 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -41,7 +41,7 @@
 
 // EDIT FROM HERE
 
-#include <HelpIndexer.hxx>
+#include <l10ntools/HelpIndexer.hxx>
 
 // EDIT ENDS HERE
 
diff --git a/xmlhelp/source/cxxhelp/provider/makefile.mk b/xmlhelp/source/cxxhelp/provider/makefile.mk
index 05f4ead..4c9a099 100644
--- a/xmlhelp/source/cxxhelp/provider/makefile.mk
+++ b/xmlhelp/source/cxxhelp/provider/makefile.mk
@@ -67,8 +67,6 @@ LIBXSLTINCDIR=external$/libxslt
 CFLAGS+= -I$(SOLARINCDIR)$/$(LIBXSLTINCDIR)
 .ENDIF
 
-CFLAGS+= -I$(SRC_ROOT)$/l10ntools$/source$/help
-
 PKGCONFIG_MODULES=libclucene-core libclucene-contribs-lib
 .INCLUDE : pkg_config.mk
 
diff --git a/xmlhelp/util/makefile.mk b/xmlhelp/util/makefile.mk
index 2f0b8f6..caf6249 100644
--- a/xmlhelp/util/makefile.mk
+++ b/xmlhelp/util/makefile.mk
@@ -58,6 +58,7 @@ SHL1STDLIBS=                     \
     $(CPPUHELPERLIB)         \
     $(CPPULIB)               \
     $(COMPHELPERLIB)         \
+    $(HELPLINKERLIB)         \
     $(SALLIB)                \
     $(EXPATASCII3RDLIB)      \
     $(UNOTOOLSLIB)           \
-- 
1.7.7.6


--=-IwWVQyy1wQB+q6KfP9CZ--



More information about the LibreOffice mailing list