kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 2dca8fd6cc1d05ed33f4b89358376e9aed6fc9cf
parent d7dd9707d701df06154ed18ee39fe28f777dcb4a
Author: Joris Vink <joris@coders.se>
Date:   Wed,  9 Sep 2020 21:09:40 +0200

Add an install-sources target.

This will place the required sources for building
single binary builds under $PREFIX/share/kore.

The kodev utility will now pickup this KORE_SOURCE path automatically
unless another one is given via the conf/build.conf file or the KORE_SOURCE
environment path.

Diffstat:
Makefile | 25+++++++++++++++++++++++--
src/cli.c | 11++++++++++-
2 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile @@ -14,13 +14,13 @@ INCLUDE_DIR=$(PREFIX)/include/kore GENERATED= PLATFORM=platform.h -VERSION=src/version.c +VERSION=$(OBJDIR)/version.c PYTHON_CURLOPT=misc/curl/python_curlopt.h S_SRC= src/kore.c src/buf.c src/config.c src/connection.c \ src/domain.c src/filemap.c src/fileref.c src/json.c src/mem.c \ src/msg.c src/module.c src/net.c src/pool.c src/runtime.c src/timer.c \ - src/utils.c src/worker.c src/keymgr.c $(VERSION) + src/utils.c src/worker.c src/keymgr.c FEATURES= FEATURES_INC= @@ -145,6 +145,7 @@ else endif S_OBJS= $(S_SRC:src/%.c=$(OBJDIR)/%.o) +S_OBJS+=$(OBJDIR)/version.o all: $(PLATFORM) $(GENERATED) $(VERSION) $(KORE) $(KODEV) @@ -195,6 +196,26 @@ install: install -m 644 kore.features $(DESTDIR)$(SHARE_DIR)/features install -m 644 include/kore/*.h $(DESTDIR)$(INCLUDE_DIR) $(MAKE) -C kodev install + $(MAKE) install-sources + +install-sources: + @mkdir -p $(DESTDIR)$(SHARE_DIR) + @cp Makefile $(DESTDIR)$(SHARE_DIR) + @cp -R src $(DESTDIR)$(SHARE_DIR) + @cp -R include $(DESTDIR)$(SHARE_DIR) + @cp -R misc $(DESTDIR)$(SHARE_DIR) + @if [ -d .git ]; then \ + GIT_REVISION=`git rev-parse --short=8 HEAD`; \ + GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`; \ + rm -f $(VERSION); \ + echo "$$GIT_BRANCH-$$GIT_REVISION" > \ + $(DESTDIR)$(SHARE_DIR)/RELEASE; \ + elif [ -f RELEASE ]; then \ + cp RELEASE $(DESTDIR)$(SHARE_DIR); \ + else \ + echo "No version information found (no .git or RELEASE)"; \ + exit 1; \ + fi uninstall: rm -f $(INSTALL_DIR)/$(KORE) diff --git a/src/cli.c b/src/cli.c @@ -197,6 +197,7 @@ static void cli_help(int, char **); static void cli_info(int, char **); static void cli_build(int, char **); static void cli_clean(int, char **); +static void cli_source(int, char **); static void cli_reload(int, char **); static void cli_flavor(int, char **); @@ -221,6 +222,7 @@ static struct cmd cmds[] = { { "info", "show info on kore on this system", cli_info }, { "build", "build an application", cli_build }, { "clean", "cleanup the build files", cli_clean }, + { "source", "print the path to kore sources", cli_source }, #if !defined(KODEV_MINIMAL) { "create", "create a new application skeleton", cli_create }, #endif @@ -755,6 +757,12 @@ cli_build(int argc, char **argv) } static void +cli_source(int argc, char **argv) +{ + printf("%s/share/kore/\n", prefix); +} + +static void cli_clean(int argc, char **argv) { char pwd[PATH_MAX], *sofile; @@ -1723,10 +1731,11 @@ cli_buildopt_new(const char *name) bopt->ldflags = NULL; bopt->flavor_nohttp = 0; bopt->single_binary = 0; - bopt->kore_source = NULL; bopt->kore_flavor = NULL; bopt->name = cli_strdup(name); + (void)cli_vasprintf(&bopt->kore_source, "%s/share/kore/", prefix); + TAILQ_INSERT_TAIL(&build_options, bopt, list); return (bopt); }