Skip to content

Commit

Permalink
Do not try to install to prefix unless root
Browse files Browse the repository at this point in the history
and use pkg-config files from share directory if possible.
  • Loading branch information
zmughal committed Oct 31, 2021
1 parent 93a5749 commit ff3733c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Build.PL
Expand Up @@ -37,6 +37,7 @@ if (my $s = `pkg-config --variable pc_path pkg-config`) {
}

$dest_libdir = $first_lib || $first_lib64 || "";
undef $dest_libdir if $> != 0; # not root
$prefix = "%s";

if($dest_libdir) {
Expand All @@ -45,10 +46,8 @@ if (my $s = `pkg-config --variable pc_path pkg-config`) {
$prefix = $s;
}
} else {
if($first_share_pc) {
if($first_share_pc && $> == 0) {
$bonus_install_command = "mv %s/lib/pkgconfig/fftw*.pc $first_share_pc";
} else {
die "Couldn't figure out a reasonable place to stick the pkg-config files for fftw.\n Sorry, you're on your own.";
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions lib/Alien/FFTW3.pm
Expand Up @@ -76,8 +76,15 @@ use warnings;
our $VERSION = '0.04';
use parent 'Alien::Base';

use Env qw(@PKG_CONFIG_PATH);
use File::Spec;

our $pkgconfig;
BEGIN {
unshift @PKG_CONFIG_PATH, File::Spec->catfile(
__PACKAGE__->dist_dir,
qw(lib pkgconfig)
) if __PACKAGE__->install_type('share');
if ($^O eq 'MSWin32') {
# no 'which' on MS Windows but 'pkg-config' might be installed
$pkgconfig = 'pkg-config' if `pkg-config --version`;
Expand Down

0 comments on commit ff3733c

Please sign in to comment.