Check-in [f720a73c8c]
Not logged in
Overview
Comment:untested copy of the LLVM build script
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f720a73c8c686d39d43ddd63b1b5c1fca8feafe2
User & Date: martin_vahi on 2016-12-03 15:37:06
Other Links: manifest | tags
Context
2016-12-03 16:18
script update and a copy of the LLVM check-in: 14cf5f930a user: martin_vahi tags: trunk
2016-12-03 15:37
untested copy of the LLVM build script check-in: f720a73c8c user: martin_vahi tags: trunk
2016-11-11 22:54
ParaSail_v_7_0 upstream deliverables added check-in: 23073bb4ac user: martin_vahi tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added work_in_progress/copy_of_the_LLVM/COMMENTS.txt version [69a94aa079].















>
>
>
>
>
>
>
1
2
3
4
5
6
7


The mmmv_LLVM_copy_t1 is not a fork of the LLVM. 
It is only a copy of the LLVM accompanied 
by a few custom scripts.


Added work_in_progress/copy_of_the_LLVM/src/download_the_LLVM_t1.bash version [3a28f1fb67].























































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
#!/usr/bin/env bash
# Initial author of this file: Martin.Vahi@softf1.com
# This file is in public domain.
#==========================================================================
S_FP_ORIG="`pwd`"
S_FP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
S_TIMESTAMP="`date +%Y`_`date +%m`_`date +%d`"
S_FN_SCRIPTFILE_NAME="`basename ${BASH_SOURCE[0]}`"
S_FP_SCRIPTFILE_NAME="$S_FP_DIR/$S_FN_SCRIPTFILE_NAME"

#--------------------------------------------------------------------------

func_mmmv_exit_if_not_on_path_t2() { # S_COMMAND_NAME
    local S_COMMAND_NAME=$1
    local S_LOCAL_VARIABLE="`which $S_COMMAND_NAME 2>/dev/null`"
    if [ "$S_LOCAL_VARIABLE" == "" ]; then
        echo ""
        echo "Command \"$S_COMMAND_NAME\" could not be found from the PATH. "
        echo "The execution of the Bash script is aborted."
        echo "GUID=='82175145-7a98-46ec-a11c-d2511130c0e7'"
        echo ""
        exit 1;
    fi
} # func_mmmv_exit_if_not_on_path_t2

func_mmmv_exit_if_not_on_path_t2 "git"
func_mmmv_exit_if_not_on_path_t2 "gcc"
func_mmmv_exit_if_not_on_path_t2 "g++"
func_mmmv_exit_if_not_on_path_t2 "cmake"
func_mmmv_exit_if_not_on_path_t2 "make"
func_mmmv_exit_if_not_on_path_t2 "svn"
func_mmmv_exit_if_not_on_path_t2 "ruby"

# To avoid verifying some of the environment variable values:
    func_mmmv_exit_if_not_on_path_t2 "basename" 
    func_mmmv_exit_if_not_on_path_t2 "dirname"
    func_mmmv_exit_if_not_on_path_t2 "date"


#--------------------------------------------------------------------------
if [ "$CC" == "" ]; then
    export CC="gcc"
fi
if [ "$CXX" == "" ]; then
    export CXX="g++"
fi

ANGERVAKS_CFLAGS=" -mtune=native -ftree-vectorize "
if [ "$CFLAGS" == "" ]; then
    export CFLAGS="$ANGERVAKS_CFLAGS"
fi
if [ "$CXXFLAGS" == "" ]; then
    export CXXFLAGS="$ANGERVAKS_CFLAGS"
fi

#--------------------------------------------------------------------------
S_FN_BASHSCRIPT_THAT_DOWNLOADS="download_the_LLVM_t1.bash"
S_FP_BASHSCRIPT_THAT_DOWNLOADS="$S_FP_DIR/$S_FN_BASHSCRIPT_THAT_DOWNLOADS"
S_FN_BASHSCRIPT_THAT_COMPILES="compile_the_downloaded_LLVM_t1.bash"
S_FP_BASHSCRIPT_THAT_COMPILES="$S_FP_DIR/$S_FN_BASHSCRIPT_THAT_COMPILES"

# The only purpose of the S_MODE based mechanism is 
# to avoid writing and maintaining the user input verificaton 
# and documentation related code. The user input decrease 
# related comfort is a bonus.
S_LC_MODE_NOT_SET="mode_not_set"
S_MODE="$S_LC_MODE_NOT_SET" # {"$S_LC_MODE_NOT_SET", "mode_download", "mode_compile"} 

if [ "$S_FP_SCRIPTFILE_NAME" == "$S_FP_BASHSCRIPT_THAT_DOWNLOADS" ]; then
    S_MODE="mode_download"
fi
if [ "$S_FP_SCRIPTFILE_NAME" == "$S_FP_BASHSCRIPT_THAT_COMPILES" ]; then
    S_MODE="mode_compile"
fi

if [ "$S_MODE" == "$S_LC_MODE_NOT_SET" ]; then
    echo ""
    echo "Either this script is flawed or "
    echo "it has a wrong file name."
    echo "This script depends on its own full path. "
    echo ""
    echo "    S_FP_SCRIPTFILE_NAME:"
    echo "    $S_FP_SCRIPTFILE_NAME"
    echo ""
    echo "The supported values are:"
    echo ""
    echo "    $S_FP_BASHSCRIPT_THAT_DOWNLOADS"
    echo "    $S_FP_BASHSCRIPT_THAT_COMPILES"
    echo ""
    echo "GUID=='3e78ecb5-aafc-4eae-811c-d2511130c0e7'"
    echo ""
    #--------
    cd $S_FP_ORIG
    exit 1 # exiting with an error
fi


#--------------------------------------------------------------------------

func_assert_last_cmd_exited_without_errors_t1() {  # S_GUID
    local S_GUID="$1"
    if [ "$?" != "0" ]; then
        echo ""
        echo "Something went wrong. The error code is: $?"
        echo "GUID==\"$S_GUID\""
        echo "GUID=='b9ff0b3b-d804-4684-921c-d2511130c0e7'"
        echo ""
        #--------
        cd $S_FP_ORIG
        exit 1 # exiting with an error
    fi
} # func_assert_last_cmd_exited_without_errors_t1


func_assert_folder_exists_t1() {  # S_FP, S_GUID
    local S_FP="$1"
    local S_GUID="$2"
    #------------------------------
    if [ "$S_GUID" == "" ]; then
        echo ""
        echo "The code that calls this function is flawed."
        echo "This function requires 2 parameters: S_FP, S_GUID"
        echo "GUID=='48c51756-c210-4ba3-831c-d2511130c0e7'"
        echo ""
        #--------
        cd $S_FP_ORIG
        exit 1 # exiting with an error
    fi
    #------------------------------
    if [ ! -e $S_FP ]; then
        if [ -h $S_FP ]; then
            echo ""
            echo "The path "
            echo ""
            echo "    $S_FP "
            echo ""
            echo "points to a broken symbolic link."
            echo "GUID==\"$S_GUID\""
            echo "GUID=='def78a2e-d710-4371-840c-d2511130c0e7'"
            echo ""
            #--------
            cd $S_FP_ORIG
            exit 1 # exiting with an error
        else
            echo ""
            echo "The folder "
            echo ""
            echo "    $S_FP "
            echo ""
            echo "does not exist."
            echo "GUID==\"$S_GUID\""
            echo "GUID=='3fbd8be3-3119-4785-b40c-d2511130c0e7'"
            echo ""
            #--------
            cd $S_FP_ORIG
            exit 1 # exiting with an error
        fi
    fi
} # func_assert_folder_exists_t1


#--------------------------------------------------------------------------

func_download(){
    #--------------------------------------------
    local S_TMP_0="$S_FP_DIR/vd_$S_TIMESTAMP"
    local S_TMP_0_SRC="$S_TMP_0/src"
    local S_TMP_0_INSTALLED="$S_TMP_0/installed"
    local S_FP_LLVM="$S_TMP_0_SRC/llvm"
    #----
    mkdir -p $S_TMP_0_SRC
    func_assert_last_cmd_exited_without_errors_t1 "dcd17662-8155-4318-911c-d2511130c0e7"
    sleep 1
    func_assert_folder_exists_t1 "$S_TMP_0_SRC" \
        "c1ea2828-6f22-4692-841c-d2511130c0e7"
    #----
    mkdir -p $S_TMP_0_INSTALLED
    func_assert_last_cmd_exited_without_errors_t1 "31c4d752-6f88-488a-831c-d2511130c0e7"
    sleep 1
    func_assert_folder_exists_t1 "$S_TMP_0_INSTALLED" \
        "0373783e-b4ce-430a-910c-d2511130c0e7"
    #----
    cp $S_FP_BASHSCRIPT_THAT_DOWNLOADS  $S_TMP_0/$S_FN_BASHSCRIPT_THAT_COMPILES
    func_assert_last_cmd_exited_without_errors_t1 "927b0e39-becb-44db-a10c-d2511130c0e7"
    #--------------------------------------------
    cd $S_TMP_0_SRC
        svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
        func_assert_last_cmd_exited_without_errors_t1 "f0647956-fecd-4d1d-a20c-d2511130c0e7"
        sleep 1
        func_assert_folder_exists_t1 "$S_FP_LLVM" "97191711-7f8f-4c9d-a30c-d2511130c0e7"
        cd $S_FP_LLVM
            #--------------------------------------------
            mkdir -p ./tools
            func_assert_last_cmd_exited_without_errors_t1 "1d2f7e32-52ed-43e6-a10c-d2511130c0e7"
            sleep 1
            func_assert_folder_exists_t1 "$S_FP_LLVM/tools" \
                "5914f031-7a05-4547-a30c-d2511130c0e7"
            cd ./tools
                svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
                func_assert_last_cmd_exited_without_errors_t1 "387a3895-2406-4acd-840c-d2511130c0e7"
            cd ..
            #--------
            sleep 1
            func_assert_folder_exists_t1 "$S_FP_LLVM/tools/clang/tools" \
                "2efb4d4a-a086-4bd1-820c-d2511130c0e7"
            cd ./tools/clang/tools
                svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra
                func_assert_last_cmd_exited_without_errors_t1 "9369adbd-a355-4f24-830c-d2511130c0e7"
            cd ../../..
            #--------
            sleep 1
            func_assert_folder_exists_t1 "$S_FP_LLVM/projects" \
                "3f8a4751-c512-4a19-a40c-d2511130c0e7"
            cd ./projects
                svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
                func_assert_last_cmd_exited_without_errors_t1 "4343b617-581d-473e-b20c-d2511130c0e7"
            cd ..
            #--------
            sleep 1
            func_assert_folder_exists_t1 "$S_FP_LLVM/projects" \
                "0385372d-d6cf-44a4-850c-d2511130c0e7"
            cd ./projects
                svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
                func_assert_last_cmd_exited_without_errors_t1 "037c885b-0854-4c67-92fb-d2511130c0e7"
            cd ..
            #--------
            make update
            func_assert_last_cmd_exited_without_errors_t1 "d495634c-9e7c-4799-a4fb-d2511130c0e7"
        #--------------------------------------------
        cd .. # $S_FP_LLVM
    cd .. # $S_TMP_0_SRC
} # func_download

#--------------------------------------------------------------------------

func_compile(){
    #--------------------------------------------
    local S_TMP_0="$S_FP_DIR"
    local S_TMP_0_SRC="$S_TMP_0/src"
    local S_TMP_0_INSTALLED="$S_TMP_0/installed"
    local S_FP_LLVM="$S_TMP_0_SRC/llvm"
    #--------------------------------------------
    func_assert_folder_exists_t1 "$S_TMP_0_SRC" \
        "32c2bf08-17b5-4ca2-bdfb-d2511130c0e7"
    func_assert_folder_exists_t1 "$S_TMP_0_INSTALLED" \
        "86e06437-0be6-45bd-83fb-d2511130c0e7"
    func_assert_folder_exists_t1 "$S_FP_LLVM" \
        "29e89158-e51a-4e78-b5fb-d2511130c0e7"
    #--------------------------------------------
    cd $S_TMP_0_SRC
        cd $S_FP_LLVM
            #--------------------------------------------
            mkdir -p build
            func_assert_last_cmd_exited_without_errors_t1 "ea188d39-6e35-41e4-b2fb-d2511130c0e7"
            sleep 1
            func_assert_folder_exists_t1 "$S_FP_LLVM/build" \
                "dae46b4a-9995-4222-91fb-d2511130c0e7"
            #--------
            cd build
                CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" nice -n15 ../configure \
                    --prefix=$S_TMP_0_INSTALLED \
                    --enable-optimized \
                    --enable-docs=yes \
                    --enable-pic \
                    --enable-targets=x86_64 \
                    --enable-libffi \
                    --enable-ltdl-install \
                    --disable-bindings \
                func_assert_last_cmd_exited_without_errors_t1 "25cc9021-8b20-46ad-92fb-d2511130c0e7"
            cd ..
            #--------------------------------------------
        cd .. # $S_FP_LLVM
    cd .. # $S_TMP_0_SRC
} # func_compile



#--------------------------------------------------------------------------

if [ "$S_MODE" == "mode_download" ]; then
    func_download
else
    if [ "$S_MODE" == "mode_compile" ]; then
        func_compile
    else
        echo ""
        echo "This script is flawed."
        echo "GUID=='3024484a-b633-40af-910c-d2511130c0e7'"
        echo ""
        #--------
        cd $S_FP_ORIG
        exit 1 # exiting with an error
    fi
fi

#--------------------------------------------------------------------------