Skip to content

Commit

Permalink
port nix-perl to meson
Browse files Browse the repository at this point in the history
  • Loading branch information
polar committed Apr 2, 2024
1 parent e6497c7 commit 4e74c28
Show file tree
Hide file tree
Showing 9 changed files with 277 additions and 202 deletions.
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.

76 changes: 43 additions & 33 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
./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,17 @@ 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.optionals finalAttrs.doCheck [
(lib.mesonOption "tests" "enabled")
];

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

postUnpack = "sourceRoot=$sourceRoot/perl";
enableParallelBuilding = true;
}))
55 changes: 55 additions & 0 deletions perl/lib/Nix/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 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

0 comments on commit 4e74c28

Please sign in to comment.