summaryrefslogtreecommitdiffstats
path: root/odk/config
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /odk/config
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'odk/config')
-rw-r--r--odk/config/cfgWin.js1022
-rwxr-xr-xodk/config/configure.pl777
-rwxr-xr-xodk/config/setsdkenv_unix76
-rw-r--r--odk/config/setsdkenv_unix.sh.in300
-rwxr-xr-xodk/config/setsdkenv_windows.bat82
-rwxr-xr-xodk/config/setsdkname.bat20
6 files changed, 2277 insertions, 0 deletions
diff --git a/odk/config/cfgWin.js b/odk/config/cfgWin.js
new file mode 100644
index 000000000..128f3e2ea
--- /dev/null
+++ b/odk/config/cfgWin.js
@@ -0,0 +1,1022 @@
+//
+// 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/.
+//
+// This file incorporates work covered by the following license notice:
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed
+// with this work for additional information regarding copyright
+// ownership. The ASF licenses this file to you under the Apache
+// License, Version 2.0 (the "License"); you may not use this file
+// except in compliance with the License. You may obtain a copy of
+// the License at http://www.apache.org/licenses/LICENSE-2.0 .
+//
+// This script asks for variables, which are necessary for building the
+// examples of the Office Development Kit. The script duplicates the template
+// script and inserts the variables into the copied script.
+// The Script was developed for the operating systems Microsoft Windows.
+var regKeyOfficeCurrentUser = "HKEY_CURRENT_USER\\Software\\LibreOffice\\UNO\\InstallPath\\";
+var regKeyOfficeLocaleMachine = "HKEY_LOCAL_MACHINE\\Software\\LibreOffice\\UNO\\InstallPath\\";
+var regKeyDotNetInstallRoot = "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\.NETFramework\\InstallRoot";
+var regKeyDotNet1_1 = "HKLM\\Software\\Microsoft\\.NETFramework\\policy\\v1.1\\4322";
+var sDirDotNet1_1 = "v1.1.4322";
+var regKeyDotNet2_0 = "HKLM\\Software\\Microsoft\\.NETFramework\\Policy\\v2.0\\50727";
+var sDirDotNet2_0 = "v2.0.50727";
+
+var regKeyJDK = "HKLM\\Software\\JavaSoft\\Java Development Kit\\";
+//var regKeyVC70 = "HKLM\\SOFTWARE\\Microsoft\\VisualStudio\\7.0\\Setup\\VC\\ProductDir";
+//var regKeyVC71 = "HKLM\\SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir";
+var regKeyVC90 = "HKLM\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VC\\ProductDir";
+
+//var regKeyVCExpress80 = "HKLM\\SOFTWARE\\Microsoft\\VCExpress\\8.0\\Setup\\VC\\ProductDir";
+var regKeyVCExpress90 = "HKLM\\SOFTWARE\\Microsoft\\VCExpress\\9.0\\Setup\\VC\\ProductDir";
+
+var regKeyWindowsSDK = "HKLM\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\CurrentInstallFolder";
+
+var WshShell = WScript.CreateObject("WScript.Shell");
+var WshSysEnv = WshShell.Environment("process");
+var aFileSystemObject = new ActiveXObject("Scripting.FileSystemObject");
+var stdin = WScript.StdIn;
+var stdout = WScript.StdOut;
+
+stdout.WriteLine("\n" +
+" *** Configure your SDK environment ***\n\n" +
+" NOTE: This script is working only for Windows 2000, Windows XP or newer versions!\n");
+
+var oo_sdk_name=WshSysEnv("OO_SDK_NAME");
+var oo_sdk_home=getSdkHome();
+var oo_user_sdk_dir=WshSysEnv("APPDATA") + "\\" + oo_sdk_name;
+var oo_user_sdk_env_script=oo_user_sdk_dir + "\\setsdkenv_windows.bat";
+
+var office_home=getOfficeHome();
+
+var oo_sdk_make_home=getMakeHome();
+var oo_sdk_zip_home=getZipHome();
+var oo_sdk_cat_home=getCatHome();
+var oo_sdk_sed_home=getSedHome();
+var oo_sdk_manifest_used="";
+var oo_sdk_windowssdk="";
+var oo_sdk_cpp_home=getCppHome();
+var oo_sdk_cli_home=getCliHome();
+var oo_sdk_java_home=getJavaHome();
+var oo_sdk_out=getOutputDir();
+var sdk_auto_deployment=getAutoDeployment();
+
+writeBatFile(oo_user_sdk_dir, oo_user_sdk_env_script);
+
+stdout.Write(
+ "\n ******************************************************************\n" +
+ " * ... \"" + oo_user_sdk_env_script + "\"\n" +
+ " * batch file has been prepared.\n" +
+ " * This batch file will be used in the future to prepare your\n" +
+ " * personal configured SDK environment.\n" +
+ " ******************************************************************\n\n");
+// " * For each time you want to use this configured SDK environment,\n" +
+// " * you have to run the \"setsdkenv_windows.bat\" file in a new shell!\n" +
+
+// done -------------------------------------------------------------------------
+
+
+function skipChoice(msg)
+{
+ stdout.Write("\n Do you want to skip the choice of " + msg + " (YES/NO) [YES]:");
+ var sChoice = stdin.ReadLine();
+ if (sChoice == "" || sChoice.toLowerCase() == "yes")
+ return true;
+
+ return false;
+}
+
+function getSdkHome()
+{
+ var sSuggestedHome = WshSysEnv("OO_SDK_HOME");
+ if (sSuggestedHome.length == 0) {
+ var scriptname = WScript.ScriptFullName;
+ sSuggestedHome = scriptname.substr(0,scriptname.length-10);
+ }
+
+ while(true)
+ {
+ stdout.Write("\n Enter the Office Software Development Kit directory [" +
+ sSuggestedHome + "]:");
+ var sHome = stdin.ReadLine();
+ if (sHome.length == 0)
+ {
+ //No user input, use default.
+ if ( ! aFileSystemObject.FolderExists(sSuggestedHome))
+ {
+ stdout.WriteLine("\n Error: Could not find directory \"" +
+ sSuggestedHome + "\". An SDK is required, please" +
+ " specify the path to a valid installation.");
+ continue;
+ }
+ sHome = sSuggestedHome;
+ }
+ else
+ {
+ //validate the user input
+ if ( ! aFileSystemObject.FolderExists(sHome))
+ {
+ stdout.WriteLine("\n Error: The directory \"" + sHome +
+ "\" does not exist. Please enter the path to a" +
+ "valid SDK installation.");
+ continue;
+ }
+ }
+ //Check if this is an sdk folder by looking for the idl sub - dir
+ var idlDir = sHome + "\\idl";
+ if (! aFileSystemObject.FolderExists(idlDir))
+ {
+ stdout.WriteLine("\n Error: Could not find directory \"" +
+ idlDir + "\". An SDK is required, please specify " +
+ "the path to a valid SDK installation.");
+ continue;
+ }
+
+ return sHome;
+ }
+}
+
+function getOfficeHome()
+{
+ var sSuggestedHome = WshSysEnv("OFFICE_HOME");
+ if (sSuggestedHome.length == 0)
+ {
+ try {
+ sSuggestedHome = WshShell.RegRead(regKeyOfficeCurrentUser);
+ //The registry entry points to the program folder but we need the
+ //installation folder
+ } catch(exc) {}
+ if (sSuggestedHome.length == 0)
+ {
+ try {
+ sSuggestedHome = WshShell.RegRead(regKeyOfficeLocaleMachine);
+ //The registry entry points to the program folder but we need
+ //the installation folder
+ } catch (exc) {}
+ }
+
+ var index=0;
+ if ((index = sSuggestedHome.lastIndexOf("\\")) != -1)
+ sSuggestedHome = sSuggestedHome.substr(0, index);
+
+ if (sSuggestedHome.length == 0)
+ sSuggestedHome = searchOffice();
+ }
+
+ while(true)
+ {
+ stdout.Write("\n Enter the Office base installation directory [" +
+ sSuggestedHome + "]:");
+ var sHome = stdin.ReadLine();
+ if (sHome.length == 0)
+ {
+ //No user input, use default.
+ if ( ! aFileSystemObject.FolderExists(sSuggestedHome))
+ {
+ stdout.WriteLine("\n Error: Could not find directory \"" +
+ sSuggestedHome + "\" An office installation is " +
+ "required, please specify the path to a valid " +
+ "office installation.");
+ sSuggestedHome = "";
+ continue;
+ }
+ sHome = sSuggestedHome;
+ } else
+ {
+ //validate the user input
+ if ( ! aFileSystemObject.FolderExists(sHome))
+ {
+ stdout.WriteLine("\n Error: The directory \"" + sHome +
+ "\" does not exist. Please specify the path to " +
+ "a valid office installation.");
+ continue;
+ }
+ }
+ //Check if this is a valid office installation folder by looking for the
+ //program sub-directory
+ var progDir = sHome + "\\program";
+ if (! aFileSystemObject.FolderExists(progDir))
+ {
+ stdout.WriteLine("\n Error: Could not find directory \"" +
+ progDir + "\". An office installation is required, " +
+ "please specify the path to a valid office " +
+ "installation.");
+ continue;
+ }
+ return sHome;
+ }
+}
+
+function searchOffice()
+{
+ var tmp = oo_sdk_home;
+
+ if (aFileSystemObject.FileExists(tmp + "\\program\\soffice.exe")) {
+ return tmp;
+ }
+
+ return "";
+}
+
+function getMakeHome()
+{
+ var sSuggestedHome = WshSysEnv("OO_SDK_MAKE_HOME");
+
+ while(true)
+ {
+ stdout.Write("\n Enter GNU make (3.79.1 or higher) tools directory [" +
+ sSuggestedHome + "]:");
+ var sHome = stdin.ReadLine();
+ if (sHome.length == 0)
+ {
+ //No user input, use default.
+ if ( ! aFileSystemObject.FolderExists(sSuggestedHome))
+ {
+ stdout.WriteLine("\n Error: Could not find directory \"" +
+ sSuggestedHome + "\". GNU make is required, " +
+ "please specify a GNU make tools directory.");
+ sSuggestedHome = "";
+ continue;
+ }
+ sHome = sSuggestedHome;
+ } else
+ {
+ //validate the user input
+ if ( ! aFileSystemObject.FolderExists(sHome))
+ {
+ stdout.WriteLine("\n Error: The directory \"" + sHome +
+ "\" does not exist. GNU make is required, " +
+ "please specify a GNU make tools directory.");
+ continue;
+ }
+ }
+ //Check for the make executable
+ var sMakePath = sHome + "\\make.exe";
+ if (! aFileSystemObject.FileExists(sMakePath))
+ {
+ sMakePath = sHome + "\\mingw32-make.exe";
+ }
+ if (! aFileSystemObject.FileExists(sMakePath))
+ {
+ stdout.WriteLine("\n Error: Could not find \"" + sMakePath +
+ "\". GNU make is required, please specify a GNU " +
+ "make tools directory.");
+ continue;
+ }
+ return sHome;
+ }
+}
+
+function getZipHome()
+{
+ var sSuggestedHome = WshSysEnv("OO_SDK_ZIP_HOME");
+
+ while(true)
+ {
+ stdout.Write("\n Enter a zip (2.3 or higher) tools directory [" +
+ sSuggestedHome + "]:");
+ var sHome = stdin.ReadLine();
+ if (sHome.length == 0)
+ {
+ //No user input, use default.
+ if ( ! aFileSystemObject.FolderExists(sSuggestedHome))
+ {
+ stdout.WriteLine("\n Error: Could not find directory \"" +
+ sSuggestedHome + "\". zip is required, please " +
+ "specify a zip tools directory.");
+ sSuggestedHome = "";
+ continue;
+ }
+ sHome = sSuggestedHome;
+ }
+ else
+ {
+ //validate the user input
+ if ( ! aFileSystemObject.FolderExists(sHome))
+ {
+ stdout.WriteLine("\n Error: The directory \"" + sHome +
+ "\" does not exist. zip is required, please " +
+ "specify a zip tools directory.");
+ continue;
+ }
+ }
+ //Check for the make executable
+ var sZipPath = sHome + "\\zip.exe";
+ if (! aFileSystemObject.FileExists(sZipPath))
+ {
+ stdout.WriteLine("\n Error: Could not find \"" + sZipPath +
+ "\". zip is required, please specify a zip tools " +
+ "directory.");
+ continue;
+ }
+ return sHome;
+ }
+}
+
+function getCatHome()
+{
+ var sSuggestedHome = WshSysEnv("OO_SDK_CAT_HOME");
+
+ while(true)
+ {
+ stdout.Write("\n Enter a cat (2.0 or higher) tools directory [" +
+ sSuggestedHome + "]:");
+ var sHome = stdin.ReadLine();
+ if (sHome.length == 0)
+ {
+ //No user input, use default.
+ if ( ! aFileSystemObject.FolderExists(sSuggestedHome))
+ {
+ stdout.WriteLine("\n Error: Could not find directory \"" +
+ sSuggestedHome + "\". cat is required, please " +
+ "specify a cat tools directory." +
+ "\nYou can get cat from " +
+ "http://sourceforge.net/projects/unxutils/files/latest/download");
+ sSuggestedHome = "";
+ continue;
+ }
+ sHome = sSuggestedHome;
+ }
+ else
+ {
+ //validate the user input
+ if ( ! aFileSystemObject.FolderExists(sHome))
+ {
+ stdout.WriteLine("\n Error: The directory \"" + sHome +
+ "\" does not exist. cat is required, please " +
+ "specify a cat tools directory." +
+ "\nYou can get cat from " +
+ "http://sourceforge.net/projects/unxutils/files/latest/download");
+ continue;
+ }
+ }
+ //Check for the make executable
+ var sCatPath = sHome + "\\cat.exe";
+ if (! aFileSystemObject.FileExists(sCatPath))
+ {
+ stdout.WriteLine("\n Error: Could not find \"" + sCatPath +
+ "\". cat is required, please specify a cat tools " +
+ "directory." +
+ "\nYou can get cat from " +
+ "http://sourceforge.net/projects/unxutils/files/latest/download");
+ continue;
+ }
+ return sHome;
+ }
+}
+
+function getSedHome()
+{
+ var sSuggestedHome = WshSysEnv("OO_SDK_SED_HOME");
+
+ while(true)
+ {
+ stdout.Write("\n Enter a sed (3.02 or higher) tools directory [" +
+ sSuggestedHome + "]:");
+ var sHome = stdin.ReadLine();
+ if (sHome.length == 0)
+ {
+ //No user input, use default.
+ if ( ! aFileSystemObject.FolderExists(sSuggestedHome))
+ {
+ stdout.WriteLine("\n Error: Could not find directory \"" +
+ sSuggestedHome + "\". sed is required, please " +
+ "specify a sed tools directory." +
+ "\nYou can get sed from " +
+ "http://sourceforge.net/projects/unxutils/files/latest/download");
+ sSuggestedHome = "";
+ continue;
+ }
+ sHome = sSuggestedHome;
+ }
+ else
+ {
+ //validate the user input
+ if ( ! aFileSystemObject.FolderExists(sHome))
+ {
+ stdout.WriteLine("\n Error: The directory \"" + sHome +
+ "\" does not exist. sed is required, please " +
+ "specify a sed tools directory." +
+ "\nYou can get sed from " +
+ "http://sourceforge.net/projects/unxutils/files/latest/download");
+ continue;
+ }
+ }
+ //Check for the make executable
+ var sSedPath = sHome + "\\sed.exe";
+ if (! aFileSystemObject.FileExists(sSedPath))
+ {
+ stdout.WriteLine("\n Error: Could not find \"" + sSedPath +
+ "\". sed is required, please specify a sed tools " +
+ "directory." +
+ "\nYou can get sed from " +
+ "http://sourceforge.net/projects/unxutils/files/latest/download");
+ continue;
+ }
+ return sHome;
+ }
+}
+
+function getCppHome()
+{
+ var sSuggestedHome = WshSysEnv("OO_SDK_CPP_HOME");
+ if (sSuggestedHome.length == 0)
+ {
+ var sVC="";
+ try {
+ sVC = WshShell.RegRead(regKeyVCExpress90);
+ }catch (exc) {}
+ if (sVC.length == 0)
+ {
+ try {
+ sVC = WshShell.RegRead(regKeyVC90);
+ }catch (exc) {}
+ }
+ // check Windows SDK if VC 9
+ if (sVC.length > 0)
+ {
+ oo_sdk_manifest_used="true";
+ try {
+ oo_sdk_windowssdk = WshShell.RegRead(regKeyWindowsSDK);
+ }catch (exc) {}
+ }
+ if (sVC.length == 0)
+ {
+ try {
+ sVC = WshShell.RegRead(regKeyVCExpress80);
+ }catch (exc) {}
+ if (sVC.length > 0)
+ oo_sdk_manifest_used="true";
+ }
+ if (sVC.length == 0)
+ {
+ try {
+ sVC = WshShell.RegRead(regKeyVC80);
+ }catch (exc) {}
+ if (sVC.length > 0)
+ oo_sdk_manifest_used="true";
+ }
+ if (sVC.length == 0)
+ {
+ try {
+ sVC = WshShell.RegRead(regKeyVC71);
+ }catch (exc) {}
+ }
+ if (sVC.length > 0)
+ {
+ sVC += "bin";
+ if (aFileSystemObject.FileExists(sVC + "\\cl.exe"))
+ sSuggestedHome = sVC;
+ }
+ }
+
+ var bSkip = false;
+ while(true)
+ {
+ stdout.Write("\n Enter the directory of the C++ compiler (optional) [" +
+ sSuggestedHome + "]:");
+ var sHome = stdin.ReadLine();
+ if (sHome.length == 0)
+ {
+ //No user input, check OO_SDK_CPP_HOME or suggested value
+ if ( sSuggestedHome.length == 0 ) {
+ bSkip = true;
+ } else {
+ if ( !aFileSystemObject.FolderExists(sSuggestedHome) )
+ {
+ stdout.WriteLine("\n Error: Could not find directory \"" +
+ sSuggestedHome + "\".");
+ sSuggestedHome = "";
+ bSkip = true;
+ }
+ }
+
+ sHome = sSuggestedHome;
+ } else
+ {
+ //validate the user input
+ if ( ! aFileSystemObject.FolderExists(sHome))
+ {
+ stdout.WriteLine("\n Error: Could not find directory \"" +
+ sHome + "\".");
+ bSkip = true;
+ }
+ }
+
+ if ( !bSkip) {
+ //Check if the C++ compiler exist
+ var cl = sHome + "\\cl.exe";
+ var mt = sHome + "\\mt.exe";
+
+ if (! aFileSystemObject.FileExists(cl))
+ {
+ stdout.WriteLine("\n Error: Could not find the C++ compiler \""
+ + cl + "\".");
+ sHome = "";
+ bSkip = true;
+ } else {
+ if (aFileSystemObject.FileExists(mt)) {
+ oo_sdk_vc8_used="true";
+ }
+ }
+ }
+
+ if ( bSkip ) {
+ if ( skipChoice("the C++ compiler") ) {
+ return "";
+ } else {
+ bSkip = false;
+ continue;
+ }
+ }
+
+ return sHome;
+ }
+}
+
+function getCliHome()
+{
+ var sSuggestedHome = WshSysEnv("OO_SDK_CLI_HOME");
+
+ if (sSuggestedHome.length == 0)
+ {
+ try {
+ var _ver = WshShell.RegRead(regKeyDotNet2_0);
+ if (_ver.length > 0)
+ {
+ sSuggestedHome = WshShell.RegRead(regKeyDotNetInstallRoot);
+ sSuggestedHome += sDirDotNet2_0;
+ if ( ! aFileSystemObject.FolderExists(sSuggestedHome))
+ sSuggestedHome = "";
+ }
+
+ if (sSuggestedHome.length == 0)
+ {
+ _ver = WshShell.RegRead(regKeyDotNet1_1);
+ if (_ver.length > 0)
+ {
+ sSuggestedHome = WshShell.RegRead(regKeyDotNetInstallRoot);
+ sSuggestedHome += sDirDotNet1_1;
+ if ( ! aFileSystemObject.FolderExists(sSuggestedHome))
+ sSuggestedHome = "";
+ }
+ }
+ } catch (exc) {}
+ }
+
+ var bSkip = false;
+ while(true)
+ {
+ stdout.Write("\n Enter the directory of the C# and VB.NET compilers (optional) [" + sSuggestedHome + "]:");
+ var sHome = stdin.ReadLine();
+ if (sHome.length == 0)
+ {
+ //No user input, check OO_SDK_CLI_HOME or suggested value
+ if ( sSuggestedHome.length == 0 ) {
+ bSkip = true;
+ } else {
+ if ( !aFileSystemObject.FolderExists(sSuggestedHome) )
+ {
+ stdout.WriteLine("\n Error: Could not find directory \"" +
+ sSuggestedHome + "\".");
+ sSuggestedHome = "";
+ bSkip = true;
+ }
+ }
+
+ sHome = sSuggestedHome;
+ }
+ else
+ {
+ //validate the user input
+ if ( ! aFileSystemObject.FolderExists(sHome))
+ {
+ stdout.WriteLine("\n Error: The directory \"" + sHome +
+ "\" does not exist.");
+ bSkip = true;
+ }
+ }
+
+ if ( !bSkip ) {
+ //Check if the C# and VB.NET compiler exist
+ var csc = sHome + "\\csc.exe";
+ var vbc = sHome + "\\vbc.exe";
+
+ if (! aFileSystemObject.FileExists(csc))
+ {
+ stdout.WriteLine("\n Error: Could not find the C# compiler \"" +
+ csc + "\".");
+ bSkip = true;
+ }
+ if (! aFileSystemObject.FileExists(vbc))
+ {
+ stdout.WriteLine("\n Error: Could not find the VB.NET compiler \"" +
+ vbc + "\".");
+ bSkip = true;
+ }
+ }
+
+ if ( bSkip ) {
+ if ( skipChoice("the C# and VB.NET compilers") ) {
+ return "";
+ } else {
+ bSkip = false;
+ continue;
+ }
+ }
+
+ return sHome;
+ }
+}
+
+function getJavaHome()
+{
+ var sSuggestedHome = WshSysEnv("OO_SDK_JAVA_HOME");
+ if (sSuggestedHome.length == 0)
+ {
+ try {
+ var currentVersion = WshShell.RegRead(regKeyJDK + "CurrentVersion");
+ if (currentVersion.length > 0)
+ {
+ sSuggestedHome = WshShell.RegRead(regKeyJDK + currentVersion +
+ "\\JavaHome");
+ if ( ! aFileSystemObject.FolderExists(sSuggestedHome) )
+ sSuggestedHome = "";
+ }
+ } catch (exc) {}
+ }
+
+ var bSkip = false;
+ while(true)
+ {
+ stdout.Write("\n Enter JAVA SDK (1.6 or higher) installation directory (optional) [" + sSuggestedHome + "]:");
+ var sHome = stdin.ReadLine();
+ if (sHome.length == 0)
+ {
+ //No user input, check OO_SDK_JAVA_HOME or suggested value
+ if ( sSuggestedHome.length == 0 ) {
+ bSkip = true;
+ } else {
+ if ( !aFileSystemObject.FolderExists(sSuggestedHome) )
+ {
+ stdout.WriteLine("\n Error: Could not find directory \"" +
+ sSuggestedHome + "\".");
+ sSuggestedHome = "";
+ bSkip=true;
+ }
+ }
+
+ sHome = sSuggestedHome;
+ } else
+ {
+ //validate the user input
+ if ( ! aFileSystemObject.FolderExists(sHome))
+ {
+ stdout.WriteLine("\n Error: The directory \"" + sHome +
+ "\" does not exist.");
+ bSkip = true;
+ }
+ }
+
+ if ( !bSkip) {
+ //Check if this is an sdk folder by looking for the javac compiler
+ var javacompiler = sHome + "\\bin\\javac.exe";
+ if (! aFileSystemObject.FileExists(javacompiler))
+ {
+ stdout.WriteLine("\n Error: Could not find \"" +
+ javacompiler + "\".");
+ bSkip = true;
+ }
+ }
+
+ if ( bSkip ) {
+ if ( skipChoice("the Java SDK") ) {
+ return "";
+ } else {
+ bSkip = false;
+ continue;
+ }
+ }
+
+ return sHome;
+ }
+}
+
+function getOutputDir()
+{
+ var defaultdir = "c:\\" + oo_sdk_name;
+ var sSuggestedDir = WshSysEnv("OO_SDK_OUT");
+ if (sSuggestedDir.length == 0)
+ sSuggestedDir = defaultdir;
+
+ var bSkip = false;
+ while(true)
+ {
+ stdout.Write(
+ "\n Default output directory is the \"c:\\" + oo_sdk_name + "\".\n" +
+ " Enter an existent directory if you prefer a different one. But note" +
+ " that only\n a path without spaces is allowed because of a" +
+ " limitation of gnu make. (optional) [" + sSuggestedDir + "]:");
+ var sDir = stdin.ReadLine();
+ if (sDir.length == 0)
+ {
+ //No user input, check OO_SDK_OUT or suggested value
+ if ( sSuggestedDir.length == 0 ) {
+ bSkip = true;
+ } else {
+ if (sSuggestedDir == oo_user_sdk_dir || sSuggestedDir == defaultdir) {
+ var fso = new ActiveXObject("Scripting.FileSystemObject");
+ if ( !fso.FolderExists(sSuggestedDir) )
+ fso.CreateFolder(sSuggestedDir);
+ }
+ if ( !aFileSystemObject.FolderExists(sSuggestedDir) )
+ {
+ stdout.WriteLine("\n Error: Could not find directory \"" +
+ sSuggestedDir + "\".");
+ sSuggestedDir = "";
+ bSkip = true;
+ }
+ }
+
+ sDir = sSuggestedDir;
+ }
+ else
+ {
+ if (sDir.indexOf(' ') != -1) {
+ stdout.WriteLine("\n Error: your specified output directory " +
+ "\"" + sDir + "\" " +
+ "contains one or more spaces.\n That " +
+ "causes problems with gnu make. Please specify" +
+ " a directory without spaces.");
+ bSkip = true;
+ }
+ //validate the user input
+ if ( ! aFileSystemObject.FolderExists(sDir))
+ {
+ stdout.WriteLine("\n Error: Could not find directory \"" +
+ sDir + "\".");
+ bSkip = true;
+ }
+ }
+
+ if ( bSkip ) {
+ if ( skipChoice("a special output directory") ) {
+ return "";
+ } else {
+ bSkip = false;
+ continue;
+ }
+ }
+
+ return sDir;
+ }
+}
+
+function getAutoDeployment()
+{
+ var sSuggestedAuto = WshSysEnv("SDK_AUTO_DEPLOYMENT");
+ if (sSuggestedAuto.length == 0)
+ sSuggestedAuto = "YES";
+
+ while(true)
+ {
+ stdout.Write("\n Automatic deployment of UNO components (YES/NO) ["+
+ sSuggestedAuto + "]:");
+ var sAuto = stdin.ReadLine();
+ if (sAuto.length == 0)
+ sAuto = sSuggestedAuto;
+ else
+ {
+ sAutoU = sAuto.toUpperCase();
+ if (sAutoU != "YES" && sAutoU != "NO")
+ {
+ stdout.WriteLine("\n Error: The value \"" + sAuto + "\" is " +
+ "invalid. Please answer YES or NO.")
+ continue;
+ }
+ sAuto = sAutoU;
+ }
+ return sAuto;
+ }
+}
+
+//The function uses sp2bv.exe to obtain a file URL from a
+//system path. The URL is already escaped for use as bootstrap variable.
+//($ -> \$). Then the resulting string is escaped for use in a bat file.
+//That is % signs are made to double % (% -> %%);
+function makeBootstrapFileUrl(systemPath)
+{
+ var oExec = WshShell.Exec("sp2bv.exe \"" + systemPath + "\"");
+ var output="";
+ while (true)
+ {
+ if (!oExec.StdOut.AtEndOfStream)
+ {
+ var next = oExec.StdOut.Read(1);
+ if (next == '%')
+ output += "%%";
+ else
+ output += next;
+ }
+ else
+ break;
+ }
+ return output;
+}
+
+function writeBatFile(fdir, file)
+{
+ var fso = new ActiveXObject("Scripting.FileSystemObject");
+ if ( !fso.FolderExists(fdir) )
+ fso.CreateFolder(fdir);
+ var newFile = fso.CreateTextFile(file, true);
+
+ newFile.Write(
+ "@echo off\n" +
+ "REM This script sets all environment variables, which\n" +
+ "REM are necessary for building the examples of the Office Development Kit.\n" +
+ "REM The Script was developed for the operating systems Windows.\n" +
+ "REM The SDK name\n" +
+ "REM Example: set OO_SDK_NAME=libreoffice3.4_sdk\n" +
+ "set OO_SDK_NAME=" + oo_sdk_name +
+ "\n\n" +
+ "REM Installation directory of the Software Development Kit.\n" +
+ "REM Example: set OO_SDK_HOME=C:\\Program Files\\LibreOffice 3\\sdk\n" +
+ "set OO_SDK_HOME=" + oo_sdk_home +
+ "\n\n" +
+ "REM Office installation directory.\n" +
+ "REM Example: set OFFICE_HOME=C:\\Program Files\\LibreOffice 3\n" +
+ "set OFFICE_HOME=" + office_home +
+ "\n\n" +
+ "REM Directory of the make command.\n" +
+ "REM Example: set OO_SDK_MAKE_HOME=D:\\NextGenerationMake\\make\n" +
+ "set OO_SDK_MAKE_HOME=" + oo_sdk_make_home +
+ "\n\n" +
+ "REM Directory of the zip tool.\n" +
+ "REM Example: set OO_SDK_ZIP_HOME=D:\\infozip\\bin\n" +
+ "set OO_SDK_ZIP_HOME=" + oo_sdk_zip_home +
+ "\n\n" +
+ "REM Directory of the cat tool.\n" +
+ "REM Example: set OO_SDK_CAT_HOME=C:\\UnxUtils\\usr\\local\\wbin\n" +
+ "set OO_SDK_CAT_HOME=" + oo_sdk_cat_home +
+ "\n\n" +
+ "REM Directory of the sed tool.\n" +
+ "REM Example: set OO_SDK_SED_HOME=C:\\UnxUtils\\usr\\local\\wbin\n" +
+ "set OO_SDK_SED_HOME=" + oo_sdk_sed_home +
+ "\n\n" +
+ "REM Directory of the C++ compiler.\n" +
+ "REM Example:set OO_SDK_CPP_HOME=C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\bin\n" +
+ "set OO_SDK_CPP_HOME=" + oo_sdk_cpp_home +
+ "\nset CPP_MANIFEST=" + oo_sdk_manifest_used +
+ "\nset CPP_WINDOWS_SDK=" + oo_sdk_windowssdk +
+ "\n\n" +
+ "REM Directory of the C# and VB.NET compilers.\n" +
+ "REM Example:set OO_SDK_CLI_HOME=C:\\WINXP\\Microsoft.NET\\Framework\\v1.0.3705\n" +
+ "set OO_SDK_CLI_HOME=" + oo_sdk_cli_home +
+ "\n\n" +
+ "REM Java SDK installation directory.\n" +
+ "REM Example: set OO_SDK_JAVA_HOME=C:\\Program Files\\Java\\jdk1.6.0_05\n" +
+ "set OO_SDK_JAVA_HOME=" + oo_sdk_java_home +
+ "\n\n" +
+ "REM Special output directory\n" +
+ "REM Example: set OO_SDK_OUT=C:\\" + oo_sdk_name + "\n" +
+ "set OO_SDK_OUT=" + oo_sdk_out +
+ "\n\n" +
+ "REM Automatic deployment\n" +
+ "REM Example: set SDK_AUTO_DEPLOYMENT=YES\n" +
+ "set SDK_AUTO_DEPLOYMENT=" + sdk_auto_deployment +
+ "\n\n" +
+ "REM Check installation path for the Office Development Kit.\n" +
+ "if not defined OO_SDK_HOME (\n" +
+ " echo Error: the variable OO_SDK_HOME is missing!\n" +
+ " goto :error\n" +
+ " )\n" +
+ "\n" +
+ "REM Check installation path for the office.\n" +
+ "REM if not defined OFFICE_HOME (\n" +
+ "REM echo Error: the variable OFFICE_HOME is missing!\n" +
+ "REM goto :error\n" +
+ "REM )\n" +
+ "\n" +
+ "REM Check installation path for GNU make.\n" +
+ "if not defined OO_SDK_MAKE_HOME (\n" +
+ " echo Error: the variable OO_SDK_MAKE_HOME is missing!\n" +
+ " goto :error\n" +
+ " )\n" +
+ "\n" +
+ "REM Check installation path for the zip tool.\n" +
+ "if not defined OO_SDK_ZIP_HOME (\n" +
+ " echo Error: the variable OO_SDK_ZIP_HOME is missing!\n" +
+ " goto :error\n" +
+ " )\n" +
+ "\n" +
+ "REM Check installation path for the cat tool.\n" +
+ "if not defined OO_SDK_CAT_HOME (\n" +
+ " echo Error: the variable OO_SDK_CAT_HOME is missing!\n" +
+ " goto :error\n" +
+ " )\n" +
+ "\n" +
+ "REM Check installation path for the sed tool.\n" +
+ "if not defined OO_SDK_SED_HOME (\n" +
+ " echo Error: the variable OO_SDK_SED_HOME is missing!\n" +
+ " goto :error\n" +
+ " )\n" +
+ "\n" +
+ "REM Set library path. \n" +
+ "set LIB=%OO_SDK_HOME%\\lib;%LIB%\n" +
+ "if defined CPP_WINDOWS_SDK (\n" +
+ " set LIB=%LIB%;%CPP_WINDOWS_SDK%\\lib\n" +
+ " )\n" +
+ "\n" +
+ "REM Set office program path.\n" +
+ "if defined OFFICE_HOME (\n" +
+ " set OFFICE_PROGRAM_PATH=%OFFICE_HOME%\\program\n" +
+ " )\n" +
+ "\n" +
+ "REM Set UNO path, necessary to ensure that the cpp examples using the\n" +
+ "REM new UNO bootstrap mechanism use the configured office installation\n" +
+ "REM (only set when using an Office).\n" +
+ "if defined OFFICE_HOME (\n" +
+ " set UNO_PATH=%OFFICE_PROGRAM_PATH%\n" +
+ " )\n" +
+ "\n" +
+ "set OO_SDK_URE_BIN_DIR=%OFFICE_PROGRAM_PATH%\n" +
+ "set OO_SDK_URE_LIB_DIR=%OFFICE_PROGRAM_PATH%\n" +
+ "set OO_SDK_URE_JAVA_DIR=%OFFICE_PROGRAM_PATH%\\classes\n" +
+ "set OO_SDK_OFFICE_BIN_DIR=%OFFICE_PROGRAM_PATH%\n" +
+ "set OO_SDK_OFFICE_LIB_DIR=%OFFICE_PROGRAM_PATH%\n" +
+ "set OO_SDK_OFFICE_JAVA_DIR=%OFFICE_PROGRAM_PATH%\\classes\n" +
+ "\n" +
+ "REM Set classpath\n" +
+ "set CLASSPATH=%OO_SDK_URE_JAVA_DIR%\\libreoffice.jar;%OO_SDK_URE_JAVA_DIR%\\unoloader.jar\n" +
+ "\n" +
+ "REM Add directory of the SDK tools to the path.\n" +
+ "set PATH=%OO_SDK_HOME%\\bin;%OO_SDK_URE_BIN_DIR%;%OO_SDK_OFFICE_BIN_DIR%;%OO_SDK_HOME%\\WINexample.out\\bin;%PATH%\n" +
+ "\n" +
+ "REM Set PATH appropriate to the output directory\n" +
+ "if defined OO_SDK_OUT set PATH=%OO_SDK_OUT%\\WINexample.out\\bin;%PATH%\n" +
+ "if not defined OO_SDK_OUT set PATH=%OO_SDK_HOME%\\WINexample.out\\bin;%PATH%\n" +
+ "\n" +
+ "REM Add directory of the command make to the path, if necessary.\n" +
+ "if defined OO_SDK_MAKE_HOME set PATH=%OO_SDK_MAKE_HOME%;%PATH%\n" +
+ "\n" +
+ "REM Add directory of the zip tool to the path, if necessary.\n" +
+ "if defined OO_SDK_ZIP_HOME set PATH=%OO_SDK_ZIP_HOME%;%PATH%\n" +
+ "\n" +
+ "REM Add directory of the cat tool to the path, if necessary.\n" +
+ "if defined OO_SDK_CAT_HOME set PATH=%OO_SDK_CAT_HOME%;%PATH%\n" +
+ "\n" +
+ "REM Add directory of the sed tool to the path, if necessary.\n" +
+ "if defined OO_SDK_SED_HOME set PATH=%OO_SDK_SED_HOME%;%PATH%\n" +
+ "\n" +
+ "REM Add directory of the C++ compiler to the path, if necessary.\n" +
+ "if defined OO_SDK_CPP_HOME set PATH=%OO_SDK_CPP_HOME%;%PATH%\n" +
+ "\n" +
+ "REM Add directory of the Win SDK to the path, if necessary.\n" +
+ "if defined CPP_WINDOWS_SDK set PATH=%CPP_WINDOWS_SDK%\\bin;%PATH%\n" +
+ "if defined CPP_WINDOWS_SDK set INCLUDE=%CPP_WINDOWS_SDK%\\Include;%INCLUDE%\n" +
+ "REM Add directory of the C# and VB.NET compilers to the path, if necessary.\n" +
+ "if defined OO_SDK_CLI_HOME set PATH=%OO_SDK_CLI_HOME%;%PATH%\n" +
+ "\n" +
+ "REM Add directory of the Java tools to the path, if necessary.\n" +
+ "if defined OO_SDK_JAVA_HOME set PATH=%OO_SDK_JAVA_HOME%\\bin;%OO_SDK_JAVA_HOME%\\jre\\bin;%PATH%\n" +
+ "\n" +
+ "REM Set environment for C++ compiler tools, if necessary.\n" +
+ "if defined OO_SDK_CPP_HOME call \"%OO_SDK_CPP_HOME%\\VCVARS32.bat\"\n" +
+ "\n" +
+ "REM Set title to identify the prepared shell.\n" +
+ "title Shell prepared for SDK\n" +
+ "\nREM Prepare shell with all necessary environment variables.\n" +
+ "echo.\n" +
+ "echo ******************************************************************\n" +
+ "echo *\n" +
+ "echo * SDK environment is prepared for Windows\n" +
+ "echo *\n" +
+ "echo * SDK = %OO_SDK_HOME%\n" +
+ "echo * Office = %OFFICE_HOME%\n" +
+ "echo * Make = %OO_SDK_MAKE_HOME%\n" +
+ "echo * Zip = %OO_SDK_ZIP_HOME%\n" +
+ "echo * cat = %OO_SDK_CAT_HOME%\n" +
+ "echo * sed = %OO_SDK_SED_HOME%\n" +
+ "echo * C++ Compiler = %OO_SDK_CPP_HOME%\n" +
+ "echo * C# and VB.NET compilers = %OO_SDK_CLI_HOME%\n" +
+ "echo * Java = %OO_SDK_JAVA_HOME%\n" +
+ "echo * Special Output directory = %OO_SDK_OUT%\n" +
+ "echo * Auto deployment = %SDK_AUTO_DEPLOYMENT%\n" +
+ "echo *\n" +
+ "echo ******************************************************************\n" +
+ "echo.\n" +
+ "goto end\n" +
+ "\n" +
+ " :error\n" +
+ "Error: Please insert the necessary environment variables into the batch file.\n" +
+ "\n" +
+ " :end\n"
+ );
+ newFile.Close();
+}
diff --git a/odk/config/configure.pl b/odk/config/configure.pl
new file mode 100755
index 000000000..f3d0e08b3
--- /dev/null
+++ b/odk/config/configure.pl
@@ -0,0 +1,777 @@
+#
+# 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/.
+#
+# This file incorporates work covered by the following license notice:
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership. The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.apache.org/licenses/LICENSE-2.0 .
+#
+# configure.pl - a perl script to set a minimal environment for the SDK.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+
+use IO::File;
+use File::Basename;
+
+$main::hostname= $ARGV[0];
+$main::sdkpath= $ARGV[1];
+$main::OO_SDK_NAME= $ARGV[2];
+
+$main::OO_MAJORVERSION=$main::OO_SDK_NAME;
+$main::OO_MINORVERSION=$main::OO_SDK_NAME;
+$main::OO_MAJORVERSION =~ s#[^\d]+(\d).(\d).+#$1#go;
+$main::OO_MINORVERSION =~ s#[^\d]+(\d).(\d).+#$2#go;
+
+$main::OO_SDK_CONFIG_HOME= "$ENV{HOME}/$main::OO_SDK_NAME";
+
+$main::operatingSystem = `/bin/sh $main::sdkpath/config.guess | cut -d"-" -f3,4`;
+chomp ($main::operatingSystem);
+
+$main::OO_SDK_HOME = $main::sdkpath;
+#$main::OO_SDK_HOME = "";
+$main::OO_SDK_HOME_SUGGESTION = $main::sdkpath;
+
+$main::OFFICE_HOME = "";
+
+$main::OO_SDK_MAKE_HOME = "";
+$main::makeName = "make";
+if ( $main::operatingSystem =~ m/solaris/ ||
+ $main::operatingSystem =~ m/freebsd/ )
+{
+ $main::makeName = "gmake";
+}
+$main::OO_SDK_MAKE_HOME_SUGGESTION = searchprog($main::makeName);
+$main::makeVersion = "3.79.1";
+$main::correctVersion = 0;
+
+$main::OO_SDK_ZIP_HOME = "";
+$main::OO_SDK_ZIP_HOME_SUGGESTION = searchprog("zip");
+$main::zipVersion = "2.3";
+
+$main::OO_SDK_CAT_HOME = "";
+$main::OO_SDK_CAT_HOME_SUGGESTION = searchprog("cat");
+# TODO cat version
+# $main::catVersion = "";
+
+$main::OO_SDK_SED_HOME = "";
+$main::OO_SDK_SED_HOME_SUGGESTION = searchprog("sed");
+# TODO sed version
+# $main::sedVersion = "";
+
+$main::OO_SDK_CPP_HOME = "";
+$main::cppName = "gcc";
+$main::cppVersion = "4.0.1";
+$main::OO_SDK_CPP_HOME_SUGGESTION = searchprog($main::cppName);
+
+$main::OO_SDK_JAVA_HOME = "";
+$main::OO_SDK_JAVA_HOME_SUGGESTION = searchprog("javac");
+$main::javaVersion = "1.6";
+
+$main::SDK_AUTO_DEPLOYMENT = "";
+$main::SDK_AUTO_DEPLOYMENT_SUGGESTION = "YES";
+
+$main::OO_SDK_OUTPUT_DIR_SUGGESTION = "$ENV{HOME}";
+$main::OO_SDK_OUTPUT_DIR = "";
+$main::skipOutputDir = 0;
+
+$main::return = 0;
+
+if ( $main::operatingSystem =~ m/darwin/ )
+{
+ print " Used SDK = $main::OO_SDK_HOME\n\n";
+
+ $main::OFFICE_HOME_SUGGESTION = searchMacOffice();
+ while ( (! -d "$main::OFFICE_HOME" ) ||
+ ((-d "$main::OFFICE_HOME") && (! -d "$main::OFFICE_HOME/Contents/MacOS")) )
+ {
+ print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: ";
+ $main::OFFICE_HOME = readStdIn();
+ chop($main::OFFICE_HOME);
+ if ( $main::OFFICE_HOME eq "" )
+ {
+ $main::OFFICE_HOME = $main::OFFICE_HOME_SUGGESTION;
+ }
+
+ if ( ! -d "$main::OFFICE_HOME" )
+ {
+ $main::OFFICE_HOME = "";
+ print " Error: An office installation is required, please specify the path to a valid installation.\n";
+ }
+
+ }
+} else
+{
+ $main::OFFICE_HOME_SUGGESTION = searchoffice();
+
+ if ( $main::OFFICE_HOME_SUGGESTION eq "" ) {
+ # prepare Office path
+ $main::OFFICE_HOME_SUGGESTION = searchprog("soffice");
+ }
+
+ if ( ! $main::OFFICE_HOME_SUGGESTION eq "" )
+ {
+ my $tmpOffice = readlink "$main::OFFICE_HOME_SUGGESTION/soffice";
+
+ if ( $tmpOffice eq "" )
+ {
+ $tmpOffice = "$main::OFFICE_HOME_SUGGESTION/soffice";
+ }
+
+ my $offset = rindex($tmpOffice, "/program/soffice");
+ if ( $offset != -1 )
+ {
+ $main::OFFICE_HOME_SUGGESTION = substr($tmpOffice, 0, $offset);
+ } else
+ {
+ $offset = rindex($tmpOffice, "/soffice");
+ if ( $offset != -1 )
+ {
+ $main::OFFICE_HOME_SUGGESTION = substr($tmpOffice, 0, $offset);
+ } else
+ {
+ $main::OFFICE_HOME_SUGGESTION = "";
+ }
+ }
+ }
+
+ while ( (! -d "$main::OFFICE_HOME" ) ||
+ ((-d "$main::OFFICE_HOME") && (! -d "$main::OFFICE_HOME/program")) )
+ {
+ print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: ";
+ $main::OFFICE_HOME = readStdIn();
+ chop($main::OFFICE_HOME);
+ if ( $main::OFFICE_HOME eq "" )
+ {
+ $main::OFFICE_HOME = $main::OFFICE_HOME_SUGGESTION;
+ }
+
+ if ( ! -d "$main::OFFICE_HOME" )
+ {
+ $main::OFFICE_HOME = "";
+ print " Error: An office installation is required, please specify the path to a valid installation.\n";
+ } else
+ {
+ # special work for a network installation, no program directory but a link to the soffice binary
+ if ( (! -d "$main::OFFICE_HOME/program") && (-e "$main::OFFICE_HOME/soffice") )
+ {
+ my $soserver = `ls -l $OFFICE_HOME_SUGGESTION/soffice | sed -n 's/.* -> //p'`;
+ $soserver= substr($soserver, 0, rindex($soserver, "program") - 1);
+
+ if ( ! -d $soserver )
+ {
+ $main::OFFICE_HOME = "";
+ print " Error: An office installation is required, please specify the path to a valid installation.\n";
+ } else
+ {
+ $main::OFFICE_HOME = $soserver;
+ }
+ }
+ }
+ }
+}
+
+# prepare GNU make path
+while ( (!$main::correctVersion) &&
+ ((! -d "$main::OO_SDK_MAKE_HOME" ) ||
+ ((-d "$main::OO_SDK_MAKE_HOME") && (! -e "$main::OO_SDK_MAKE_HOME/$main::makeName"))) )
+{
+ print " Enter GNU make ($main::makeVersion or higher) tools directory [$main::OO_SDK_MAKE_HOME_SUGGESTION]: ";
+ $main::OO_SDK_MAKE_HOME = readStdIn();
+ chop($main::OO_SDK_MAKE_HOME);
+ if ( $main::OO_SDK_MAKE_HOME eq "" )
+ {
+ $main::OO_SDK_MAKE_HOME = $main::OO_SDK_MAKE_HOME_SUGGESTION;
+ }
+ if ( (! -d "$main::OO_SDK_MAKE_HOME") ||
+ ((-d "$main::OO_SDK_MAKE_HOME") && (! -e "$main::OO_SDK_MAKE_HOME/$main::makeName")) )
+ {
+ $main::OO_SDK_MAKE_HOME = "";
+ print " Error: GNU make is required, please specify a GNU make tools directory.\n";
+ } else
+ {
+ #check version
+ my $testVersion = `$OO_SDK_MAKE_HOME/$main::makeName --version`;
+ if ( $testVersion eq "")
+ {
+ print " Set the environment variable OO_SDK_MAKE_HOME to your GNU build tools directory.\n";
+ print " GNU make version $main::makeVersion can be obtained at ftp://ftp.gnu.org/gnu/make/\n";
+ } else
+ {
+ if ($testVersion =~ m#((\d+\.)+\d+)# )
+ {
+ $testVersion = $1;
+ }
+ $main::correctVersion = testVersion($main::makeVersion, $testVersion, "$main::OO_SDK_MAKE_HOME/$main::makeName", 1);
+ if ( !$main::correctVersion )
+ {
+ print " The '$main::makeName' command found at '$main::OO_SDK_MAKE_HOME' has a wrong version\n";
+ $main::OO_SDK_MAKE_HOME = "";
+ }
+ }
+ }
+}
+
+# prepare zip path
+$main::correctVersion = 0;
+while ( (!$main::correctVersion) &&
+ ((! -d "$main::OO_SDK_ZIP_HOME" ) ||
+ ((-d "$main::OO_SDK_ZIP_HOME") && (! -e "$main::OO_SDK_ZIP_HOME/zip"))) )
+{
+ print " Enter zip ($main::zipVersion or higher) tool directory [$main::OO_SDK_ZIP_HOME_SUGGESTION]: ";
+ $main::OO_SDK_ZIP_HOME = readStdIn();
+ chop($main::OO_SDK_ZIP_HOME);
+ if ( $main::OO_SDK_ZIP_HOME eq "" )
+ {
+ $main::OO_SDK_ZIP_HOME = $main::OO_SDK_ZIP_HOME_SUGGESTION;
+ }
+ if ( (! -d "$main::OO_SDK_ZIP_HOME") ||
+ ((-d "$main::OO_SDK_ZIP_HOME") && (! -e "$main::OO_SDK_ZIP_HOME/zip")) )
+ {
+ $main::OO_SDK_ZIP_HOME = "";
+ print " Error: zip tool is required, please specify a zip tool directory.\n";
+ } else
+ {
+ #check version
+ my $testVersion = `$OO_SDK_ZIP_HOME/zip -h 2>&1 | egrep Zip | head -n 1`;
+ $testVersion =~ s#Zip ([\d.]+) .*#$1#go;
+ if ( $testVersion eq "")
+ {
+ print " Set the environment variable OO_SDK_ZIP_HOME to your zip tool directory.\n";
+ print " zip version $main::zipVersion can be obtained at ftp://www.info-zip.org/\n";
+ } else
+ {
+ if ($testVersion =~ m#((\d+\.)+\d+)# )
+ {
+ $testVersion = $1;
+ }
+ $main::correctVersion = testVersion($main::zipVersion, $testVersion, "$main::OO_SDK_MAKE_HOME/zip", 1);
+ if ( !$main::correctVersion )
+ {
+ print " The 'zip' command found at '$main::OO_SDK_ZIP_HOME' has a wrong version\n";
+ $main::OO_SDK_ZIP_HOME = "";
+ }
+ }
+ }
+}
+
+# prepare cat path
+$main::correctVersion = 0;
+while ( (!$main::correctVersion) &&
+ ((! -d "$main::OO_SDK_CAT_HOME" ) ||
+ ((-d "$main::OO_SDK_CAT_HOME") && (! -e "$main::OO_SDK_CAT_HOME/cat"))) )
+{
+ print " Enter cat tool directory [$main::OO_SDK_CAT_HOME_SUGGESTION]: ";
+ $main::OO_SDK_CAT_HOME = readStdIn();
+ chop($main::OO_SDK_CAT_HOME);
+ if ( $main::OO_SDK_CAT_HOME eq "" )
+ {
+ $main::OO_SDK_CAT_HOME = $main::OO_SDK_CAT_HOME_SUGGESTION;
+ }
+ if ( (! -d "$main::OO_SDK_CAT_HOME") ||
+ ((-d "$main::OO_SDK_CAT_HOME") && (! -e "$main::OO_SDK_CAT_HOME/cat")) )
+ {
+ $main::OO_SDK_CAT_HOME = "";
+ print " Error: cat tool is required, please specify a cat tool directory.\n";
+ }
+ # else ...
+ # TODO check version
+ # NOTE: only Linux cat understands --version
+}
+
+# prepare sed path
+$main::correctVersion = 0;
+while ( (!$main::correctVersion) &&
+ ((! -d "$main::OO_SDK_SED_HOME" ) ||
+ ((-d "$main::OO_SDK_SED_HOME") && (! -e "$main::OO_SDK_SED_HOME/sed"))) )
+{
+ print " Enter sed tool directory [$main::OO_SDK_SED_HOME_SUGGESTION]: ";
+ $main::OO_SDK_SED_HOME = readStdIn();
+ chop($main::OO_SDK_SED_HOME);
+ if ( $main::OO_SDK_SED_HOME eq "" )
+ {
+ $main::OO_SDK_SED_HOME = $main::OO_SDK_SED_HOME_SUGGESTION;
+ }
+ if ( (! -d "$main::OO_SDK_SED_HOME") ||
+ ((-d "$main::OO_SDK_SED_HOME") && (! -e "$main::OO_SDK_SED_HOME/sed")) )
+ {
+ $main::OO_SDK_SED_HOME = "";
+ print " Error: sed tool is required, please specify a sed tool directory.\n";
+ }
+ # else ...
+ # TODO check version
+ # NOTE: only Linux sed understands --version
+}
+
+# prepare C++ compiler path
+$main::correctVersion = 0;
+while ( (!$main::correctVersion) &&
+ ((! -d "$main::OO_SDK_CPP_HOME" ) ||
+ ((-d "$main::OO_SDK_CPP_HOME") && (! -e "$main::OO_SDK_CPP_HOME/$main::cpp"))) )
+{
+ print " C++ compilers where for example a language binding exist:\n";
+ print " - Solaris, Sun WorkShop 6 update 1 C++ 5.2 2000/09/11 or higher\n";
+ print " - Linux, GNU C++ compiler, gcc version 4.0.1 or higher\n";
+ print " - MacOS, GNU C++ compiler, gcc version 4.0.1 or higher\n";
+ print " Enter the directory of the C++ compiler, the directory\n";
+ print " where the compiler is located (optional) [$main::OO_SDK_CPP_HOME_SUGGESTION]: ";
+
+ $main::OO_SDK_CPP_HOME = readStdIn();
+ chop($main::OO_SDK_CPP_HOME);
+ if ( $main::OO_SDK_CPP_HOME eq "" )
+ {
+ $main::OO_SDK_CPP_HOME = $main::OO_SDK_CPP_HOME_SUGGESTION;
+ }
+
+ if ( ! $main::OO_SDK_CPP_HOME eq "" )
+ {
+ if ( (! -d "$main::OO_SDK_CPP_HOME") ||
+ ((-d "$main::OO_SDK_CPP_HOME") && (! -e "$main::OO_SDK_CPP_HOME/$main::cppName")) )
+ {
+ print " Error: Could not find directory '$main::OO_SDK_CPP_HOME'.\n";
+ if ( skipChoice("C++ compiler") == 1 )
+ {
+ $main::correctVersion = 1;
+ }
+ $main::OO_SDK_CPP_HOME = "";
+ } else
+ {
+ #check version
+ if ( $main::cppName eq "gcc" )
+ {
+ my $testVersion = `$OO_SDK_CPP_HOME/$main::cppName -dumpversion`;
+ if ( $testVersion eq "")
+ {
+ print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a ";
+ print " GNU compiler.\nSet the environment variable OO_SDK_CPP_HOME to your GNU build tools ";
+ print " directory.\nA GNU compiler version $main::cppVersion can be obtained at ";
+ print " ftp://ftp.gnu.org/gnu/gcc/\n";
+ } else
+ {
+ $main::correctVersion = testVersion($main::cppVersion, $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 1);
+ if ( !$main::correctVersion )
+ {
+ print " The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n";
+ if ( skipChoice("C++ compiler") == 1 )
+ {
+ $main::correctVersion = 1;
+ }
+
+ $main::OO_SDK_CPP_HOME = "";
+ }
+ }
+ }
+ }
+ } else
+ {
+ # the C++ compiler is optional
+ $main::correctVersion = 1;
+ }
+}
+
+
+# prepare Java path
+$main::correctVersion = 0;
+
+# prepare Java suggestion (cut bin directory to be in the root of the Java SDK)
+$main::offset = rindex($main::OO_SDK_JAVA_HOME_SUGGESTION, "/bin");
+if ( $main::offset != -1 )
+{
+ $main::OO_SDK_JAVA_HOME_SUGGESTION = substr($main::OO_SDK_JAVA_HOME_SUGGESTION, 0, $main::offset);
+}
+
+while ( (!$main::correctVersion) &&
+ ((! -d "$main::OO_SDK_JAVA_HOME" ) ||
+ ((-d "$main::OO_SDK_JAVA_HOME") && (! -e "$main::OO_SDK_JAVA_HOME/bin/javac"))) )
+{
+ print " Enter Java SDK (1.6 or higher) installation directory (optional) [$main::OO_SDK_JAVA_HOME_SUGGESTION]: ";
+ $main::OO_SDK_JAVA_HOME = readStdIn();
+ chop($main::OO_SDK_JAVA_HOME);
+ if ( $main::OO_SDK_JAVA_HOME eq "" )
+ {
+ $main::OO_SDK_JAVA_HOME = $main::OO_SDK_JAVA_HOME_SUGGESTION;
+ }
+ if ( ! $main::OO_SDK_JAVA_HOME eq "" )
+ {
+ if ( (! -d "$main::OO_SDK_JAVA_HOME") ||
+ ((-d "$main::OO_SDK_JAVA_HOME") && (! -e "$main::OO_SDK_JAVA_HOME/bin/javac")) )
+ {
+ print " Error: Could not find directory '$main::OO_SDK_JAVA_HOME' or '$main::OO_SDK_JAVA_HOME/bin/javac'.\n";
+ if ( skipChoice("JAVA SDK") == 1 )
+ {
+ $main::correctVersion = 1;
+ }
+ $main::OO_SDK_JAVA_HOME = "";
+ } else
+ {
+ #check version
+ my $testVersion = `$main::OO_SDK_JAVA_HOME/bin/java -version 2>&1 | egrep "java version" | head -n 1 | sed -e 's#.*version "##' | sed -e 's#".*##'`;
+ $testVersion =~ s#([^\n]+)\n#$1#go;
+
+ $main::correctVersion = testVersion($main::javaVersion, $testVersion, "$main::OO_SDK_JAVA_HOME/bin/java", 1);
+ if ( !$main::correctVersion )
+ {
+ if ( skipChoice("JAVA SDK") == 1 )
+ {
+ $main::correctVersion = 1;
+ }
+ $main::OO_SDK_JAVA_HOME = "";
+ }
+ }
+ }else
+ {
+ # the Java SDK is optional
+ $main::correctVersion = 1;
+ }
+}
+
+
+# prepare output directory (optional)
+while ( (!$main::skipOutputDir) &&
+ (! -d "$main::OO_SDK_OUTPUT_DIR") )
+{
+ print " Default output directory is in your HOME directory.\n";
+ print " Enter an existent directory if you prefer a different output directory (optional) [$main::OO_SDK_OUTPUT_DIR_SUGGESTION]: ";
+
+ $main::OO_SDK_OUTPUT_DIR = readStdIn();
+
+ chop($main::OO_SDK_OUTPUT_DIR);
+ if ( $main::OO_SDK_OUTPUT_DIR eq "" )
+ {
+ $main::OO_SDK_OUTPUT_DIR = $main::OO_SDK_OUTPUT_DIR_SUGGESTION;
+ }
+ if ( ! $main::OO_SDK_OUTPUT_DIR eq "" )
+ {
+ if ( ! -d "$main::OO_SDK_OUTPUT_DIR" )
+ {
+ print " Error: Could not find directory '$main::OO_SDK_OUTPUT_DIR'.\n";
+ if ( skipChoice("optional output directory") == 1 )
+ {
+ $main::skipOutputDir = 1;
+ }
+ $main::OO_SDK_OUTPUT_DIR = "";
+ }
+ } else
+ {
+ # the output directory is optional
+ $main::skipOutputDir = 1;
+ }
+}
+
+# prepare auto deployment
+while ( $main::SDK_AUTO_DEPLOYMENT eq "" ||
+ ((! $main::SDK_AUTO_DEPLOYMENT eq "YES") &&
+ (! $main::SDK_AUTO_DEPLOYMENT eq "NO")) )
+{
+ print " Automatic deployment of UNO components (YES/NO) [$main::SDK_AUTO_DEPLOYMENT_SUGGESTION]: ";
+ $main::SDK_AUTO_DEPLOYMENT = uc <STDIN>;
+ chop($main::SDK_AUTO_DEPLOYMENT);
+ if ( $main::SDK_AUTO_DEPLOYMENT eq "" )
+ {
+ $main::SDK_AUTO_DEPLOYMENT = "YES";
+ }
+}
+
+prepareScriptFile("setsdkenv_unix.sh.in", "setsdkenv_unix.sh");
+chmod 0644, "$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh";
+
+print "\n";
+print " ************************************************************************\n";
+print " * ... your SDK environment has been prepared.\n";
+print " * For each time you want to use this configured SDK environment, you\n";
+print " * have to run the \"setsdkenv_unix\" script file!\n";
+print " * Alternatively can you source one of the scripts\n";
+print " * \"$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh\"\n";
+print " * to get an environment without starting a new shell.\n";
+print " ************************************************************************\n\n";
+
+exit $return;
+
+sub skipChoice
+{
+ my $msg = shift;
+ my $skip = "";
+ while ( !( $skip eq "yes" || $skip eq "no") )
+ {
+ print " Do you want to skip the choice of the '$msg' (YES/NO): [YES] ";
+ $skip = lc <STDIN>;
+ chop($skip);
+ if ( $skip eq "" ) { $skip = "yes"; } # default
+ if ( $skip eq "yes" )
+ {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+sub resolveLink
+{
+ my $base= shift;
+ my $link= shift;
+
+ my $resolvedpath = "$base/$link";
+ my $linktarget = readlink "$resolvedpath";
+ my $resolvedlink = "";
+
+ while ( $linktarget ne "") {
+
+ if ( $linktarget =~ m/^\/.*/ )
+ {
+ $resolvedpath = "$linktarget";
+ } else {
+ $resolvedpath = `cd $base/$linktarget; pwd`;
+ chop $resolvedpath;
+ }
+ $base = dirname("$resolvedpath");
+
+ $linktarget = readlink "$resolvedpath";
+ }
+
+ $resolvedlink = `cd $resolvedpath; pwd`;
+ chop $resolvedlink;
+ return $resolvedlink;
+}
+
+sub searchprog
+{
+ my $_search= shift;
+ my $tmpPath = `echo "\$PATH"`;
+ my @pathList = split(":" , $tmpPath);
+ my $progDir = "";
+
+ if ( $_search eq "javac" )
+ {
+ if ( $main::operatingSystem =~ m/darwin/ ) {
+ $progDir = resolveLink("/System/Library/Frameworks/JavaVM.Framework/Versions", "CurrentJDK");
+
+ if ( -e "$progDir/Home/bin/javac" )
+ {
+ return "$progDir/Home/bin";
+ }
+ }
+
+ if ( $main::operatingSystem =~ m/solaris/ ) {
+ $progDir = resolveLink("/usr/jdk", "latest");
+ if ( -e "$progDir/bin/javac" )
+ {
+ return "$progDir/bin";
+ }
+ }
+ }
+
+ if ( $_search eq "gmake" && $main::operatingSystem =~ m/solaris/ ) {
+ if ( -e "/usr/sfw/bin/gmake" )
+ {
+ return "/usr/sfw/bin";
+ }
+ }
+
+ foreach $i (@pathList)
+ {
+ chomp ($i);
+
+ if ( -e "$i/$_search" )
+ {
+
+ if ( index($i, "/") == 0 )
+ {
+ # # absolute path; leave unchanged
+ $progDir = $i;
+ } else
+ {
+ $progDir = `cd "$i"; pwd`;
+ }
+ return $progDir
+ }
+ }
+ return $progDir
+}
+
+sub searchMacOffice
+{
+ if (-d "/Applications/LibreOffice.app" ) {
+ return "/Applications/LibreOffice.app"
+ }
+ if (-d "/Applications/OpenOffice.org.app" ) {
+ return "/Applications/OpenOffice.org.app"
+ }
+ if (-d "/Applications/Oracle Open Office.app" ) {
+ return "/Applications/Oracle Open Office.app";
+ }
+ if (-d "/Applications/StarOffice.app" ) {
+ return "/Applications/StarOffice.app";
+ }
+ if (-d "/Applications/StarSuite.app" ) {
+ return "/Applications/StarSuite.app";
+ }
+
+ return "";
+}
+
+sub searchoffice
+{
+ my $offset = rindex($main::sdkpath, "/libreoffice");
+ my $tmpOffice = substr($main::sdkpath, 0, $offset);
+ my $officepath = "$tmpOffice/libreoffice";
+
+# if ( $main::OO_MINORVERSION > 0) {
+# $officepath = "$officepath$main::OO_MINORVERSION";
+# }
+
+ # search corresponding office for this SDK
+ if (-d $officepath && -e "$officepath/program/soffice") {
+ return $officepath;
+ }
+ # fallback
+ my $tmpversion = $main::OO_MAJORVERSION;
+# if ( $main::OO_MINORVERSION > 0) {
+# $tmpversion = "$tmpversion.$main::OO_MINORVERSION";
+# }
+
+ $officepath = "$tmpOffice/oracle_open_office$tmpversion";
+ if (-d $officepath && -e "$officepath/program/soffice") {
+ return $officepath;
+ }
+
+ # Before trying versioned directories, check if the sdk is directly under
+ # the office path.
+ $officepath = $main::sdkpath . "/..";
+ if (-d $officepath && -e "$officepath/program/soffice") {
+ return $officepath;
+ }
+
+ my $tmpversion = $main::OO_MAJORVERSION + 6;
+ if ( $main::OO_MINORVERSION > 0) {
+ $tmpversion = "$tmpversion.$main::OO_MINORVERSION";
+ }
+
+ $officepath = "$tmpOffice/staroffice$tmpversion";
+ if (-d $officepath && -e "$officepath/program/soffice") {
+ return $officepath;
+ }
+ $officepath = "$tmpOffice/StarOffice$tmpversion";
+ if (-d $officepath && -e "$officepath/program/soffice") {
+ return $officepath;
+ }
+ $officepath = "$tmpOffice/starsuite$tmpversion";
+ if (-d $officepath && -e "$officepath/program/soffice") {
+ return $officepath;
+ }
+ $officepath = "$tmpOffice/StarSuite$tmpversion";
+ if (-d $officepath && -e "$officepath/program/soffice") {
+ return $officepath;
+ }
+ $officepath = "";
+
+ # search other potential matching office versions
+ my $path = "/opt/";
+ my $entry = "";
+ my $version = "0";
+ for $entry (glob($path.'*')) {
+ ## if the file is a directory
+ if( -d $entry) {
+
+ if ($entry =~ m#(.+(o|O)ffice(\.org){0,1}(\d([\d\.]){0,2}))# ||
+ $entry =~ m#(.+(s|S)uite(.*)(\d([\d\.]){0,2}))# )
+ {
+ if ($4 > $version) {
+ $version = $4;
+ $officepath = $entry;
+ }
+ }
+ }
+ }
+ return $officepath;
+}
+
+
+
+sub testVersion
+{
+ my $tmpMustBeVersion = shift;
+ my $tmpTestVersion = shift;
+ my $toolName = shift;
+ # 1=check + message 2=check only
+ my $checkOnly = shift;
+ my @mustBeVersion = split(/\.|_|-/,$tmpMustBeVersion);
+ my @testVersion = split(/\.|_|-/,$tmpTestVersion);
+ my $length = $#mustBeVersion;
+
+ if ($#testVersion < $#mustBeVersion) {
+ $length = $#testVersion;
+ }
+
+ for ($i=0; $i <= $length; $i++ )
+ {
+ if ( $testVersion[$i] > $mustBeVersion[$i] )
+ {
+ return 1; # 1 indicates a correct version
+ }
+
+ if ( $testVersion[$i] < $mustBeVersion[$i] )
+ {
+ if ( $#checkOnly == 1 ) {
+ print " The command '$toolName' has the version $tmpTestVersion.\n";
+ print " The SDK requires at least the version $tmpMustBeVersion.\n";
+ }
+ return 0;
+ }
+ }
+
+ return 1; # 1 indicates a correct version
+}
+
+sub readStdIn
+{
+ my $tmpstdin = <STDIN>;
+ if ( index($tmpstdin, "\$") != -1)
+ {
+ return `echo $tmpstdin`;
+ }
+
+ return $tmpstdin;
+}
+
+sub prepareScriptFile()
+{
+ my $inputFile = shift;
+ my $outputFile = shift;
+
+ if ( ! -d "$main::OO_SDK_CONFIG_HOME/$main::hostname" )
+ {
+ system("mkdir -p $main::OO_SDK_CONFIG_HOME/$main::hostname");
+ }
+
+ open ( FILEIN, "$main::sdkpath/$inputFile" ) || die "\nERROR: could not open '$main::sdkpath/$inputFile' for reading";
+ open ( FILEOUT, ">$main::OO_SDK_CONFIG_HOME/$main::hostname/$outputFile" ) || die "\nERROR: could not open '$main::OO_SDK_CONFIG_HOME/$main::hostname/$outputFile' for writing";
+
+ while ( <FILEIN> )
+ {
+ $_ =~ s#\@OO_SDK_NAME\@#$main::OO_SDK_NAME#go;
+ $_ =~ s#\@OO_SDK_HOME\@#$main::OO_SDK_HOME#go;
+ $_ =~ s#\@OFFICE_HOME\@#$main::OFFICE_HOME#go;
+ $_ =~ s#\@OO_SDK_MAKE_HOME\@#$main::OO_SDK_MAKE_HOME#go;
+ $_ =~ s#\@OO_SDK_ZIP_HOME\@#$main::OO_SDK_ZIP_HOME#go;
+ $_ =~ s#\@OO_SDK_CAT_HOME\@#$main::OO_SDK_CAT_HOME#go;
+ $_ =~ s#\@OO_SDK_SED_HOME\@#$main::OO_SDK_SED_HOME#go;
+ $_ =~ s#\@OO_SDK_CPP_HOME\@#$main::OO_SDK_CPP_HOME#go;
+ $_ =~ s#\@OO_SDK_JAVA_HOME\@#$main::OO_SDK_JAVA_HOME#go;
+ $_ =~ s#\@SDK_AUTO_DEPLOYMENT\@#$main::SDK_AUTO_DEPLOYMENT#go;
+ $_ =~ s#\@OO_SDK_OUTPUT_DIR\@#$main::OO_SDK_OUTPUT_DIR#go;
+
+ print FILEOUT $_;
+ }
+
+ close FILEIN;
+ close FILEOUT;
+}
diff --git a/odk/config/setsdkenv_unix b/odk/config/setsdkenv_unix
new file mode 100755
index 000000000..cc5f06e64
--- /dev/null
+++ b/odk/config/setsdkenv_unix
@@ -0,0 +1,76 @@
+#! /bin/sh
+#
+# 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/.
+#
+# This file incorporates work covered by the following license notice:
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership. The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.apache.org/licenses/LICENSE-2.0 .
+#
+
+OSTYPE=`uname -s`
+HOSTNAME=`hostname`
+CURRENTDIR=`/bin/pwd`
+SDKTMPDIR=`dirname $0`
+OO_SDK_HOME=`(cd $SDKTMPDIR && pwd && cd $CURRENTDIR) | head -n 1`
+OOVERSION=`cat $OO_SDK_HOME/settings/dk.mk | tail -3 | head -n 1 | cut -d"=" -f2 | cut -d"." -f1,2`
+if [ "$OSTYPE" = "Darwin" ]
+then
+ OO_SDK_NAME=`basename $OO_SDK_HOME`
+else
+ OO_SDK_NAME=libreoffice${OOVERSION}_sdk
+fi
+
+export OO_SDK_HOME
+
+if [ "$1" = "--force-configure" ]
+then
+ if [ -r $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh ]
+ then
+ rm $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh
+ fi
+ shift
+elif [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ -n "$1" ]
+then
+ echo
+ echo " using: setsdkenv_unix [options]"
+ echo ""
+ echo " options:"
+ echo " --force-configure : force a new configuration of your SDK environment."
+ echo " Alternatively can you edit your SDK environment scripts directly:"
+ echo " $HOME/$OO_SDK_NAME/setsdkenv_unix.sh"
+ echo " -h, --help : print this help and exit"
+ echo
+ exit 1
+fi
+
+# source the prepared environment and start a new shell
+if [ -r $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh ]
+then
+ . $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh
+else
+ echo
+ echo " ************************************************************************"
+ echo " *"
+ echo " * You have to configure your SDK environment first before you can"
+ echo " * use it. The configuration has to be done only once."
+ echo " *"
+ echo " ************************************************************************"
+ echo
+
+ perl $OO_SDK_HOME/configure.pl $HOSTNAME $OO_SDK_HOME $OO_SDK_NAME
+
+ . $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh
+fi
+
+"$SHELL" "$@"
+echo Shell terminated.
diff --git a/odk/config/setsdkenv_unix.sh.in b/odk/config/setsdkenv_unix.sh.in
new file mode 100644
index 000000000..7feda4159
--- /dev/null
+++ b/odk/config/setsdkenv_unix.sh.in
@@ -0,0 +1,300 @@
+#! /bin/sh
+#
+# 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/.
+#
+# This file incorporates work covered by the following license notice:
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership. The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.apache.org/licenses/LICENSE-2.0 .
+#
+
+# This script starts a new shell and sets all environment variables, which
+# are necessary for building the examples of the Office Development Kit.
+# The Script was developed for the operating systems Solaris, Linux and MacOS.
+
+# The SDK name
+OO_SDK_NAME=@OO_SDK_NAME@
+export OO_SDK_NAME
+
+# Installation directory of the Software Development Kit.
+# Example: OO_SDK_HOME=/opt/libreoffice/basis3.4/sdk
+OO_SDK_HOME='@OO_SDK_HOME@'
+
+# Office installation directory.
+# Example: OFFICE_HOME=/opt/libreoffice
+OFFICE_HOME='@OFFICE_HOME@'
+export OFFICE_HOME
+
+# Directory of the make command.
+# Example: OO_SDK_MAKE_HOME=/usr/bin
+OO_SDK_MAKE_HOME=@OO_SDK_MAKE_HOME@
+
+# Directory of the zip command.
+# Example: OO_SDK_ZIP_HOME=/usr/bin
+OO_SDK_ZIP_HOME=@OO_SDK_ZIP_HOME@
+
+# Directory of the cat command.
+# Example: OO_SDK_CAT_HOME=/usr/bin
+OO_SDK_CAT_HOME=@OO_SDK_CAT_HOME@
+
+# Directory of the sed command.
+# Example: OO_SDK_SED_HOME=/usr/bin
+OO_SDK_SED_HOME=@OO_SDK_SED_HOME@
+
+# Directory of the C++ compiler.
+# Example: OO_SDK_CPP_HOME=/usr/bin
+OO_SDK_CPP_HOME=@OO_SDK_CPP_HOME@
+
+# Directory of the Java SDK.
+# Example: OO_SDK_JAVA_HOME=/usr/jdk/jdk1.6.0_10
+OO_SDK_JAVA_HOME=@OO_SDK_JAVA_HOME@
+
+# Special output directory
+# Example: OO_SDK_OUTPUT_DIR=$HOME
+OO_SDK_OUTPUT_DIR=@OO_SDK_OUTPUT_DIR@
+
+# Environment variable to enable auto deployment of example components
+# Example: SDK_AUTO_DEPLOYMENT=YES
+SDK_AUTO_DEPLOYMENT=@SDK_AUTO_DEPLOYMENT@
+export SDK_AUTO_DEPLOYMENT
+
+# Check installation path for the OpenOffice Development Kit.
+if [ -z "${OO_SDK_HOME}" ]
+then
+ echo Error: Please insert a correct value for the variable OO_SDK_HOME.
+ exit 0
+fi
+
+export OO_SDK_HOME
+
+# Get the operating system.
+sdk_platform=`/bin/sh ${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`
+
+# Set the directory name.
+programdir=program
+sdk_lo_java_dir=program/classes
+case ${sdk_platform} in
+ darwin*)
+ programdir="Contents/MacOS"
+ sdk_lo_java_dir=Contents/Resources/java
+ ;;
+esac
+
+# Set office program path (only set when using an Office).
+OFFICE_PROGRAM_PATH=${OFFICE_HOME}/${programdir}
+export OFFICE_PROGRAM_PATH
+
+# Set UNO path, necessary to ensure that the cpp examples using the
+# new UNO bootstrap mechanism use the configured office installation (only set
+# when using an Office).
+UNO_PATH=${OFFICE_PROGRAM_PATH}
+export UNO_PATH
+
+case ${sdk_platform} in
+ darwin*)
+ OO_SDK_URE_BIN_DIR=${OFFICE_PROGRAM_PATH}
+ OO_SDK_URE_LIB_DIR=${OFFICE_HOME}/Contents/Frameworks
+ OO_SDK_URE_JAVA_DIR=${OFFICE_HOME}/${sdk_lo_java_dir}
+ ;;
+ *)
+ OO_SDK_URE_BIN_DIR=${OFFICE_PROGRAM_PATH}
+ OO_SDK_URE_LIB_DIR=${OFFICE_PROGRAM_PATH}
+ OO_SDK_URE_JAVA_DIR=${OFFICE_PROGRAM_PATH}/classes
+ ;;
+esac
+export OO_SDK_URE_BIN_DIR
+export OO_SDK_URE_LIB_DIR
+export OO_SDK_URE_JAVA_DIR
+
+OO_SDK_OUT=$OO_SDK_HOME
+# Prepare appropriate output directory.
+if [ -n "${OO_SDK_OUTPUT_DIR}" ]
+then
+ OO_SDK_OUT=${OO_SDK_OUTPUT_DIR}/${OO_SDK_NAME}
+ export OO_SDK_OUT
+fi
+
+# Set the directory name.
+case ${sdk_platform} in
+ solaris*)
+ sdk_proctype=`/bin/sh ${OO_SDK_HOME}/config.guess | cut -d"-" -f1`
+ if [ "${sdk_proctype}" = "sparc" ]
+ then
+ directoryname=solsparc
+ platform='Solaris Sparc'
+ else
+ directoryname=solintel
+ platform='Solaris x86'
+ fi
+ comid=gcc3
+ soext=so
+ exampleout=SOLARISexample.out
+ LD_LIBRARY_PATH=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
+ export LD_LIBRARY_PATH
+ ;;
+
+ darwin*)
+ directoryname=macosx
+ comid=gcc3
+ soext=dylib
+ exampleout=MACOSXexample.out
+ platform=MacOSX
+ DYLD_LIBRARY_PATH=${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${DYLD_LIBRARY_PATH}
+ export DYLD_LIBRARY_PATH
+ ;;
+
+ linux-gnu*)
+ directoryname=linux
+ comid=gcc3
+ soext=so
+ exampleout=LINUXexample.out
+ platform=Linux
+ LD_LIBRARY_PATH=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
+ export LD_LIBRARY_PATH
+ ;;
+
+ freebsd*)
+ directoryname=freebsd
+ comid=gcc3
+ soext=so
+ exampleout=FREEBSDexample.out
+ platform=FreeBSD
+ LD_LIBRARY_PATH=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
+ export LD_LIBRARY_PATH
+
+ if [ -e "/sbin/sysctl" ]
+ then
+ OSVERSION=`/sbin/sysctl -n kern.osreldate`
+ else
+ OSVERSION=`/usr/sbin/sysctl -n kern.osreldate`
+ fi
+ if [ $OSVERSION -lt 500016 ]
+ then
+ PTHREAD_CFLAGS=-D_THREAD_SAFE
+ PTHREAD_LIBS=-pthread
+ export PTHREAD_CFLAGS
+ export PTHREAD_LIBS
+ elif [ $OSVERSION -lt 502102 ]
+ then
+ PTHREAD_CFLAGS=-D_THREAD_SAFE
+ PTHREAD_LIBS=-lc_r
+ export PTHREAD_CFLAGS
+ export PTHREAD_LIBS
+ else
+ PTHREAD_LIBS=-pthread
+ export PTHREAD_LIBS
+ fi
+ ;;
+esac
+
+# Add directory of the SDK tools to the path.
+PATH=${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}/bin:${OO_SDK_URE_BIN_DIR}:${OFFICE_PROGRAM_PATH}:${PATH}
+
+# Set the classpath
+CLASSPATH=${OO_SDK_URE_JAVA_DIR}/libreoffice.jar:${OO_SDK_URE_JAVA_DIR}/unoloader.jar:${CLASSPATH}
+export CLASSPATH
+
+
+# Add directory of the command make to the path, if necessary.
+if [ -n "${OO_SDK_MAKE_HOME}" ]
+then
+ PATH=${OO_SDK_MAKE_HOME}:${PATH}
+ export OO_SDK_MAKE_HOME
+fi
+
+# Add directory of the zip tool to the path, if necessary.
+if [ -n "${OO_SDK_ZIP_HOME}" ]
+then
+ PATH=${OO_SDK_ZIP_HOME}:${PATH}
+ export OO_SDK_ZIP_HOME
+fi
+
+# Add directory of the sed tool to the path, if necessary.
+if [ -n "${OO_SDK_SED_HOME}" ]
+then
+ PATH=${OO_SDK_SED_HOME}:${PATH}
+ export OO_SDK_SED_HOME
+fi
+
+# Add directory of the cat tool to the path, if necessary.
+if [ -n "${OO_SDK_CAT_HOME}" ]
+then
+ PATH=${OO_SDK_CAT_HOME}:${PATH}
+ export OO_SDK_CAT_HOME
+fi
+
+# Add directory of the C++ tools to the path, if necessary.
+if [ -n "${OO_SDK_CPP_HOME}" ]
+then
+ PATH=${OO_SDK_CPP_HOME}:${PATH}
+ export OO_SDK_CPP_HOME
+fi
+
+# Add directory of the Java tools to the path, if necessary.
+if [ -n "${OO_SDK_JAVA_HOME}" ]
+then
+ PATH=${OO_SDK_JAVA_HOME}/bin:${PATH}
+# JAVA_HOME=${OO_SDK_JAVA_HOME}
+# export JAVA_HOME
+ export OO_SDK_JAVA_HOME
+
+ export PATH
+fi
+
+export PATH
+
+if [ "${platform}" = "MacOSX" ]
+then
+# For URE, prepare symbolic links for libraries:
+# Only necessary on MacOSX, on other Unix systems the links are already prepared
+# in the SDK installation.
+
+# cleanup potential old links first
+ rm -f "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}" \
+ "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}" \
+ "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}" \
+ "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}" \
+ "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
+
+# prepare links
+ mkdir -p "${OO_SDK_OUT}/${directoryname}/lib"
+ ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppu.${soext}.3" \
+ "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}"
+ ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppuhelper${comid}.${soext}.3" \
+ "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}"
+ ln -s "${OO_SDK_URE_LIB_DIR}/libuno_sal.${soext}.3" \
+ "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}"
+ ln -s "${OO_SDK_URE_LIB_DIR}/libuno_salhelper${comid}.${soext}.3" \
+ "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
+ ln -s "${OO_SDK_URE_LIB_DIR}/libuno_purpenvhelper${comid}.${soext}.3" \
+ "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
+fi
+
+
+# Prepare shell with all necessary environment variables.
+echo
+echo " ************************************************************************"
+echo " *"
+echo " * SDK environment is prepared for ${platform}"
+echo " *"
+echo " * SDK = $OO_SDK_HOME"
+echo " * Office = $OFFICE_HOME"
+echo " * Make = $OO_SDK_MAKE_HOME"
+echo " * Zip = $OO_SDK_ZIP_HOME"
+echo " * cat = $OO_SDK_CAT_HOME"
+echo " * sed = $OO_SDK_SED_HOME"
+echo " * C++ Compiler = $OO_SDK_CPP_HOME"
+echo " * Java = $OO_SDK_JAVA_HOME"
+echo " * SDK Output directory = $OO_SDK_OUT"
+echo " * Auto deployment = $SDK_AUTO_DEPLOYMENT"
+echo " *"
+echo " ************************************************************************"
diff --git a/odk/config/setsdkenv_windows.bat b/odk/config/setsdkenv_windows.bat
new file mode 100755
index 000000000..e6d1335ad
--- /dev/null
+++ b/odk/config/setsdkenv_windows.bat
@@ -0,0 +1,82 @@
+rem
+rem This file is part of the LibreOffice project.
+rem
+rem This Source Code Form is subject to the terms of the Mozilla Public
+rem License, v. 2.0. If a copy of the MPL was not distributed with this
+rem file, You can obtain one at http://mozilla.org/MPL/2.0/.
+rem
+rem This file incorporates work covered by the following license notice:
+rem
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements. See the NOTICE file distributed
+rem with this work for additional information regarding copyright
+rem ownership. The ASF licenses this file to you under the Apache
+rem License, Version 2.0 (the "License"); you may not use this file
+rem except in compliance with the License. You may obtain a copy of
+rem the License at http://www.apache.org/licenses/LICENSE-2.0 .
+rem
+
+@echo off
+
+set SDK_DIR_TMP=%~dp0
+set SDK_DIR=%SDK_DIR_TMP:~0,-1%
+
+if "%@RIGHT[5,%SDK_DIR%]" EQU "~0,-1" (
+ set SDK_DIR=%@FULL[%0]
+ set /A LENGTH=%@LEN[%SDK_DIR%] - 22
+ set SDK_DIR=%@LEFT[%LENGTH%,%SDK_DIR%]
+ unset LENGTH
+)
+
+set OO_SDK_NAME=__SDKNAME__
+
+set OO_USER_SDK_DIR=%APPDATA%\%OO_SDK_NAME%
+set OO_USER_SDKENV_SCRIPT=%OO_USER_SDK_DIR%\setsdkenv_windows.bat
+
+if "%1" EQU "--force-configure" (
+ if exist "%OO_USER_ENV_SCRIPT%". (
+ del "%OO_USER_SDKENV_SCRIPT%"
+ )
+ goto start
+)
+
+if "%1" EQU "-h" goto printhelp
+if "%1" EQU "--help" goto printhelp
+if "%1" NEQ "" goto printhelp
+
+:start
+cls
+
+if not exist "%OO_USER_SDKENV_SCRIPT%". (
+ echo.
+ echo ******************************************************************
+ echo *
+ echo * You have to configure your SDK environment first before you can
+ echo * use it. The configuration has to be done only once.
+ echo *
+ echo ******************************************************************
+ echo.
+
+ cscript //e:javascript //I //Nologo "%SDK_DIR%\cfgWin.js"
+ goto setenv
+)
+
+goto setenv
+
+:printhelp
+echo.
+echo using: setsdkenv_windows.bat [options]
+echo.
+echo options:
+echo --force-configure : force a new configuration of your SDK environment.
+echo Alternatively can you edit your SDK environment script directly:
+echo "%OO_USER_SDKENV_SCRIPT%"
+echo -h, --help : print this help and exit
+echo.
+goto end
+
+
+:setenv
+call "%OO_USER_SDKENV_SCRIPT%"
+
+:end \ No newline at end of file
diff --git a/odk/config/setsdkname.bat b/odk/config/setsdkname.bat
new file mode 100755
index 000000000..72cf9cfdb
--- /dev/null
+++ b/odk/config/setsdkname.bat
@@ -0,0 +1,20 @@
+rem
+rem This file is part of the LibreOffice project.
+rem
+rem This Source Code Form is subject to the terms of the Mozilla Public
+rem License, v. 2.0. If a copy of the MPL was not distributed with this
+rem file, You can obtain one at http://mozilla.org/MPL/2.0/.
+rem
+rem This file incorporates work covered by the following license notice:
+rem
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements. See the NOTICE file distributed
+rem with this work for additional information regarding copyright
+rem ownership. The ASF licenses this file to you under the Apache
+rem License, Version 2.0 (the "License"); you may not use this file
+rem except in compliance with the License. You may obtain a copy of
+rem the License at http://www.apache.org/licenses/LICENSE-2.0 .
+rem
+@echo off
+
+set OO_SDK_NAME=%~n1