C API: Keep the structure flat

See https://github.com/NixOS/nix/pull/10329
This commit is contained in:
José Luis Lafuente 2024-03-28 19:00:04 +01:00
parent d96b52bd8b
commit c57de60522
No known key found for this signature in database
GPG Key ID: 8A3455EBE455489A
26 changed files with 50 additions and 32 deletions

View File

@ -18,9 +18,9 @@ makefiles = \
src/libexpr/local.mk \
src/libcmd/local.mk \
src/nix/local.mk \
src/libutil/c/local.mk \
src/libstore/c/local.mk \
src/libexpr/c/local.mk \
src/libutil-c/local.mk \
src/libstore-c/local.mk \
src/libexpr-c/local.mk \
src/resolve-system-dependencies/local.mk \
scripts/local.mk \
misc/bash/local.mk \

View File

@ -36,9 +36,9 @@ GENERATE_LATEX = NO
# so they can expand variables despite configure variables.
INPUT = \
src/libutil/c \
src/libexpr/c \
src/libstore/c \
src/libutil-c \
src/libexpr-c \
src/libstore-c \
doc/external-api/README.md
FILE_PATTERNS = nix_api_*.h *.md

View File

@ -2,7 +2,7 @@ GLOBAL_CXXFLAGS += -Wno-deprecated-declarations -Werror=switch
# Allow switch-enum to be overridden for files that do not support it, usually because of dependency headers.
ERROR_SWITCH_ENUM = -Werror=switch-enum
$(foreach i, config.h $(wildcard src/lib*/*.hh) $(wildcard src/lib*/*.h $(filter-out %_internal.h, $(wildcard src/lib*/c/*.h))), \
$(foreach i, config.h $(wildcard src/lib*/*.hh) $(wildcard src/lib*/*.h $(filter-out %_internal.h, $(wildcard src/lib*c/*.h))), \
$(eval $(call install-file-in, $(i), $(includedir)/nix, 0644)))
$(GCH): src/libutil/util.hh config.h

25
src/libexpr-c/local.mk Normal file
View File

@ -0,0 +1,25 @@
libraries += libexprc
libexprc_NAME = libnixexprc
libexprc_DIR := $(d)
libexprc_SOURCES := \
$(wildcard $(d)/*.cc) \
# Not just for this library itself, but also for downstream libraries using this library
INCLUDE_libexprc := -I $(d)
libexprc_CXXFLAGS += $(INCLUDE_libutil) $(INCLUDE_libutilc) \
$(INCLUDE_libfetchers) \
$(INCLUDE_libstore) $(INCLUDE_libstorec) \
$(INCLUDE_libexpr) $(INCLUDE_libexprc)
libexprc_LIBS = libutil libutilc libstore libstorec libexpr
libexprc_LDFLAGS += -pthread
$(eval $(call install-file-in, $(d)/nix-expr-c.pc, $(libdir)/pkgconfig, 0644))
libexprc_FORCE_INSTALL := 1

View File

@ -1,19 +0,0 @@
libraries += libexprc
libexprc_NAME = libnixexprc
libexprc_DIR := $(d)
libexprc_SOURCES := \
$(wildcard $(d)/*.cc) \
libexprc_CXXFLAGS += -I src/libutil -Isrc/libfetchers -I src/libstore -I src/libstorec -I src/libexpr -I src/libutil/c -I src/libstore/c
libexprc_LIBS = libutil libutilc libstore libstorec libexpr
libexprc_LDFLAGS += -pthread
$(eval $(call install-file-in, $(d)/nix-expr-c.pc, $(libdir)/pkgconfig, 0644))
libexprc_FORCE_INSTALL := 1

View File

@ -10,7 +10,11 @@ libstorec_LIBS = libutil libstore libutilc
libstorec_LDFLAGS += -pthread
libstorec_CXXFLAGS += -I src/libutil -I src/libstore -I src/libutil/c
# Not just for this library itself, but also for downstream libraries using this library
INCLUDE_libstorec := -I $(d)
libstorec_CXXFLAGS += $(INCLUDE_libutil) $(INCLUDE_libutilc) \
$(INCLUDE_libstore) $(INCLUDE_libstorec)
$(eval $(call install-file-in, $(d)/nix-store-c.pc, $(libdir)/pkgconfig, 0644))

View File

@ -6,7 +6,10 @@ libutilc_DIR := $(d)
libutilc_SOURCES := $(wildcard $(d)/*.cc)
libutilc_CXXFLAGS += -I src/libutil
# Not just for this library itself, but also for downstream libraries using this library
INCLUDE_libutilc := -I $(d)
libutilc_CXXFLAGS += $(INCLUDE_libutil) $(INCLUDE_libutilc)
libutilc_LIBS = libutil

View File

@ -24,9 +24,12 @@ libexpr-tests_EXTRA_INCLUDES = \
-I tests/unit/libstore-support \
-I tests/unit/libutil-support \
$(INCLUDE_libexpr) \
$(INCLUDE_libexprc) \
$(INCLUDE_libfetchers) \
$(INCLUDE_libstore) \
$(INCLUDE_libutil)
$(INCLUDE_libstorec) \
$(INCLUDE_libutil) \
$(INCLUDE_libutilc)
libexpr-tests_CXXFLAGS += $(libexpr-tests_EXTRA_INCLUDES)

View File

@ -20,7 +20,9 @@ libstore-tests_EXTRA_INCLUDES = \
-I tests/unit/libstore-support \
-I tests/unit/libutil-support \
$(INCLUDE_libstore) \
$(INCLUDE_libutil)
$(INCLUDE_libstorec) \
$(INCLUDE_libutil) \
$(INCLUDE_libutilc)
libstore-tests_CXXFLAGS += $(libstore-tests_EXTRA_INCLUDES)

View File

@ -18,7 +18,8 @@ libutil-tests_SOURCES := $(wildcard $(d)/*.cc)
libutil-tests_EXTRA_INCLUDES = \
-I tests/unit/libutil-support \
$(INCLUDE_libutil)
$(INCLUDE_libutil) \
$(INCLUDE_libutilc)
libutil-tests_CXXFLAGS += $(libutil-tests_EXTRA_INCLUDES)

View File

@ -1,4 +1,3 @@
#include "config.hh"
#include "args.hh"
#include "nix_api_util.h"