summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in4
-rw-r--r--include/slibtool/slibtool.h10
-rw-r--r--src/driver/slbt_driver_ctx.c13
3 files changed, 25 insertions, 2 deletions
diff --git a/Makefile.in b/Makefile.in
index 0957e32..d8ae066 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -86,10 +86,10 @@ include $(PROJECT_DIR)/project/overrides.mk
$(APP_SRCS:%.c=%.o): version.tag
$(APP_SRCS:%.c=%.o): CFLAGS_STATIC = $(CFLAGS_APP)
-src/%.lo: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag dirs.tag
+src/%.lo: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag dirs.tag version.tag
$(CC) -c -o $@ $< $(CFLAGS_SHARED)
-src/%.o: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag dirs.tag
+src/%.o: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag dirs.tag version.tag
$(CC) -c -o $@ $< $(CFLAGS_STATIC)
lib/%$(OS_LIB_SUFFIX)$(VER_XYZ):
diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h
index 953ab19..a2529f7 100644
--- a/include/slibtool/slibtool.h
+++ b/include/slibtool/slibtool.h
@@ -87,6 +87,13 @@ enum slbt_warning_level {
SLBT_WARNING_LEVEL_NONE,
};
+struct slbt_source_version {
+ int major;
+ int minor;
+ int revision;
+ const char * commit;
+};
+
struct slbt_input {
void * addr;
size_t size;
@@ -204,6 +211,9 @@ struct slbt_unit_ctx {
int nerrors;
};
+/* package info */
+slbt_api const struct slbt_source_version * slbt_source_version(void);
+
/* driver api */
slbt_api int slbt_get_driver_ctx (char ** argv, char ** envp, uint32_t flags, struct slbt_driver_ctx **);
slbt_api int slbt_create_driver_ctx (const struct slbt_common_ctx *, struct slbt_driver_ctx **);
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index 1c6343f..f65460a 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -11,9 +11,17 @@
#define ARGV_DRIVER
#include <slibtool/slibtool.h>
+#include "slibtool_version.h"
#include "slibtool_driver_impl.h"
#include "argv/argv.h"
+/* package info */
+static const struct slbt_source_version slbt_src_version = {
+ SLBT_TAG_VER_MAJOR,
+ SLBT_TAG_VER_MINOR,
+ SLBT_TAG_VER_PATCH,
+ SLIBTOOL_GIT_VERSION
+};
/* flavor settings */
#define SLBT_FLAVOR_SETTINGS(flavor,bfmt,arp,ars,dsop,dsos,exep,exes,impp,imps,ldenv) \
@@ -1021,3 +1029,8 @@ int slbt_set_alternate_host(
return 0;
}
+
+const struct slbt_source_version * slbt_source_version(void)
+{
+ return &slbt_src_version;
+}