WaE: C6011 Dereferencing NULL pointer warnings
[LibreOffice.git] / odk / config / setsdkenv_unix
blobcc5f06e64d20d7631cca156d8069e7f5a717637d
1 #! /bin/sh
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 OSTYPE=`uname -s`
21 HOSTNAME=`hostname`
22 CURRENTDIR=`/bin/pwd`
23 SDKTMPDIR=`dirname $0`
24 OO_SDK_HOME=`(cd $SDKTMPDIR && pwd && cd $CURRENTDIR) | head -n 1`
25 OOVERSION=`cat $OO_SDK_HOME/settings/dk.mk | tail -3 | head -n 1 | cut -d"=" -f2 | cut -d"." -f1,2`
26 if [ "$OSTYPE" = "Darwin" ]
27 then
28 OO_SDK_NAME=`basename $OO_SDK_HOME`
29 else
30 OO_SDK_NAME=libreoffice${OOVERSION}_sdk
33 export OO_SDK_HOME
35 if [ "$1" = "--force-configure" ]
36 then
37 if [ -r $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh ]
38 then
39 rm $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh
41 shift
42 elif [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ -n "$1" ]
43 then
44 echo
45 echo " using: setsdkenv_unix [options]"
46 echo ""
47 echo " options:"
48 echo " --force-configure : force a new configuration of your SDK environment."
49 echo " Alternatively can you edit your SDK environment scripts directly:"
50 echo " $HOME/$OO_SDK_NAME/setsdkenv_unix.sh"
51 echo " -h, --help : print this help and exit"
52 echo
53 exit 1
56 # source the prepared environment and start a new shell
57 if [ -r $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh ]
58 then
59 . $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh
60 else
61 echo
62 echo " ************************************************************************"
63 echo " *"
64 echo " * You have to configure your SDK environment first before you can"
65 echo " * use it. The configuration has to be done only once."
66 echo " *"
67 echo " ************************************************************************"
68 echo
70 perl $OO_SDK_HOME/configure.pl $HOSTNAME $OO_SDK_HOME $OO_SDK_NAME
72 . $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh
75 "$SHELL" "$@"
76 echo Shell terminated.