2014-02-01 13:23:14 +02:00
|
|
|
libraries += libstore
|
2013-11-22 16:54:18 +02:00
|
|
|
|
2013-11-24 01:53:41 +02:00
|
|
|
libstore_NAME = libnixstore
|
|
|
|
|
2013-11-22 18:45:52 +02:00
|
|
|
libstore_DIR := $(d)
|
2013-11-22 16:54:18 +02:00
|
|
|
|
2023-09-03 00:35:16 +03:00
|
|
|
libstore_SOURCES := $(wildcard $(d)/*.cc $(d)/builtins/*.cc)
|
2024-03-27 18:01:07 +02:00
|
|
|
ifdef HOST_UNIX
|
2023-09-03 00:35:16 +03:00
|
|
|
libstore_SOURCES += $(wildcard $(d)/unix/*.cc $(d)/unix/builtins/*.cc $(d)/unix/build/*.cc)
|
|
|
|
endif
|
2024-04-17 23:20:56 +03:00
|
|
|
ifdef HOST_LINUX
|
|
|
|
libstore_SOURCES += $(wildcard $(d)/linux/*.cc)
|
|
|
|
endif
|
2023-09-03 00:35:16 +03:00
|
|
|
ifdef HOST_WINDOWS
|
|
|
|
libstore_SOURCES += $(wildcard $(d)/windows/*.cc)
|
2024-03-27 18:01:07 +02:00
|
|
|
endif
|
2013-11-22 16:54:18 +02:00
|
|
|
|
2020-06-16 15:16:39 +03:00
|
|
|
libstore_LIBS = libutil
|
2013-11-23 22:11:02 +02:00
|
|
|
|
2024-01-09 19:29:37 +02:00
|
|
|
libstore_LDFLAGS += $(SQLITE3_LIBS) $(LIBCURL_LIBS) $(THREAD_LDFLAGS)
|
Apply OS checks to host platform, not build
Previously, the build system used uname(1) output when it wanted to
check the operating system it was being built for, which meant that it
didn't take into-account cross-compilation when the build and host
operating systems were different.
To fix this, instead of consulting uname output, we consult the host
triple, specifically the third "kernel" part.
For "kernel"s with stable ABIs, like Linux or Cygwin, we can use a
simple ifeq to test whether we're compiling for that system, but for
other platforms, like Darwin, FreeBSD, or Solaris, we have to use a
more complicated check to take into account the version numbers at the
end of the "kernel"s. I couldn't find a way to just strip these
version numbers in GNU Make without shelling out, which would be even
more ugly IMO. Because these checks differ between kernels, and the
patsubst ones are quite fiddly, I've added variables for each host OS
we might want to check to make them easier to reuse.
2021-06-01 10:58:21 +03:00
|
|
|
ifdef HOST_LINUX
|
2023-09-03 00:10:28 +03:00
|
|
|
libstore_LDFLAGS += -ldl
|
2018-02-08 18:26:18 +02:00
|
|
|
endif
|
2016-05-04 18:16:48 +03:00
|
|
|
|
2017-10-18 02:15:51 +03:00
|
|
|
$(foreach file,$(libstore_FILES),$(eval $(call install-data-in,$(d)/$(file),$(datadir)/nix/sandbox)))
|
|
|
|
|
2016-05-04 18:16:48 +03:00
|
|
|
ifeq ($(ENABLE_S3), 1)
|
2024-01-11 03:26:02 +02:00
|
|
|
libstore_LDFLAGS += -laws-cpp-sdk-transfer -laws-cpp-sdk-s3 -laws-cpp-sdk-core -laws-crt-cpp
|
2016-05-04 18:16:48 +03:00
|
|
|
endif
|
2013-11-22 16:54:18 +02:00
|
|
|
|
Apply OS checks to host platform, not build
Previously, the build system used uname(1) output when it wanted to
check the operating system it was being built for, which meant that it
didn't take into-account cross-compilation when the build and host
operating systems were different.
To fix this, instead of consulting uname output, we consult the host
triple, specifically the third "kernel" part.
For "kernel"s with stable ABIs, like Linux or Cygwin, we can use a
simple ifeq to test whether we're compiling for that system, but for
other platforms, like Darwin, FreeBSD, or Solaris, we have to use a
more complicated check to take into account the version numbers at the
end of the "kernel"s. I couldn't find a way to just strip these
version numbers in GNU Make without shelling out, which would be even
more ugly IMO. Because these checks differ between kernels, and the
patsubst ones are quite fiddly, I've added variables for each host OS
we might want to check to make them easier to reuse.
2021-06-01 10:58:21 +03:00
|
|
|
ifdef HOST_SOLARIS
|
2024-01-11 03:26:02 +02:00
|
|
|
libstore_LDFLAGS += -lsocket
|
2014-04-03 17:59:25 +03:00
|
|
|
endif
|
|
|
|
|
2018-02-18 09:35:01 +02:00
|
|
|
ifeq ($(HAVE_SECCOMP), 1)
|
2024-01-11 03:26:02 +02:00
|
|
|
libstore_LDFLAGS += $(LIBSECCOMP_LIBS)
|
2017-05-29 12:34:24 +03:00
|
|
|
endif
|
|
|
|
|
2023-09-03 00:10:28 +03:00
|
|
|
# Not just for this library itself, but also for downstream libraries using this library
|
|
|
|
|
|
|
|
INCLUDE_libstore := -I $(d) -I $(d)/build
|
2024-03-27 18:01:07 +02:00
|
|
|
ifdef HOST_UNIX
|
|
|
|
INCLUDE_libstore += -I $(d)/unix
|
|
|
|
endif
|
2024-04-17 23:20:56 +03:00
|
|
|
ifdef HOST_LINUX
|
|
|
|
INCLUDE_libstore += -I $(d)/linux
|
|
|
|
endif
|
2024-04-17 18:34:09 +03:00
|
|
|
ifdef HOST_WINDOWS
|
|
|
|
INCLUDE_libstore += -I $(d)/windows
|
|
|
|
endif
|
2023-09-03 00:10:28 +03:00
|
|
|
|
2024-01-13 22:47:08 +02:00
|
|
|
ifdef HOST_WINDOWS
|
|
|
|
NIX_ROOT = N:\\\\
|
|
|
|
else
|
|
|
|
NIX_ROOT =
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Prefix all but `NIX_STORE_DIR`, since we aren't doing a local store
|
|
|
|
# yet so a "logical" store dir that is the same as unix is prefered.
|
|
|
|
#
|
|
|
|
# Also, it keeps the unit tests working.
|
|
|
|
|
2020-03-30 15:29:29 +03:00
|
|
|
libstore_CXXFLAGS += \
|
2023-09-03 00:10:28 +03:00
|
|
|
$(INCLUDE_libutil) $(INCLUDE_libstore) $(INCLUDE_libstore) \
|
2024-01-13 22:47:08 +02:00
|
|
|
-DNIX_PREFIX=\"$(NIX_ROOT)$(prefix)\" \
|
2013-11-22 16:54:18 +02:00
|
|
|
-DNIX_STORE_DIR=\"$(storedir)\" \
|
2024-01-13 22:47:08 +02:00
|
|
|
-DNIX_DATA_DIR=\"$(NIX_ROOT)$(datadir)\" \
|
|
|
|
-DNIX_STATE_DIR=\"$(NIX_ROOT)$(localstatedir)/nix\" \
|
|
|
|
-DNIX_LOG_DIR=\"$(NIX_ROOT)$(localstatedir)/log/nix\" \
|
|
|
|
-DNIX_CONF_DIR=\"$(NIX_ROOT)$(sysconfdir)/nix\" \
|
|
|
|
-DNIX_BIN_DIR=\"$(NIX_ROOT)$(bindir)\" \
|
|
|
|
-DNIX_MAN_DIR=\"$(NIX_ROOT)$(mandir)\" \
|
|
|
|
-DLSOF=\"$(NIX_ROOT)$(lsof)\"
|
2014-01-09 23:10:35 +02:00
|
|
|
|
2022-06-22 19:21:37 +03:00
|
|
|
ifeq ($(embedded_sandbox_shell),yes)
|
|
|
|
libstore_CXXFLAGS += -DSANDBOX_SHELL=\"__embedded_sandbox_shell__\"
|
|
|
|
|
2023-09-03 00:35:16 +03:00
|
|
|
$(d)/unix/build/local-derivation-goal.cc: $(d)/unix/embedded-sandbox-shell.gen.hh
|
2022-06-22 19:21:37 +03:00
|
|
|
|
2023-09-03 00:35:16 +03:00
|
|
|
$(d)/unix/embedded-sandbox-shell.gen.hh: $(sandbox_shell)
|
2022-06-22 19:21:37 +03:00
|
|
|
$(trace-gen) hexdump -v -e '1/1 "0x%x," "\n"' < $< > $@.tmp
|
|
|
|
@mv $@.tmp $@
|
|
|
|
else
|
2024-01-11 03:26:02 +02:00
|
|
|
ifneq ($(sandbox_shell),)
|
|
|
|
libstore_CXXFLAGS += -DSANDBOX_SHELL="\"$(sandbox_shell)\""
|
|
|
|
endif
|
2022-06-22 19:21:37 +03:00
|
|
|
endif
|
2019-10-09 06:12:31 +03:00
|
|
|
|
2023-09-03 00:35:16 +03:00
|
|
|
$(d)/unix/local-store.cc: $(d)/unix/schema.sql.gen.hh $(d)/unix/ca-specific-schema.sql.gen.hh
|
2014-01-09 23:10:35 +02:00
|
|
|
|
2023-09-03 00:35:16 +03:00
|
|
|
$(d)/unix/build.cc:
|
2014-02-01 15:28:31 +02:00
|
|
|
|
2023-09-03 00:35:16 +03:00
|
|
|
clean-files += $(d)/unix/schema.sql.gen.hh $(d)/unix/ca-specific-schema.sql.gen.hh
|
2014-09-18 13:00:40 +03:00
|
|
|
|
2023-11-25 07:33:21 +02:00
|
|
|
$(eval $(call install-file-in, $(buildprefix)$(d)/nix-store.pc, $(libdir)/pkgconfig, 0644))
|
2020-02-03 19:04:09 +02:00
|
|
|
|
|
|
|
$(foreach i, $(wildcard src/libstore/builtins/*.hh), \
|
|
|
|
$(eval $(call install-file-in, $(i), $(includedir)/nix/builtins, 0644)))
|
2020-10-12 20:07:51 +03:00
|
|
|
|
|
|
|
$(foreach i, $(wildcard src/libstore/build/*.hh), \
|
|
|
|
$(eval $(call install-file-in, $(i), $(includedir)/nix/build, 0644)))
|