diff options
-rw-r--r-- | src/logic/slbt_exec_install.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/logic/slbt_exec_install.c b/src/logic/slbt_exec_install.c index c2e334a..d1147aa 100644 --- a/src/logic/slbt_exec_install.c +++ b/src/logic/slbt_exec_install.c @@ -108,6 +108,7 @@ static int slbt_exec_install_entry( char dlnkname[PATH_MAX]; char lasource[PATH_MAX]; bool fexe = false; + bool fpe; struct stat st; /* executable wrapper? */ @@ -162,6 +163,13 @@ static int slbt_exec_install_entry( dot = strrchr(slnkname,'.'); strcpy(dot,dctx->cctx->settings.dsosuffix); + /* PE support: does .libs/libfoo.so.def exist? */ + if ((size_t)snprintf(dstfile,sizeof(dstfile),"%s.def", + slnkname) >= sizeof(dstfile)) + return -1; + + fpe = stat(dstfile,&st) ? false : true; + /* basename */ if ((base = strrchr(slnkname,'/'))) base++; @@ -244,12 +252,21 @@ static int slbt_exec_install_entry( dstdir,slnkname) >= sizeof(dlnkname)) return -1; - /* create symlink: libfoo.so.x --> libfoo.so.x.y.z */ - if (slbt_create_symlink( - dctx,ectx, - target,dlnkname, - false)) - return -1; + if (fpe) { + /* copy: .libs/libfoo.so.x.y.z --> libfoo.so.x */ + if (slbt_copy_file( + dctx,ectx, + srcfile, + dlnkname)) + return -1; + } else { + /* create symlink: libfoo.so.x --> libfoo.so.x.y.z */ + if (slbt_create_symlink( + dctx,ectx, + target,dlnkname, + false)) + return -1; + } return 0; } |