Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
llvm-epi-0.8
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Roger Ferrer
llvm-epi-0.8
Commits
bf56cb50
Commit
bf56cb50
authored
11 years ago
by
Greg Clayton
Browse files
Options
Downloads
Patches
Plain Diff
Detect when llvm or clang sources have changed and rebuild llvm/clang automatically.
llvm-svn: 203594
parent
0bc22877
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lldb/scripts/build-llvm.pl
+92
-5
92 additions, 5 deletions
lldb/scripts/build-llvm.pl
with
92 additions
and
5 deletions
lldb/scripts/build-llvm.pl
+
92
−
5
View file @
bf56cb50
...
...
@@ -11,7 +11,9 @@
use
strict
;
use
File::
Basename
;
use
File::
Glob
'
:glob
';
use
File::
Slurp
;
use
List::
Util
qw[min max]
;
use
Digest::
MD5
qw(md5_hex)
;
our
$llvm_srcroot
=
$ENV
{
SCRIPT_INPUT_FILE_0
};
our
$llvm_dstroot
=
$ENV
{
SCRIPT_INPUT_FILE_1
};
...
...
@@ -49,7 +51,10 @@ else
{
die
"
Unsupported LLVM configuration: '
$llvm_configuration
'
\n
";
}
our
@llvm_repositories
=
(
"
$llvm_srcroot
",
"
$llvm_srcroot
/tools/clang
"
);
our
@archive_files
=
(
"
$llvm_configuration
/lib/libclang.a
",
"
$llvm_configuration
/lib/libclangAnalysis.a
",
...
...
@@ -157,6 +162,28 @@ sub build_llvm
#my $extra_svn_options = $debug ? "" : "--quiet";
# Make the llvm build directory
my
$arch_idx
=
0
;
# Calculate if the current source digest so we can compare it to each architecture
# build folder
my
@llvm_md5_strings
;
foreach
my
$repo
(
@llvm_repositories
)
{
if
(
-
d
"
$repo
/.svn
")
{
push
(
@llvm_md5_strings
,
`
svn info '
$repo
'
`);
push
(
@llvm_md5_strings
,
`
svn diff '
$repo
'
`);
}
elsif
(
-
d
"
$repo
/.git
")
{
push
(
@llvm_md5_strings
,
`
cd '
$repo
'; git branch -v
`);
push
(
@llvm_md5_strings
,
`
cd '
$repo
'; git diff
`);
}
}
#print "LLVM MD5 will be generated from:\n";
#print @llvm_md5_strings;
my
$llvm_hex_digest
=
md5_hex
(
@llvm_md5_strings
);
#print "llvm MD5: $llvm_hex_digest\n";
foreach
my
$arch
(
@archs
)
{
my
$llvm_dstroot_arch
=
"
${llvm_dstroot}
/
${arch}
";
...
...
@@ -165,6 +192,8 @@ sub build_llvm
my
$do_configure
=
0
;
my
$do_make
=
0
;
my
$is_arm
=
$arch
=~
/^arm/
;
my
$save_arch_digest
=
1
;
my
$arch_digest_file
=
"
$llvm_dstroot_arch
/md5
";
my
$llvm_dstroot_arch_archive
=
"
$llvm_dstroot_arch
/
$llvm_clang_basename
";
print
"
LLVM architecture root for
${arch}
exists at '
$llvm_dstroot_arch
'...
";
...
...
@@ -173,6 +202,7 @@ sub build_llvm
print
"
YES
\n
";
$do_configure
=
!-
e
"
$llvm_dstroot_arch
/config.log
";
my
@archive_modtimes
;
# dstroot for llvm build exists, make sure all .a files are built
for
my
$llvm_lib
(
@archive_files
)
{
...
...
@@ -182,13 +212,65 @@ sub build_llvm
$do_make
=
1
;
}
}
if
(
!-
e
$llvm_dstroot_arch_archive
)
if
(
$do_make
==
0
)
{
$do_make
=
1
;
if
(
-
e
$arch_digest_file
)
{
my
$arch_hex_digest
=
read_file
(
$arch_digest_file
);
if
(
$arch_hex_digest
eq
$llvm_hex_digest
)
{
# No sources have been changed or updated
$save_arch_digest
=
0
;
}
else
{
# Sources have changed, or svn has been updated
print
"
Sources have changed, rebuilding...
\n
";
$do_make
=
1
;
}
}
else
{
# No MD5 digest, we need to make
print
"
Missing MD5 digest file '
$arch_digest_file
', rebuilding...
\n
";
$do_make
=
1
;
}
if
(
$do_make
==
0
)
{
if
(
-
e
$llvm_dstroot_arch_archive
)
{
# the final archive exists, check the modification times on all .a files that
# make the final archive to make sure we don't need to rebuild
my
$llvm_dstroot_arch_archive_modtime
=
(
stat
(
$llvm_dstroot_arch_archive
))[
9
];
for
my
$llvm_lib
(
@archive_files
)
{
if
(
-
e
"
$llvm_dstroot_arch
/
$llvm_lib
")
{
if
(
$llvm_dstroot_arch_archive_modtime
<
(
stat
("
$llvm_dstroot_arch
/
$llvm_lib
"))[
9
])
{
print
"
'
$llvm_dstroot_arch
/
$llvm_lib
' is newer than '
$llvm_dstroot_arch_archive
', rebuilding...
\n
";
$do_make
=
1
;
last
;
}
}
}
if
(
$do_make
==
0
)
{
print
"
LLVM architecture archive for
${arch}
is '
$llvm_dstroot_arch_archive
' and is up to date.
\n
";
}
}
else
{
$do_make
=
1
;
}
}
}
else
if
(
$do_make
)
{
print
"
LLVM architecture archive for
${arch}
is '
$llvm_dstroot_arch_archive
'
\n
"
;
unlink
(
$llvm_dstroot_arch_archive
)
;
}
}
else
...
...
@@ -235,6 +317,11 @@ sub build_llvm
}
}
}
if
(
$save_arch_digest
)
{
write_file
(
$arch_digest_file
,
\
$llvm_hex_digest
);
}
if
(
$do_configure
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment