diff --git a/VERSION b/VERSION new file mode 100644 index 0000000000..96718a911e --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +2011.05 diff --git a/src/NQP/Compiler.pm b/src/NQP/Compiler.pm index f7861856d5..a3cc15c79b 100644 --- a/src/NQP/Compiler.pm +++ b/src/NQP/Compiler.pm @@ -7,6 +7,7 @@ sub MAIN(@ARGS) { $nqpcomp.language('nqp'); $nqpcomp.parsegrammar(NQP::Grammar); $nqpcomp.parseactions(NQP::Actions); + hll-config($nqpcomp.config); # Add extra command line options. my @clo := $nqpcomp.commandline_options(); diff --git a/tools/build/Makefile.in b/tools/build/Makefile.in index 2567760647..ead30c141e 100644 --- a/tools/build/Makefile.in +++ b/tools/build/Makefile.in @@ -300,7 +300,8 @@ $(STAGE1)/$(P6REGEX_PBC): $(STAGE0_PBCS) $(STAGE1)/$(HLL_PBC) $(STAGE1)/$(CORE_S $(STAGE1)/$(NQP_PBC): $(STAGE0_PBCS) $(STAGE1)/$(P6REGEX_PBC) $(STAGE1)/$(CORE_SETTING_PBC) $(NQP_SOURCES) $(MKPATH) $(STAGE1)/gen - $(PERL) tools/build/gen-cat.pl $(NQP_SOURCES) > $(STAGE1)/$(NQP_COMBINED) + $(PERL) tools/build/gen-version.pl >src/gen/nqp-config.pm + $(PERL) tools/build/gen-cat.pl $(NQP_SOURCES) src/gen/nqp-config.pm > $(STAGE1)/$(NQP_COMBINED) $(PARROT) --library=$(STAGE0) $(STAGE0)/$(NQP_PBC) \ --target=pir --output=$(STAGE1)/$(NQP_COMBINED_PIR) \ --module-path=$(STAGE1) --setting-path=$(STAGE1) $(STAGE1)/$(NQP_COMBINED) @@ -356,7 +357,8 @@ $(STAGE2)/$(P6REGEX_PBC): $(STAGE1_PBCS) $(STAGE2)/$(HLL_PBC) $(P6REGEX_SOURCES) $(STAGE2)/$(NQP_PBC): $(STAGE0_PBCS) $(STAGE2)/$(P6REGEX_PBC) $(NQP_SOURCES) $(MKPATH) $(STAGE1)/gen - $(PERL) tools/build/gen-cat.pl $(NQP_SOURCES) > $(STAGE2)/$(NQP_COMBINED) + $(PERL) tools/build/gen-version.pl >src/gen/nqp-config.pm + $(PERL) tools/build/gen-cat.pl $(NQP_SOURCES) src/gen/nqp-config.pm > $(STAGE2)/$(NQP_COMBINED) $(PARROT) --library=$(STAGE1) $(STAGE1)/$(NQP_PBC) \ --target=pir --output=$(STAGE2)/$(NQP_COMBINED_PIR) \ --module-path=$(STAGE2) --setting-path=$(STAGE2) $(STAGE2)/$(NQP_COMBINED) diff --git a/tools/build/gen-version.pl b/tools/build/gen-version.pl new file mode 100644 index 0000000000..2ff40ee5d3 --- /dev/null +++ b/tools/build/gen-version.pl @@ -0,0 +1,32 @@ +#! perl + +=head1 TITLE + +gen-version.l -- script to generate version information for HLL compilers + +=cut + +use POSIX 'strftime'; + +open(my $fh, '<', 'VERSION') or die $!; +my $VERSION = <$fh>; +close($fh); + +if (-d '.git' && open(my $GIT, '-|', "git describe --tags")) { + $VERSION = <$GIT>; + close($GIT); +} + +chomp $VERSION; + +my $builddate = strftime('%Y-%m-%dT%H:%M:%SZ', gmtime); + +print <<"END_VERSION"; +sub hll-config(\$config) { + \$config := '$VERSION'; + \$config := '$builddate'; +} +END_VERSION + +0; +