Merge remote-tracking branch 'origin/master' into flakes

This commit is contained in:
Eelco Dolstra 2019-11-07 11:44:02 +01:00
commit f730841db4
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
15 changed files with 153 additions and 25 deletions

View file

@ -15,8 +15,16 @@ makefiles = \
tests/local.mk \ tests/local.mk \
tests/plugins/local.mk tests/plugins/local.mk
GLOBAL_CXXFLAGS += -g -Wall -include config.h
-include Makefile.config -include Makefile.config
OPTIMIZE = 1
ifeq ($(OPTIMIZE), 1)
GLOBAL_CXXFLAGS += -O3
else
GLOBAL_CXXFLAGS += -O0
endif
include mk/lib.mk include mk/lib.mk
GLOBAL_CXXFLAGS += -g -Wall -include config.h -std=c++17

View file

@ -50,14 +50,11 @@ AC_DEFINE_UNQUOTED(SYSTEM, ["$system"], [platform identifier ('cpu-os')])
test "$localstatedir" = '${prefix}/var' && localstatedir=/nix/var test "$localstatedir" = '${prefix}/var' && localstatedir=/nix/var
# Set default flags for nix (as per AC_PROG_CC/CXX docs), CFLAGS=
# while still allowing the user to override them from the command line. CXXFLAGS=
: ${CFLAGS="-O3"}
: ${CXXFLAGS="-O3"}
AC_PROG_CC AC_PROG_CC
AC_PROG_CXX AC_PROG_CXX
AC_PROG_CPP AC_PROG_CPP
AX_CXX_COMPILE_STDCXX_17([noext], [mandatory])
AC_CHECK_TOOL([AR], [ar]) AC_CHECK_TOOL([AR], [ar])

View file

@ -386,7 +386,6 @@
pkgs = nixpkgsFor.x86_64-linux; pkgs = nixpkgsFor.x86_64-linux;
officialRelease = false; officialRelease = false;
}; };
*/
# Check whether we can still evaluate NixOS. # Check whether we can still evaluate NixOS.
tests.evalNixOS = tests.evalNixOS =
@ -400,6 +399,7 @@
touch $out touch $out
''; '';
*/
# Aggregate job containing the release-critical jobs. # Aggregate job containing the release-critical jobs.
release = release =
@ -421,7 +421,7 @@
tests.nix-copy-closure tests.nix-copy-closure
tests.binaryTarball tests.binaryTarball
#tests.evalNixpkgs #tests.evalNixpkgs
tests.evalNixOS #tests.evalNixOS
installerScript installerScript
]; ];
}; };

View file

@ -89,6 +89,7 @@ include mk/jars.mk
include mk/patterns.mk include mk/patterns.mk
include mk/templates.mk include mk/templates.mk
include mk/tests.mk include mk/tests.mk
include mk/precompiled-headers.mk
# Include all sub-Makefiles. # Include all sub-Makefiles.

View file

@ -1,10 +1,10 @@
$(buildprefix)%.o: %.cc $(buildprefix)%.o: %.cc
@mkdir -p "$(dir $@)" @mkdir -p "$(dir $@)"
$(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS) $(GLOBAL_CXXFLAGS_PCH) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(call filename-to-dep, $@) -MP $(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS_PCH) $(GLOBAL_CXXFLAGS) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(call filename-to-dep, $@) -MP
$(buildprefix)%.o: %.cpp $(buildprefix)%.o: %.cpp
@mkdir -p "$(dir $@)" @mkdir -p "$(dir $@)"
$(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS) $(GLOBAL_CXXFLAGS_PCH) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(call filename-to-dep, $@) -MP $(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS_PCH) $(GLOBAL_CXXFLAGS) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(call filename-to-dep, $@) -MP
$(buildprefix)%.o: %.c $(buildprefix)%.o: %.c
@mkdir -p "$(dir $@)" @mkdir -p "$(dir $@)"

42
mk/precompiled-headers.mk Normal file
View file

@ -0,0 +1,42 @@
PRECOMPILE_HEADERS ?= 1
print-var-help += \
echo " PRECOMPILE_HEADERS ($(PRECOMPILE_HEADERS)): Whether to use precompiled headers to speed up the build";
GCH = $(buildprefix)precompiled-headers.h.gch
$(GCH): precompiled-headers.h
@rm -f $@
@mkdir -p "$(dir $@)"
$(trace-gen) $(CXX) -x c++-header -o $@ $^ $(GLOBAL_CXXFLAGS)
PCH = $(buildprefix)precompiled-headers.h.pch
$(PCH): precompiled-headers.h
@rm -f $@
@mkdir -p "$(dir $@)"
$(trace-gen) $(CXX) -x c++-header -o $@ $^ $(GLOBAL_CXXFLAGS)
clean-files += $(GCH) $(PCH)
ifeq ($(PRECOMPILE_HEADERS), 1)
ifeq ($(CXX), g++)
GLOBAL_CXXFLAGS_PCH += -include $(buildprefix)precompiled-headers.h -Winvalid-pch
GLOBAL_ORDER_AFTER += $(GCH)
else ifeq ($(CXX), clang++)
GLOBAL_CXXFLAGS_PCH += -include-pch $(PCH) -Winvalid-pch
GLOBAL_ORDER_AFTER += $(PCH)
else
$(error Don't know how to precompile headers on $(CXX))
endif
endif

View file

@ -4,4 +4,11 @@ GLOBAL_CXXFLAGS += -g -Wall
-include Makefile.config -include Makefile.config
OPTIMIZE = 1
ifeq ($(OPTIMIZE), 1)
GLOBAL_CFLAGS += -O3
GLOBAL_CXXFLAGS += -O3
endif
include mk/lib.mk include mk/lib.mk

View file

@ -2,10 +2,8 @@ AC_INIT(nix-perl, m4_esyscmd([bash -c "echo -n $(cat ../.version)$VERSION_SUFFIX
AC_CONFIG_SRCDIR(MANIFEST) AC_CONFIG_SRCDIR(MANIFEST)
AC_CONFIG_AUX_DIR(../config) AC_CONFIG_AUX_DIR(../config)
# Set default flags for nix (as per AC_PROG_CC/CXX docs), CFLAGS=
# while still allowing the user to override them from the command line. CXXFLAGS=
: ${CFLAGS="-O3"}
: ${CXXFLAGS="-O3"}
AC_PROG_CC AC_PROG_CC
AC_PROG_CXX AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11 AX_CXX_COMPILE_STDCXX_11

71
precompiled-headers.h Normal file
View file

@ -0,0 +1,71 @@
#include <algorithm>
#include <array>
#include <atomic>
#include <cassert>
#include <cctype>
#include <chrono>
#include <climits>
#include <cmath>
#include <condition_variable>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <exception>
#include <functional>
#include <future>
#include <iostream>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <mutex>
#include <numeric>
#include <optional>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <string>
#include <thread>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <boost/format.hpp>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <grp.h>
#include <net/if.h>
#include <netdb.h>
#include <netinet/ip.h>
#include <pwd.h>
#include <sched.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/param.h>
#include <sys/personality.h>
#include <sys/resource.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#include <termios.h>
#include <unistd.h>
#include "util.hh"
#include "args.hh"

View file

@ -24,8 +24,8 @@
#include <chrono> #include <chrono>
#include <regex> #include <regex>
#include <queue> #include <queue>
#include <climits>
#include <limits.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/types.h> #include <sys/types.h>

View file

@ -34,6 +34,10 @@ DownloadSettings downloadSettings;
static GlobalConfig::Register r1(&downloadSettings); static GlobalConfig::Register r1(&downloadSettings);
CachedDownloadRequest::CachedDownloadRequest(const std::string & uri)
: uri(uri), ttl(settings.tarballTtl)
{ }
std::string resolveUri(const std::string & uri) std::string resolveUri(const std::string & uri)
{ {
if (uri.compare(0, 8, "channel:") == 0) if (uri.compare(0, 8, "channel:") == 0)

View file

@ -2,7 +2,7 @@
#include "types.hh" #include "types.hh"
#include "hash.hh" #include "hash.hh"
#include "globals.hh" #include "config.hh"
#include <string> #include <string>
#include <future> #include <future>
@ -71,12 +71,12 @@ struct CachedDownloadRequest
bool unpack = false; bool unpack = false;
std::string name; std::string name;
Hash expectedHash; Hash expectedHash;
unsigned int ttl = settings.tarballTtl; unsigned int ttl;
bool gcRoot = false; bool gcRoot = false;
bool getLastModified = false; bool getLastModified = false;
CachedDownloadRequest(const std::string & uri) CachedDownloadRequest(const std::string & uri);
: uri(uri) { } CachedDownloadRequest() = delete;
}; };
struct CachedDownloadResult struct CachedDownloadResult

View file

@ -10,6 +10,7 @@
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <climits>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <thread> #include <thread>
@ -17,7 +18,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <grp.h> #include <grp.h>
#include <limits.h>
#include <pwd.h> #include <pwd.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/types.h> #include <sys/types.h>

View file

@ -1,10 +1,10 @@
#include <assert.h> #include <cassert>
#include "xml-writer.hh" #include "xml-writer.hh"
namespace nix { namespace nix {
XMLWriter::XMLWriter(bool indent, std::ostream & output) XMLWriter::XMLWriter(bool indent, std::ostream & output)
: output(output), indent(indent) : output(output), indent(indent)

View file

@ -10,8 +10,9 @@
#include "daemon.hh" #include "daemon.hh"
#include <algorithm> #include <algorithm>
#include <climits>
#include <cstring> #include <cstring>
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
#include <sys/types.h> #include <sys/types.h>
@ -23,7 +24,6 @@
#include <pwd.h> #include <pwd.h>
#include <grp.h> #include <grp.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h>
#if __APPLE__ || __FreeBSD__ #if __APPLE__ || __FreeBSD__
#include <sys/ucred.h> #include <sys/ucred.h>