diff options
author | Peter Foley <pefoley2@verizon.net> | 2013-02-21 00:56:13 -0600 |
---|---|---|
committer | Peter Foley <pefoley2@verizon.net> | 2013-02-23 21:39:52 +0000 |
commit | 613221bde1744265c336c2b5f2ade0bfb9b22d16 (patch) | |
tree | 9d7efa2dc01fdab24b599f7e40677d019e9ad14b /odk/config | |
parent | 5003ab57eee903d072fc7fac8cb5c69a34fb9d5c (diff) |
convert odk to gbuild and add to tail_build
Change-Id: I8e8de7f2bb87cce7916c7c2df24c1b0ddaea55c0
Reviewed-on: https://gerrit.libreoffice.org/2288
Reviewed-by: Peter Foley <pefoley2@verizon.net>
Tested-by: Peter Foley <pefoley2@verizon.net>
Diffstat (limited to 'odk/config')
-rw-r--r-- | odk/config/cfgWin.js | 908 | ||||
-rw-r--r-- | odk/config/configure.pl | 810 | ||||
-rwxr-xr-x | odk/config/setsdkenv_unix | 84 | ||||
-rw-r--r-- | odk/config/setsdkenv_unix.csh.in | 289 | ||||
-rw-r--r-- | odk/config/setsdkenv_unix.sh.in | 311 | ||||
-rwxr-xr-x | odk/config/setsdkenv_windows.bat | 82 | ||||
-rwxr-xr-x | odk/config/setsdkenv_windows.template | 186 | ||||
-rwxr-xr-x | odk/config/setsdkname.bat | 20 |
8 files changed, 2690 insertions, 0 deletions
diff --git a/odk/config/cfgWin.js b/odk/config/cfgWin.js new file mode 100644 index 000000000000..99dca7f3bc3a --- /dev/null +++ b/odk/config/cfgWin.js @@ -0,0 +1,908 @@ +// +// 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_ure_home=office_home + "\\URE"; + +var oo_sdk_make_home=getMakeHome(); +var oo_sdk_zip_home=getZipHome(); +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 installtion 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 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.4.1_01 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 specifiy" + + " 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 enviroment 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 URE installation directory.\n" + + "REM Example: set OO_SDK_URE_HOME=C:\\Program Files\\LibreOffice 3\\URE\n" + + "set OO_SDK_URE_HOME=" + oo_sdk_ure_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 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 if not defined OO_SDK_URE_HOME (\n" + + "REM echo Error: either of the variables OFFICE_HOME and\n" + + "REM echo OO_SDK_URE_HOME is missing!\n" + + "REM goto :error\n" + + "REM )\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 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" + + "REM if defined OO_SDK_URE_HOME (\n" + + "set OO_SDK_URE_BIN_DIR=%OO_SDK_URE_HOME%\\bin\n" + + "set OO_SDK_URE_LIB_DIR=%OO_SDK_URE_HOME%\\bin\n" + + "set OO_SDK_URE_JAVA_DIR=%OO_SDK_URE_HOME%\\java\n" + + "REM ) else (\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" + + "REM )\n" + + "\n" + + "REM Set classpath\n" + + "set CLASSPATH=%OO_SDK_URE_JAVA_DIR%\\juh.jar;%OO_SDK_URE_JAVA_DIR%\\jurt.jar;%OO_SDK_URE_JAVA_DIR%\\ridl.jar;%OO_SDK_URE_JAVA_DIR%\\unoloader.jar;%OO_SDK_OFFICE_JAVA_DIR%\\unoil.jar\n" + + "REM if defined OFFICE_HOME (\n" + + "REM set CLASSPATH=%CLASSPATH%;%OO_SDK_OFFICE_JAVA_DIR%\\unoil.jar\n" + + "REM )\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 (\n" + + " set PATH=%OO_SDK_OUT%\\WINexample.out\\bin;%PATH%\n" + + " ) else (\n" + + " set PATH=%OO_SDK_HOME%\\WINexample.out\\bin;%PATH%\n" + + " )\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 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 (\n" + + " set PATH=%CPP_WINDOWS_SDK%\\bin;%PATH%\n" + + " set INCLUDE=%CPP_WINDOWS_SDK%\\Include;%INCLUDE%\n" + + ")\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 tilte 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 * URE = %OO_SDK_URE_HOME%\n" + + "echo * Make = %OO_SDK_MAKE_HOME%\n" + + "echo * Zip = %OO_SDK_ZIP_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 100644 index 000000000000..8cd2a54978dd --- /dev/null +++ b/odk/config/configure.pl @@ -0,0 +1,810 @@ +# +# 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 = `$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_OR_URE = "Office"; +$main::OFFICE_OR_URE_SUGGESTION = "Office"; + +$main::OFFICE_HOME = ""; + +$main::OO_SDK_URE_HOME = `cd $main::sdkpath/../ure-link && pwd`; +chomp($main::OO_SDK_URE_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_CPP_HOME = ""; +$main::cppName = "gcc"; +$main::cppVersion = "4.0.1"; +if ( $main::operatingSystem =~ m/solaris/ ) +{ + $main::cppName = "CC"; + $main::cppVersion = "5.2"; +} +$main::OO_SDK_CC_55_OR_HIGHER = ""; +$main::OO_SDK_CPP_HOME_SUGGESTION = searchprog($main::cppName); + +$main::OO_SDK_JAVA_HOME = ""; +$main::OO_SDK_JAVA_BIN_DIR = "bin"; +if ( $main::operatingSystem =~ m/darwin/ ) +{ + $main::OO_SDK_JAVA_BIN_DIR="Commands"; +} +$main::OO_SDK_JAVA_HOME_SUGGESTION = searchprog("javac"); +$main::javaVersion = "1.5.0_01"; + +$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::OFFICE_OR_URE eq "Office" ) +{ + if ( $main::operatingSystem =~ m/darwin/ ) + { +# used for a SDK as part of the office installation +# $main::OFFICE_HOME = `cd $main::sdkpath/../../.. && pwd`; +# chomp($main::OFFICE_HOME); +# print " Used Office = $main::OFFICE_HOME\n"; + 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"; + } + + # check more details + if ( -d "$main::OFFICE_HOME/Contents/ure-link" ) { + $main::OO_SDK_URE_HOME = "$main::OFFICE_HOME/Contents/ure-link"; + } else { + $main::OFFICE_HOME = ""; + $main::OO_SDK_URE_HOME = ""; + print " Error: no URE found in office installation, 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 prgram 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; + } + } + } + } + } +} +else +{ + # prepare URE path + $main::OO_SDK_URE_HOME_SUGGESTION = "/opt/openoffice.org/ure"; + $main::OO_SDK_URE_HOME_SUGGESTION = "" unless + -e "$main::OO_SDK_URE_HOME_SUGGESTION/bin/uno"; + for (;;) + { + print " Enter the URE installation directory", + " [$main::OO_SDK_URE_HOME_SUGGESTION]: "; + $main::OO_SDK_URE_HOME = readStdIn(); + chop $main::OO_SDK_URE_HOME; + $main::OO_SDK_URE_HOME = $main::OO_SDK_URE_HOME_SUGGESTION if + $main::OO_SDK_URE_HOME eq "" && + $main::OO_SDK_URE_HOME_SUGGESTION ne ""; + last if -e "$main::OO_SDK_URE_HOME/bin/uno"; + print " Error: A valid URE installation is required.\n"; + } +} + +# 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 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 + { + # for Solaris we have to check the version too + open(FILE, "$OO_SDK_CPP_HOME/$main::cppName -V 2>&1 |"); + my @lines = <FILE>; + my $testVersion = $lines[0]; + if ( $testVersion eq "") + { + print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a "; + print " Solaris C++ compiler.\nSet the environment variable OO_SDK_CPP_HOME to your Solaris C++ compiler directory.\n"; + } else + { + if ($testVersion =~ m#((\d+\.)+\d+)# ) + { + $testVersion = $1; + } + $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 { + $main::correctVersion = testVersion("5.5", $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 2); + if ( $main::correctVersion ) { + $main::OO_SDK_CC_55_OR_HIGHER = $testVersion; + } + } + } + } + } + } else + { + # the C++ compiler is optional + $main::correctVersion = 1; + } +} + + +# prepare Java path +$main::correctVersion = 0; + +# prepare Java suggestion (cut bin or Commands directory to be in the root of the Java SDK) +$main::offset = rindex($main::OO_SDK_JAVA_HOME_SUGGESTION, "/$main::OO_SDK_JAVA_BIN_DIR"); +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/$main::OO_SDK_JAVA_BIN_DIR/javac"))) ) +{ + print " Enter Java SDK (1.5, recommendation is 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/$main::OO_SDK_JAVA_BIN_DIR/javac")) ) + { + print " Error: Could not find directory '$main::OO_SDK_JAVA_HOME' or '$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/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/$main::OO_SDK_JAVA_BIN_DIR/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/$main::OO_SDK_JAVA_BIN_DIR/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 +if ( $main::OFFICE_OR_URE eq "Office" ) +{ + 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"; + } + } +} +else +{ + $main::SDK_AUTO_DEPLOYMENT = "NO"; +} + +prepareScriptFile("setsdkenv_unix.sh.in", "setsdkenv_unix.sh", 1); +chmod 0644, "$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh"; + +prepareScriptFile("setsdkenv_unix.csh.in", "setsdkenv_unix.csh", 2); +chmod 0644, "$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.csh"; + +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 " * \"$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.csh\"\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/$main::OO_SDK_JAVA_BIN_DIR/javac" ) + { + return "$progDir/$main::OO_SDK_JAVA_BIN_DIR"; + } + } + + if ( $main::operatingSystem =~ m/solaris/ ) { + $progDir = resolveLink("/usr/jdk", "latest"); + if ( -e "$progDir/$main::OO_SDK_JAVA_BIN_DIR/javac" ) + { + return "$progDir/$main::OO_SDK_JAVA_BIN_DIR"; + } + } + } + + 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; + } + + 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; + # shell mode 1 = sh + # 2 = csh + my $shellMode = 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_URE_HOME\@#$main::OO_SDK_URE_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_CPP_HOME\@#$main::OO_SDK_CPP_HOME#go; + $_ =~ s#\@OO_SDK_CC_55_OR_HIGHER\@#$main::OO_SDK_CC_55_OR_HIGHER#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 000000000000..08972af3c647 --- /dev/null +++ b/odk/config/setsdkenv_unix @@ -0,0 +1,84 @@ +#! /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 -2 | 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 + if [ -r $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.csh ] + then + rm $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.csh + 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 " $HOME/$OO_SDK_NAME/setsdkenv_unix.csh" + 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 " * can 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. + +TERMHEAD=$HOSTNAME +echo "]2;$TERMHEAD" diff --git a/odk/config/setsdkenv_unix.csh.in b/odk/config/setsdkenv_unix.csh.in new file mode 100644 index 000000000000..bdd5ede21f53 --- /dev/null +++ b/odk/config/setsdkenv_unix.csh.in @@ -0,0 +1,289 @@ +#! /bin/csh +# +# 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 sets all enviroment 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 +setenv OO_SDK_NAME @OO_SDK_NAME@ + +# Installation directory of the Software Development Kit. +# Example: setenv OO_SDK_HOME /opt/libreoffice/basis3.4/sdk +setenv OO_SDK_HOME '@OO_SDK_HOME@' + +# Office installation directory. +# Example: set OFFICE_HOME=/opt/libreoffice +setenv OFFICE_HOME '@OFFICE_HOME@' + +# URE installation directory. +# Example: setenv OO_SDK_URE_HOME /opt/libreoffice/ure +setenv OO_SDK_URE_HOME '@OO_SDK_URE_HOME@' + +# Directory of the make command. +# Example: setenv OO_SDK_MAKE_HOME /usr/bin +setenv OO_SDK_MAKE_HOME @OO_SDK_MAKE_HOME@ + +# Directory of the zip command. +# Example: setenv OO_SDK_ZIP_HOME /usr/bin +setenv OO_SDK_ZIP_HOME @OO_SDK_ZIP_HOME@ + +# Directory of the C++ compiler. +# Example: setenv OO_SDK_CPP_HOME /usr/bin +setenv OO_SDK_CPP_HOME @OO_SDK_CPP_HOME@ + +# Solaris only +setenv OO_SDK_CC_55_OR_HIGHER @OO_SDK_CC_55_OR_HIGHER@ + +# Directory of the Java SDK. +# Example: setenv OO_SDK_JAVA_HOME "/usr/jdk/jdk1.6.0_10" +setenv OO_SDK_JAVA_HOME @OO_SDK_JAVA_HOME@ + +# Special output directory +# Example: setenv OO_SDK_OUTPUT_DIR "$HOME" +setenv OO_SDK_OUTPUT_DIR @OO_SDK_OUTPUT_DIR@ + +# Environment variable to enable auto deployment of example components +# Example: set SDK_AUTO_DEPLOYMENT=YES +setenv SDK_AUTO_DEPLOYMENT @SDK_AUTO_DEPLOYMENT@ + +# Get the operating system. +set sdk_platform=`${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4` + +# Set the directory name. +set programdir=program +set javadir=bin +switch (${sdk_platform}) + case "darwin*": + set programdir="Contents/MacOS" + set javacdir=Commands + breaksw +endsw + + +# Set office program path. +if ( "${OFFICE_HOME}" != "" ) then + setenv OFFICE_PROGRAM_PATH "${OFFICE_HOME}/${programdir}" +endif + + +# Set UNO path, necessary to ensure that the cpp examples using the +# new UNO bootstrap mechanism use the configured office installation. +if ( ${?OFFICE_PROGRAM_PATH} ) then + setenv UNO_PATH "${OFFICE_PROGRAM_PATH}" +endif + +if ( "${OO_SDK_URE_HOME}" != "" ) then + setenv OO_SDK_URE_BIN_DIR "${OO_SDK_URE_HOME}/bin" + setenv OO_SDK_URE_LIB_DIR "${OO_SDK_URE_HOME}/lib" + setenv OO_SDK_URE_JAVA_DIR "${OO_SDK_URE_HOME}/share/java" +else + setenv OO_SDK_URE_BIN_DIR "${OFFICE_PROGRAM_PATH}" + setenv OO_SDK_URE_LIB_DIR "${OFFICE_PROGRAM_PATH}" + setenv OO_SDK_URE_JAVA_DIR "${OFFICE_PROGRAM_PATH}/classes" +endif + +# Set SDK example output directory +setenv OO_SDK_OUT ${OO_SDK_HOME} +if ( $?OO_SDK_OUTPUT_DIR ) then + setenv OO_SDK_OUT ${OO_SDK_OUTPUT_DIR}/${OO_SDK_NAME} +endif + +# check platform and set appropriate variables +switch (`${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`) + case "solaris*": + if ( `${OO_SDK_HOME}/config.guess | cut -d"-" -f1` == "sparc" ) then + set directoryname=solsparc + set platform=Solaris Sparc + else + set directoryname=solintel + set platform=Solaris Intel + endif + set comid=C52 + set pltfrm=sunpro + set soext=so + set exampleout=SOLARISexample.out + + # set LD_LIBRARY_PATH + if ( $?LD_LIBRARY_PATH == 0) then + setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:. + else + setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH} + endif + breaksw + + case "linux-gnu": + set directoryname=linux + set comid=gcc3 + set pltfrm=gcc + set soext=so + set exampleout=LINUXexample.out + set platform=Linux + + # set LD_LIBRARY_PATH + if ( $?LD_LIBRARY_PATH == 0) then + setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:. + else + setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH} + endif + breaksw + + case "darwin*": + set directoryname=macosx + set comid=gcc3 + set pltfrm=gcc + set soext=dylib + set exampleout=MACOSXexample.out + set platform=MacOSX + + # set DYLD_LIBRARY_PATH + if ( $?DYLD_LIBRARY_PATH == 0) then + setenv DYLD_LIBRARY_PATH ${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:. + else + setenv DYLD_LIBRARY_PATH ${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${DYLD_LIBRARY_PATH} + endif + breaksw + + case "freebsd*": + set directoryname=freebsd + set comid=gcc3 + set pltfrm=gcc + set soext=so + set exampleout=FREEBSDexample.out + set platform=FreeBSD + + # set LD_LIBRARY_PATH + if ( $?LD_LIBRARY_PATH == 0) then + setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:. + else + setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH} + endif + + if ( -e "/sbin/sysctl" ) then + set OSVERSION=`/sbin/sysctl -n kern.osreldate` + else + set OSVERSION=`/usr/sbin/sysctl -n kern.osreldate` + endif + + if ( ${OSVERSION} < 500016 ) then + setenv PTHREAD_CFLAGS -D_THREAD_SAFE + setenv PTHREAD_LIBS -pthread + else if ( ${OSVERSION} < 502102 ) then + setenv PTHREAD_CFLAGS -D_THREAD_SAFE + setenv PTHREAD_LIBS -lc_r + else + setenv PTHREAD_LIBS -pthread + endif + breaksw +endsw + +# set PATH +if ( $?PATH == 0) then + setenv PATH ${OO_SDK_ZIP_HOME}:${OO_SDK_MAKE_HOME}:${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}:${OO_SDK_URE_BIN_DIR}:. +else + setenv PATH ${OO_SDK_ZIP_HOME}:${OO_SDK_MAKE_HOME}:${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}:${OO_SDK_URE_BIN_DIR}:.:${PATH} +endif + +# Set CLASSPATH +if ( ${?OFFICE_PROGRAM_PATH} ) then + if ( ${?CLASSPATH} == 0 ) then + setenv CLASSPATH "${OFFICE_PROGRAM_PATH}/classes/unoil.jar" + else + setenv CLASSPATH "${OFFICE_PROGRAM_PATH}/classes/unoil.jar:${CLASSPATH}" + endif +endif +if ( $?CLASSPATH == 0) then + setenv CLASSPATH "${OO_SDK_URE_JAVA_DIR}/juh.jar:${OO_SDK_URE_JAVA_DIR}/jurt.jar:${OO_SDK_URE_JAVA_DIR}/ridl.jar:${OO_SDK_URE_JAVA_DIR}/unoloader.jar" +else + setenv CLASSPATH "${OO_SDK_URE_JAVA_DIR}/juh.jar:${OO_SDK_URE_JAVA_DIR}/jurt.jar:${OO_SDK_URE_JAVA_DIR}/ridl.jar:${OO_SDK_URE_JAVA_DIR}/unoloader.jar:${CLASSPATH}" +endif + +if ( $?OO_SDK_CPP_HOME == 0) then + setenv PATH ${OO_SDK_CPP_HOME}:${PATH} +endif + +if ( $?OO_SDK_JAVA_HOME == 0) then + setenv PATH ${OO_SDK_JAVA_HOME}:${PATH} +endif + + +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.so" \ + "${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}" + + if ( "${OO_SDK_URE_HOME}" != "" ) then + 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}" + endif +endif + + +echo +echo " ************************************************************************" +echo " *" +echo " * SDK environment is prepared for ${platform}" +echo " *" +echo " * SDK = ${OO_SDK_HOME}" +echo " * Office = ${OFFICE_HOME}" +echo " * URE = ${OO_SDK_URE_HOME}" +echo " * Make = ${OO_SDK_MAKE_HOME}" +echo " * Zip = ${OO_SDK_ZIP_HOME}" +if ( $?OO_SDK_CPP_HOME == 0) then +echo " * C++ Compiler = " +else +echo " * C++ Compiler = ${OO_SDK_CPP_HOME}" +endif +if ( $?OO_SDK_JAVA_HOME == 0) then +echo " * Java = " +else +echo " * Java = ${OO_SDK_JAVA_HOME}" +endif +if ( $?OO_SDK_OUTPUT_DIR == 0) then +echo " * Special Output directory = " +else +echo " * SDK Output directory = ${OO_SDK_OUT}" +endif +echo " * Auto deployment = ${SDK_AUTO_DEPLOYMENT}" +echo " *" +echo " ************************************************************************" + +unset sdkdir +unset directoryname +unset comid +unset exampleout +unset platform + +echo "]2;Shell prepared with the SDK environment" diff --git a/odk/config/setsdkenv_unix.sh.in b/odk/config/setsdkenv_unix.sh.in new file mode 100644 index 000000000000..01e01bac995e --- /dev/null +++ b/odk/config/setsdkenv_unix.sh.in @@ -0,0 +1,311 @@ +#! /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 enviroment 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@' + +# URE installation directory. +# Example: OO_SDK_URE_HOME=/opt/libreoffice/ure +OO_SDK_URE_HOME='@OO_SDK_URE_HOME@' +export OO_SDK_URE_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 C++ compiler. +# Example: OO_SDK_CPP_HOME=/usr/bin +OO_SDK_CPP_HOME=@OO_SDK_CPP_HOME@ + +# Solaris only +OO_SDK_CC_55_OR_HIGHER=@OO_SDK_CC_55_OR_HIGHER@ + +# 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 + +# Check installation path for the office. +if [ -z "${OFFICE_HOME}" ] && [ -z "${OO_SDK_URE_HOME}" ] +then + echo 'Error: Please set either the environment variable OFFICE_HOME or the' + echo 'environment variable OO_SDK_URE_HOME.' + exit 0 +fi + +# Get the operating system. +sdk_platform=`${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4` + +# Set the directory name. +programdir=program +javadir=bin +case ${sdk_platform} in + darwin*) + programdir="Contents/MacOS" + javacdir=Commands + ;; +esac + +# Set office program path (only set when using an Office). +if [ "${OFFICE_HOME}" ] +then + OFFICE_PROGRAM_PATH=${OFFICE_HOME}/${programdir} + export OFFICE_PROGRAM_PATH +fi + + +# 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). +if [ "${OFFICE_HOME}" ] +then + UNO_PATH=${OFFICE_PROGRAM_PATH} + export UNO_PATH +fi + +if [ "${OO_SDK_URE_HOME}" ] +then + OO_SDK_URE_BIN_DIR=${OO_SDK_URE_HOME}/bin + OO_SDK_URE_LIB_DIR=${OO_SDK_URE_HOME}/lib + OO_SDK_URE_JAVA_DIR=${OO_SDK_URE_HOME}/share/java +else + 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 +fi +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=`${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=C52 + pltfrm=sunpro + 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 + pltfrm=gcc + 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 + pltfrm=gcc + 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 + pltfrm=gcc + 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}/juh.jar:${OO_SDK_URE_JAVA_DIR}/jurt.jar:${OO_SDK_URE_JAVA_DIR}/ridl.jar:${OO_SDK_URE_JAVA_DIR}/unoloader.jar:${OFFICE_PROGRAM_PATH}/classes/unoil.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 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 + + if [ -n "${OO_SDK_CC_55_OR_HIGHER}" ] + then + export OO_SDK_CC_55_OR_HIGHER + fi +fi + +# Add directory of the Java tools to the path, if necessary. +if [ -n "${OO_SDK_JAVA_HOME}" ] +then + PATH=${OO_SDK_JAVA_HOME}/${javadir}:${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 + if [ "${OO_SDK_URE_HOME}" ] + then + 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 +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 " * URE = $OO_SDK_URE_HOME" +echo " * Make = $OO_SDK_MAKE_HOME" +echo " * Zip = $OO_SDK_ZIP_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 " ************************************************************************" + +echo "]2;Shell prepared with the SDK environment" diff --git a/odk/config/setsdkenv_windows.bat b/odk/config/setsdkenv_windows.bat new file mode 100755 index 000000000000..ac1a559d935c --- /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 * can use it! The configuration has to be done only once. + echo * + echo ****************************************************************** + echo. + + cscript //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/setsdkenv_windows.template b/odk/config/setsdkenv_windows.template new file mode 100755 index 000000000000..8b1eb594e658 --- /dev/null +++ b/odk/config/setsdkenv_windows.template @@ -0,0 +1,186 @@ +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 +REM This script sets all enviroment variables, which +REM are necessary for building the examples of the Office Development Kit. +REM The Script was developed for the operating systems Windows. +REM The SDK name +REM Example: set OO_SDK_NAME=libreoffice3.4_sdk +set OO_SDK_NAME=libreoffice3.4_sdk + +REM Installation directory of the Software Development Kit. +REM Example: set OO_SDK_HOME=C:\Program Files\LibreOffice 3\sdk +set OO_SDK_HOME= + +REM Office installation directory. +REM Example: set OFFICE_HOME=C:\Program Files\LibreOffice 3 +set OFFICE_HOME= + +REM URE installation directory. +REM Example: set OO_SDK_URE_HOME=C:\Program Files\LibreOffice 3\URE +set OO_SDK_URE_HOME= + +REM Directory of the make command. +REM Example: set OO_SDK_MAKE_HOME=D:\NextGenerationMake\make +set OO_SDK_MAKE_HOME= + +REM Directory of the zip tool. +REM Example: set OO_SDK_ZIP_HOME=D:\infozip\bin +set OO_SDK_ZIP_HOME= + +REM Directory of the C++ compiler. +REM Example:set OO_SDK_CPP_HOME=C:\Program Files\Microsoft Visual Studio 9.0\VC\bin +REM Example:set CPP_WINDOWS_SDK=C:\Program Files\\Microsoft SDKs\Windows\v6.0A\ +set OO_SDK_CPP_HOME= +set CPP_VC8= +set CPP_WINDOWS_SDK= + +REM Directory of the C# and VB.NET compilers. +REM Example:set OO_SDK_CLI_HOME=C:\WINXP\Microsoft.NET\Framework\v1.0.3705 +set OO_SDK_CLI_HOME= + +REM Java SDK installation directory. +REM Example: set OO_SDK_JAVA_HOME=C:\Program Files\Java\jdk1.6.0_05 +set OO_SDK_JAVA_HOME= + +REM Special output directory +REM Example: set OO_SDK_OUT=C:\Program Files\Libreoffice 3\sdk +set OO_SDK_OUT= + +REM Automatic deployment +REM Example: set SDK_AUTO_DEPLOYMENT=YES +set SDK_AUTO_DEPLOYMENT=YES + +REM Check installation path for the StarOffice Development Kit. +if not defined OO_SDK_HOME ( + echo Error: the variable OO_SDK_HOME is missing! + goto :error + ) + +REM Check installation path for the office. +REM if not defined OFFICE_HOME ( +REM if not defined OO_SDK_URE_HOME ( +REM echo Error: either of the variables OFFICE_HOME and +REM echo OO_SDK_URE_HOME is missing! +REM goto :error +REM ) +REM ) + +REM Check installation path for GNU make. +if not defined OO_SDK_MAKE_HOME ( + echo Error: the variable OO_SDK_MAKE_HOME is missing! + goto :error + ) + +REM Check installation path for the zip tool. +if not defined OO_SDK_ZIP_HOME ( + echo Error: the variable OO_SDK_ZIP_HOME is missing! + goto :error + ) + +REM Set library path. +set LIB=%OO_SDK_HOME%\lib;%LIB% +if defined CPP_WINDOWS_SDK ( + set LIB=%LIB%;%CPP_WINDOWS_SDK%\lib + ) + +REM Set office program path. +if defined OFFICE_HOME ( + set OFFICE_PROGRAM_PATH=%OFFICE_HOME%\program + ) + +REM Set UNO path, necessary to ensure that the cpp examples using the +REM new UNO bootstrap mechanism use the configured office installation +REM (only set when using an Office). +if defined OFFICE_HOME ( + set UNO_PATH=%OFFICE_PROGRAM_PATH% + ) + +REM if defined OO_SDK_URE_HOME ( +set OO_SDK_URE_BIN_DIR=%OO_SDK_URE_HOME%\bin +set OO_SDK_URE_LIB_DIR=%OO_SDK_URE_HOME%\bin +set OO_SDK_URE_JAVA_DIR=%OO_SDK_URE_HOME%\java +REM ) else ( +set OO_SDK_OFFICE_BIN_DIR=%OFFICE_PROGRAM_PATH% +set OO_SDK_OFFICE_LIB_DIR=%OFFICE_PROGRAM_PATH% +set OO_SDK_OFFICE_JAVA_DIR=%OFFICE_PROGRAM_PATH%\classes +REM ) + +REM Set classpath +set CLASSPATH=%OO_SDK_URE_JAVA_DIR%\juh.jar;%OO_SDK_URE_JAVA_DIR%\jurt.jar;%OO_SDK_URE_JAVA_DIR%\ridl.jar;%OO_SDK_URE_JAVA_DIR%\unoloader.jar;%OO_SDK_OFFICE_JAVA_DIR%\unoil.jar +REM if defined OFFICE_HOME ( +REM set CLASSPATH=%CLASSPATH%;%OO_SDK_OFFICE_JAVA_DIR%\unoil.jar +REM ) + +REM Add directory of the SDK tools to the path. +set PATH=%OO_SDK_HOME%\bin;%OO_SDK_URE_BIN_DIR%;%OO_SDK_OFFICE_BIN_DIR%;%OO_SDK_HOME%\WINexample.out\bin;%PATH% + +REM Set PATH appropriate to the output directory +if defined OO_SDK_OUT ( + set PATH=%OO_SDK_OUT%\WINexample.out\bin;%PATH% + ) else ( + set PATH=%OO_SDK_HOME%\WINexample.out\bin;%PATH% + ) + +REM Add directory of the command make to the path, if necessary. +if defined OO_SDK_MAKE_HOME set PATH=%OO_SDK_MAKE_HOME%;%PATH% + +REM Add directory of the zip tool to the path, if necessary. +if defined OO_SDK_ZIP_HOME set PATH=%OO_SDK_ZIP_HOME%;%PATH% + +REM Add directory of the C++ compiler to the path, if necessary. +if defined OO_SDK_CPP_HOME set PATH=%OO_SDK_CPP_HOME%;%PATH% + +REM Add directory of the C# and VB.NET compilers to the path, if necessary. +if defined OO_SDK_CLI_HOME set PATH=%OO_SDK_CLI_HOME%;%PATH% + +REM Add directory of the Java tools to the path, if necessary. +if defined OO_SDK_JAVA_HOME set PATH=%OO_SDK_JAVA_HOME%\bin;%OO_SDK_JAVA_HOME%\jre\bin;%PATH% + +REM Set environment for C++ compiler tools, if necessary. +if defined OO_SDK_CPP_HOME call "%OO_SDK_CPP_HOME%\VCVARS32.bat" + +REM Set tilte to identify the prepared shell. +title Shell prepared for SDK + +REM Prepare shell with all necessary environment variables. +echo. +echo ****************************************************************** +echo * +echo * SDK environment is prepared for Windows +echo * +echo * SDK = %OO_SDK_HOME% +echo * Office = %OFFICE_HOME% +echo * URE = %OO_SDK_URE_HOME% +echo * Make = %OO_SDK_MAKE_HOME% +echo * Zip = %OO_SDK_ZIP_HOME% +echo * C++ Compiler = %OO_SDK_CPP_HOME% +echo * C# and VB.NET compilers = %OO_SDK_CLI_HOME% +echo * Java = %OO_SDK_JAVA_HOME% +echo * Special Output directory = %OO_SDK_OUT% +echo * Auto deployment = %SDK_AUTO_DEPLOYMENT% +echo * +echo ****************************************************************** +echo. +goto end + + :error +Error: Please insert the necessary environment variables into the batch file. + + :end diff --git a/odk/config/setsdkname.bat b/odk/config/setsdkname.bat new file mode 100755 index 000000000000..72cf9cfdbfe0 --- /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 |