summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-23 10:47:31 -0400
committermidipix <writeonce@midipix.org>2016-04-23 10:47:31 -0400
commit0c24891cf3ee3795761f5c71f589792b50393e12 (patch)
treed91a90fc575901564a114aeeaad726e4cf20cfb1
parent26ea30b3aa10c572acb726eff9b833e443eb46e2 (diff)
downloadslibtool-0c24891cf3ee3795761f5c71f589792b50393e12.tar.bz2
slibtool-0c24891cf3ee3795761f5c71f589792b50393e12.tar.xz
utility: support hard-coded static-only and shared-only flavors via symlinks.
-rw-r--r--src/slibtool.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/slibtool.c b/src/slibtool.c
index 229686d..328fc24 100644
--- a/src/slibtool.c
+++ b/src/slibtool.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <unistd.h>
+#include <string.h>
#include <slibtool/slibtool.h>
#include "slibtool_version.h"
#include "slibtool_driver_impl.h"
@@ -50,9 +51,12 @@ static int slibtool_exit(struct slbt_driver_ctx * dctx, int nerrors)
int slibtool_main(int argc, char ** argv, char ** envp)
{
int ret;
+ uint64_t flags;
struct slbt_driver_ctx * dctx;
struct slbt_unit_ctx * uctx;
const char ** unit;
+ char * program;
+ char * dash;
char * sargv[5];
/* --version only? */
@@ -69,7 +73,28 @@ int slibtool_main(int argc, char ** argv, char ** envp)
: slibtool_exit(dctx,0);
}
- if ((ret = slbt_get_driver_ctx(argv,envp,SLBT_DRIVER_FLAGS,&dctx)))
+ /* program */
+ if ((program = strrchr(argv[0],'/')))
+ program++;
+ else
+ program = argv[0];
+
+ /* dash */
+ if ((dash = strrchr(program,'-')))
+ dash++;
+
+ /* flags */
+ if (dash == 0)
+ flags = SLBT_DRIVER_FLAGS;
+
+ else if (!(strcmp(dash,"shared")))
+ flags = SLBT_DRIVER_FLAGS | SLBT_DRIVER_DISABLE_STATIC;
+
+ else if (!(strcmp(dash,"static")))
+ flags = SLBT_DRIVER_FLAGS | SLBT_DRIVER_DISABLE_SHARED;
+
+ /* driver context */
+ if ((ret = slbt_get_driver_ctx(argv,envp,flags,&dctx)))
return (ret == SLBT_USAGE) ? !--argc : 2;
if (dctx->cctx->drvflags & SLBT_DRIVER_VERSION)