xref: /aoo42x/main/odk/setsdkenv_unix (revision a412ed64)
1cdf0e10cSrcweir#! /bin/sh
2b31e36b3SAndrew Rist# *************************************************************
3b31e36b3SAndrew Rist#
4b31e36b3SAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
5b31e36b3SAndrew Rist#  or more contributor license agreements.  See the NOTICE file
6b31e36b3SAndrew Rist#  distributed with this work for additional information
7b31e36b3SAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
8b31e36b3SAndrew Rist#  to you under the Apache License, Version 2.0 (the
9b31e36b3SAndrew Rist#  "License"); you may not use this file except in compliance
10b31e36b3SAndrew Rist#  with the License.  You may obtain a copy of the License at
11b31e36b3SAndrew Rist#
12b31e36b3SAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
13b31e36b3SAndrew Rist#
14b31e36b3SAndrew Rist#  Unless required by applicable law or agreed to in writing,
15b31e36b3SAndrew Rist#  software distributed under the License is distributed on an
16b31e36b3SAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17b31e36b3SAndrew Rist#  KIND, either express or implied.  See the License for the
18b31e36b3SAndrew Rist#  specific language governing permissions and limitations
19b31e36b3SAndrew Rist#  under the License.
20b31e36b3SAndrew Rist#
21b31e36b3SAndrew Rist# *************************************************************
22cdf0e10cSrcweir
23cdf0e10cSrcweirOSTYPE=`uname -s`
24cdf0e10cSrcweirHOSTNAME=`hostname`
25cdf0e10cSrcweirCURRENTDIR=`/bin/pwd`
26cdf0e10cSrcweirSDKTMPDIR=`dirname $0`
27cdf0e10cSrcweirOO_SDK_HOME=`(cd $SDKTMPDIR && pwd && cd $CURRENTDIR) | head -n 1`
28cdf0e10cSrcweirOOVERSION=`cat $OO_SDK_HOME/settings/dk.mk | tail -2 | head -n 1 | cut -d"=" -f2 | cut -d"." -f1,2`
29cdf0e10cSrcweirif [ "$OSTYPE" = "Darwin" ]
30cdf0e10cSrcweirthen
31cdf0e10cSrcweir    OO_SDK_NAME=`basename $OO_SDK_HOME`
32cdf0e10cSrcweirelse
33cdf0e10cSrcweir    OO_SDK_NAME=openoffice.org${OOVERSION}_sdk
34cdf0e10cSrcweirfi
35cdf0e10cSrcweir
36cdf0e10cSrcweirexport OO_SDK_HOME
37cdf0e10cSrcweir
38cdf0e10cSrcweirif [ "$1" = "--force-configure" ]
39cdf0e10cSrcweirthen
40cdf0e10cSrcweir    if [ -r $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh ]
41cdf0e10cSrcweir    then
42cdf0e10cSrcweir	rm $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh
43cdf0e10cSrcweir    fi
44cdf0e10cSrcweir    if [ -r $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.csh ]
45cdf0e10cSrcweir    then
46cdf0e10cSrcweir	rm $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.csh
47cdf0e10cSrcweir    fi
48cdf0e10cSrcweir    shift
49cdf0e10cSrcweirelif [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ -n "$1" ]
50cdf0e10cSrcweirthen
51cdf0e10cSrcweir    echo
52cdf0e10cSrcweir    echo " using: setsdkenv_unix [options]"
53cdf0e10cSrcweir    echo ""
54cdf0e10cSrcweir    echo " options:"
55cdf0e10cSrcweir    echo "   --force-configure : force a new configuration of your SDK environment."
56*a412ed64SAriel Constenla-Haile    echo "                       Alternatively can you edit your SDK environment script directly:"
57cdf0e10cSrcweir    echo "                        $HOME/$OO_SDK_NAME/setsdkenv_unix.sh"
58cdf0e10cSrcweir    echo "   -h, --help        : print this help and exit"
59cdf0e10cSrcweir    echo
60cdf0e10cSrcweir    exit 1
61cdf0e10cSrcweirfi
62cdf0e10cSrcweir
63cdf0e10cSrcweir# source the prepared environment and start a new shell
64cdf0e10cSrcweirif [ -r $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh ]
65cdf0e10cSrcweirthen
66cdf0e10cSrcweir    . $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh
67cdf0e10cSrcweirelse
68cdf0e10cSrcweir    echo
69cdf0e10cSrcweir    echo " ************************************************************************"
70cdf0e10cSrcweir    echo " *"
71cdf0e10cSrcweir    echo " *  You have to configure your SDK environment first before you can"
72cdf0e10cSrcweir    echo " *  can use it! The configuration has to be done only once."
73cdf0e10cSrcweir    echo " *"
74cdf0e10cSrcweir    echo " ************************************************************************"
75cdf0e10cSrcweir    echo
76cdf0e10cSrcweir
77cdf0e10cSrcweir    perl $OO_SDK_HOME/configure.pl $HOSTNAME $OO_SDK_HOME $OO_SDK_NAME
78cdf0e10cSrcweir
79cdf0e10cSrcweir    . $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh
80cdf0e10cSrcweirfi
81cdf0e10cSrcweir
82cdf0e10cSrcweir"$SHELL" "$@"
83cdf0e10cSrcweirecho  Shell terminated.
84cdf0e10cSrcweir
85cdf0e10cSrcweirTERMHEAD=$HOSTNAME
86cdf0e10cSrcweirecho "]2;$TERMHEAD"
87