]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
kresc WIP: mainly client.mk fixes kresc
authorVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 24 Jul 2017 17:39:30 +0000 (19:39 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 24 Jul 2017 17:43:12 +0000 (19:43 +0200)
Note: I chose to install into sbin/kresc, just as with the C implementation.

Makefile
client/client.mk
client/kresc.lua.in
lib/kresc.c
lib/lib.mk

index 37a291801cd72d22f241f220d4532e54911763a6..c2ce95ef40590c919c45d0b2caa21061918c12b6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,9 +10,6 @@ clean: contrib-clean lib-clean daemon-clean client-clean modules-clean \
 doc: doc-html
 .PHONY: all install check clean doc info
 
-#FIXME: implement these
-.PHONY: client client-install client-clean
-
 # Options
 ifdef COVERAGE
 BUILD_CFLAGS += --coverage
@@ -50,7 +47,7 @@ ifeq ($(libknot_SONAME),)
   $(error "Unable to resolve libknot_SONAME, update find_soname in platform.mk")
 endif
 ifeq ($(libzscanner_SONAME),)
-  $(error "Unable to resolve libzscanner_SONAME, update find_some in platform.mk")
+  $(error "Unable to resolve libzscanner_SONAME, update find_soname in platform.mk")
 endif
 
 # Find Go version and platform
index c74dbd896f367654a08e52b2a2c9b01cb38a2c6a..c97aeed996aa46b4f18b6a6091f487dac3cb4190 100644 (file)
@@ -1,11 +1,18 @@
-client_SOURCES := kresc.lua
 
-client:
-       # Install luarocks modules because I do not know how to do it properly
-       luarocks install ljlinenoise --local;
+client: client/kresc
+       @# Install luarocks modules because I do not know how to do it properly
+       @# TODO: try to detect this somehow
+       @echo "make sure ljlinenoise is installed, e.g. via:"
+       @echo "$ luarocks install ljlinenoise --local"
 
-client/kresc.lua: client/kresc.lua.in
+client/kresc: client/kresc.lua.in
        @$(call quiet,SED,$<) -e "s/@libkres_SONAME@/$(libkres_SONAME)/" $< > $@
-       
+
+client-install: client
+       $(INSTALL) -D client/kresc $(DESTDIR)$(SBINDIR)
+
 client-clean:
-       @$(call quiet,RM,modules/version/version.lua) client/client.lua
\ No newline at end of file
+       @$(call quiet,RM,client/kresc) client/kresc
+
+.PHONY: client client-install client-clean
+
index 1b457383c908bb1e3759446ec981f03bc954eda9..5dbc5f5115638ba9a87cda308b9446fcfa2f0e77 100644 (file)
@@ -6,7 +6,7 @@ function init()
   int kr_init_tty(const char *path);
   char *kr_run_cmd(const char *cmd, size_t * out_len);
   ]]
-  kresc = ffi.load(@libkres_SONAME@) -- FIXME in makefile
+  kresc = ffi.load('@libkres_SONAME@')
   kresc.kr_init_tty(arg[1])
 end
 
index 3ceb00484d50744d97d3725d4f5d519b51949cc5..f9b55d1438a1c6db4bb795224ab042e3da0cbf7c 100644 (file)
@@ -36,6 +36,8 @@ FILE *g_tty = NULL;           //!< connection to the daemon
 //! Initialize connection to the daemon; return 0 on success.
 KR_EXPORT int kr_init_tty(const char *path)
 {
+       if (!path)
+               return 1;
        int fd = socket(AF_UNIX, SOCK_STREAM, 0);
        if (fd < 0)
                return 1;
index 31cbca2749a5038bbf67949e510360cbe76b472b..2761ef714f088181b79d9bab86894673a92a0a44 100644 (file)
@@ -80,6 +80,8 @@ else
 $(eval $(call make_lib,libkres,lib,yes,$(ABIVER)))
 endif
 
+libkres_SONAME := libkres$(call SOVER_EXT,$(ABIVER))
+
 # Generate pkg-config file
 libkres.pc:
        @echo 'prefix='$(PREFIX) > $@