diff options
author | midipix <writeonce@midipix.org> | 2016-12-14 17:57:04 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-12-14 19:12:19 -0500 |
commit | ec5e56b417a69747befea0d373aeff18016433ad (patch) | |
tree | 8655decbb972a2500ed52396a09d1ed34b17cf47 | |
parent | 03e536f958a6668b8ea88a1303d1524ee5e16c99 (diff) | |
download | slibtool-ec5e56b417a69747befea0d373aeff18016433ad.tar.bz2 slibtool-ec5e56b417a69747befea0d373aeff18016433ad.tar.xz |
link mode: create an archive /dev/null symlink placeholder as needed.
-rw-r--r-- | src/internal/slibtool_symlink_impl.c | 5 | ||||
-rw-r--r-- | src/logic/slbt_exec_link.c | 28 |
2 files changed, 30 insertions, 3 deletions
diff --git a/src/internal/slibtool_symlink_impl.c b/src/internal/slibtool_symlink_impl.c index 42185e8..d95beba 100644 --- a/src/internal/slibtool_symlink_impl.c +++ b/src/internal/slibtool_symlink_impl.c @@ -12,8 +12,9 @@ #include "slibtool_errinfo_impl.h" #include "slibtool_symlink_impl.h" -#define SLBT_DEV_NULL_FLAGS (SLBT_DRIVER_ALL_STATIC \ - | SLBT_DRIVER_DISABLE_SHARED) +#define SLBT_DEV_NULL_FLAGS (SLBT_DRIVER_ALL_STATIC \ + | SLBT_DRIVER_DISABLE_SHARED \ + | SLBT_DRIVER_DISABLE_STATIC) int slbt_create_symlink( const struct slbt_driver_ctx * dctx, diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c index 3aa9d2f..8691760 100644 --- a/src/logic/slbt_exec_link.c +++ b/src/logic/slbt_exec_link.c @@ -786,6 +786,31 @@ static int slbt_exec_link_create_import_library( return 0; } +static int slbt_exec_link_create_noop_symlink( + const struct slbt_driver_ctx * dctx, + struct slbt_exec_ctx * ectx, + const char * arfilename) +{ + struct stat st; + + /* file exists? */ + if (!(lstat(arfilename,&st))) + return 0; + + /* needed? */ + if (errno == ENOENT) { + if (slbt_create_symlink( + dctx,ectx, + "/dev/null", + arfilename, + false)) + return SLBT_NESTED_ERROR(dctx); + return 0; + } + + return SLBT_SYSTEM_ERROR(dctx); +} + static int slbt_exec_link_create_archive( const struct slbt_driver_ctx * dctx, struct slbt_exec_ctx * ectx, @@ -807,7 +832,8 @@ static int slbt_exec_link_create_archive( /* -disable-static? */ if (dctx->cctx->drvflags & SLBT_DRIVER_DISABLE_STATIC) if (dctx->cctx->rpath) - return 0; + return slbt_exec_link_create_noop_symlink( + dctx,ectx,arfilename); /* initial state */ slbt_reset_arguments(ectx); |