Skip to content

Commit 1210419

Browse files
authored
Add libvips version number to shared library SONAME and filename (#252)
This should help improve support for multiple versions of sharp that use differing versions of libvips running within the same process by ensuring dlopen accesses the relevant shared library.
1 parent 9f3d92f commit 1210419

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

build/lin.sh

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
#!/usr/bin/env bash
22
set -e
33

4+
# Remove patch version component
5+
without_patch() {
6+
echo "${1%.[[:digit:]]*}"
7+
}
8+
# Remove prerelease suffix
9+
without_prerelease() {
10+
echo "${1%-[[:alnum:]]*}"
11+
}
12+
413
# Environment / working directories
514
case ${PLATFORM} in
615
linux*)
@@ -9,15 +18,15 @@ case ${PLATFORM} in
918
TARGET=/target
1019
PACKAGE=/packaging
1120
ROOT=/root
12-
VIPS_CPP_DEP=libvips-cpp.so.42
21+
VIPS_CPP_DEP=libvips-cpp.so.$(without_prerelease $VERSION_VIPS)
1322
;;
1423
darwin*)
1524
DARWIN=true
1625
DEPS=$PWD/deps
1726
TARGET=$PWD/target
1827
PACKAGE=$PWD
1928
ROOT=$PWD/platforms/$PLATFORM
20-
VIPS_CPP_DEP=libvips-cpp.42.dylib
29+
VIPS_CPP_DEP=libvips-cpp.$(without_prerelease $VERSION_VIPS).dylib
2130
;;
2231
esac
2332

@@ -120,15 +129,6 @@ VERSION_AOM=3.10.0
120129
VERSION_HEIF=1.18.2
121130
VERSION_CGIF=0.4.1
122131

123-
# Remove patch version component
124-
without_patch() {
125-
echo "${1%.[[:digit:]]*}"
126-
}
127-
# Remove prerelease suffix
128-
without_prerelease() {
129-
echo "${1%-[[:alnum:]]*}"
130-
}
131-
132132
# Check for newer versions
133133
# Skip by setting the VERSION_LATEST_REQUIRED environment variable to "false"
134134
ALL_AT_VERSION_LATEST=true
@@ -447,13 +447,15 @@ meson install -C _build --tag devel
447447
mkdir ${DEPS}/vips
448448
$CURL https://github.com/libvips/libvips/releases/download/v${VERSION_VIPS}/vips-${VERSION_VIPS}.tar.xz | tar xJC ${DEPS}/vips --strip-components=1
449449
cd ${DEPS}/vips
450+
# Use version number in SONAME
451+
$CURL https://gist.githubusercontent.com/lovell/313a6901e9db1bf285f2a1f1180499e4/raw/3988223c7dfa4d22745d9392034b0117abef1446/libvips-cpp-soversion.patch | patch -p1
450452
# Disable HBR support in heifsave
451453
$CURL https://github.com/libvips/build-win64-mxe/raw/v${VERSION_VIPS}/build/patches/vips-8-heifsave-disable-hbr-support.patch | patch -p1
452-
# Link libvips.so.42 statically into libvips-cpp.so.42
454+
# Link libvips.so statically into libvips-cpp.so
453455
sed -i'.bak' "s/library('vips'/static_&/" libvips/meson.build
454456
sed -i'.bak' "/version: library_version/{N;d;}" libvips/meson.build
455457
if [ "$LINUX" = true ]; then
456-
# Ensure libvips-cpp.so.42 is linked with -z nodelete
458+
# Ensure libvips-cpp.so is linked with -z nodelete
457459
sed -i'.bak' "/gnu_symbol_visibility: 'hidden',/a link_args: nodelete_link_args," cplusplus/meson.build
458460
# Ensure symbols from external libs (except for libglib-2.0.a and libgobject-2.0.a) are not exposed
459461
EXCLUDE_LIBS=$(find ${TARGET}/lib -maxdepth 1 -name '*.a' ! -name 'libglib-2.0.a' ! -name 'libgobject-2.0.a' -printf "-Wl,--exclude-libs=%f ")

0 commit comments

Comments
 (0)