Skip to content

Commit e04c6b0

Browse files
committed
Support a single shared libvips binary on Linux/macOS (#83)
1 parent bc1e9e6 commit e04c6b0

File tree

6 files changed

+32
-12
lines changed

6 files changed

+32
-12
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ All notable changes to NetVips will be documented in this file. See [here](CHANG
33

44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
## [1.2.3] - ???
7+
### Added
8+
- Add support for a single shared libvips binary on Linux and macOS ([#83](https://github.com/kleisauke/net-vips/issues/83)).
9+
610
## [1.2.2] - 2020-06-16
711
### Fixed
812
- Fix the buffer-based fallback mechanism for `NewFromStream` / `NewFromSource` on Windows 32-bit.
@@ -134,6 +138,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
134138
### Added
135139
- First release!
136140

141+
[1.2.3]: https://github.com/kleisauke/net-vips/compare/v1.2.2...v1.2.3
137142
[1.2.2]: https://github.com/kleisauke/net-vips/compare/v1.2.1...v1.2.2
138143
[1.2.1]: https://github.com/kleisauke/net-vips/compare/v1.2.0...v1.2.1
139144
[1.2.0]: https://github.com/kleisauke/net-vips/compare/v1.1.0...v1.2.0

appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
image: Visual Studio 2019
22

33
# Version format
4-
version: 1.2.2.{build}
4+
version: 1.2.3.{build}
55

66
init:
77
- git config --global core.autocrlf true

build/test-mono.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ DLL_FILE="$SCRIPT_DIR/tests/NetVips.Tests/bin/Release/net472/NetVips.Tests.dll"
1616
if [ "$(uname)" == "Darwin" ]; then
1717
RID="osx-x64"
1818

19-
# Prefer Homebrew's glib to avoid compatibility issues
20-
# with the one provided by mono.
19+
# Prefer Homebrew's glib to avoid compatibility issues
20+
# with the one provided by Mono.
2121
export DYLD_LIBRARY_PATH=$(brew --prefix glib)/lib
2222
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
2323
RID="linux-x64"

src/NetVips/Interop/Libraries.Linux.cs

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ namespace NetVips.Interop
22
{
33
internal static partial class Libraries
44
{
5-
internal const string GLib = "libgobject-2.0.so.0";
6-
internal const string GObject = "libgobject-2.0.so.0";
7-
internal const string Vips = "libvips.so.42";
5+
// We can safely define all these variables as `libvips.so.42` since
6+
// DLLImport uses dlsym() on Linux. This function also searches for named
7+
// symbols in the dependencies of the shared library. Therefore, we can
8+
// provide libvips as a single shared library with all dependencies
9+
// statically linked without breaking compatibility with shared builds
10+
// (i.e. what is usually installed via package managers).
11+
internal const string GLib = "libvips.so.42",
12+
GObject = "libvips.so.42",
13+
Vips = "libvips.so.42";
814
}
915
}

src/NetVips/Interop/Libraries.OSX.cs

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ namespace NetVips.Interop
22
{
33
internal static partial class Libraries
44
{
5-
internal const string GLib = "libgobject-2.0.dylib";
6-
internal const string GObject = "libgobject-2.0.dylib";
7-
internal const string Vips = "libvips.42.dylib";
5+
// We can safely define all these variables as `libvips.42.dylib` since
6+
// DLLImport uses dlsym() on macOS. This function also searches for named
7+
// symbols in the dependencies of the shared library. Therefore, we can
8+
// provide libvips as a single shared library with all dependencies
9+
// statically linked without breaking compatibility with shared builds
10+
// (i.e. what is usually installed via package managers).
11+
internal const string GLib = "libvips.42.dylib",
12+
GObject = "libvips.42.dylib",
13+
Vips = "libvips.42.dylib";
814
}
915
}

src/NetVips/Interop/Libraries.Windows.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ namespace NetVips.Interop
22
{
33
internal static partial class Libraries
44
{
5-
internal const string GLib = "libglib-2.0-0.dll";
6-
internal const string GObject = "libgobject-2.0-0.dll";
7-
internal const string Vips = "libvips-42.dll";
5+
// We cannot define all these variables as `libvips-42.dll` without
6+
// breaking compatibility with the shared Windows build. Therefore,
7+
// we always ship at least 3 DLLs.
8+
internal const string GLib = "libglib-2.0-0.dll",
9+
GObject = "libgobject-2.0-0.dll",
10+
Vips = "libvips-42.dll";
811
}
912
}

0 commit comments

Comments
 (0)