forked from lix-project/lix
meson: perl bindings: seems to work?
Change-Id: I2ee77e8ccf177dcad8964ee034a6f321fa71b615
This commit is contained in:
parent
5587050da8
commit
70b9d12c08
|
@ -316,6 +316,6 @@ in stdenv.mkDerivation (finalAttrs: {
|
|||
meta.platforms = lib.platforms.unix;
|
||||
|
||||
passthru.perl-bindings = pkgs.callPackage ./perl {
|
||||
inherit fileset stdenv;
|
||||
inherit fileset stdenv buildWithMeson;
|
||||
};
|
||||
})
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
, nix, curl, bzip2, xz, boost, libsodium, darwin
|
||||
, meson
|
||||
, ninja
|
||||
, buildWithMeson ? true # XXX(Qyriad): MAKE FALSE BEFORE COMMIT
|
||||
, buildWithMeson ? false,
|
||||
}:
|
||||
|
||||
perl.pkgs.toPerlModule (stdenv.mkDerivation {
|
||||
|
@ -13,27 +13,32 @@ perl.pkgs.toPerlModule (stdenv.mkDerivation {
|
|||
|
||||
src = fileset.toSource {
|
||||
root = ../.;
|
||||
fileset = fileset.unions [
|
||||
fileset = fileset.unions ([
|
||||
../.version
|
||||
./lib
|
||||
] ++ lib.optionals (!buildWithMeson) [
|
||||
./MANIFEST
|
||||
../m4
|
||||
../mk
|
||||
./MANIFEST
|
||||
./Makefile
|
||||
./Makefile.config.in
|
||||
./configure.ac
|
||||
./lib
|
||||
./local.mk
|
||||
];
|
||||
] ++ lib.optionals buildWithMeson [
|
||||
./meson.build
|
||||
./meson.options
|
||||
]);
|
||||
};
|
||||
|
||||
nativeBuildInputs =
|
||||
[ autoconf-archive
|
||||
autoreconfHook
|
||||
pkg-config
|
||||
] ++ lib.optionals buildWithMeson [
|
||||
meson
|
||||
ninja
|
||||
];
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
] ++ lib.optionals (!buildWithMeson) [
|
||||
autoconf-archive
|
||||
autoreconfHook
|
||||
] ++ lib.optionals buildWithMeson [
|
||||
meson
|
||||
ninja
|
||||
];
|
||||
|
||||
buildInputs =
|
||||
[ nix
|
||||
|
|
53
perl/lib/Nix/meson.build
Normal file
53
perl/lib/Nix/meson.build
Normal file
|
@ -0,0 +1,53 @@
|
|||
store_xs_cpp = custom_target(
|
||||
input : 'Store.xs',
|
||||
output : 'Store.cc',
|
||||
command : [
|
||||
xsubpp,
|
||||
'@INPUT@',
|
||||
'-output',
|
||||
'@OUTPUT@',
|
||||
],
|
||||
build_by_default : true,
|
||||
)
|
||||
|
||||
perl_libstore = shared_module(
|
||||
'Store',
|
||||
store_xs_cpp,
|
||||
# This library does NOT get the normal libsuffix. it's just `Store.so`, not `libStore.so`.
|
||||
# XXX(Qyriad): is this also true on macOS?
|
||||
name_prefix : '',
|
||||
dependencies : [
|
||||
libstore,
|
||||
sodium,
|
||||
perl_include,
|
||||
],
|
||||
link_args : [
|
||||
# Nix doesn't provide a pkg-config file for libutil.
|
||||
'-lnixutil',
|
||||
],
|
||||
install : true,
|
||||
install_dir : perl_libdir / 'auto/Nix/Store',
|
||||
)
|
||||
|
||||
config_pm = configure_file(
|
||||
input : 'Config.pm.in',
|
||||
output : 'Config.pm',
|
||||
configuration : {
|
||||
'PACKAGE_VERSION': meson.project_version(),
|
||||
},
|
||||
)
|
||||
|
||||
nix_perl_sources = files(
|
||||
'Store.pm',
|
||||
'Manifest.pm',
|
||||
'SSH.pm',
|
||||
'CopyClosure.pm',
|
||||
'Utils.pm',
|
||||
)
|
||||
|
||||
install_data(
|
||||
nix_perl_sources,
|
||||
config_pm,
|
||||
install_dir : perl_libdir / 'Nix',
|
||||
preserve_path : true,
|
||||
)
|
|
@ -57,17 +57,18 @@ perl_incdir = run_command(
|
|||
check : true,
|
||||
).stdout() + '/CORE'
|
||||
|
||||
sodium = dependency('libsodium', 'sodium', required : true)
|
||||
perl_include = declare_dependency(
|
||||
# This must have is_system : true, or #include "config.h" will get perl's config.h
|
||||
# instead of Nix's.
|
||||
include_directories : include_directories(perl_incdir, is_system : true),
|
||||
)
|
||||
|
||||
perl_flags = [
|
||||
'-I' + perl_libdir,
|
||||
]
|
||||
sodium = dependency('libsodium', 'sodium', required : true)
|
||||
|
||||
summary({
|
||||
'perl-version': perl_version,
|
||||
'perl-arch-name': perl_arch_name,
|
||||
'perl-libdir' : perl_libdir,
|
||||
'perl-flags': perl_flags,
|
||||
})
|
||||
|
||||
if cxx.get_linker_id() in ['ld.bfd', 'ld.gold']
|
||||
|
@ -76,54 +77,4 @@ endif
|
|||
|
||||
libstore = dependency('nixstore', 'nix-store', required : true)
|
||||
|
||||
# XXX(Qyriad): wtf is this name
|
||||
store_xs_cpp = custom_target(
|
||||
input : 'lib/Nix/Store.xs',
|
||||
# FIXME(Qyriad): in make, outputs lib/Nix/Store.cc; should this be subdir?
|
||||
output : 'Store.cc',
|
||||
command : [
|
||||
xsubpp,
|
||||
'@INPUT@',
|
||||
'-output',
|
||||
'@OUTPUT@',
|
||||
],
|
||||
build_by_default : true,
|
||||
)
|
||||
|
||||
|
||||
#perl_store_sources = files(
|
||||
# store_xs_cpp,
|
||||
#)
|
||||
|
||||
# shared_module() instead of shared_library() to not have -Wl,--no-undefined,
|
||||
# since this module is dlopen()'d I think?
|
||||
perl_store = shared_module(
|
||||
'Store',
|
||||
store_xs_cpp,
|
||||
# This library does NOT get the normal libsuffix. it's just `Store.so`, not `libStore.so`.
|
||||
# XXX(Qyriad): is this also true on macOS?
|
||||
name_prefix : '',
|
||||
dependencies : [
|
||||
libstore,
|
||||
sodium,
|
||||
declare_dependency(
|
||||
include_directories : include_directories(perl_incdir, is_system : true),
|
||||
),
|
||||
],
|
||||
include_directories : include_directories('../src'),
|
||||
cpp_args : [
|
||||
# FIXME(Qyriad): for the love of madoka what the fuck
|
||||
#'-Wno-unknown-warning-option',
|
||||
'-Wno-unused-variable',
|
||||
'-Wno-literal-suffix',
|
||||
#'-Wno-reserved-user-defined-literal',
|
||||
#'-Wno-duplicate-decl-specifier',
|
||||
#'-Wno-pointer-bool-conversion',
|
||||
# prevent #include <config.h> from getting perl's config.h instead of nix's
|
||||
#'-isystem' + perl_incdir,
|
||||
],
|
||||
link_args : [
|
||||
# Nix doesn't provide a pkg-config file for this
|
||||
'-lnixutil',
|
||||
],
|
||||
)
|
||||
subdir('lib/Nix')
|
||||
|
|
Loading…
Reference in a new issue