firasuke / cross / slibtool

Forked from cross/slibtool 6 months ago
Clone

965661 driver: account for sub-directories when verifying output file prefix.

Authored and Committed by midipix 8 years ago
    driver: account for sub-directories when verifying output file prefix.
    
        
file modified
+8 -3
src/driver/slbt_driver_ctx.c CHANGED
@@ -476,6 +476,7 @@ static int slbt_init_link_params(struct slbt_driver_ctx_impl * ctx)
476
476
const char * program;
477
477
const char * libname;
478
478
const char * prefix;
479
+ const char * base;
479
480
char * dot;
480
481
481
482
program = argv_program_name(ctx->cctx.targv[0]);
@@ -497,12 +498,16 @@ static int slbt_init_link_params(struct slbt_driver_ctx_impl * ctx)
497
498
return 0;
498
499
499
500
/* todo: archive? library? wrapper? inlined function, avoid repetition */
501
+ if ((base = strrchr(ctx->cctx.output,'/')))
502
+ base++;
503
+ else
504
+ base = ctx->cctx.output;
500
505
501
506
/* archive? */
502
507
if (!strcmp(dot,ctx->cctx.settings.arsuffix)) {
503
508
prefix = ctx->cctx.settings.arprefix;
504
509
505
- if (!strncmp(prefix,ctx->cctx.output,strlen(prefix)))
510
+ if (!strncmp(prefix,base,strlen(prefix)))
506
511
libname = ctx->cctx.output;
507
512
else {
508
513
if (ctx->cctx.drvflags & SLBT_DRIVER_VERBOSITY_ERRORS)
@@ -519,7 +524,7 @@ static int slbt_init_link_params(struct slbt_driver_ctx_impl * ctx)
519
524
else if (!strcmp(dot,ctx->cctx.settings.dsosuffix)) {
520
525
prefix = ctx->cctx.settings.dsoprefix;
521
526
522
- if (!strncmp(prefix,ctx->cctx.output,strlen(prefix)))
527
+ if (!strncmp(prefix,base,strlen(prefix)))
523
528
libname = ctx->cctx.output;
524
529
else {
525
530
if (ctx->cctx.drvflags & SLBT_DRIVER_VERBOSITY_ERRORS)
@@ -536,7 +541,7 @@ static int slbt_init_link_params(struct slbt_driver_ctx_impl * ctx)
536
541
else if (!strcmp(dot,".la")) {
537
542
prefix = ctx->cctx.settings.dsoprefix;
538
543
539
- if (!strncmp(prefix,ctx->cctx.output,strlen(prefix)))
544
+ if (!strncmp(prefix,base,strlen(prefix)))
540
545
libname = ctx->cctx.output;
541
546
else {
542
547
if (ctx->cctx.drvflags & SLBT_DRIVER_VERBOSITY_ERRORS)