mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
Progress on Wine CI support, MinGW dev shell with Meson (#10975)
* Only build perl subproject on Linux * Fix various Windows regressions * Don't put the emulator hook in test builds We run the tests in a separate derivation. Only need it for the dev shell. * Fix native dev shells * Fix cross dev shells we don't know how to emulate Co-authored-by: PoweredByPie <poweredbypie@users.noreply.github.com> Co-authored-by: Joachim Schiele <js@lastlog.de> Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>
This commit is contained in:
parent
56757e15cf
commit
0ec5e3a1bc
9 changed files with 49 additions and 29 deletions
20
flake.nix
20
flake.nix
|
@ -278,6 +278,7 @@
|
||||||
in
|
in
|
||||||
"-D${prefix}:${rest}";
|
"-D${prefix}:${rest}";
|
||||||
havePerl = stdenv.buildPlatform == stdenv.hostPlatform && stdenv.hostPlatform.isUnix;
|
havePerl = stdenv.buildPlatform == stdenv.hostPlatform && stdenv.hostPlatform.isUnix;
|
||||||
|
ignoreCrossFile = flags: builtins.filter (flag: !(lib.strings.hasInfix "cross-file" flag)) flags;
|
||||||
in {
|
in {
|
||||||
pname = "shell-for-" + attrs.pname;
|
pname = "shell-for-" + attrs.pname;
|
||||||
|
|
||||||
|
@ -309,10 +310,12 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
mesonFlags =
|
mesonFlags =
|
||||||
map (transformFlag "libutil") pkgs.nixComponents.nix-util.mesonFlags
|
map (transformFlag "libutil") (ignoreCrossFile pkgs.nixComponents.nix-util.mesonFlags)
|
||||||
++ map (transformFlag "libstore") pkgs.nixComponents.nix-store.mesonFlags
|
++ map (transformFlag "libstore") (ignoreCrossFile pkgs.nixComponents.nix-store.mesonFlags)
|
||||||
++ map (transformFlag "libfetchers") pkgs.nixComponents.nix-fetchers.mesonFlags
|
++ map (transformFlag "libfetchers") (ignoreCrossFile pkgs.nixComponents.nix-fetchers.mesonFlags)
|
||||||
++ lib.optionals havePerl (map (transformFlag "perl") pkgs.nixComponents.nix-perl-bindings.mesonFlags)
|
++ lib.optionals havePerl (map (transformFlag "perl") (ignoreCrossFile pkgs.nixComponents.nix-perl-bindings.mesonFlags))
|
||||||
|
++ map (transformFlag "libexpr") (ignoreCrossFile pkgs.nixComponents.nix-expr.mesonFlags)
|
||||||
|
++ map (transformFlag "libcmd") (ignoreCrossFile pkgs.nixComponents.nix-cmd.mesonFlags)
|
||||||
;
|
;
|
||||||
|
|
||||||
nativeBuildInputs = attrs.nativeBuildInputs or []
|
nativeBuildInputs = attrs.nativeBuildInputs or []
|
||||||
|
@ -322,9 +325,16 @@
|
||||||
++ lib.optionals havePerl pkgs.nixComponents.nix-perl-bindings.nativeBuildInputs
|
++ lib.optionals havePerl pkgs.nixComponents.nix-perl-bindings.nativeBuildInputs
|
||||||
++ pkgs.nixComponents.nix-internal-api-docs.nativeBuildInputs
|
++ pkgs.nixComponents.nix-internal-api-docs.nativeBuildInputs
|
||||||
++ pkgs.nixComponents.nix-external-api-docs.nativeBuildInputs
|
++ pkgs.nixComponents.nix-external-api-docs.nativeBuildInputs
|
||||||
|
++ lib.optional
|
||||||
|
(!stdenv.buildPlatform.canExecute stdenv.hostPlatform
|
||||||
|
# Hack around https://github.com/nixos/nixpkgs/commit/bf7ad8cfbfa102a90463433e2c5027573b462479
|
||||||
|
&& !(stdenv.hostPlatform.isWindows && stdenv.buildPlatform.isDarwin)
|
||||||
|
&& stdenv.hostPlatform.emulatorAvailable pkgs.buildPackages
|
||||||
|
&& lib.meta.availableOn stdenv.buildPlatform (stdenv.hostPlatform.emulator pkgs.buildPackages))
|
||||||
|
pkgs.buildPackages.mesonEmulatorHook
|
||||||
++ [
|
++ [
|
||||||
pkgs.buildPackages.cmake
|
pkgs.buildPackages.cmake
|
||||||
pkgs.shellcheck
|
pkgs.buildPackages.shellcheck
|
||||||
modular.pre-commit.settings.package
|
modular.pre-commit.settings.package
|
||||||
(pkgs.writeScriptBin "pre-commit-hooks-install"
|
(pkgs.writeScriptBin "pre-commit-hooks-install"
|
||||||
modular.pre-commit.settings.installationScript)
|
modular.pre-commit.settings.installationScript)
|
||||||
|
|
|
@ -29,7 +29,9 @@ subproject('libexpr-c')
|
||||||
subproject('libmain-c')
|
subproject('libmain-c')
|
||||||
|
|
||||||
# Language Bindings
|
# Language Bindings
|
||||||
subproject('perl')
|
if not meson.is_cross_build()
|
||||||
|
subproject('perl')
|
||||||
|
endif
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
subproject('nix-util-test-support')
|
subproject('nix-util-test-support')
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include "nix_api_util.h"
|
#include "nix_api_util.h"
|
||||||
#include "nix_api_util_internal.h"
|
#include "nix_api_util_internal.h"
|
||||||
|
|
||||||
#ifdef HAVE_BOEHMGC
|
#if HAVE_BOEHMGC
|
||||||
#include <mutex>
|
# include <mutex>
|
||||||
#define GC_INCLUDE_NEW 1
|
# define GC_INCLUDE_NEW 1
|
||||||
#include "gc_cpp.h"
|
# include "gc_cpp.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nix_err nix_libexpr_init(nix_c_context * context)
|
nix_err nix_libexpr_init(nix_c_context * context)
|
||||||
|
@ -131,7 +131,7 @@ void nix_state_free(EvalState * state)
|
||||||
delete state;
|
delete state;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_BOEHMGC
|
#if HAVE_BOEHMGC
|
||||||
std::unordered_map<
|
std::unordered_map<
|
||||||
const void *,
|
const void *,
|
||||||
unsigned int,
|
unsigned int,
|
||||||
|
@ -207,7 +207,7 @@ nix_err nix_value_decref(nix_c_context * context, nix_value *x)
|
||||||
|
|
||||||
void nix_gc_register_finalizer(void * obj, void * cd, void (*finalizer)(void * obj, void * cd))
|
void nix_gc_register_finalizer(void * obj, void * cd, void (*finalizer)(void * obj, void * cd))
|
||||||
{
|
{
|
||||||
#ifdef HAVE_BOEHMGC
|
#if HAVE_BOEHMGC
|
||||||
GC_REGISTER_FINALIZER(obj, finalizer, cd, 0, 0);
|
GC_REGISTER_FINALIZER(obj, finalizer, cd, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
#ifdef HAVE_BOEHMGC
|
#if HAVE_BOEHMGC
|
||||||
# include "gc/gc.h"
|
# include "gc/gc.h"
|
||||||
# define GC_INCLUDE_NEW 1
|
# define GC_INCLUDE_NEW 1
|
||||||
# include "gc_cpp.h"
|
# include "gc_cpp.h"
|
||||||
|
@ -174,7 +174,7 @@ ExternalValue * nix_create_external_value(nix_c_context * context, NixCExternalV
|
||||||
context->last_err_code = NIX_OK;
|
context->last_err_code = NIX_OK;
|
||||||
try {
|
try {
|
||||||
auto ret = new
|
auto ret = new
|
||||||
#ifdef HAVE_BOEHMGC
|
#if HAVE_BOEHMGC
|
||||||
(GC)
|
(GC)
|
||||||
#endif
|
#endif
|
||||||
NixCExternalValue(*desc, v);
|
NixCExternalValue(*desc, v);
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "nix_api_value.h"
|
#include "nix_api_value.h"
|
||||||
#include "value/context.hh"
|
#include "value/context.hh"
|
||||||
|
|
||||||
#ifdef HAVE_BOEHMGC
|
#if HAVE_BOEHMGC
|
||||||
# include "gc/gc.h"
|
# include "gc/gc.h"
|
||||||
# define GC_INCLUDE_NEW 1
|
# define GC_INCLUDE_NEW 1
|
||||||
# include "gc_cpp.h"
|
# include "gc_cpp.h"
|
||||||
|
@ -131,7 +131,7 @@ PrimOp * nix_alloc_primop(
|
||||||
try {
|
try {
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
auto p = new
|
auto p = new
|
||||||
#ifdef HAVE_BOEHMGC
|
#if HAVE_BOEHMGC
|
||||||
(GC)
|
(GC)
|
||||||
#endif
|
#endif
|
||||||
nix::PrimOp{
|
nix::PrimOp{
|
||||||
|
|
|
@ -62,7 +62,7 @@ Goal::Co DrvOutputSubstitutionGoal::init()
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
outPipe->readSide.get()
|
outPipe->readSide.get()
|
||||||
#else
|
#else
|
||||||
&outPipe
|
&*outPipe
|
||||||
#endif
|
#endif
|
||||||
}, true, false);
|
}, true, false);
|
||||||
|
|
||||||
|
|
|
@ -416,7 +416,11 @@ void deletePath(const fs::path & path)
|
||||||
|
|
||||||
void createDir(const Path & path, mode_t mode)
|
void createDir(const Path & path, mode_t mode)
|
||||||
{
|
{
|
||||||
if (mkdir(path.c_str(), mode) == -1)
|
if (mkdir(path.c_str()
|
||||||
|
#ifndef _WIN32
|
||||||
|
, mode
|
||||||
|
#endif
|
||||||
|
) == -1)
|
||||||
throw SysError("creating directory '%1%'", path);
|
throw SysError("creating directory '%1%'", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ void RestoreSink::createRegularFile(const CanonPath & path, std::function<void(C
|
||||||
RestoreRegularFile crf;
|
RestoreRegularFile crf;
|
||||||
crf.fd =
|
crf.fd =
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
CreateFileW(path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)
|
CreateFileW(p.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)
|
||||||
#else
|
#else
|
||||||
open(p.c_str(), O_CREAT | O_EXCL | O_WRONLY | O_CLOEXEC, 0666)
|
open(p.c_str(), O_CREAT | O_EXCL | O_WRONLY | O_CLOEXEC, 0666)
|
||||||
#endif
|
#endif
|
||||||
|
@ -145,7 +145,7 @@ void RestoreRegularFile::operator () (std::string_view data)
|
||||||
void RestoreSink::createSymlink(const CanonPath & path, const std::string & target)
|
void RestoreSink::createSymlink(const CanonPath & path, const std::string & target)
|
||||||
{
|
{
|
||||||
auto p = append(dstPath, path);
|
auto p = append(dstPath, path);
|
||||||
nix::createSymlink(target, p);
|
nix::createSymlink(target, p.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -88,12 +88,17 @@ nix_sources = files(
|
||||||
'store-info.cc',
|
'store-info.cc',
|
||||||
'store-repair.cc',
|
'store-repair.cc',
|
||||||
'store.cc',
|
'store.cc',
|
||||||
'unix/daemon.cc',
|
|
||||||
'upgrade-nix.cc',
|
'upgrade-nix.cc',
|
||||||
'verify.cc',
|
'verify.cc',
|
||||||
'why-depends.cc',
|
'why-depends.cc',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if host_machine.system() != 'windows'
|
||||||
|
nix_sources += files(
|
||||||
|
'unix/daemon.cc',
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
nix_sources += [
|
nix_sources += [
|
||||||
gen_header.process('doc/manual/generate-manpage.nix'),
|
gen_header.process('doc/manual/generate-manpage.nix'),
|
||||||
gen_header.process('doc/manual/generate-settings.nix'),
|
gen_header.process('doc/manual/generate-settings.nix'),
|
||||||
|
@ -104,12 +109,6 @@ nix_sources += [
|
||||||
gen_header.process('help-stores.md'),
|
gen_header.process('help-stores.md'),
|
||||||
]
|
]
|
||||||
|
|
||||||
if host_machine.system() != 'windows'
|
|
||||||
nix_sources += files(
|
|
||||||
'unix/daemon.cc',
|
|
||||||
)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# The rest of the subdirectories aren't separate components,
|
# The rest of the subdirectories aren't separate components,
|
||||||
# just source files in another directory, so we process them here.
|
# just source files in another directory, so we process them here.
|
||||||
|
|
||||||
|
@ -146,9 +145,7 @@ nix_store_sources = files(
|
||||||
# Hurray for Meson list flattening!
|
# Hurray for Meson list flattening!
|
||||||
sources = [
|
sources = [
|
||||||
nix_sources,
|
nix_sources,
|
||||||
build_remote_sources,
|
|
||||||
nix_build_sources,
|
nix_build_sources,
|
||||||
nix_channel_sources,
|
|
||||||
unpack_channel_gen,
|
unpack_channel_gen,
|
||||||
nix_collect_garbage_sources,
|
nix_collect_garbage_sources,
|
||||||
nix_copy_closure_sources,
|
nix_copy_closure_sources,
|
||||||
|
@ -158,6 +155,13 @@ sources = [
|
||||||
nix_store_sources,
|
nix_store_sources,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if host_machine.system() != 'windows'
|
||||||
|
sources += [
|
||||||
|
build_remote_sources,
|
||||||
|
nix_channel_sources,
|
||||||
|
]
|
||||||
|
endif
|
||||||
|
|
||||||
include_dirs = [include_directories('.')]
|
include_dirs = [include_directories('.')]
|
||||||
|
|
||||||
this_exe = executable(
|
this_exe = executable(
|
||||||
|
|
Loading…
Reference in a new issue