Skip to content

Commit be7fd36

Browse files
committed
Make NQP's source digest available through the compiler config
This gives NQP's user precise information about the NQP version used and makes it possible to detect any change in NQP's sources.
1 parent 1684794 commit be7fd36

File tree

4 files changed

+36
-8
lines changed

4 files changed

+36
-8
lines changed

tools/build/Makefile-JVM.in

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ EVAL_CLIENT = tools/jvm/eval-client.pl
5959
NQP_JAR = nqp.jar
6060
J_NQP_SOURCES= src/vm/jvm/NQP/Ops.nqp $(COMMON_NQP_SOURCES)
6161

62+
J_SOURCES = \
63+
$(COMMON_SOURCES) \
64+
$(J_QAST_SOURCES) \
65+
$(J_HLL_SOURCES) \
66+
$(J_NQP_SOURCES) \
67+
src/vm/jvm/ModuleLoader.nqp \
68+
6269
J_STAGE1_OUTPUT = \
6370
$(J_STAGE1_DIR)/$(NQP_MO_JAR) \
6471
$(J_STAGE1_DIR)/$(MODULE_LOADER_JAR) \
@@ -186,7 +193,7 @@ $(J_STAGE1_DIR)/$(P6QREGEX_JAR): $(J_STAGE0_DIR) $(P6QREGEX_SOURCES) $(J_STAGE1_
186193
--setting=NQPCORE --no-regex-lib --target=jar \
187194
--output=$(J_STAGE1_DIR)/$(P6QREGEX_JAR) $(J_STAGE1_DIR)/$(P6QREGEX_COMBINED)
188195

189-
$(J_STAGE1_DIR)/$(NQP_JAR): $(J_STAGE0_DIR) $(J_NQP_SOURCES) $(J_STAGE1_DIR)/$(P6QREGEX_JAR)
196+
$(J_STAGE1_DIR)/$(NQP_JAR): $(J_STAGE0_DIR) $(J_STAGE1_DIR)/$(P6QREGEX_JAR) $(J_SOURCES)
190197
$(MKPATH) $(J_STAGE1_DIR)
191198
$(PERL) tools/build/gen-version.pl $(PREFIX) $(NQP_LIB_DIR) > $(J_STAGE1_DIR)/nqp-config.nqp
192199
$(PERL) tools/build/gen-cat.pl jvm $(J_NQP_SOURCES) $(J_STAGE1_DIR)/nqp-config.nqp > $(J_STAGE1_DIR)/$(NQP_COMBINED)
@@ -254,7 +261,7 @@ $(J_STAGE2_DIR)/$(P6QREGEX_JAR): $(J_STAGE1_DIR) $(P6QREGEX_SOURCES) $(J_STAGE2_
254261
--setting=NQPCORE --no-regex-lib --target=jar \
255262
--output=$(J_STAGE2_DIR)/$(P6QREGEX_JAR) $(J_STAGE2_DIR)/$(P6QREGEX_COMBINED)
256263

257-
$(J_STAGE2_DIR)/$(NQP_JAR): $(J_STAGE1_DIR) $(J_NQP_SOURCES) $(J_STAGE2_DIR)/$(P6QREGEX_JAR)
264+
$(J_STAGE2_DIR)/$(NQP_JAR): $(J_STAGE1_DIR) $(J_STAGE2_DIR)/$(P6QREGEX_JAR) $(J_SOURCES)
258265
$(MKPATH) $(J_STAGE2_DIR)
259266
$(PERL) tools/build/gen-version.pl $(PREFIX) $(NQP_LIB_DIR) > $(J_STAGE2_DIR)/nqp-config.nqp
260267
$(PERL) tools/build/gen-cat.pl jvm $(J_NQP_SOURCES) $(J_STAGE2_DIR)/nqp-config.nqp > $(J_STAGE2_DIR)/$(NQP_COMBINED)

tools/build/Makefile-Moar.in

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ P5QREGEX_MOAR = NQPP5QRegex.moarvm
3939
NQP_MOAR = nqp.moarvm
4040
M_NQP_SOURCES= src/vm/moar/NQP/Ops.nqp $(COMMON_NQP_SOURCES)
4141

42+
M_SOURCES = \
43+
$(COMMON_SOURCES) \
44+
$(M_QAST_SOURCES) \
45+
$(M_HLL_SOURCES) \
46+
$(M_NQP_SOURCES) \
47+
src/vm/moar/ModuleLoader.nqp \
48+
4249
M_STAGE1_OUTPUT = \
4350
$(M_STAGE1_DIR)/$(NQP_MO_MOAR) \
4451
$(M_STAGE1_DIR)/$(MODULE_LOADER_MOAR) \
@@ -169,7 +176,7 @@ $(M_STAGE1_DIR)/$(P6QREGEX_MOAR): $(M_STAGE0_DIR) $(P6QREGEX_SOURCES) $(M_STAGE1
169176
--setting=NQPCORE --no-regex-lib --target=mbc \
170177
--output=$(M_STAGE1_DIR)/$(P6QREGEX_MOAR) $(M_STAGE1_DIR)/$(P6QREGEX_COMBINED)
171178

172-
$(M_STAGE1_DIR)/$(NQP_MOAR): $(M_STAGE0_DIR) $(M_NQP_SOURCES) $(M_STAGE1_DIR)/$(P6QREGEX_MOAR)
179+
$(M_STAGE1_DIR)/$(NQP_MOAR): $(M_STAGE0_DIR) $(M_STAGE1_DIR)/$(P6QREGEX_MOAR) $(M_SOURCES)
173180
$(MKPATH) $(M_STAGE1_DIR)/gen
174181
$(PERL) tools/build/gen-version.pl $(PREFIX) $(NQP_LIB_DIR) > $(M_STAGE1_DIR)/nqp-config.nqp
175182
$(PERL) tools/build/gen-cat.pl moar $(M_NQP_SOURCES) $(M_STAGE1_DIR)/nqp-config.nqp > $(M_STAGE1_DIR)/$(NQP_COMBINED)
@@ -240,7 +247,7 @@ $(M_STAGE2_DIR)/$(P6QREGEX_MOAR): $(M_STAGE1_DIR) $(P6QREGEX_SOURCES) $(M_STAGE2
240247
--setting=NQPCORE --no-regex-lib --target=mbc \
241248
--output=$(M_STAGE2_DIR)/$(P6QREGEX_MOAR) $(M_STAGE2_DIR)/$(P6QREGEX_COMBINED)
242249

243-
$(M_STAGE2_DIR)/$(NQP_MOAR): $(M_STAGE1_DIR) $(M_NQP_SOURCES) $(M_STAGE2_DIR)/$(P6QREGEX_MOAR)
250+
$(M_STAGE2_DIR)/$(NQP_MOAR): $(M_STAGE1_DIR) $(M_STAGE2_DIR)/$(P6QREGEX_MOAR) $(M_SOURCES)
244251
$(MKPATH) $(M_STAGE2_DIR)/gen
245252
$(PERL) tools/build/gen-version.pl $(PREFIX) $(NQP_LIB_DIR) > $(M_STAGE2_DIR)/nqp-config.nqp
246253
$(PERL) tools/build/gen-cat.pl moar $(M_NQP_SOURCES) $(M_STAGE2_DIR)/nqp-config.nqp > $(M_STAGE2_DIR)/$(NQP_COMBINED)

tools/build/Makefile-common.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ NQP_MO_SOURCES = \
100100

101101
NQP_MO_COMBINED = nqpmo.nqp
102102

103+
COMMON_SOURCES = \
104+
$(CORE_SETTING_SOURCES) \
105+
$(QASTNODE_SOURCES) \
106+
$(P5QREGEX_SOURCES) \
107+
$(QREGEX_SOURCES) \
108+
$(NQP_MO_SOURCES) \
109+
103110
PERL = @perl@
104111
MKPATH = $(PERL) -MExtUtils::Command -e mkpath
105112
CHMOD = $(PERL) -MExtUtils::Command -e chmod

tools/build/gen-version.pl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ =head1 TITLE
66
77
=cut
88

9+
use Digest::SHA;
10+
use File::Find;
911
use POSIX 'strftime';
1012

1113
my $prefix = shift;
@@ -25,12 +27,17 @@ =head1 TITLE
2527

2628
my $builddate = strftime('%Y-%m-%dT%H:%M:%SZ', gmtime);
2729

30+
my $sha = Digest::SHA->new;
31+
find(sub { next unless /\.nqp\z/; $sha->addfile($_) }, "src");
32+
my $source_digest = $sha->hexdigest;
33+
2834
print <<"END_VERSION";
2935
sub hll-config(\$config) {
30-
\$config<version> := '$VERSION';
31-
\$config<build-date> := '$builddate';
32-
\$config<prefix> := '$prefix';
33-
\$config<libdir> := '$libdir';
36+
\$config<version> := '$VERSION';
37+
\$config<build-date> := '$builddate';
38+
\$config<prefix> := '$prefix';
39+
\$config<libdir> := '$libdir';
40+
\$config<source-digest> := '$source_digest';
3441
}
3542
END_VERSION
3643

0 commit comments

Comments
 (0)