From 017e4a07445fa6a6b77571b2f3d4707fae7fdbcb Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sat, 24 Feb 2024 13:42:14 -0700 Subject: Update SharedLibrary docs [skip appveyor] Signed-off-by: Mats Wichmann --- CHANGES.txt | 1 + RELEASE.txt | 1 + SCons/Tool/Tool.xml | 67 ++++++++++++++++++++++++++++++++--------------------- 3 files changed, 43 insertions(+), 26 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index fce79a9..803476d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -95,6 +95,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER would fail with an exception if called with a module which is not found. It will now return None. Updated manpage entry and docstring.. + - Improve SharedLibrary docs a bit. RELEASE 4.6.0 - Sun, 19 Nov 2023 17:22:20 -0700 diff --git a/RELEASE.txt b/RELEASE.txt index 585f8d2..0ca6aa1 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -89,6 +89,7 @@ DOCUMENTATION some more explantion. Clarified discussion of the scanner function in the Scanner Objects section of the manpage. - The manpage entry for Pseudo was clarified. +- The manpage entry for SharedLibrary was clarified. DEVELOPMENT ----------- diff --git a/SCons/Tool/Tool.xml b/SCons/Tool/Tool.xml index 25e4625..fd8deb8 100644 --- a/SCons/Tool/Tool.xml +++ b/SCons/Tool/Tool.xml @@ -150,13 +150,24 @@ env.Program(target='foo', source=['foo.o', 'bar.c', 'baz.f']) Builds a shared library -(.so on a POSIX system, -.dll on Windows) given one or more object files -or C, C++, D or Fortran source files. -If any source files are given, -then they will be automatically -compiled to object files. +and/or C, C++, D or Fortran source files. +Any source files listed in the +source parameter +will be automatically +compiled to object files suitable +for use in a shared library. +Any object files listed in the +source parameter +must have been built for a shared library +(that is, using the +&b-SharedObject; +builder method). +&scons; +will raise an error if there is any mismatch. + + + The target library file prefix, specified by the &cv-link-SHLIBPREFIX; &consvar; (by default, lib on POSIX systems, @@ -165,7 +176,13 @@ and suffix, specified by the &cv-link-SHLIBSUFFIX; &consvar; (by default, .dll on Windows systems, .so on POSIX systems), -are automatically added to the target if not already present. +are automatically added (if not already present) +to the target name to make up the library filename. +On a POSIX system, if the &cv-link-SHLIBVERSION; &consvar; is set, +it is appended (following a period) to the resulting library name. + + + Example: @@ -195,16 +212,6 @@ if there is not already a .dll.a file explicitly listed in the targets. - -Any object files listed in the -source -must have been built for a shared library -(that is, using the -&b-SharedObject; -builder method). -&scons; -will raise an error if there is any mismatch. - On some platforms, there is a distinction between a shared library @@ -214,7 +221,7 @@ For maximum portability, use the &b-link-LoadableModule; builder for the latter. -When the &cv-link-SHLIBVERSION; &consvar; is defined, a versioned +If &cv-link-SHLIBVERSION; is defined, a versioned shared library is created. This modifies &cv-link-SHLINKFLAGS; as required, adds the version number to the library name, and creates any symbolic links that are needed. @@ -225,17 +232,25 @@ env.SharedLibrary(target='bar', source=['bar.c', 'foo.o'], SHLIBVERSION='1.5.2') -On a POSIX system, versions with a single token create exactly one symlink: -libbar.so.6 would have symlink libbar.so only. -On a POSIX system, versions with two or more -tokens create exactly two symlinks: libbar.so.2.3.1 would have symlinks -libbar.so and libbar.so.2; on a Darwin (OSX) system the library would be -libbar.2.3.1.dylib and the link would be libbar.dylib. +On a POSIX system, supplying a simple version string (no dots) +creates exactly one symbolic link: SHLIBVERSION="1" +would create (for example) library libbar.so.1 +and symbolic link libbar.so. +Supplying a dotted version string will create two symbolic links +(irrespective of the number of segments in the version): +SHLIBVERSION="1.5.2" for the same library +would create library libbar.so.1.5.2 +and symbolic links libbar.so and +libbar.so.1. A Darwin (OSX) +system creates one symlink in either case, +for the second example the library would be +libbar.1.5.2.dylib +and the link would be libbar.dylib. -On Windows systems, specifying -register=1 +On Windows systems, specifying the +register=1 keyword argument will cause the .dll to be registered after it is built. The command that is run is determined by the &cv-link-REGSVR; &consvar; -- cgit v0.12