@@ -43,6 +43,7 @@ do_polly="yes"
4343BuildDir=" ` pwd` "
4444ExtraConfigureFlags=" "
4545ExportBranch=" "
46+ git_ref=" "
4647
4748function usage() {
4849 echo " usage: ` basename $0 ` -release X.Y.Z -rc NUM [OPTIONS]"
@@ -60,8 +61,7 @@ function usage() {
6061 echo " -use-gzip Use gzip instead of xz."
6162 echo " -use-ninja Use ninja instead of make/gmake."
6263 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."
6565 echo " -no-rt Disable check-out & build Compiler-RT"
6666 echo " -no-libs Disable check-out & build libcxx/libcxxabi/libunwind"
6767 echo " -no-libcxxabi Disable check-out & build libcxxabi"
@@ -88,13 +88,14 @@ while [ $# -gt 0 ]; do
8888 -final | --final )
8989 RC=final
9090 ;;
91- -svn-path | --svn-path )
91+ -git-ref | --git-ref )
9292 shift
9393 Release=" test"
9494 Release_no_dot=" test"
9595 ExportBranch=" $1 "
9696 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"
9899 echo " This is intended to aid new packagers in trialing "
99100 echo " builds without requiring a tag to be created first"
100101 ;;
@@ -196,6 +197,17 @@ if [ -z "$Triple" ]; then
196197 exit 1
197198fi
198199
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+
199211# Figure out how many make processes to run.
200212if [ -z " $NumJobs " ]; then
201213 NumJobs=` sysctl -n hw.activecpu 2> /dev/null || true`
@@ -211,7 +223,7 @@ if [ -z "$NumJobs" ]; then
211223fi
212224
213225# Projects list
214- projects=" llvm cfe clang-tools-extra"
226+ projects=" llvm clang clang-tools-extra"
215227if [ $do_rt = " yes" ]; then
216228 projects=" $projects compiler-rt"
217229fi
288300
289301check_program_exists ${MAKE}
290302
291- # Make sure that the URLs are valid.
292- function check_valid_urls() {
293- for proj in $projects ; do
294- echo " # Validating $proj SVN URL"
295-
296- if ! svn ls $Base_url /$proj /$ExportBranch > /dev/null 2>&1 ; then
297- echo " $proj does not have a $ExportBranch branch/tag!"
298- exit 1
299- fi
300- done
301- }
302-
303303# Export sources to the build directory.
304304function export_sources() {
305- check_valid_urls
306-
307- for proj in $projects ; do
308- case $proj in
309- llvm)
310- projsrc=$proj .src
311- ;;
312- cfe)
313- projsrc=llvm.src/tools/clang
314- ;;
315- lld|lldb|polly)
316- projsrc=llvm.src/tools/$proj
317- ;;
318- clang-tools-extra)
319- projsrc=llvm.src/tools/clang/tools/extra
320- ;;
321- compiler-rt|libcxx|libcxxabi|libunwind|openmp)
322- projsrc=llvm.src/projects/$proj
323- ;;
324- test-suite)
325- projsrc=$proj .src
326- ;;
327- * )
328- echo " error: unknown project $proj "
329- exit 1
330- ;;
331- esac
332-
333- if [ -d $projsrc ]; then
334- echo " # Reusing $proj $Release -$RC sources in $projsrc "
335- continue
336- fi
337- echo " # Exporting $proj $Release -$RC sources to $projsrc "
338- if ! svn export -q $Base_url /$proj /$ExportBranch $projsrc ; then
339- echo " error: failed to export $proj project"
340- exit 1
341- fi
342- done
305+ SrcDir=$BuildDir /llvm-project
306+ mkdir -p $SrcDir
307+ echo " # Using git ref: $git_ref "
308+
309+ # GitHub allows you to download a tarball of any commit using the URL:
310+ # https://github.com/$organization/$repo/archive/$ref.tar.gz
311+ curl -L https://github.com/llvm/llvm-project/archive/$git_ref .tar.gz | \
312+ tar -C $SrcDir --strip-components=1 -xzf -
313+
314+ if [ " $do_test_suite " = " yes" ]; then
315+ TestSuiteSrcDir=$BuildDir /llvm-test-suite
316+ mkdir -p $TestSuiteSrcDir
317+
318+ # We can only use named refs, like branches and tags, that exist in
319+ # both the llvm-project and test-suite repos if we want to run the
320+ # test suite.
321+ # If the test-suite fails to download assume we are using a ref that
322+ # doesn't exist in the test suite and disable it.
323+ set +e
324+ curl -L https://github.com/llvm/test-suite/archive/$git_ref .tar.gz | \
325+ tar -C $TestSuiteSrcDir --strip-components=1 -xzf -
326+ if [ $? -ne -0 ]; then
327+ echo " $git_ref not found in test-suite repo, test-suite disabled."
328+ do_test_suite=" no"
329+ fi
330+ set -e
331+ fi
343332
344- cd $BuildDir
333+ cd $BuildDir
345334}
346335
347336function configure_llvmCore() {
@@ -369,6 +358,7 @@ function configure_llvmCore() {
369358 ;;
370359 esac
371360
361+ project_list=${projects// / ;}
372362 echo " # Using C compiler: $c_compiler "
373363 echo " # Using C++ compiler: $cxx_compiler "
374364
@@ -378,12 +368,14 @@ function configure_llvmCore() {
378368 echo " #" env CC=" $c_compiler " CXX=" $cxx_compiler " \
379369 cmake -G " $generator " \
380370 -DCMAKE_BUILD_TYPE=$BuildType -DLLVM_ENABLE_ASSERTIONS=$Assertions \
381- $ExtraConfigureFlags $BuildDir /llvm.src \
371+ -DLLVM_ENABLE_PROJECTS=" $project_list " \
372+ $ExtraConfigureFlags $BuildDir /llvm-project/llvm \
382373 2>&1 | tee $LogDir /llvm.configure-Phase$Phase -$Flavor .log
383374 env CC=" $c_compiler " CXX=" $cxx_compiler " \
384375 cmake -G " $generator " \
385376 -DCMAKE_BUILD_TYPE=$BuildType -DLLVM_ENABLE_ASSERTIONS=$Assertions \
386- $ExtraConfigureFlags $BuildDir /llvm.src \
377+ -DLLVM_ENABLE_PROJECTS=" $project_list " \
378+ $ExtraConfigureFlags $BuildDir /llvm-project/llvm \
387379 2>&1 | tee $LogDir /llvm.configure-Phase$Phase -$Flavor .log
388380
389381 cd $BuildDir
@@ -494,10 +486,10 @@ if [ $do_test_suite = "yes" ]; then
494486 SandboxDir=" $BuildDir /sandbox"
495487 Lit=$SandboxDir /bin/lit
496488 TestSuiteBuildDir=" $BuildDir /test-suite-build"
497- TestSuiteSrcDir=" $BuildDir /test-suite.src "
489+ TestSuiteSrcDir=" $BuildDir /llvm- test-suite"
498490
499491 virtualenv $SandboxDir
500- $SandboxDir /bin/python $BuildDir /llvm.src /utils/lit/setup.py install
492+ $SandboxDir /bin/python $BuildDir /llvm-project/llvm /utils/lit/setup.py install
501493 mkdir -p $TestSuiteBuildDir
502494fi
503495
0 commit comments