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.
This commit is contained in:
Joris Vink 2020-09-09 21:09:40 +02:00
parent d7dd9707d7
commit 2dca8fd6cc
2 changed files with 33 additions and 3 deletions

View File

@ -14,13 +14,13 @@ INCLUDE_DIR=$(PREFIX)/include/kore
GENERATED= GENERATED=
PLATFORM=platform.h PLATFORM=platform.h
VERSION=src/version.c VERSION=$(OBJDIR)/version.c
PYTHON_CURLOPT=misc/curl/python_curlopt.h PYTHON_CURLOPT=misc/curl/python_curlopt.h
S_SRC= src/kore.c src/buf.c src/config.c src/connection.c \ 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/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/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=
FEATURES_INC= FEATURES_INC=
@ -145,6 +145,7 @@ else
endif endif
S_OBJS= $(S_SRC:src/%.c=$(OBJDIR)/%.o) S_OBJS= $(S_SRC:src/%.c=$(OBJDIR)/%.o)
S_OBJS+=$(OBJDIR)/version.o
all: $(PLATFORM) $(GENERATED) $(VERSION) $(KORE) $(KODEV) all: $(PLATFORM) $(GENERATED) $(VERSION) $(KORE) $(KODEV)
@ -195,6 +196,26 @@ install:
install -m 644 kore.features $(DESTDIR)$(SHARE_DIR)/features install -m 644 kore.features $(DESTDIR)$(SHARE_DIR)/features
install -m 644 include/kore/*.h $(DESTDIR)$(INCLUDE_DIR) install -m 644 include/kore/*.h $(DESTDIR)$(INCLUDE_DIR)
$(MAKE) -C kodev install $(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: uninstall:
rm -f $(INSTALL_DIR)/$(KORE) rm -f $(INSTALL_DIR)/$(KORE)

View File

@ -197,6 +197,7 @@ static void cli_help(int, char **);
static void cli_info(int, char **); static void cli_info(int, char **);
static void cli_build(int, char **); static void cli_build(int, char **);
static void cli_clean(int, char **); static void cli_clean(int, char **);
static void cli_source(int, char **);
static void cli_reload(int, char **); static void cli_reload(int, char **);
static void cli_flavor(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 }, { "info", "show info on kore on this system", cli_info },
{ "build", "build an application", cli_build }, { "build", "build an application", cli_build },
{ "clean", "cleanup the build files", cli_clean }, { "clean", "cleanup the build files", cli_clean },
{ "source", "print the path to kore sources", cli_source },
#if !defined(KODEV_MINIMAL) #if !defined(KODEV_MINIMAL)
{ "create", "create a new application skeleton", cli_create }, { "create", "create a new application skeleton", cli_create },
#endif #endif
@ -754,6 +756,12 @@ cli_build(int argc, char **argv)
cli_buildopt_cleanup(); cli_buildopt_cleanup();
} }
static void
cli_source(int argc, char **argv)
{
printf("%s/share/kore/\n", prefix);
}
static void static void
cli_clean(int argc, char **argv) cli_clean(int argc, char **argv)
{ {
@ -1723,10 +1731,11 @@ cli_buildopt_new(const char *name)
bopt->ldflags = NULL; bopt->ldflags = NULL;
bopt->flavor_nohttp = 0; bopt->flavor_nohttp = 0;
bopt->single_binary = 0; bopt->single_binary = 0;
bopt->kore_source = NULL;
bopt->kore_flavor = NULL; bopt->kore_flavor = NULL;
bopt->name = cli_strdup(name); bopt->name = cli_strdup(name);
(void)cli_vasprintf(&bopt->kore_source, "%s/share/kore/", prefix);
TAILQ_INSERT_TAIL(&build_options, bopt, list); TAILQ_INSERT_TAIL(&build_options, bopt, list);
return (bopt); return (bopt);
} }