Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lang/perl/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ META.yml
LICENSE
NOTICE
README
VERSION.txt
t/00_compile.t
t/01_names.t
t/01_schema.t
Expand Down
16 changes: 14 additions & 2 deletions lang/perl/Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ use Config;
use inc::Module::Install;

my $version;
$version = `cat ../../share/VERSION.txt`;
# We need to have VERSION.txt file in place to allow Avro.pm to get the version from it,
# but VERSION.txt has to be copied from ../../share/VERSION.txt.
# If we are in a cpan* installation we expect VERSION.txt to be already in place,
# but if we are in a git clone it won't be there, so we need to copy it.
unless (-f 'VERSION.txt') {
`cp -vf ../../share/VERSION.txt ./`;
}
$version = `cat VERSION.txt`;
chomp $version;

license 'apache';
Expand Down Expand Up @@ -67,4 +74,9 @@ my %packages = (
my %provides = map { $_ => { file => $packages{$_}, version => $version } } keys %packages;
provides(%provides);

WriteMakefile(PM_FILTER => "sed -e 's/\+\+MODULE_VERSION\+\+/$version/'");
WriteMakefile(
PM_FILTER => "sed -e 's/\+\+MODULE_VERSION\+\+/$version/'",
realclean => {
FILES => "VERSION.txt" # can be removed on realclean
}
);
6 changes: 5 additions & 1 deletion lang/perl/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ case "$target" in
;;

dist)
perl ./Makefile.PL && make dist
# The dist target is used to create a distribution tarball that can be uploaded to CPAN,
# so we need to add VERSION.txt to the tarball to make it available to Makefile.PL
cp -vf ../../share/VERSION.txt ./ && \
perl ./Makefile.PL && make dist && \
rm -vf ./VERSION.txt
;;

clean)
Expand Down