summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/driver/slbt_driver_ctx.c44
-rw-r--r--src/internal/slibtool_driver_impl.h1
-rw-r--r--src/skin/slbt_skin_default.c5
3 files changed, 50 insertions, 0 deletions
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index 10a531f..b9203c8 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -14,6 +14,7 @@
#include "slibtool_driver_impl.h"
#include "argv/argv.h"
+
static const char cfgexplicit[] = "command-line argument";
static const char cfghost[] = "derived from <host>";
static const char cfgtarget[] = "derived from <target>";
@@ -220,6 +221,11 @@ static int slbt_split_argv(
} else if (!(strcmp("rpath",&argv[i][1]))) {
*targv++ = argv[i++];
*targv++ = argv[i];
+
+ } else if (!(strcmp("version-info",&argv[i][1]))) {
+ *targv++ = argv[i++];
+ *targv++ = argv[i];
+
} else {
for (option=options; option->long_name; option++)
if (!(strcmp(option->long_name,&argv[i][1])))
@@ -383,6 +389,33 @@ static int slbt_init_host_params(
return 0;
}
+static int slbt_init_version_info(
+ struct slbt_driver_ctx_impl * ictx,
+ struct slbt_version_info * verinfo)
+{
+ int current;
+ int revision;
+ int age;
+
+ sscanf(verinfo->verinfo,"%d:%d:%d",
+ &current,&revision,&age);
+
+ if (current < age) {
+ if (ictx->cctx.drvflags & SLBT_DRIVER_VERBOSITY_ERRORS)
+ fprintf(stderr,
+ "%s: error: invalid version info: "
+ "<current> may not be smaller than <age>.\n",
+ argv_program_name(ictx->cctx.targv[0]));
+ return -1;
+ }
+
+ verinfo->major = current - age;
+ verinfo->minor = age;
+ verinfo->revision = revision;
+
+ return 0;
+}
+
int slbt_get_driver_ctx(
char ** argv,
char ** envp,
@@ -524,6 +557,10 @@ int slbt_get_driver_ctx(
cctx.rpath = entry->arg;
break;
+ case TAG_VERSION_INFO:
+ cctx.verinfo.verinfo = entry->arg;
+ break;
+
case TAG_TARGET:
cctx.target = entry->arg;
break;
@@ -573,6 +610,13 @@ int slbt_get_driver_ctx(
return -1;
}
+ /* version info */
+ if (ctx->cctx.verinfo.verinfo)
+ if (slbt_init_version_info(ctx,&ctx->cctx.verinfo)) {
+ slbt_free_driver_ctx(&ctx->ctx);
+ return -1;
+ }
+
*pctx = &ctx->ctx;
return SLBT_OK;
}
diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h
index 0ba0dfc..91bdc92 100644
--- a/src/internal/slibtool_driver_impl.h
+++ b/src/internal/slibtool_driver_impl.h
@@ -33,6 +33,7 @@ enum app_tags {
TAG_DLLTOOL,
TAG_OUTPUT,
TAG_RPATH,
+ TAG_VERSION_INFO,
TAG_NO_SUPPRESS,
TAG_PREFER_PIC,
TAG_PREFER_NON_PIC,
diff --git a/src/skin/slbt_skin_default.c b/src/skin/slbt_skin_default.c
index 926cc75..8339024 100644
--- a/src/skin/slbt_skin_default.c
+++ b/src/skin/slbt_skin_default.c
@@ -86,6 +86,11 @@ const struct argv_option slbt_default_options[] = {
"where a library should eventually be "
"installed, relative to $(DESTDIR)$(PREFIX)"},
+ {"version-info", 0,TAG_VERSION_INFO,ARGV_OPTARG_REQUIRED,
+ ARGV_OPTION_HYBRID_ONLY|ARGV_OPTION_HYBRID_SPACE,0,
+ "<current>[:<revision>[:<age>]]",
+ "specify version information"},
+
{"no-suppress", 0,TAG_NO_SUPPRESS,ARGV_OPTARG_NONE,
ARGV_OPTION_HYBRID_ONLY,0,0,
"transparently forward all "