Alien-Meson

 view release on metacpan or  search on metacpan

lib/Alien/Meson.pm  view on Meta::CPAN

  eval {
    require Alien::Meson;
    Alien::Meson->_apply_destdir_prefix_hack;
  };

  share { ... }

Applies a hack to fix how the C<DESTDIR> and prefix are joined to follow the
approach that Meson takes. See issue at L<https://github.com/PerlAlien/Alien-Build/issues/407>
for more information.

B<WARNING>: This is a hack. It is not expected to work long-term and if a
better solution is possible, it will be deprecated then removed.

=cut

sub _apply_destdir_prefix_hack {
  my ($class) = @_;
  no warnings "redefine";
  # Work around for Meson's `destdir_join` which drops the first part of
  # the path when joining (this is the drive letter).
  # See <https://github.com/mesonbuild/meson/blob/1.2.3/mesonbuild/scripts/__init__.py>.
  *Alien::Build::Util::_destdir_prefix = \&_meson_destdir_prefix;
}

sub _meson_destdir_prefix {
  my($destdir, $prefix) = @_;
  $prefix =~ s{^/?([a-z]):}{}i if $^O eq 'MSWin32';
  path($destdir)->child($prefix)->stringify;
}

=head1 HELPERS

=head2 meson

 %{meson}

B<WARNING>: This interpolation is deprecated. This will be removed in a future
version as some share installs of Meson are not callable as a single executable
(they need to be prefixed with the Python interpreter). Instead use
C<< Alien::Meson->exe >> directly.

Returns 'meson', 'meson.py', or appropriate command for
platform.

=cut

sub alien_helper {
  return +{
    meson => sub {
      warn "Interpolation of %{meson} is deprecated. See POD for Alien::Meson.";
      join " ", Alien::Meson->exe;
    },
  };
}

=head1 SEE ALSO

=over 4

=item L<Meson|https://mesonbuild.com/>

The Meson Build system home page.

=item L<Alien>

Documentation on the Alien concept itself.

=item L<Alien::Base>

The base class for this Alien.

=item L<Alien::Build::Manual::AlienUser>

Detailed manual for users of Alien classes.

=back

=cut

1;



( run in 1.724 second using v1.01-cache-2.11-cpan-df04353d9ac )