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
|
|
|
|
2020-10-11 19:39:08 +03:00
|
|
|
libstore_SOURCES := $(wildcard $(d)/*.cc $(d)/builtins/*.cc $(d)/build/*.cc)
|
2024-03-27 18:01:07 +02:00
|
|
|
ifdef HOST_UNIX
|
|
|
|
libstore_SOURCES += $(wildcard $(d)/unix/*.cc)
|
|
|
|
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 18:34:09 +03:00
|
|
|
ifdef HOST_WINDOWS
|
|
|
|
INCLUDE_libstore += -I $(d)/windows
|
|
|
|
endif
|
2023-09-03 00:10:28 +03:00
|
|
|
|
2020-03-30 15:29:29 +03:00
|
|
|
libstore_CXXFLAGS += \
|
2023-09-03 00:10:28 +03:00
|
|
|
$(INCLUDE_libutil) $(INCLUDE_libstore) $(INCLUDE_libstore) \
|
2015-04-16 19:46:17 +03:00
|
|
|
-DNIX_PREFIX=\"$(prefix)\" \
|
2013-11-22 16:54:18 +02:00
|
|
|
-DNIX_STORE_DIR=\"$(storedir)\" \
|
|
|
|
-DNIX_DATA_DIR=\"$(datadir)\" \
|
|
|
|
-DNIX_STATE_DIR=\"$(localstatedir)/nix\" \
|
|
|
|
-DNIX_LOG_DIR=\"$(localstatedir)/log/nix\" \
|
|
|
|
-DNIX_CONF_DIR=\"$(sysconfdir)/nix\" \
|
2014-08-04 19:00:00 +03:00
|
|
|
-DNIX_BIN_DIR=\"$(bindir)\" \
|
2018-02-15 00:05:55 +02:00
|
|
|
-DNIX_MAN_DIR=\"$(mandir)\" \
|
2017-04-20 20:11:45 +03:00
|
|
|
-DLSOF=\"$(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__\"
|
|
|
|
|
|
|
|
$(d)/build/local-derivation-goal.cc: $(d)/embedded-sandbox-shell.gen.hh
|
|
|
|
|
|
|
|
$(d)/embedded-sandbox-shell.gen.hh: $(sandbox_shell)
|
|
|
|
$(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
|
|
|
|
2020-10-20 16:14:02 +03:00
|
|
|
$(d)/local-store.cc: $(d)/schema.sql.gen.hh $(d)/ca-specific-schema.sql.gen.hh
|
2014-01-09 23:10:35 +02:00
|
|
|
|
2017-10-18 02:15:51 +03:00
|
|
|
$(d)/build.cc:
|
2014-02-01 15:28:31 +02:00
|
|
|
|
2020-10-20 16:14:02 +03:00
|
|
|
clean-files += $(d)/schema.sql.gen.hh $(d)/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)))
|