Re: Setting macOS shared library versioning information with scons

"Andrew C. Morrow" <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <CA+Acj4fHJKvTD7V8YjivGRPrvpmKDNmVfO5Ji-zmP_u-DbaEMQ@mail.gmail.com>
My recommendation would be to not attempt to automatically provide values
for -compatibility_version and -current_version, but to provide variables
that allow users to set them. If you did want something that mapped
SOVERSION=x.y.z to -current_version=y.z -compat_version=y.0 or something
(or the +1 variants of that), I think you could do it with generator
functions that would parse SOVERSION.

# No flags passed for -current_version or -compat_version
env.SharedLibrary(..., SOVERSION=1.2.3, ...)

# User sets explicitly, links with -Wl,-current_version=7.1
-Wl,-compatibility_version=7.0
env.SharedLibrary(..., SOVERSION=1.2.3, APPLELINK_CURRENT_VERSION=7.1,
APPLELINK_COMPATIBILITY_VERSION=7.0)

# User programmatically describes how SOVERSION maps to values for
compat/current.

def currentVersionFromSoVersion(source, target, env, for_signature):
    return env['SOVERSION'].split(.)[1:]

def compatVersionFromSoVersion(source, target, env, for_signature):
    return env['SOVERSION'].split(.)[1] + ".0"

env['APPLELINK_CURRENT_VERSION'] = currentVersionFromSoVersion
env['APPLELINK_COMPATIBILITY_VERSION'] = compatVersionFromSoVersion

# Links as -Wl,current_version=2.3 -Wl,compat_version=2.0
env.SharedLibrary(..., SOVERSION=1.2.3, ...)

Something like that? Would currentVersionFromSoVersion be able to see the
SOVERSION set in the following:

env.SharedLibrary(
    SOVERSION=1.2.3,
    APPLELINK_CURRENT_VERSION=currentVersionFromSoVersion
)

You could also add some validation for the rules for current_version and
compatibility_version in whatever piece of applelink.py ends up doing the
expansion of APPLELINK_CURRENT_VERSION and APPLELINK_COMPATIBILITY_VERSION.




On Sat, Oct 13, 2018 at 2:07 PM Bill Deegan <[email protected]>
wrote:

> That's true, but macOS's 'shared library" is different than linux (as are
> DLL's).
> Versioning is embedded in the libraries via the flags discussed in the
> thread.
> As such, the .1 and .1.2.3 may not be directly mappable to macOS's
> versioned library usage.
>
> On Sat, Oct 13, 2018 at 5:42 AM Paweł Tomulik <[email protected]>
> wrote:
>
>> W dniu 08.05.2018 o 18:40, Ryan Schmidt pisze:
>> > Hello,
>> >
>> > I'm a developer with the MacPorts package management system.
>> >
>> > We noticed that after updating our scons port to 2.4.1, serf's shared
>> library was built incorrectly, in that its current version and
>> compatibility version were no longer being set. Here is our bug report
>> about this:
>> >
>> > https://trac.macports.org/ticket/50854
>> >
>> > It seems that scons's shared library generation code was refactored in
>> 2.4.1, and in the process, the code that sets the -current_version and
>> -compatibility_version flags was removed. Was this regression intentional,
>> and if so, how are projects that use scons to build shared libraries on
>> macOS now supposed to set library version information? Should they manually
>> specify -current_version and -compatibility_version?
>> >
>> > I realize scons 2.4.1 was released 2.5 years ago, but the problem
>> remains in scons 3.0.1. The developers of serf are preparing to release
>> serf 1.4.0, and I'm trying to help them ensure that they finally fix the
>> shared library versioning issue on their end, hopefully in a way that's
>> compatible with both current and future versions of scons.
>> >
>> > _______________________________________________
>> > Scons-users mailing list
>> > [email protected]
>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >
>>
>> Perhaps this comment (and surrounding comments) could be relevant:
>>
>>
>> https://bitbucket.org/scons/scons/pull-requests/247/new-versioned-libraries-gnulink-cyglink/diff#comment-10067665
>>
>>
>>
>> --
>> Pawel Tomulik
>> _______________________________________________
>> Scons-users mailing list
>> [email protected]
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
> _______________________________________________
> Scons-users mailing list
> [email protected]
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>

_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.