From 1c05ca6d85d7871e111aa39d6cd3470a28af22bf Mon Sep 17 00:00:00 2001 From: midipix Date: Mon, 18 Apr 2016 20:33:39 -0400 Subject: install mode: PE support: create libfoo.so.x as a copy of libfoo.so.x.y.z. --- src/logic/slbt_exec_install.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'src/logic') 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; } -- cgit v1.2.3