From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 173181F51B for ; Wed, 13 Dec 2023 00:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1702428621; bh=Zk+ZUAGp8O0FLXfPW9BTZLTCzsPgqk1/uUZN/LC4JVw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LeTfDQ8wClPgKvvJ46PkYGz/+O2/BknJfl6HBoyGxd5LSeFNJhDyc9CSYJ5gPKefA VteCaS/oMlc7v0QfQiScTODs0Uh+/AG6KxtGcI0agnZYxWquqW47+KJEr1t1OJ08YE /IHG1WlOKFudqJ6vpXSwUTZTelRkJnIqSD54r6Ts= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 07/14] xap_helper_cxx: decouple from Inline::C Date: Wed, 13 Dec 2023 00:50:12 +0000 Message-ID: <20231213005019.26912-8-e@80x24.org> In-Reply-To: <20231213005019.26912-1-e@80x24.org> References: <20231213005019.26912-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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);