File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ META.yml
4040LICENSE
4141NOTICE
4242README
43+ VERSION.txt
4344t/00_compile.t
4445t/01_names.t
4546t/01_schema.t
Original file line number Diff line number Diff line change @@ -19,7 +19,14 @@ use Config;
1919use inc::Module::Install;
2020
2121my $version ;
22- $version = ` cat ../../share/VERSION.txt` ;
22+ # We need to have VERSION.txt file in place to allow Avro.pm to get the version from it,
23+ # but VERSION.txt has to be copied from ../../share/VERSION.txt.
24+ # If we are in a cpan* installation we expect VERSION.txt to be already in place,
25+ # but if we are in a git clone it won't be there, so we need to copy it.
26+ unless (-f ' VERSION.txt' ) {
27+ ` cp -vf ../../share/VERSION.txt ./` ;
28+ }
29+ $version = ` cat VERSION.txt` ;
2330chomp $version ;
2431
2532license ' apache' ;
@@ -67,4 +74,9 @@ my %packages = (
6774my %provides = map { $_ => { file => $packages {$_ }, version => $version } } keys %packages ;
6875provides(%provides );
6976
70- WriteMakefile(PM_FILTER => " sed -e 's/\+\+ MODULE_VERSION\+\+ /$version /'" );
77+ WriteMakefile(
78+ PM_FILTER => " sed -e 's/\+\+ MODULE_VERSION\+\+ /$version /'" ,
79+ realclean => {
80+ FILES => " VERSION.txt" # can be removed on realclean
81+ }
82+ );
Original file line number Diff line number Diff line change @@ -58,7 +58,11 @@ case "$target" in
5858 ;;
5959
6060 dist)
61- perl ./Makefile.PL && make dist
61+ # The dist target is used to create a distribution tarball that can be uploaded to CPAN,
62+ # so we need to add VERSION.txt to the tarball to make it available to Makefile.PL
63+ cp -vf ../../share/VERSION.txt ./ && \
64+ perl ./Makefile.PL && make dist && \
65+ rm -vf ./VERSION.txt
6266 ;;
6367
6468 clean)
You can’t perform that action at this time.
0 commit comments