summaryrefslogtreecommitdiffstats
path: root/Utilities/Release/release_cmake.sh.in
blob: 12442c60d6ba9b73d7d87a9ce3e247703e28e0f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/sh
echo "Start release"
date
echo ""
echo  "remove and create working directory @CMAKE_RELEASE_DIRECTORY@"
rm -rf @CMAKE_RELEASE_DIRECTORY@ 
mkdir @CMAKE_RELEASE_DIRECTORY@

check_exit_value()
{
   VALUE="$1"
   if [ "$VALUE" != "0" ]; then
    echo "error in $2"
    exit 1
   fi      
}

if [ ! -z "@CC@" ]; then
    export CC="@CC@"
    check_exit_value $? "set CC compiler env var" || exit 1
fi

if [ ! -z "@FC@" ]; then
    export FC="@FC@"
    check_exit_value $? "set FC compiler env var" || exit 1
fi

if [ ! -z "@CXX@" ]; then
    export CXX="@CXX@"
    check_exit_value $? "set CC compiler env var" || exit 1
fi

if [ ! -z "@LDFLAGS@" ]; then
    export LDFLAGS="@LDFLAGS@"
    check_exit_value $? "set LDFLAGS env var" || exit 1
fi

if [ ! -z "@CFLAGS@" ]; then
    export CFLAGS="@CFLAGS@"
    check_exit_value $? "set CFLAGS  env var" || exit 1
fi

if [ ! -z "@CXXFLAGS@" ]; then
    export CXXFLAGS="@CXXFLAGS@"
    check_exit_value $? "setCXXFLAGS env var" || exit 1
fi

if [ ! -z "@USER_MAKE_RULE_FILE_CONTENTS@" ]; then
    echo "@USER_MAKE_RULE_FILE_CONTENTS@" > "@USER_MAKE_RULE_FILE@"
    check_exit_value $? "Create User Rule file" || exit 1
fi
echo "Create a directory to build in"
rm -rf @CMAKE_RELEASE_DIRECTORY@/@CMAKE_VERSION@-build
check_exit_value $? "Remove build tree" || exit 1
mkdir @CMAKE_RELEASE_DIRECTORY@/@CMAKE_VERSION@-build
check_exit_value $? "Create build directory" || exit 1
# make sure directory was created
if [ ! -d @CMAKE_RELEASE_DIRECTORY@/@CMAKE_VERSION@-build ]; then
        echo "Could not create @CMAKE_RELEASE_DIRECTORY@/@CMAKE_VERSION@-build"
        exit -1
fi

echo "Create initial cache"
echo "@INITIAL_CACHE@" > @CMAKE_RELEASE_DIRECTORY@/@CMAKE_VERSION@-build/CMakeCache.txt
check_exit_value $? "Create initial cache" || exit 1

#echo "Login into cvs."
#echo "cmake" | @CVS_COMMAND@ -d @CVSROOT@ login

echo "Checkout the source for @CMAKE_VERSION@"
cd @CMAKE_RELEASE_DIRECTORY@ 
@CMAKE_CHECKOUT@ -d @CMAKE_VERSION@ CMake
check_exit_value $? "Checkout cmake source" || exit 1

cd @CMAKE_RELEASE_DIRECTORY@/@CMAKE_VERSION@-build 

if [ ! -z "@CONFIGURE_WITH_CMAKE@" ]; then 
    echo  "Run cmake to configure cmake"
    @CMAKE_CONFIGURE_PATH@ ../@CMAKE_VERSION@
    check_exit_value $? "Configure cmake" || exit 1
else
    echo  "Run cmake bootstrap --parallel=@PROCESSORS@"
    ../@CMAKE_VERSION@/bootstrap --parallel=@PROCESSORS@
    check_exit_value $? "Bootstrap cmake" || exit 1
fi

echo "Build cmake with @MAKE@"
@MAKE@
check_exit_value $? "Build cmake" || exit 1

if [ -z "@SKIP_TESTS@" ]; then
    echo "Run cmake tests"
    @MAKE@ test
    check_exit_value $? "Test cmake" || exit 1
fi

# loop over binary generators 
generators="@CPACK_BINARY_GENERATORS@"
for GEN in $generators; do
    echo "Create $GEN package"
    ./bin/cpack -D CMAKE_MAKE_PROGRAM=@MAKE_PROGRAM@ -G $GEN
    check_exit_value $? "Create $GEN package" || exit 1
done

# loop over source generators 
generators="@CPACK_SOURCE_GENERATORS@"
for GEN in $generators; do
    echo "Create $GEN package"
    ./bin/cpack -D CMAKE_MAKE_PROGRAM=@MAKE_PROGRAM@ -G $GEN --config CPackSourceConfig.cmake
    check_exit_value $? "Create $GEN package" || exit 1
done



# need to add an extra copy thing here
if [ ! -z "@EXTRA_COPY@" ]; then
    @EXTRA_COPY@
    check_exit_value $? "Extra copy step @EXTRA_COPY@" || exit 1
fi
echo "End release"
date
echo ""
exit 0