We don't actually need Inline::C support to build a standalone
executable implemented in C++.
---
 lib/PublicInbox/XapHelperCxx.pm | 11 ++++++-----
 t/xap_helper.t                  |  6 ++++--
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/lib/PublicInbox/XapHelperCxx.pm b/lib/PublicInbox/XapHelperCxx.pm
index 17f988ee..8e95ff42 100644
--- a/lib/PublicInbox/XapHelperCxx.pm
+++ b/lib/PublicInbox/XapHelperCxx.pm
@@ -16,8 +16,9 @@ use autodie;
 my $cxx = which($ENV{CXX} // 'c++');
 my $dir = substr("$cxx-$Config{archname}", 1); # drop leading '/'
 $dir =~ tr!/!-!;
-$ENV{PERL_INLINE_DIRECTORY} // die('BUG: PERL_INLINE_DIRECTORY unset');
-substr($dir, 0, 0) = "$ENV{PERL_INLINE_DIRECTORY}/";
+my $idir = ($ENV{XDG_CACHE_HOME} //
+       (($ENV{HOME} // die('HOME unset')).'/.cache')).'/public-inbox/jaot';
+substr($dir, 0, 0) = "$idir/";
 my $bin = "$dir/xap_helper";
 my ($srcpfx) = (__FILE__ =~ m!\A(.+/)[^/]+\z!);
 my @srcs = map { $srcpfx.$_ } qw(xh_mset.h xh_cidx.h xap_helper.h);
@@ -54,9 +55,9 @@ sub needs_rebuild () {
 }
 
 sub build () {
-       if (!-d $dir && !CORE::mkdir($dir)) {
-               my $err = $!;
-               die "mkdir($dir): $err" if !-d $dir;
+       if (!-d $dir) {
+               require File::Path;
+               File::Path::make_path($dir);
        }
        require PublicInbox::CodeSearch;
        require PublicInbox::Lock;
diff --git a/t/xap_helper.t b/t/xap_helper.t
index be010c75..0f474608 100644
--- a/t/xap_helper.t
+++ b/t/xap_helper.t
@@ -149,8 +149,10 @@ unless ($ENV{TEST_XH_CXX_ONLY}) {
        no_pollerfd($ar->{pid});
 }
 SKIP: {
-       require PublicInbox::XapHelperCxx;
-       my $cmd = eval { PublicInbox::XapHelperCxx::cmd() };
+       my $cmd = eval {
+               require PublicInbox::XapHelperCxx;
+               PublicInbox::XapHelperCxx::cmd();
+       };
        skip "XapHelperCxx build: $@", 1 if $@;
 
        @NO_CXX = $ENV{TEST_XH_CXX_ONLY} ? (0) : (0, 1);

Reply via email to