diff --git a/Makefile b/Makefile index f80b8bb82..68ec3ab0c 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ makefiles = \ src/libfetchers/local.mk \ src/libmain/local.mk \ src/libexpr/local.mk \ + src/libcmd/local.mk \ src/nix/local.mk \ src/resolve-system-dependencies/local.mk \ scripts/local.mk \ diff --git a/src/build-remote/build-remote.cc b/src/build-remote/build-remote.cc index 17a0a8373..5b8ab3387 100644 --- a/src/build-remote/build-remote.cc +++ b/src/build-remote/build-remote.cc @@ -17,7 +17,7 @@ #include "store-api.hh" #include "derivations.hh" #include "local-store.hh" -#include "../nix/legacy.hh" +#include "legacy.hh" using namespace nix; using std::cin; diff --git a/src/nix/command.cc b/src/libcmd/command.cc similarity index 100% rename from src/nix/command.cc rename to src/libcmd/command.cc diff --git a/src/nix/command.hh b/src/libcmd/command.hh similarity index 100% rename from src/nix/command.hh rename to src/libcmd/command.hh diff --git a/src/nix/installables.cc b/src/libcmd/installables.cc similarity index 100% rename from src/nix/installables.cc rename to src/libcmd/installables.cc diff --git a/src/nix/installables.hh b/src/libcmd/installables.hh similarity index 100% rename from src/nix/installables.hh rename to src/libcmd/installables.hh diff --git a/src/nix/legacy.cc b/src/libcmd/legacy.cc similarity index 100% rename from src/nix/legacy.cc rename to src/libcmd/legacy.cc diff --git a/src/nix/legacy.hh b/src/libcmd/legacy.hh similarity index 100% rename from src/nix/legacy.hh rename to src/libcmd/legacy.hh diff --git a/src/libcmd/local.mk b/src/libcmd/local.mk new file mode 100644 index 000000000..ab0e0e43d --- /dev/null +++ b/src/libcmd/local.mk @@ -0,0 +1,15 @@ +libraries += libcmd + +libcmd_NAME = libnixcmd + +libcmd_DIR := $(d) + +libcmd_SOURCES := $(wildcard $(d)/*.cc) + +libcmd_CXXFLAGS += -I src/libutil -I src/libstore -I src/libexpr -I src/libmain -I src/libfetchers + +libcmd_LDFLAGS = -llowdown + +libcmd_LIBS = libstore libutil libexpr libmain libfetchers + +$(eval $(call install-file-in, $(d)/nix-cmd.pc, $(prefix)/lib/pkgconfig, 0644)) diff --git a/src/nix/markdown.cc b/src/libcmd/markdown.cc similarity index 100% rename from src/nix/markdown.cc rename to src/libcmd/markdown.cc diff --git a/src/nix/markdown.hh b/src/libcmd/markdown.hh similarity index 100% rename from src/nix/markdown.hh rename to src/libcmd/markdown.hh diff --git a/src/libcmd/nix-cmd.pc.in b/src/libcmd/nix-cmd.pc.in new file mode 100644 index 000000000..1761a9f41 --- /dev/null +++ b/src/libcmd/nix-cmd.pc.in @@ -0,0 +1,9 @@ +prefix=@prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Nix +Description: Nix Package Manager +Version: @PACKAGE_VERSION@ +Libs: -L${libdir} -lnixcmd +Cflags: -I${includedir}/nix -std=c++17 diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc index d1c14596c..361f9730d 100755 --- a/src/nix-build/nix-build.cc +++ b/src/nix-build/nix-build.cc @@ -17,7 +17,7 @@ #include "get-drvs.hh" #include "common-eval-args.hh" #include "attr-path.hh" -#include "../nix/legacy.hh" +#include "legacy.hh" using namespace nix; using namespace std::string_literals; diff --git a/src/nix-channel/nix-channel.cc b/src/nix-channel/nix-channel.cc index 309970df6..57189d557 100755 --- a/src/nix-channel/nix-channel.cc +++ b/src/nix-channel/nix-channel.cc @@ -2,7 +2,7 @@ #include "globals.hh" #include "filetransfer.hh" #include "store-api.hh" -#include "../nix/legacy.hh" +#include "legacy.hh" #include "fetchers.hh" #include diff --git a/src/nix-collect-garbage/nix-collect-garbage.cc b/src/nix-collect-garbage/nix-collect-garbage.cc index 57092b887..c1769790a 100644 --- a/src/nix-collect-garbage/nix-collect-garbage.cc +++ b/src/nix-collect-garbage/nix-collect-garbage.cc @@ -2,7 +2,7 @@ #include "profiles.hh" #include "shared.hh" #include "globals.hh" -#include "../nix/legacy.hh" +#include "legacy.hh" #include #include diff --git a/src/nix-copy-closure/nix-copy-closure.cc b/src/nix-copy-closure/nix-copy-closure.cc index 10990f7b5..ad2e06067 100755 --- a/src/nix-copy-closure/nix-copy-closure.cc +++ b/src/nix-copy-closure/nix-copy-closure.cc @@ -1,6 +1,6 @@ #include "shared.hh" #include "store-api.hh" -#include "../nix/legacy.hh" +#include "legacy.hh" using namespace nix; diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index d6a16999f..106a78fc4 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -14,7 +14,7 @@ #include "json.hh" #include "value-to-json.hh" #include "xml-writer.hh" -#include "../nix/legacy.hh" +#include "legacy.hh" #include #include diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc index 3956fef6d..ea2e85eb0 100644 --- a/src/nix-instantiate/nix-instantiate.cc +++ b/src/nix-instantiate/nix-instantiate.cc @@ -10,7 +10,7 @@ #include "store-api.hh" #include "local-fs-store.hh" #include "common-eval-args.hh" -#include "../nix/legacy.hh" +#include "legacy.hh" #include #include diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index b7eda5ba6..37191b9e6 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -9,7 +9,7 @@ #include "util.hh" #include "worker-protocol.hh" #include "graphml.hh" -#include "../nix/legacy.hh" +#include "legacy.hh" #include #include diff --git a/src/nix/daemon.cc b/src/nix/daemon.cc index a358cb0d9..26006167d 100644 --- a/src/nix/daemon.cc +++ b/src/nix/daemon.cc @@ -8,7 +8,7 @@ #include "globals.hh" #include "derivations.hh" #include "finally.hh" -#include "../nix/legacy.hh" +#include "legacy.hh" #include "daemon.hh" #include diff --git a/src/nix/local.mk b/src/nix/local.mk index 23c08fc86..83b6dd08b 100644 --- a/src/nix/local.mk +++ b/src/nix/local.mk @@ -14,9 +14,9 @@ nix_SOURCES := \ $(wildcard src/nix-instantiate/*.cc) \ $(wildcard src/nix-store/*.cc) \ -nix_CXXFLAGS += -I src/libutil -I src/libstore -I src/libfetchers -I src/libexpr -I src/libmain +nix_CXXFLAGS += -I src/libutil -I src/libstore -I src/libfetchers -I src/libexpr -I src/libmain -I src/libcmd -nix_LIBS = libexpr libmain libfetchers libstore libutil +nix_LIBS = libexpr libmain libfetchers libstore libutil libcmd nix_LDFLAGS = -pthread $(SODIUM_LIBS) $(EDITLINE_LIBS) $(BOOST_LDFLAGS) -llowdown