diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/boost/Makefile.am | 8 | ||||
-rw-r--r-- | src/boost/format/Makefile | 7 | ||||
-rw-r--r-- | src/bsdiff-4.3/Makefile | 13 | ||||
-rw-r--r-- | src/libexpr/Makefile | 20 | ||||
-rw-r--r-- | src/libexpr/eval.cc | 23 | ||||
-rw-r--r-- | src/libexpr/primops.cc | 1 | ||||
-rw-r--r-- | src/libmain/Makefile | 11 | ||||
-rw-r--r-- | src/libmain/shared.cc | 20 | ||||
-rw-r--r-- | src/libstore/Makefile | 26 | ||||
-rw-r--r-- | src/libstore/globals.cc | 2 | ||||
-rw-r--r-- | src/libutil/Makefile | 15 | ||||
-rw-r--r-- | src/nix-daemon/Makefile | 7 | ||||
-rw-r--r-- | src/nix-env/Makefile | 7 | ||||
-rw-r--r-- | src/nix-env/user-env.cc | 2 | ||||
-rw-r--r-- | src/nix-hash/Makefile | 7 | ||||
-rw-r--r-- | src/nix-instantiate/Makefile | 7 | ||||
-rw-r--r-- | src/nix-log2xml/Makefile | 8 | ||||
-rw-r--r-- | src/nix-store/Makefile | 9 |
18 files changed, 160 insertions, 33 deletions
diff --git a/src/boost/Makefile.am b/src/boost/Makefile.am deleted file mode 100644 index 8b5aa25fb5bd..000000000000 --- a/src/boost/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -SUBDIRS = format - -nobase_pkginclude_HEADERS = assert.hpp checked_delete.hpp format.hpp \ - shared_ptr.hpp weak_ptr.hpp throw_exception.hpp \ - enable_shared_from_this.hpp \ - detail/shared_count.hpp detail/workaround.hpp - -pkgincludedir = ${includedir}/nix/boost diff --git a/src/boost/format/Makefile b/src/boost/format/Makefile new file mode 100644 index 000000000000..17897fa59074 --- /dev/null +++ b/src/boost/format/Makefile @@ -0,0 +1,7 @@ +LIBS += libformat + +libformat_NAME = libnixformat + +libformat_DIR := $(d) + +libformat_SOURCES := $(wildcard $(d)/*.cc) diff --git a/src/bsdiff-4.3/Makefile b/src/bsdiff-4.3/Makefile new file mode 100644 index 000000000000..aca1ac116205 --- /dev/null +++ b/src/bsdiff-4.3/Makefile @@ -0,0 +1,13 @@ +PROGRAMS += bsdiff bspatch + +bsdiff_DIR := $(d) +bsdiff_SOURCES := $(d)/bsdiff.c +bsdiff_LDFLAGS = -lbz2 $(bsddiff_compat_include) +bsdiff_INSTALL_DIR = $(libexecdir)/nix + +bspatch_DIR := $(d) +bspatch_SOURCES := $(d)/bspatch.c +bspatch_LDFLAGS = -lbz2 $(bsddiff_compat_include) +bspatch_INSTALL_DIR = $(libexecdir)/nix + +dist_files += $(d)/compat-include/* diff --git a/src/libexpr/Makefile b/src/libexpr/Makefile new file mode 100644 index 000000000000..de276aa65296 --- /dev/null +++ b/src/libexpr/Makefile @@ -0,0 +1,20 @@ +LIBS += libexpr + +libexpr_NAME = libnixexpr + +libexpr_DIR := $(d) + +libexpr_SOURCES := $(wildcard $(d)/*.cc) $(d)/lexer-tab.cc $(d)/parser-tab.cc + +libexpr_LIBS = libutil libstore libformat + +# The dependency on libgc must be propagated (i.e. meaning that +# programs/libraries that use libexpr must explicitly pass -lgc), +# because inline functions in libexpr's header files call libgc. +libexpr_LDFLAGS_PROPAGATED = $(BDW_GC_LIBS) + +$(d)/parser-tab.cc $(d)/parser-tab.hh: $(d)/parser.y + bison -v -o $(libexpr_DIR)/parser-tab.cc $< -d + +$(d)/lexer-tab.cc $(d)/lexer-tab.hh: $(d)/lexer.l + flex --outfile $(libexpr_DIR)/lexer-tab.cc --header-file=$(libexpr_DIR)/lexer-tab.hh $< diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 3d8ee9934016..2087c7c43ffb 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -129,7 +129,15 @@ string showType(const Value & v) } -Symbol getName(const AttrName & name, EvalState & state, Env & env) { +/* Called when the Boehm GC runs out of memory. */ +static void * oomHandler(size_t requested) +{ + /* Convert this to a proper C++ exception. */ + throw std::bad_alloc(); +} + + +static Symbol getName(const AttrName & name, EvalState & state, Env & env) { if (name.symbol.set()) { return name.symbol; } else { @@ -168,8 +176,16 @@ EvalState::EvalState() countCalls = getEnv("NIX_COUNT_CALLS", "0") != "0"; #if HAVE_BOEHMGC - static bool gcInitialised = true; - if (gcInitialised) { + static bool gcInitialised = false; + if (!gcInitialised) { + + /* Initialise the Boehm garbage collector. This isn't + necessary on most platforms, but for portability we do it + anyway. */ + GC_INIT(); + + GC_oom_fn = oomHandler; + /* Set the initial heap size to something fairly big (25% of physical RAM, up to a maximum of 384 MiB) so that in most cases we don't need to garbage collect at all. (Collection @@ -193,6 +209,7 @@ EvalState::EvalState() debug(format("setting initial heap size to %1% bytes") % size); GC_expand_hp(size); } + gcInitialised = true; } #endif diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 4f836e279425..ca316f08af13 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -1322,6 +1322,7 @@ void EvalState::createBaseEnv() /* Add a wrapper around the derivation primop that computes the `drvPath' and `outPath' attributes lazily. */ string path = findFile("nix/derivation.nix"); + assert(!path.empty()); sDerivationNix = symbols.create(path); evalFile(path, v); addConstant("derivation", v); diff --git a/src/libmain/Makefile b/src/libmain/Makefile new file mode 100644 index 000000000000..0efeee531478 --- /dev/null +++ b/src/libmain/Makefile @@ -0,0 +1,11 @@ +LIBS += libmain + +libmain_NAME = libnixmain + +libmain_DIR := $(d) + +libmain_SOURCES := $(wildcard $(d)/*.cc) + +libmain_LIBS = libstore libutil libformat + +libmain_ALLOW_UNDEFINED = 1 diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 999b5023802c..fb70cb076732 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -15,10 +15,6 @@ #include <unistd.h> #include <signal.h> -#if HAVE_BOEHMGC -#include <gc/gc.h> -#endif - namespace nix { @@ -236,14 +232,6 @@ static void initAndRun(int argc, char * * argv) } -/* Called when the Boehm GC runs out of memory. */ -static void * oomHandler(size_t requested) -{ - /* Convert this to a proper C++ exception. */ - throw std::bad_alloc(); -} - - void showManPage(const string & name) { string cmd = "man " + name; @@ -273,14 +261,6 @@ int main(int argc, char * * argv) std::ios::sync_with_stdio(false); -#if HAVE_BOEHMGC - /* Initialise the Boehm garbage collector. This isn't necessary - on most platforms, but for portability we do it anyway. */ - GC_INIT(); - - GC_oom_fn = oomHandler; -#endif - try { try { initAndRun(argc, argv); diff --git a/src/libstore/Makefile b/src/libstore/Makefile new file mode 100644 index 000000000000..dcedd4c26ab8 --- /dev/null +++ b/src/libstore/Makefile @@ -0,0 +1,26 @@ +LIBS += libstore + +libstore_NAME = libnixstore + +libstore_DIR := $(d) + +libstore_SOURCES := $(wildcard $(d)/*.cc) + +libstore_LIBS = libutil libformat + +libstore_LDFLAGS = -lsqlite3 -lbz2 + +libstore_CXXFLAGS = \ + -DNIX_STORE_DIR=\"$(storedir)\" \ + -DNIX_DATA_DIR=\"$(datadir)\" \ + -DNIX_STATE_DIR=\"$(localstatedir)/nix\" \ + -DNIX_LOG_DIR=\"$(localstatedir)/log/nix\" \ + -DNIX_CONF_DIR=\"$(sysconfdir)/nix\" \ + -DNIX_LIBEXEC_DIR=\"$(libexecdir)\" \ + -DNIX_BIN_DIR=\"$(bindir)\" \ + -DPACKAGE_VERSION=\"$(PACKAGE_VERSION)\" + +$(d)/local-store.cc: $(d)/schema.sql.hh + +%.sql.hh: %.sql + sed -e 's/"/\\"/g' -e 's/\(.*\)/"\1\\n"/' < $< > $@ || (rm $@ && exit 1) diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index 1ecc629cb55f..68add1982f43 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -212,7 +212,7 @@ Settings::SettingsMap Settings::getOverrides() } -const string nixVersion = NIX_VERSION; +const string nixVersion = PACKAGE_VERSION; } diff --git a/src/libutil/Makefile b/src/libutil/Makefile new file mode 100644 index 000000000000..83bd05f281d6 --- /dev/null +++ b/src/libutil/Makefile @@ -0,0 +1,15 @@ +LIBS += libutil + +libutil_NAME = libnixutil + +libutil_DIR := $(d) + +libutil_SOURCES := $(wildcard $(d)/*.cc) + +ifeq ($(HAVE_OPENSSL), 1) + libutil_LDFLAGS = $(OPENSSL_LIBS) +else + libutil_SOURCES += $(d)/md5.c $(d)/sha1.c $(d)/sha256.c +endif + +libutil_LIBS = libformat diff --git a/src/nix-daemon/Makefile b/src/nix-daemon/Makefile new file mode 100644 index 000000000000..f6bc9ea31c92 --- /dev/null +++ b/src/nix-daemon/Makefile @@ -0,0 +1,7 @@ +PROGRAMS += nix-daemon + +nix-daemon_DIR := $(d) + +nix-daemon_SOURCES := $(d)/nix-daemon.cc + +nix-daemon_LIBS = libmain libstore libutil libformat diff --git a/src/nix-env/Makefile b/src/nix-env/Makefile new file mode 100644 index 000000000000..5a38d2fb76af --- /dev/null +++ b/src/nix-env/Makefile @@ -0,0 +1,7 @@ +PROGRAMS += nix-env + +nix-env_DIR := $(d) + +nix-env_SOURCES := $(wildcard $(d)/*.cc) + +nix-env_LIBS = libexpr libmain libstore libutil libformat diff --git a/src/nix-env/user-env.cc b/src/nix-env/user-env.cc index c2dab4f0c757..3a73f2647a6b 100644 --- a/src/nix-env/user-env.cc +++ b/src/nix-env/user-env.cc @@ -1,5 +1,5 @@ +#include "user-env.hh" #include "util.hh" -#include "get-drvs.hh" #include "derivations.hh" #include "store-api.hh" #include "globals.hh" diff --git a/src/nix-hash/Makefile b/src/nix-hash/Makefile new file mode 100644 index 000000000000..062e4d13b29e --- /dev/null +++ b/src/nix-hash/Makefile @@ -0,0 +1,7 @@ +PROGRAMS += nix-hash + +nix-hash_DIR := $(d) + +nix-hash_SOURCES := $(d)/nix-hash.cc + +nix-hash_LIBS = libmain libstore libutil libformat diff --git a/src/nix-instantiate/Makefile b/src/nix-instantiate/Makefile new file mode 100644 index 000000000000..daa741eb7f08 --- /dev/null +++ b/src/nix-instantiate/Makefile @@ -0,0 +1,7 @@ +PROGRAMS += nix-instantiate + +nix-instantiate_DIR := $(d) + +nix-instantiate_SOURCES := $(d)/nix-instantiate.cc + +nix-instantiate_LIBS = libexpr libmain libstore libutil libformat diff --git a/src/nix-log2xml/Makefile b/src/nix-log2xml/Makefile new file mode 100644 index 000000000000..8467d1973bda --- /dev/null +++ b/src/nix-log2xml/Makefile @@ -0,0 +1,8 @@ +PROGRAMS += nix-log2xml + +nix-log2xml_DIR := $(d) + +nix-log2xml_SOURCES := $(d)/log2xml.cc + +$(foreach file, mark-errors.xsl log2html.xsl treebits.js, \ + $(eval $(call install-data-in, $(d)/$(file), $(datadir)/nix/log2html))) diff --git a/src/nix-store/Makefile b/src/nix-store/Makefile new file mode 100644 index 000000000000..edd111b42015 --- /dev/null +++ b/src/nix-store/Makefile @@ -0,0 +1,9 @@ +PROGRAMS += nix-store + +nix-store_DIR := $(d) + +nix-store_SOURCES := $(wildcard $(d)/*.cc) + +nix-store_LIBS = libmain libstore libutil libformat + +nix-store_LDFLAGS = -lbz2 |