C API: move to src/lib*/c/

This commit is contained in:
Yorick van Pelt 2023-08-07 17:16:58 +02:00 committed by José Luis Lafuente
parent df9401eb4e
commit e642bbc2a7
No known key found for this signature in database
GPG key ID: 8A3455EBE455489A
22 changed files with 78 additions and 5 deletions

View file

@ -18,6 +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/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 \
src/libexpr \
src/libstore
src/libutil/c \
src/libexpr/c \
src/libstore/c
FILE_PATTERNS = nix_api_*.h

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), \
$(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

19
src/libexpr/c/local.mk Normal file
View file

@ -0,0 +1,19 @@
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 libstorec libexpr
libexprc_LDFLAGS += -pthread
$(eval $(call install-file-in, $(d)/nix-expr-c.pc, $(libdir)/pkgconfig, 0644))
libexprc_FORCE_INSTALL := 1

View file

@ -0,0 +1,10 @@
prefix=@prefix@
libdir=@libdir@
includedir=@includedir@
Name: Nix
Description: Nix Package Manager - C API
Version: @PACKAGE_VERSION@
Requires: nix-store-c
Libs: -L${libdir} -lnixexprc
Cflags: -I${includedir}/nix

17
src/libstore/c/local.mk Normal file
View file

@ -0,0 +1,17 @@
libraries += libstorec
libstorec_NAME = libnixstorec
libstorec_DIR := $(d)
libstorec_SOURCES := $(wildcard $(d)/*.cc)
libstorec_LIBS = libutil libstore libutilc
libstorec_LDFLAGS += -pthread
libstorec_CXXFLAGS += -I src/libutil -I src/libstore -I src/libutil/c
$(eval $(call install-file-in, $(d)/nix-store-c.pc, $(libdir)/pkgconfig, 0644))
libstorec_FORCE_INSTALL := 1

View file

@ -0,0 +1,9 @@
prefix=@prefix@
libdir=@libdir@
includedir=@includedir@
Name: Nix
Description: Nix Package Manager - C API
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lnixstorec -lnixutilc
Cflags: -I${includedir}/nix

15
src/libutil/c/local.mk Normal file
View file

@ -0,0 +1,15 @@
libraries += libutilc
libutilc_NAME = libnixutilc
libutilc_DIR := $(d)
libutilc_SOURCES := $(wildcard $(d)/*.cc)
libutilc_CXXFLAGS += -I src/libutil
libutilc_LIBS = libutil
libutilc_LDFLAGS += -pthread
libutilc_FORCE_INSTALL := 1

View file

@ -22,7 +22,7 @@ libutil-tests_EXTRA_INCLUDES = \
libutil-tests_CXXFLAGS += $(libutil-tests_EXTRA_INCLUDES)
libutil-tests_LIBS = libutil-test-support libutil
libutil-tests_LIBS = libutil-test-support libutil libutilc
libutil-tests_LDFLAGS := -lrapidcheck $(GTEST_LIBS)