summaryrefslogtreecommitdiff
path: root/src/internal/slibtool_libmeta_impl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/slibtool_libmeta_impl.c')
-rw-r--r--src/internal/slibtool_libmeta_impl.c57
1 files changed, 38 insertions, 19 deletions
diff --git a/src/internal/slibtool_libmeta_impl.c b/src/internal/slibtool_libmeta_impl.c
index 3fc9645..17e090c 100644
--- a/src/internal/slibtool_libmeta_impl.c
+++ b/src/internal/slibtool_libmeta_impl.c
@@ -1,6 +1,6 @@
/*******************************************************************/
-/* slibtool: a skinny libtool implementation, written in C */
-/* Copyright (C) 2016--2021 SysDeer Technologies, LLC */
+/* slibtool: a strong libtool implementation, written in C */
+/* Copyright (C) 2016--2024 SysDeer Technologies, LLC */
/* Released under the Standard MIT License; see COPYING.SLIBTOOL. */
/*******************************************************************/
@@ -13,14 +13,15 @@
#include "slibtool_dprintf_impl.h"
#include "slibtool_errinfo_impl.h"
#include "slibtool_metafile_impl.h"
+#include "slibtool_visibility_impl.h"
static int slbt_create_default_library_wrapper(
const struct slbt_driver_ctx * dctx,
struct slbt_exec_ctx * ectx,
- char * arname,
- char * soname,
- char * soxyz,
- char * solnk)
+ const char * arname,
+ const char * soname,
+ const char * soxyz,
+ const char * solnk)
{
int ret;
int fdout;
@@ -28,6 +29,7 @@ static int slbt_create_default_library_wrapper(
const char * base;
bool fnover;
bool fvernum;
+ bool fspace;
int current;
int revision;
int age;
@@ -54,7 +56,8 @@ static int slbt_create_default_library_wrapper(
fnover = !!(dctx->cctx->drvflags & SLBT_DRIVER_AVOID_VERSION);
fvernum = !!(dctx->cctx->verinfo.vernumber);
- verinfo = slbt_source_version();
+ fspace = !!soname[0];
+ verinfo = slbt_api_source_version();
/* wrapper header */
header = "libtool compatible library wrapper\n";
@@ -67,7 +70,7 @@ static int slbt_create_default_library_wrapper(
"# [commit reference: %s]\n\n"
"dlname='%s'\n"
- "library_names='%s %s %s'\n"
+ "library_names='%s%s%s%s%s'\n"
"old_library='%s'\n\n"
"inherited_linker_flags='%s'\n"
@@ -99,7 +102,9 @@ static int slbt_create_default_library_wrapper(
/* library_names */
fnover ? solnk : soxyz,
+ fspace ? " " : "",
fnover ? solnk : soname,
+ fspace ? " " : "",
solnk,
/* old_library */
@@ -130,16 +135,17 @@ static int slbt_create_default_library_wrapper(
static int slbt_create_compatible_library_wrapper(
const struct slbt_driver_ctx * dctx,
struct slbt_exec_ctx * ectx,
- char * arname,
- char * soname,
- char * soxyz,
- char * solnk)
+ const char * arname,
+ const char * soname,
+ const char * soxyz,
+ const char * solnk)
{
int ret;
int fdout;
const char * base;
bool fnover;
bool fvernum;
+ bool fspace;
int current;
int revision;
int age;
@@ -173,7 +179,8 @@ static int slbt_create_compatible_library_wrapper(
fnover = !!(dctx->cctx->drvflags & SLBT_DRIVER_AVOID_VERSION);
fvernum = !!(dctx->cctx->verinfo.vernumber);
- verinfo = slbt_source_version();
+ fspace = !!soname[0];
+ verinfo = slbt_api_source_version();
/* wrapper content */
ret = slbt_dprintf(fdout,
@@ -188,7 +195,7 @@ static int slbt_create_compatible_library_wrapper(
"dlname='%s'\n\n"
"# Names of this library.\n"
- "library_names='%s %s %s'\n\n"
+ "library_names='%s%s%s%s%s'\n\n"
"# The name of the static archive.\n"
"old_library='%s'\n\n"
@@ -233,7 +240,9 @@ static int slbt_create_compatible_library_wrapper(
/* library_names */
fnover ? solnk : soxyz,
+ fspace ? " " : "",
fnover ? solnk : soname,
+ fspace ? " " : "",
solnk,
/* old_library */
@@ -266,14 +275,24 @@ static int slbt_create_compatible_library_wrapper(
return (ret < 0) ? SLBT_SYSTEM_ERROR(dctx,0) : 0;
}
-int slbt_create_library_wrapper(
+slbt_hidden int slbt_create_library_wrapper(
const struct slbt_driver_ctx * dctx,
struct slbt_exec_ctx * ectx,
- char * arname,
- char * soname,
- char * soxyz,
- char * solnk)
+ const char * arname,
+ const char * soname,
+ const char * soxyz,
+ const char * solnk)
{
+ if (!arname) {
+ arname = "";
+ }
+
+ if (!soname) {
+ soname = "";
+ soxyz = "";
+ solnk = "";
+ }
+
if (dctx->cctx->drvflags & SLBT_DRIVER_LEGABITS)
return slbt_create_compatible_library_wrapper(
dctx,ectx,arname,soxyz,soname,solnk);