From 1ac635d6007b620b0850fb5e7e68cfb7b8badca7 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 25 Apr 2024 16:07:00 -0400 Subject: [PATCH] perl: Allow running `yath test` in the build directory For most purposes, the stock `ninja test` should be fine, but this allows for doing other things with the `yath` during development. --- perl/.yath.rc | 2 -- perl/.yath.rc.in | 2 ++ perl/default.nix | 2 +- perl/meson.build | 16 ++++++++++++---- 4 files changed, 15 insertions(+), 7 deletions(-) delete mode 100644 perl/.yath.rc create mode 100644 perl/.yath.rc.in diff --git a/perl/.yath.rc b/perl/.yath.rc deleted file mode 100644 index 118bf80c8..000000000 --- a/perl/.yath.rc +++ /dev/null @@ -1,2 +0,0 @@ -[test] --I=rel(lib/Nix) diff --git a/perl/.yath.rc.in b/perl/.yath.rc.in new file mode 100644 index 000000000..e6f5f93ec --- /dev/null +++ b/perl/.yath.rc.in @@ -0,0 +1,2 @@ +[test] +-I=rel(@lib_dir@) diff --git a/perl/default.nix b/perl/default.nix index 185c8126f..45682381e 100644 --- a/perl/default.nix +++ b/perl/default.nix @@ -26,7 +26,7 @@ perl.pkgs.toPerlModule (stdenv.mkDerivation (finalAttrs: { ./meson.build ./meson_options.txt ] ++ lib.optionals finalAttrs.doCheck [ - ./.yath.rc + ./.yath.rc.in ./t ]); }; diff --git a/perl/meson.build b/perl/meson.build index bbeb0afa1..350e5bd67 100644 --- a/perl/meson.build +++ b/perl/meson.build @@ -138,15 +138,23 @@ nix_perl_store_dep_list = [ # # build # #------------------------------------------------- -subdir('lib/Nix') +lib_dir = join_paths('lib', 'Nix') +subdir(lib_dir) if get_option('tests').enabled() + yath_rc_conf = configuration_data() + yath_rc_conf.set('lib_dir', lib_dir) + yath_rc = configure_file( + output : '.yath.rc', + input : '.yath.rc.in', + configuration : yath_rc_conf, + ) subdir('t') test( 'nix-perl-test', yath, - args : [ - '-I=@0@'.format( join_paths( meson.current_build_dir(), 'lib', 'Nix') ), - ], + args : ['test'], + workdir : meson.current_build_dir(), + depends : [nix_perl_store_lib], ) endif