Skip to content

Commit

Permalink
add version information to shared libraries. Helps with #1774
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Jul 19, 2019
1 parent 74ea791 commit 261e04a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
22 changes: 19 additions & 3 deletions scripts/jlibtool.c
Expand Up @@ -218,6 +218,9 @@
#endif


#define XSTRINGIFY(x) #x
#define STRINGIFY(x) XSTRINGIFY(x)

/* We want to say we are libtool 1.4 for shlibtool compatibility. */
#define VERSION "1.4"

Expand Down Expand Up @@ -2061,7 +2064,7 @@ static void link_fixup(command_t *cmd)
#endif

{
char *tmp = lt_malloc(PATH_MAX);
char *tmp = lt_malloc(PATH_MAX + 30);

#ifdef __APPLE__
strcpy(tmp, cmd->install_path);
Expand All @@ -2076,12 +2079,25 @@ static void link_fixup(command_t *cmd)
}

/*
* @todo - push the version for non-OSX systems
* As "libfoo.so.VERSION"
* Add the version as "libfoo.so.PROGRAM_VERSION"
*/
#if defined(PROGRAM_VERSION) && !defined(__APPLE__)
strcat(tmp, "." STRINGIFY(PROGRAM_VERSION));
#endif

push_count_chars(cmd->shared_opts.normal, tmp);
}

#if defined(PROGRAM_VERSION) && defined(__APPLE__)
/*
* These are separate options on OSX.
*/
push_count_chars(cmd->shared_opts.normal,
"-current_version " STRINGIFY(PROGRAM_VERSION));
push_count_chars(cmd->shared_opts.normal,
"-compatibility_version " STRINGIFY(PROGRAM_VERSION));
#endif

#endif
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/libtool.mk
Expand Up @@ -44,7 +44,7 @@ ifeq "${LIBTOOL}" "JLIBTOOL"
${JLIBTOOL}: ${top_makedir}/jlibtool.c
$(Q)mkdir -p $(dir $@)
$(Q)echo CC jlibtool.c
$(Q)${CC} $< -o $@
$(Q)${CC} $< -o $@ -DPROGRAM_VERSION=$(RADIUSD_VERSION_STRING)

clean: jlibtool_clean

Expand Down

0 comments on commit 261e04a

Please sign in to comment.