@@ -43,6 +43,7 @@ do_polly="yes"
43
43
BuildDir=" ` pwd` "
44
44
ExtraConfigureFlags=" "
45
45
ExportBranch=" "
46
+ git_ref=" "
46
47
47
48
function usage() {
48
49
echo " usage: ` basename $0 ` -release X.Y.Z -rc NUM [OPTIONS]"
@@ -60,8 +61,7 @@ function usage() {
60
61
echo " -use-gzip Use gzip instead of xz."
61
62
echo " -use-ninja Use ninja instead of make/gmake."
62
63
echo " -configure-flags FLAGS Extra flags to pass to the configure step."
63
- echo " -svn-path DIR Use the specified DIR instead of a release."
64
- echo " For example -svn-path trunk or -svn-path branches/release_37"
64
+ echo " -git-ref sha Use the specified git ref for testing instead of a release."
65
65
echo " -no-rt Disable check-out & build Compiler-RT"
66
66
echo " -no-libs Disable check-out & build libcxx/libcxxabi/libunwind"
67
67
echo " -no-libcxxabi Disable check-out & build libcxxabi"
@@ -88,13 +88,14 @@ while [ $# -gt 0 ]; do
88
88
-final | --final )
89
89
RC=final
90
90
;;
91
- -svn-path | --svn-path )
91
+ -git-ref | --git-ref )
92
92
shift
93
93
Release=" test"
94
94
Release_no_dot=" test"
95
95
ExportBranch=" $1 "
96
96
RC=" ` echo $ExportBranch | sed -e ' s,/,_,g' ` "
97
- echo " WARNING: Using the branch $ExportBranch instead of a release tag"
97
+ git_ref=" $1 "
98
+ echo " WARNING: Using the ref $git_ref instead of a release tag"
98
99
echo " This is intended to aid new packagers in trialing "
99
100
echo " builds without requiring a tag to be created first"
100
101
;;
@@ -196,6 +197,17 @@ if [ -z "$Triple" ]; then
196
197
exit 1
197
198
fi
198
199
200
+ if [ " $Release " != " test" ]; then
201
+ if [ -n " $git_ref " ]; then
202
+ echo " error: can't specify both -release and -git-ref"
203
+ exit 1
204
+ fi
205
+ git_ref=llvmorg-$Release
206
+ if [ " $RC " != " final" ]; then
207
+ git_ref=" $git_ref -$RC "
208
+ fi
209
+ fi
210
+
199
211
# Figure out how many make processes to run.
200
212
if [ -z " $NumJobs " ]; then
201
213
NumJobs=` sysctl -n hw.activecpu 2> /dev/null || true`
@@ -211,7 +223,7 @@ if [ -z "$NumJobs" ]; then
211
223
fi
212
224
213
225
# Projects list
214
- projects=" llvm cfe clang-tools-extra"
226
+ projects=" llvm clang clang-tools-extra"
215
227
if [ $do_rt = " yes" ]; then
216
228
projects=" $projects compiler-rt"
217
229
fi
285
297
286
298
check_program_exists ${MAKE}
287
299
288
- # Make sure that the URLs are valid.
289
- function check_valid_urls() {
290
- for proj in $projects ; do
291
- echo " # Validating $proj SVN URL"
292
-
293
- if ! svn ls $Base_url /$proj /$ExportBranch > /dev/null 2>&1 ; then
294
- echo " $proj does not have a $ExportBranch branch/tag!"
295
- exit 1
296
- fi
297
- done
298
- }
299
-
300
300
# Export sources to the build directory.
301
301
function export_sources() {
302
- check_valid_urls
303
-
304
- for proj in $projects ; do
305
- case $proj in
306
- llvm)
307
- projsrc=$proj .src
308
- ;;
309
- cfe)
310
- projsrc=llvm.src/tools/clang
311
- ;;
312
- lld|lldb|polly)
313
- projsrc=llvm.src/tools/$proj
314
- ;;
315
- clang-tools-extra)
316
- projsrc=llvm.src/tools/clang/tools/extra
317
- ;;
318
- compiler-rt|libcxx|libcxxabi|libunwind|openmp)
319
- projsrc=llvm.src/projects/$proj
320
- ;;
321
- test-suite)
322
- projsrc=$proj .src
323
- ;;
324
- * )
325
- echo " error: unknown project $proj "
326
- exit 1
327
- ;;
328
- esac
329
-
330
- if [ -d $projsrc ]; then
331
- echo " # Reusing $proj $Release -$RC sources in $projsrc "
332
- continue
333
- fi
334
- echo " # Exporting $proj $Release -$RC sources to $projsrc "
335
- if ! svn export -q $Base_url /$proj /$ExportBranch $projsrc ; then
336
- echo " error: failed to export $proj project"
337
- exit 1
338
- fi
339
- done
302
+ SrcDir=$BuildDir /llvm-project
303
+ mkdir -p $SrcDir
304
+ echo " # Using git ref: $git_ref "
305
+
306
+ # GitHub allows you to download a tarball of any commit using the URL:
307
+ # https://github.com/$organization/$repo/archive/$ref.tar.gz
308
+ curl -L https://github.com/llvm/llvm-project/archive/$git_ref .tar.gz | \
309
+ tar -C $SrcDir --strip-components=1 -xzf -
310
+
311
+ if [ " $do_test_suite " = " yes" ]; then
312
+ TestSuiteSrcDir=$BuildDir /llvm-test-suite
313
+ mkdir -p $TestSuiteSrcDir
314
+
315
+ # We can only use named refs, like branches and tags, that exist in
316
+ # both the llvm-project and test-suite repos if we want to run the
317
+ # test suite.
318
+ # If the test-suite fails to download assume we are using a ref that
319
+ # doesn't exist in the test suite and disable it.
320
+ set +e
321
+ curl -L https://github.com/llvm/test-suite/archive/$git_ref .tar.gz | \
322
+ tar -C $TestSuiteSrcDir --strip-components=1 -xzf -
323
+ if [ $? -ne -0 ]; then
324
+ echo " $git_ref not found in test-suite repo, test-suite disabled."
325
+ do_test_suite=" no"
326
+ fi
327
+ set -e
328
+ fi
340
329
341
- cd $BuildDir
330
+ cd $BuildDir
342
331
}
343
332
344
333
function configure_llvmCore() {
@@ -366,6 +355,7 @@ function configure_llvmCore() {
366
355
;;
367
356
esac
368
357
358
+ project_list=${projects// / ;}
369
359
echo " # Using C compiler: $c_compiler "
370
360
echo " # Using C++ compiler: $cxx_compiler "
371
361
@@ -375,12 +365,14 @@ function configure_llvmCore() {
375
365
echo " #" env CC=" $c_compiler " CXX=" $cxx_compiler " \
376
366
cmake -G " $generator " \
377
367
-DCMAKE_BUILD_TYPE=$BuildType -DLLVM_ENABLE_ASSERTIONS=$Assertions \
378
- $ExtraConfigureFlags $BuildDir /llvm.src \
368
+ -DLLVM_ENABLE_PROJECTS=" $project_list " \
369
+ $ExtraConfigureFlags $BuildDir /llvm-project/llvm \
379
370
2>&1 | tee $LogDir /llvm.configure-Phase$Phase -$Flavor .log
380
371
env CC=" $c_compiler " CXX=" $cxx_compiler " \
381
372
cmake -G " $generator " \
382
373
-DCMAKE_BUILD_TYPE=$BuildType -DLLVM_ENABLE_ASSERTIONS=$Assertions \
383
- $ExtraConfigureFlags $BuildDir /llvm.src \
374
+ -DLLVM_ENABLE_PROJECTS=" $project_list " \
375
+ $ExtraConfigureFlags $BuildDir /llvm-project/llvm \
384
376
2>&1 | tee $LogDir /llvm.configure-Phase$Phase -$Flavor .log
385
377
386
378
cd $BuildDir
@@ -491,10 +483,10 @@ if [ $do_test_suite = "yes" ]; then
491
483
SandboxDir=" $BuildDir /sandbox"
492
484
Lit=$SandboxDir /bin/lit
493
485
TestSuiteBuildDir=" $BuildDir /test-suite-build"
494
- TestSuiteSrcDir=" $BuildDir /test-suite.src "
486
+ TestSuiteSrcDir=" $BuildDir /llvm- test-suite"
495
487
496
488
virtualenv $SandboxDir
497
- $SandboxDir /bin/python $BuildDir /llvm.src /utils/lit/setup.py install
489
+ $SandboxDir /bin/python $BuildDir /llvm-project/llvm /utils/lit/setup.py install
498
490
mkdir -p $TestSuiteBuildDir
499
491
fi
500
492
0 commit comments