]> git.argeo.org Git - cc0/argeo-build.git/blob - configure
Close directory stream
[cc0/argeo-build.git] / configure
1 #!/bin/sh
2
3 # We build where we are
4 SDK_BUILD_BASE=$(pwd -P)/output
5
6 if [ -z "$SDK_SRC_BASE" ]
7 then
8 echo Script variable SDK_SRC_BASE must be set in the calling \'configure\' script,
9 echo to the root location of the sources, typically with such a pattern:
10 echo 'SDK_SRC_BASE="$(cd "$(dirname "$0")"; pwd -P)"'
11 echo "(see 'configure.template' from the argeo-build directory)"
12 echo In order to build Argeo Build itself, explicitly set SDK_SRC_BASE as an environment variable
13 exit 1
14 fi
15
16 SDK_MK=$SDK_SRC_BASE/sdk.mk
17
18 if [ -f "$SDK_MK" ];
19 then
20 echo "File $SDK_MK already exists. Remove it in order to configure a new build location:"
21 echo "rm $SDK_MK"
22 exit 1
23
24 else
25
26 if [ -z "$JAVA_HOME" ]
27 then
28 JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
29 echo "Environment variable JAVA_HOME not set, using $JAVA_HOME of $(which java)"
30 fi
31
32 # Create build directory, so that it can be used right away
33 # and we check whether we have the rights
34 mkdir -p $SDK_BUILD_BASE
35 if [ -f "$SDK_MK" ];
36 then
37 echo "Cannot create $SDK_BUILD_BASE, SDK configuration has failed."
38 exit 2
39 fi
40
41 # Generate sdk.mk
42 cat > "$SDK_MK" <<EOF
43 SDK_SRC_BASE := $SDK_SRC_BASE
44 SDK_BUILD_BASE := $SDK_BUILD_BASE
45 JAVA_HOME := $JAVA_HOME
46
47 -include \$(SDK_SRC_BASE)/branch.mk
48 -include \$(SDK_SRC_BASE)/sdk/branches/\$(BRANCH).bnd
49 EOF
50
51
52 echo SDK was configured.
53 echo "JAVA_HOME : $JAVA_HOME"
54 echo "Base for sources : $SDK_SRC_BASE"
55 echo "Base for builds : $SDK_BUILD_BASE"
56 exit 0
57 fi
58