Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port Nix-Perl to Meson #10378

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions perl/.yath.rc

This file was deleted.

2 changes: 2 additions & 0 deletions perl/.yath.rc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[test]
-I=rel(@lib_dir@)
21 changes: 0 additions & 21 deletions perl/Makefile

This file was deleted.

18 changes: 0 additions & 18 deletions perl/Makefile.config.in

This file was deleted.

84 changes: 0 additions & 84 deletions perl/configure.ac

This file was deleted.

77 changes: 43 additions & 34 deletions perl/default.nix
Original file line number Diff line number Diff line change
@@ -1,47 +1,52 @@
{ lib, fileset
{ lib
, fileset
, stdenv
, perl, perlPackages
, autoconf-archive, autoreconfHook, pkg-config
, nix, curl, bzip2, xz, boost, libsodium, darwin
, perl
, perlPackages
, meson
, ninja
, pkg-config
, nix
, curl
, bzip2
, xz
, boost
, libsodium
, darwin
}:

perl.pkgs.toPerlModule (stdenv.mkDerivation (finalAttrs: {
name = "nix-perl-${nix.version}";

src = fileset.toSource {
root = ../.;
root = ./.;
fileset = fileset.unions ([
../.version
../m4
../mk
./MANIFEST
./Makefile
./Makefile.config.in
./configure.ac
./lib
./local.mk
./meson.build
./meson_options.txt
] ++ lib.optionals finalAttrs.doCheck [
./.yath.rc
./.yath.rc.in
./t
]);
};

nativeBuildInputs =
[ autoconf-archive
autoreconfHook
pkg-config
];

buildInputs =
[ nix
curl
bzip2
xz
perl
boost
]
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
nativeBuildInputs = [
meson
ninja
pkg-config
];

buildInputs = [
nix
curl
bzip2
xz
perl
boost
]
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;

# `perlPackages.Test2Harness` is marked broken for Darwin
doCheck = !stdenv.isDarwin;
Expand All @@ -50,12 +55,16 @@ perl.pkgs.toPerlModule (stdenv.mkDerivation (finalAttrs: {
perlPackages.Test2Harness
];

configureFlags = [
"--with-dbi=${perlPackages.DBI}/${perl.libPrefix}"
"--with-dbd-sqlite=${perlPackages.DBDSQLite}/${perl.libPrefix}"
mesonFlags = [
(lib.mesonOption "version" (builtins.readFile ../.version))
(lib.mesonOption "dbi_path" "${perlPackages.DBI}/${perl.libPrefix}")
(lib.mesonOption "dbd_sqlite_path" "${perlPackages.DBDSQLite}/${perl.libPrefix}")
(lib.mesonEnable "tests" finalAttrs.doCheck)
];

enableParallelBuilding = true;
mesonCheckFlags = [
"--print-errorlogs"
];

postUnpack = "sourceRoot=$sourceRoot/perl";
enableParallelBuilding = true;
}))
2 changes: 1 addition & 1 deletion perl/lib/Nix/Store.xs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "config.h"
#include "nix/config.h"

#include "EXTERN.h"
#include "perl.h"
Expand Down
59 changes: 59 additions & 0 deletions perl/lib/Nix/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Nix-Perl Scripts
#============================================================================



# Sources
#-------------------------------------------------

nix_perl_store_xs = files('Store.xs')

nix_perl_scripts = files(
'CopyClosure.pm',
'Manifest.pm',
'SSH.pm',
'Store.pm',
'Utils.pm',
)

foreach f : nix_perl_scripts
fs.copyfile(f)
endforeach


# Targets
#---------------------------------------------------

nix_perl_scripts += configure_file(
output : 'Config.pm',
input : 'Config.pm.in',
configuration : nix_perl_conf,
)

nix_perl_store_cc = custom_target(
'Store.cc',
output : 'Store.cc',
input : nix_perl_store_xs,
command : [xsubpp, '@INPUT@', '-output', '@OUTPUT@'],
)

# Build Nix::Store Library
#-------------------------------------------------
nix_perl_store_lib = library(
'Store',
sources : nix_perl_store_cc,
name_prefix : '',
install : true,
install_mode : 'rwxr-xr-x',
install_dir : join_paths(nix_perl_install_dir, 'auto', 'Nix', 'Store'),
dependencies : nix_perl_store_dep_list,
)


# Install Scripts
#---------------------------------------------------
install_data(
nix_perl_scripts,
install_mode : 'rw-r--r--',
install_dir : join_paths(nix_perl_install_dir,'Nix'),
)
46 changes: 0 additions & 46 deletions perl/local.mk

This file was deleted.

Loading
Loading