Autotools hell
This commit is contained in:
parent
fc5c1d4e5d
commit
fda8741aa3
|
@ -14,6 +14,7 @@ ENABLE_FUNCTIONAL_TESTS = @ENABLE_FUNCTIONAL_TESTS@
|
||||||
ENABLE_INTERNAL_API_DOCS = @ENABLE_INTERNAL_API_DOCS@
|
ENABLE_INTERNAL_API_DOCS = @ENABLE_INTERNAL_API_DOCS@
|
||||||
ENABLE_S3 = @ENABLE_S3@
|
ENABLE_S3 = @ENABLE_S3@
|
||||||
ENABLE_UNIT_TESTS = @ENABLE_UNIT_TESTS@
|
ENABLE_UNIT_TESTS = @ENABLE_UNIT_TESTS@
|
||||||
|
ENABLE_TRACY = @ENABLE_TRACY@
|
||||||
GTEST_LIBS = @GTEST_LIBS@
|
GTEST_LIBS = @GTEST_LIBS@
|
||||||
HAVE_LIBCPUID = @HAVE_LIBCPUID@
|
HAVE_LIBCPUID = @HAVE_LIBCPUID@
|
||||||
HAVE_SECCOMP = @HAVE_SECCOMP@
|
HAVE_SECCOMP = @HAVE_SECCOMP@
|
||||||
|
|
|
@ -14,6 +14,5 @@ TODO: explain
|
||||||
|
|
||||||
## TODOs
|
## TODOs
|
||||||
|
|
||||||
- Add config flag to enable tracing.
|
- Document everything.
|
||||||
- Remove tracy submodule approach, inject it through Nix.
|
- Rewrite autotools madness with somebody who actually know what they're doing.
|
||||||
-
|
|
||||||
|
|
11
configure.ac
11
configure.ac
|
@ -348,6 +348,17 @@ if test "$gc" = yes; then
|
||||||
AC_DEFINE(HAVE_BOEHMGC, 1, [Whether to use the Boehm garbage collector.])
|
AC_DEFINE(HAVE_BOEHMGC, 1, [Whether to use the Boehm garbage collector.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(tracy-profiler, AS_HELP_STRING([--enable-tracy-profiler],[Profile the Nix evaluation using the Tracy profiler (default no)]),
|
||||||
|
TRACY_PROFILER=$enableval, TRACY_PROFILER=no)
|
||||||
|
if test "$TRACY_PROFILER" != no; then
|
||||||
|
CXXFLAGS="-I $TRACY_PROFILER/include/Tracy $CXXFLAGS"
|
||||||
|
echo "TRACY ENABLED: $TRACY_PROFILER"
|
||||||
|
else
|
||||||
|
echo "TRACY DISABLED"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
AC_SUBST(TRACY_PROFILER)
|
||||||
|
|
||||||
AS_IF([test "$ENABLE_UNIT_TESTS" == "yes"],[
|
AS_IF([test "$ENABLE_UNIT_TESTS" == "yes"],[
|
||||||
|
|
||||||
# Look for gtest.
|
# Look for gtest.
|
||||||
|
|
19
flake.lock
19
flake.lock
|
@ -64,12 +64,29 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs-tracy": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1707205788,
|
||||||
|
"narHash": "sha256-dFPctGYh7cNPAuJQY9i4+1/M+LdrRDpk0RRwpClEQ4w=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "e311f423a6e56505afae9d4b621759826e7270c0",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-23.11-small",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"libgit2": "libgit2",
|
"libgit2": "libgit2",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nixpkgs-regression": "nixpkgs-regression"
|
"nixpkgs-regression": "nixpkgs-regression",
|
||||||
|
"nixpkgs-tracy": "nixpkgs-tracy"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
19
flake.nix
19
flake.nix
|
@ -2,11 +2,14 @@
|
||||||
description = "The purely functional package manager";
|
description = "The purely functional package manager";
|
||||||
|
|
||||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05-small";
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05-small";
|
||||||
|
# Tracy is in a half-broken situation on 23.05. We need the changes
|
||||||
|
# introduced by https://github.com/NixOS/nixpkgs/pull/261589.
|
||||||
|
inputs.nixpkgs-tracy.url = "github:NixOS/nixpkgs/nixos-23.11-small";
|
||||||
inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
|
inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
|
||||||
inputs.flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
|
inputs.flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
|
||||||
inputs.libgit2 = { url = "github:libgit2/libgit2"; flake = false; };
|
inputs.libgit2 = { url = "github:libgit2/libgit2"; flake = false; };
|
||||||
|
|
||||||
outputs = { self, nixpkgs, nixpkgs-regression, libgit2, ... }:
|
outputs = { self, nixpkgs, nixpkgs-regression, libgit2, nixpkgs-tracy, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
|
@ -186,6 +189,14 @@
|
||||||
stdenv
|
stdenv
|
||||||
versionSuffix
|
versionSuffix
|
||||||
;
|
;
|
||||||
|
# We have to use the nixos-23.11 tracy version. However,
|
||||||
|
# we can't link the 23.11 lib on our 23.05 nix without
|
||||||
|
# hitting some Glibc ABI incompatibilities.
|
||||||
|
#
|
||||||
|
# To go around that issue, we build the 23.11 tracy
|
||||||
|
# derivation with the 23.05 toolchain/libs.
|
||||||
|
tracy = final.callPackage (nixpkgs-tracy.legacyPackages.${final.hostPlatform.system}.path + "/pkgs/development/tools/tracy") {};
|
||||||
|
enableTracy = true;
|
||||||
officialRelease = false;
|
officialRelease = false;
|
||||||
boehmgc = final.boehmgc-nix;
|
boehmgc = final.boehmgc-nix;
|
||||||
libgit2 = final.libgit2-nix;
|
libgit2 = final.libgit2-nix;
|
||||||
|
@ -223,6 +234,10 @@
|
||||||
self.packages.${system}.nix.override { enableGC = false; }
|
self.packages.${system}.nix.override { enableGC = false; }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
buildWithTracy = forAllSystems (system:
|
||||||
|
self.packages.${system}.nix.override { enableTracy = true; }
|
||||||
|
);
|
||||||
|
|
||||||
buildNoTests = forAllSystems (system:
|
buildNoTests = forAllSystems (system:
|
||||||
self.packages.${system}.nix.override {
|
self.packages.${system}.nix.override {
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
@ -394,7 +409,7 @@
|
||||||
stdenvs)));
|
stdenvs)));
|
||||||
|
|
||||||
devShells = let
|
devShells = let
|
||||||
makeShell = pkgs: stdenv: (pkgs.nix.override { inherit stdenv; forDevShell = true; }).overrideAttrs (attrs: {
|
makeShell = pkgs: stdenv: (pkgs.nix.override { inherit stdenv; forDevShell = true; enableTracy = true; }).overrideAttrs (attrs: {
|
||||||
installFlags = "sysconfdir=$(out)/etc";
|
installFlags = "sysconfdir=$(out)/etc";
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
PATH=$prefix/bin:$PATH
|
PATH=$prefix/bin:$PATH
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
, rapidcheck
|
, rapidcheck
|
||||||
, sqlite
|
, sqlite
|
||||||
, util-linux
|
, util-linux
|
||||||
|
, tracy
|
||||||
, xz
|
, xz
|
||||||
|
|
||||||
, busybox-sandbox-shell ? null
|
, busybox-sandbox-shell ? null
|
||||||
|
@ -76,6 +77,9 @@
|
||||||
# only leaked *within* the process.)
|
# only leaked *within* the process.)
|
||||||
, enableGC ? true
|
, enableGC ? true
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
, enableTracy ? false
|
||||||
|
|
||||||
# Whether to enable Markdown rendering in the Nix binary.
|
# Whether to enable Markdown rendering in the Nix binary.
|
||||||
, enableMarkdown ? !stdenv.hostPlatform.isWindows
|
, enableMarkdown ? !stdenv.hostPlatform.isWindows
|
||||||
|
|
||||||
|
@ -234,6 +238,7 @@ in {
|
||||||
rapidcheck
|
rapidcheck
|
||||||
] ++ lib.optional stdenv.isLinux libseccomp
|
] ++ lib.optional stdenv.isLinux libseccomp
|
||||||
++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid
|
++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid
|
||||||
|
++ lib.optional enableTracy tracy
|
||||||
# There have been issues building these dependencies
|
# There have been issues building these dependencies
|
||||||
++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform && (stdenv.isLinux || stdenv.isDarwin))
|
++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform && (stdenv.isLinux || stdenv.isDarwin))
|
||||||
(aws-sdk-cpp.override {
|
(aws-sdk-cpp.override {
|
||||||
|
@ -287,6 +292,8 @@ in {
|
||||||
(lib.enableFeature enableMarkdown "markdown")
|
(lib.enableFeature enableMarkdown "markdown")
|
||||||
(lib.enableFeature installUnitTests "install-unit-tests")
|
(lib.enableFeature installUnitTests "install-unit-tests")
|
||||||
(lib.withFeatureAs true "readline-flavor" readlineFlavor)
|
(lib.withFeatureAs true "readline-flavor" readlineFlavor)
|
||||||
|
] ++ lib.optionals (enableTracy) [
|
||||||
|
"--enable-tracy-profiler=${tracy}"
|
||||||
] ++ lib.optionals (!forDevShell) [
|
] ++ lib.optionals (!forDevShell) [
|
||||||
"--sysconfdir=/etc"
|
"--sysconfdir=/etc"
|
||||||
] ++ lib.optionals installUnitTests [
|
] ++ lib.optionals installUnitTests [
|
||||||
|
|
|
@ -10,10 +10,9 @@ libexpr_SOURCES := \
|
||||||
$(wildcard $(d)/primops/*.cc) \
|
$(wildcard $(d)/primops/*.cc) \
|
||||||
$(wildcard $(d)/flake/*.cc) \
|
$(wildcard $(d)/flake/*.cc) \
|
||||||
$(d)/lexer-tab.cc \
|
$(d)/lexer-tab.cc \
|
||||||
$(d)/parser-tab.cc \
|
$(d)/parser-tab.cc
|
||||||
$(d)/tracy/public/TracyClient.cpp
|
|
||||||
|
|
||||||
libexpr_CXXFLAGS += -I src/libutil -I src/libstore -I src/libfetchers -I src/libmain -I src/libexpr -I src/libexpr/tracy/public -DTRACY_ENABLE=1
|
libexpr_CXXFLAGS += -I src/libutil -I src/libstore -I src/libfetchers -I src/libmain -I src/libexpr
|
||||||
|
|
||||||
libexpr_LIBS = libutil libstore libfetchers
|
libexpr_LIBS = libutil libstore libfetchers
|
||||||
|
|
||||||
|
@ -21,6 +20,10 @@ libexpr_LDFLAGS += -lboost_context $(THREAD_LDFLAGS)
|
||||||
ifdef HOST_LINUX
|
ifdef HOST_LINUX
|
||||||
libexpr_LDFLAGS += -ldl
|
libexpr_LDFLAGS += -ldl
|
||||||
endif
|
endif
|
||||||
|
ifneq ($(TRACY_PROFILER), no)
|
||||||
|
libexpr_LDFLAGS += -ltracy
|
||||||
|
libexpr_CXXFLAGS += -DTRACY_ENABLE=1
|
||||||
|
endif
|
||||||
|
|
||||||
# The dependency on libgc must be propagated (i.e. meaning that
|
# The dependency on libgc must be propagated (i.e. meaning that
|
||||||
# programs/libraries that use libexpr must explicitly pass -lgc),
|
# programs/libraries that use libexpr must explicitly pass -lgc),
|
||||||
|
|
Loading…
Reference in New Issue