Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise logic for unified (semistatic) libvips binaries #263

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 20 additions & 22 deletions src/FFI.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,8 @@ private static function init(): void
}

$vips_libname = self::libraryName("libvips", 42);
if (PHP_OS_FAMILY === "Windows") {
$glib_libname = self::libraryName("libglib-2.0", 0);
$gobject_libname = self::libraryName("libgobject-2.0", 0);
} else {
$glib_libname = $vips_libname;
$gobject_libname = $vips_libname;
}
$glib_libname = self::libraryName("libglib-2.0", 0);
$gobject_libname = self::libraryName("libgobject-2.0", 0);

Utils::debugLog("init", ["library" => $vips_libname]);

Expand Down Expand Up @@ -775,21 +770,24 @@ private static function init(): void
}

Utils::debugLog("init", ["binding ..."]);
self::$glib = self::libraryLoad(
$libraryPaths,
$glib_libname,
$glib_decls
);
self::$gobject = self::libraryLoad(
$libraryPaths,
$gobject_libname,
$gobject_decls
);
self::$vips = self::libraryLoad(
$libraryPaths,
$vips_libname,
$vips_decls
);

/**
* We can sometimes get dependent libraries from libvips -- either the platform
* will open dependencies for us automatically, or the libvips binary has been
* built to includes all main dependencies (common on Windows, can happen
* elsewhere).
*
* We must get GLib functions from libvips if we can, since it will be the
* one that libvips itself is using, and they will share runtime types.
*/
self::$glib =
self::libraryLoad($libraryPaths, $vips_libname, $glib_decls) ??
self::libraryLoad($libraryPaths, $glib_libname, $glib_decls);
self::$gobject =
self::libraryLoad($libraryPaths, $vips_libname, $gobject_decls) ??
self::libraryLoad($libraryPaths, $gobject_libname, $gobject_decls);

self::$vips = self::libraryLoad($libraryPaths, $vips_libname, $vips_decls);

# Useful for debugging
# self::$vips->vips_leak_set(1);
Expand Down