2024-03-01 20:15:44 +00:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
autoconf-archive,
|
|
|
|
autoreconfHook,
|
|
|
|
aws-sdk-cpp,
|
2024-04-06 21:44:27 +00:00
|
|
|
# If the patched version of Boehm isn't passed, then patch it based off of
|
|
|
|
# pkgs.boehmgc. This allows `callPackage`ing this file without needing to
|
|
|
|
# to implement behavior that this package flat out doesn't build without
|
|
|
|
# anyway, but also allows easily overriding the patch logic.
|
|
|
|
boehmgc-nix ? __forDefaults.boehmgc-nix,
|
2024-03-01 20:15:44 +00:00
|
|
|
boehmgc,
|
|
|
|
nlohmann_json,
|
|
|
|
bison,
|
2024-03-26 17:32:25 +00:00
|
|
|
build-release-notes,
|
2024-03-01 20:15:44 +00:00
|
|
|
boost,
|
|
|
|
brotli,
|
|
|
|
bzip2,
|
2024-03-27 02:36:17 +00:00
|
|
|
cmake,
|
2024-03-01 20:15:44 +00:00
|
|
|
curl,
|
2024-03-09 04:09:11 +00:00
|
|
|
doxygen,
|
2024-03-01 20:15:44 +00:00
|
|
|
editline,
|
|
|
|
fileset,
|
|
|
|
flex,
|
|
|
|
git,
|
|
|
|
gtest,
|
|
|
|
jq,
|
|
|
|
libarchive,
|
|
|
|
libcpuid,
|
|
|
|
libseccomp,
|
|
|
|
libsodium,
|
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and
install Lix executables, libraries, and headers. Meson does not yet
build docs, Perl bindings, or run tests, which will be added in
following commits. As such, this commit does not remove the existing
build system, or make it the default, and also as such, this commit has
several FIXMEs and TODOs as notes for what should be done before the
existing autoconf + make buildsystem can be removed and Meson made the
default. This commit does not modify any source files.
A Meson-enabled build is also added as a Hydra job, and to
`nix flake check`.
Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21 19:41:23 +00:00
|
|
|
lsof,
|
2024-03-01 20:15:44 +00:00
|
|
|
lowdown,
|
|
|
|
mdbook,
|
|
|
|
mdbook-linkcheck,
|
|
|
|
mercurial,
|
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and
install Lix executables, libraries, and headers. Meson does not yet
build docs, Perl bindings, or run tests, which will be added in
following commits. As such, this commit does not remove the existing
build system, or make it the default, and also as such, this commit has
several FIXMEs and TODOs as notes for what should be done before the
existing autoconf + make buildsystem can be removed and Meson made the
default. This commit does not modify any source files.
A Meson-enabled build is also added as a Hydra job, and to
`nix flake check`.
Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21 19:41:23 +00:00
|
|
|
meson,
|
|
|
|
ninja,
|
2024-03-01 20:15:44 +00:00
|
|
|
openssl,
|
|
|
|
pkg-config,
|
2024-04-06 04:28:27 +00:00
|
|
|
python3,
|
2024-03-01 20:15:44 +00:00
|
|
|
rapidcheck,
|
|
|
|
sqlite,
|
2024-03-27 02:36:17 +00:00
|
|
|
toml11,
|
2024-03-01 20:15:44 +00:00
|
|
|
util-linuxMinimal ? utillinuxMinimal,
|
|
|
|
utillinuxMinimal ? null,
|
|
|
|
xz,
|
|
|
|
|
2024-03-09 08:22:06 +00:00
|
|
|
busybox-sandbox-shell,
|
2024-03-01 20:15:44 +00:00
|
|
|
|
2024-03-18 00:01:05 +00:00
|
|
|
nix-doc,
|
|
|
|
|
2024-03-01 20:15:44 +00:00
|
|
|
pname ? "nix",
|
|
|
|
versionSuffix ? "",
|
|
|
|
officialRelease ? true,
|
|
|
|
# Set to true to build the release notes for the next release.
|
|
|
|
buildUnreleasedNotes ? false,
|
2024-03-09 04:09:11 +00:00
|
|
|
internalApiDocs ? false,
|
2023-12-18 20:59:58 +00:00
|
|
|
# Avoid setting things that would interfere with a functioning devShell
|
|
|
|
forDevShell ? false,
|
2024-03-01 20:15:44 +00:00
|
|
|
|
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and
install Lix executables, libraries, and headers. Meson does not yet
build docs, Perl bindings, or run tests, which will be added in
following commits. As such, this commit does not remove the existing
build system, or make it the default, and also as such, this commit has
several FIXMEs and TODOs as notes for what should be done before the
existing autoconf + make buildsystem can be removed and Meson made the
default. This commit does not modify any source files.
A Meson-enabled build is also added as a Hydra job, and to
`nix flake check`.
Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21 19:41:23 +00:00
|
|
|
# FIXME(Qyriad): build Lix using Meson instead of autoconf and make.
|
|
|
|
# This flag will be removed when the migration to Meson is complete.
|
|
|
|
buildWithMeson ? false,
|
|
|
|
|
2024-03-01 20:15:44 +00:00
|
|
|
# Not a real argument, just the only way to approximate let-binding some
|
|
|
|
# stuff for argument defaults.
|
|
|
|
__forDefaults ? {
|
|
|
|
canRunInstalled = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
2024-04-06 21:44:27 +00:00
|
|
|
|
|
|
|
boehmgc-nix = (boehmgc.override {
|
|
|
|
enableLargeConfig = true;
|
|
|
|
}).overrideAttrs {
|
|
|
|
patches = [
|
|
|
|
# We do *not* include prev.patches (which doesn't exist in normal pkgs.boehmgc anyway)
|
|
|
|
# because if the caller of this package passed a patched boehm as `boehmgc` instead of
|
|
|
|
# `boehmgc-nix` then this will almost certainly have duplicate patches, which means
|
|
|
|
# the patches won't apply and we'll get a build failure.
|
|
|
|
./boehmgc-coroutine-sp-fallback.diff
|
|
|
|
# https://github.com/ivmai/bdwgc/pull/586
|
|
|
|
./boehmgc-traceable_allocator-public.diff
|
|
|
|
];
|
|
|
|
};
|
2024-03-01 20:15:44 +00:00
|
|
|
},
|
|
|
|
}: let
|
|
|
|
inherit (__forDefaults) canRunInstalled;
|
|
|
|
|
|
|
|
version = lib.fileContents ./.version + versionSuffix;
|
|
|
|
|
2024-03-05 20:51:49 +00:00
|
|
|
aws-sdk-cpp-nix = aws-sdk-cpp.override {
|
|
|
|
apis = [ "s3" "transfer" ];
|
|
|
|
customMemoryManagement = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
testConfigureFlags = [
|
|
|
|
"RAPIDCHECK_HEADERS=${lib.getDev rapidcheck}/extras/gtest/include"
|
|
|
|
];
|
|
|
|
|
2024-03-09 04:09:11 +00:00
|
|
|
# The internal API docs need these for the build, but if we're not building
|
|
|
|
# Nix itself, then these don't need to be propagated.
|
|
|
|
maybePropagatedInputs = [
|
2024-04-06 21:44:27 +00:00
|
|
|
boehmgc-nix
|
2024-03-09 04:09:11 +00:00
|
|
|
nlohmann_json
|
|
|
|
];
|
|
|
|
|
2024-03-01 20:15:44 +00:00
|
|
|
# .gitignore has already been processed, so any changes in it are irrelevant
|
|
|
|
# at this point. It is not represented verbatim for test purposes because
|
|
|
|
# that would interfere with repo semantics.
|
|
|
|
baseFiles = fileset.fileFilter (f: f.name != ".gitignore") ./.;
|
2024-03-05 20:51:49 +00:00
|
|
|
|
|
|
|
configureFiles = fileset.unions [
|
|
|
|
./.version
|
|
|
|
./configure.ac
|
|
|
|
./m4
|
|
|
|
# TODO: do we really need README.md? It doesn't seem used in the build.
|
|
|
|
./README.md
|
|
|
|
];
|
|
|
|
|
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and
install Lix executables, libraries, and headers. Meson does not yet
build docs, Perl bindings, or run tests, which will be added in
following commits. As such, this commit does not remove the existing
build system, or make it the default, and also as such, this commit has
several FIXMEs and TODOs as notes for what should be done before the
existing autoconf + make buildsystem can be removed and Meson made the
default. This commit does not modify any source files.
A Meson-enabled build is also added as a Hydra job, and to
`nix flake check`.
Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21 19:41:23 +00:00
|
|
|
topLevelBuildFiles = fileset.unions ([
|
2024-03-05 20:51:49 +00:00
|
|
|
./local.mk
|
|
|
|
./Makefile
|
|
|
|
./Makefile.config.in
|
|
|
|
./mk
|
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and
install Lix executables, libraries, and headers. Meson does not yet
build docs, Perl bindings, or run tests, which will be added in
following commits. As such, this commit does not remove the existing
build system, or make it the default, and also as such, this commit has
several FIXMEs and TODOs as notes for what should be done before the
existing autoconf + make buildsystem can be removed and Meson made the
default. This commit does not modify any source files.
A Meson-enabled build is also added as a Hydra job, and to
`nix flake check`.
Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21 19:41:23 +00:00
|
|
|
] ++ lib.optionals buildWithMeson [
|
|
|
|
./meson.build
|
|
|
|
./meson.options
|
2024-03-25 18:12:56 +00:00
|
|
|
./meson
|
|
|
|
./scripts/meson.build
|
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and
install Lix executables, libraries, and headers. Meson does not yet
build docs, Perl bindings, or run tests, which will be added in
following commits. As such, this commit does not remove the existing
build system, or make it the default, and also as such, this commit has
several FIXMEs and TODOs as notes for what should be done before the
existing autoconf + make buildsystem can be removed and Meson made the
default. This commit does not modify any source files.
A Meson-enabled build is also added as a Hydra job, and to
`nix flake check`.
Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21 19:41:23 +00:00
|
|
|
]);
|
2024-03-05 20:51:49 +00:00
|
|
|
|
|
|
|
functionalTestFiles = fileset.unions [
|
|
|
|
./tests/functional
|
|
|
|
./tests/unit
|
|
|
|
(fileset.fileFilter (f: lib.strings.hasPrefix "nix-profile" f.name) ./scripts)
|
|
|
|
];
|
|
|
|
|
|
|
|
in stdenv.mkDerivation (finalAttrs: {
|
|
|
|
inherit pname version;
|
|
|
|
|
2024-03-01 20:15:44 +00:00
|
|
|
src = fileset.toSource {
|
|
|
|
root = ./.;
|
2024-03-05 20:51:49 +00:00
|
|
|
fileset = fileset.intersection baseFiles (fileset.unions ([
|
|
|
|
configureFiles
|
|
|
|
topLevelBuildFiles
|
|
|
|
functionalTestFiles
|
2024-03-09 04:09:11 +00:00
|
|
|
] ++ lib.optionals (!finalAttrs.dontBuild || internalApiDocs) [
|
2024-03-01 20:15:44 +00:00
|
|
|
./boehmgc-coroutine-sp-fallback.diff
|
|
|
|
./doc
|
|
|
|
./misc
|
|
|
|
./precompiled-headers.h
|
|
|
|
./src
|
|
|
|
./COPYING
|
|
|
|
./scripts/local.mk
|
2024-03-05 20:51:49 +00:00
|
|
|
]));
|
2024-03-01 20:15:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
VERSION_SUFFIX = versionSuffix;
|
|
|
|
|
2024-03-05 20:51:49 +00:00
|
|
|
outputs = [ "out" ]
|
|
|
|
++ lib.optionals (!finalAttrs.dontBuild) [ "dev" "doc" ];
|
|
|
|
|
|
|
|
dontBuild = false;
|
2024-03-01 20:15:44 +00:00
|
|
|
|
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and
install Lix executables, libraries, and headers. Meson does not yet
build docs, Perl bindings, or run tests, which will be added in
following commits. As such, this commit does not remove the existing
build system, or make it the default, and also as such, this commit has
several FIXMEs and TODOs as notes for what should be done before the
existing autoconf + make buildsystem can be removed and Meson made the
default. This commit does not modify any source files.
A Meson-enabled build is also added as a Hydra job, and to
`nix flake check`.
Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21 19:41:23 +00:00
|
|
|
# FIXME(Qyriad): see if this is still needed once the migration to Meson is completed.
|
|
|
|
mesonFlags = lib.optionals (buildWithMeson && stdenv.hostPlatform.isLinux) [
|
|
|
|
"-Dsandbox-shell=${lib.getBin busybox-sandbox-shell}/bin/busybox"
|
|
|
|
];
|
|
|
|
|
2024-03-27 02:36:17 +00:00
|
|
|
# We only include CMake so that Meson can locate toml11, which only ships CMake dependency metadata.
|
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
|
2024-03-01 20:15:44 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
bison
|
|
|
|
flex
|
2024-04-06 04:28:27 +00:00
|
|
|
python3
|
2024-03-05 20:51:49 +00:00
|
|
|
] ++ [
|
2024-03-01 20:15:44 +00:00
|
|
|
(lib.getBin lowdown)
|
|
|
|
mdbook
|
|
|
|
mdbook-linkcheck
|
|
|
|
autoconf-archive
|
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and
install Lix executables, libraries, and headers. Meson does not yet
build docs, Perl bindings, or run tests, which will be added in
following commits. As such, this commit does not remove the existing
build system, or make it the default, and also as such, this commit has
several FIXMEs and TODOs as notes for what should be done before the
existing autoconf + make buildsystem can be removed and Meson made the
default. This commit does not modify any source files.
A Meson-enabled build is also added as a Hydra job, and to
`nix flake check`.
Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21 19:41:23 +00:00
|
|
|
] ++ lib.optional (!buildWithMeson) autoreconfHook ++ [
|
2024-03-01 20:15:44 +00:00
|
|
|
pkg-config
|
|
|
|
|
|
|
|
# Tests
|
|
|
|
git
|
|
|
|
mercurial
|
|
|
|
jq
|
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and
install Lix executables, libraries, and headers. Meson does not yet
build docs, Perl bindings, or run tests, which will be added in
following commits. As such, this commit does not remove the existing
build system, or make it the default, and also as such, this commit has
several FIXMEs and TODOs as notes for what should be done before the
existing autoconf + make buildsystem can be removed and Meson made the
default. This commit does not modify any source files.
A Meson-enabled build is also added as a Hydra job, and to
`nix flake check`.
Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21 19:41:23 +00:00
|
|
|
lsof
|
2024-03-01 20:15:44 +00:00
|
|
|
] ++ lib.optional stdenv.hostPlatform.isLinux util-linuxMinimal
|
2024-03-26 17:32:25 +00:00
|
|
|
++ lib.optional (!officialRelease && buildUnreleasedNotes) build-release-notes
|
2024-03-09 04:09:11 +00:00
|
|
|
++ lib.optional internalApiDocs doxygen
|
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and
install Lix executables, libraries, and headers. Meson does not yet
build docs, Perl bindings, or run tests, which will be added in
following commits. As such, this commit does not remove the existing
build system, or make it the default, and also as such, this commit has
several FIXMEs and TODOs as notes for what should be done before the
existing autoconf + make buildsystem can be removed and Meson made the
default. This commit does not modify any source files.
A Meson-enabled build is also added as a Hydra job, and to
`nix flake check`.
Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21 19:41:23 +00:00
|
|
|
++ lib.optionals buildWithMeson [
|
|
|
|
meson
|
|
|
|
ninja
|
2024-03-27 02:36:17 +00:00
|
|
|
cmake
|
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and
install Lix executables, libraries, and headers. Meson does not yet
build docs, Perl bindings, or run tests, which will be added in
following commits. As such, this commit does not remove the existing
build system, or make it the default, and also as such, this commit has
several FIXMEs and TODOs as notes for what should be done before the
existing autoconf + make buildsystem can be removed and Meson made the
default. This commit does not modify any source files.
A Meson-enabled build is also added as a Hydra job, and to
`nix flake check`.
Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21 19:41:23 +00:00
|
|
|
];
|
2024-03-01 20:15:44 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
curl
|
|
|
|
bzip2
|
|
|
|
xz
|
|
|
|
brotli
|
|
|
|
editline
|
|
|
|
openssl
|
|
|
|
sqlite
|
|
|
|
libarchive
|
|
|
|
boost
|
|
|
|
lowdown
|
|
|
|
libsodium
|
2024-03-27 02:36:17 +00:00
|
|
|
toml11
|
2024-03-18 00:01:05 +00:00
|
|
|
nix-doc
|
2024-03-01 20:15:44 +00:00
|
|
|
]
|
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and
install Lix executables, libraries, and headers. Meson does not yet
build docs, Perl bindings, or run tests, which will be added in
following commits. As such, this commit does not remove the existing
build system, or make it the default, and also as such, this commit has
several FIXMEs and TODOs as notes for what should be done before the
existing autoconf + make buildsystem can be removed and Meson made the
default. This commit does not modify any source files.
A Meson-enabled build is also added as a Hydra job, and to
`nix flake check`.
Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21 19:41:23 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [ libseccomp busybox-sandbox-shell ]
|
2024-03-01 20:15:44 +00:00
|
|
|
++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid
|
|
|
|
# There have been issues building these dependencies
|
|
|
|
++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) aws-sdk-cpp-nix
|
2024-03-09 04:09:11 +00:00
|
|
|
++ lib.optionals (finalAttrs.dontBuild) maybePropagatedInputs
|
2024-03-01 20:15:44 +00:00
|
|
|
;
|
|
|
|
|
2024-03-09 08:22:06 +00:00
|
|
|
checkInputs = [
|
2024-03-01 20:15:44 +00:00
|
|
|
gtest
|
|
|
|
rapidcheck
|
|
|
|
];
|
|
|
|
|
2024-03-09 04:09:11 +00:00
|
|
|
propagatedBuildInputs = lib.optionals (!finalAttrs.dontBuild) maybePropagatedInputs;
|
2024-03-01 20:15:44 +00:00
|
|
|
|
|
|
|
disallowedReferences = [
|
|
|
|
boost
|
|
|
|
];
|
|
|
|
|
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and
install Lix executables, libraries, and headers. Meson does not yet
build docs, Perl bindings, or run tests, which will be added in
following commits. As such, this commit does not remove the existing
build system, or make it the default, and also as such, this commit has
several FIXMEs and TODOs as notes for what should be done before the
existing autoconf + make buildsystem can be removed and Meson made the
default. This commit does not modify any source files.
A Meson-enabled build is also added as a Hydra job, and to
`nix flake check`.
Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21 19:41:23 +00:00
|
|
|
# Needed for Meson to find Boost.
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/86131.
|
|
|
|
env = lib.optionalAttrs (buildWithMeson || forDevShell) {
|
|
|
|
BOOST_INCLUDEDIR = "${lib.getDev boost}/include";
|
|
|
|
BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
|
|
|
|
};
|
|
|
|
|
2024-03-05 20:51:49 +00:00
|
|
|
preConfigure = lib.optionalString (!finalAttrs.dontBuild && !stdenv.hostPlatform.isStatic) ''
|
2024-03-01 20:15:44 +00:00
|
|
|
# Copy libboost_context so we don't get all of Boost in our closure.
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/45462
|
|
|
|
mkdir -p $out/lib
|
|
|
|
cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib
|
|
|
|
rm -f $out/lib/*.a
|
2024-03-05 23:26:46 +00:00
|
|
|
'' + lib.optionalString (!finalAttrs.dontBuild && stdenv.hostPlatform.isLinux) ''
|
2024-03-05 20:51:49 +00:00
|
|
|
chmod u+w $out/lib/*.so.*
|
|
|
|
patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.*
|
2024-03-05 23:26:46 +00:00
|
|
|
'' + lib.optionalString (!finalAttrs.dontBuild && stdenv.hostPlatform.isDarwin) ''
|
2024-03-05 20:51:49 +00:00
|
|
|
for LIB in $out/lib/*.dylib; do
|
|
|
|
chmod u+w $LIB
|
|
|
|
install_name_tool -id $LIB $LIB
|
|
|
|
install_name_tool -delete_rpath ${boost}/lib/ $LIB || true
|
|
|
|
done
|
|
|
|
install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib
|
2024-03-09 08:22:06 +00:00
|
|
|
'' + ''
|
|
|
|
# Workaround https://github.com/NixOS/nixpkgs/issues/294890.
|
|
|
|
if [[ -n "''${doCheck:-}" ]]; then
|
|
|
|
appendToVar configureFlags "--enable-tests"
|
|
|
|
else
|
|
|
|
appendToVar configureFlags "--disable-tests"
|
|
|
|
fi
|
2024-03-01 20:15:44 +00:00
|
|
|
'';
|
|
|
|
|
2024-04-05 18:09:59 +00:00
|
|
|
configureFlags = [
|
2024-03-01 20:15:44 +00:00
|
|
|
"--with-boost=${boost}/lib"
|
2024-04-05 18:09:59 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2024-03-01 20:15:44 +00:00
|
|
|
"--with-sandbox-shell=${busybox-sandbox-shell}/bin/busybox"
|
|
|
|
] ++ lib.optionals (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) [
|
|
|
|
"LDFLAGS=-fuse-ld=gold"
|
2023-12-18 20:59:58 +00:00
|
|
|
]
|
2024-03-01 20:15:44 +00:00
|
|
|
++ lib.optional stdenv.hostPlatform.isStatic "--enable-embedded-sandbox-shell"
|
2024-03-09 04:09:11 +00:00
|
|
|
++ lib.optionals (finalAttrs.doCheck || internalApiDocs) testConfigureFlags
|
2024-03-01 20:15:44 +00:00
|
|
|
++ lib.optional (!canRunInstalled) "--disable-doc-gen"
|
2024-03-09 04:09:11 +00:00
|
|
|
++ [ (lib.enableFeature internalApiDocs "internal-api-docs") ]
|
2024-03-27 02:36:17 +00:00
|
|
|
++ lib.optional (!forDevShell) "--sysconfdir=/etc"
|
|
|
|
++ [
|
|
|
|
"TOML11_HEADERS=${lib.getDev toml11}/include"
|
|
|
|
];
|
2024-03-01 20:15:44 +00:00
|
|
|
|
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and
install Lix executables, libraries, and headers. Meson does not yet
build docs, Perl bindings, or run tests, which will be added in
following commits. As such, this commit does not remove the existing
build system, or make it the default, and also as such, this commit has
several FIXMEs and TODOs as notes for what should be done before the
existing autoconf + make buildsystem can be removed and Meson made the
default. This commit does not modify any source files.
A Meson-enabled build is also added as a Hydra job, and to
`nix flake check`.
Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21 19:41:23 +00:00
|
|
|
mesonBuildType = lib.optional (buildWithMeson || forDevShell) "debugoptimized";
|
|
|
|
|
2024-03-09 04:09:11 +00:00
|
|
|
installTargets = lib.optional internalApiDocs "internal-api-html";
|
|
|
|
|
2024-03-01 20:15:44 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
makeFlags = "profiledir=$(out)/etc/profile.d PRECOMPILE_HEADERS=1";
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2024-03-21 21:38:11 +00:00
|
|
|
mesonCheckFlags = lib.optionals (buildWithMeson || forDevShell) [
|
|
|
|
"--suite=check"
|
|
|
|
];
|
|
|
|
|
2024-03-01 20:15:44 +00:00
|
|
|
installFlags = "sysconfdir=$(out)/etc";
|
|
|
|
|
2024-03-09 04:09:11 +00:00
|
|
|
postInstall = lib.optionalString (!finalAttrs.dontBuild) ''
|
|
|
|
mkdir -p $doc/nix-support
|
|
|
|
echo "doc manual $doc/share/doc/nix/manual" >> $doc/nix-support/hydra-build-products
|
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isStatic ''
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
echo "file binary-dist $out/bin/nix" >> $out/nix-support/hydra-build-products
|
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and
install Lix executables, libraries, and headers. Meson does not yet
build docs, Perl bindings, or run tests, which will be added in
following commits. As such, this commit does not remove the existing
build system, or make it the default, and also as such, this commit has
several FIXMEs and TODOs as notes for what should be done before the
existing autoconf + make buildsystem can be removed and Meson made the
default. This commit does not modify any source files.
A Meson-enabled build is also added as a Hydra job, and to
`nix flake check`.
Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21 19:41:23 +00:00
|
|
|
for lib in libnixutil.dylib libnixexpr.dylib; do
|
|
|
|
install_name_tool \
|
|
|
|
-change "${lib.getLib boost}/lib/libboost_context.dylib" \
|
|
|
|
"$out/lib/libboost_context.dylib" \
|
|
|
|
"$out/lib/$lib"
|
|
|
|
done
|
2024-03-09 04:09:11 +00:00
|
|
|
'' + lib.optionalString internalApiDocs ''
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
echo "doc internal-api-docs $out/share/doc/nix/internal-api/html" >> "$out/nix-support/hydra-build-products"
|
2024-03-01 20:15:44 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
doInstallCheck = finalAttrs.doCheck;
|
|
|
|
installCheckFlags = "sysconfdir=$(out)/etc";
|
|
|
|
installCheckTarget = "installcheck"; # work around buggy detection in stdenv
|
|
|
|
|
2024-03-25 18:12:56 +00:00
|
|
|
mesonInstallCheckFlags = [
|
|
|
|
"--suite=installcheck"
|
|
|
|
];
|
|
|
|
|
2024-03-01 20:15:44 +00:00
|
|
|
preInstallCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
|
|
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
|
|
|
|
'';
|
|
|
|
|
2024-03-25 18:12:56 +00:00
|
|
|
installCheckPhase = lib.optionalString buildWithMeson ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
flagsArray=($mesonInstallCheckFlags "''${mesonInstallCheckFlagsArray[@]}")
|
|
|
|
meson test --no-rebuild "''${flagsArray[@]}"
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
|
|
|
|
2024-03-05 20:51:49 +00:00
|
|
|
separateDebugInfo = !stdenv.hostPlatform.isStatic && !finalAttrs.dontBuild;
|
2024-03-01 20:15:44 +00:00
|
|
|
|
|
|
|
strictDeps = true;
|
|
|
|
|
2024-03-25 06:45:25 +00:00
|
|
|
# strictoverflow is disabled because we trap on signed overflow instead
|
|
|
|
hardeningDisable = [ "strictoverflow" ]
|
|
|
|
++ lib.optional stdenv.hostPlatform.isStatic "pie";
|
2024-03-01 20:15:44 +00:00
|
|
|
|
|
|
|
meta.platforms = lib.platforms.unix;
|
|
|
|
|
|
|
|
passthru.perl-bindings = pkgs.callPackage ./perl {
|
2024-04-01 20:06:44 +00:00
|
|
|
inherit fileset stdenv buildWithMeson;
|
2024-03-01 20:15:44 +00:00
|
|
|
};
|
2024-04-06 21:44:27 +00:00
|
|
|
|
|
|
|
# Export the patched version of boehmgc.
|
|
|
|
# flake.nix exports that into its overlay.
|
|
|
|
passthru.boehmgc-nix = __forDefaults.boehmgc-nix;
|
2024-03-01 20:15:44 +00:00
|
|
|
})
|