add VIPS_SONAME etc.

helps check ABI and php-vips-ext lock the right library
This commit is contained in:
John Cupitt 2016-12-31 17:58:33 +00:00
parent c1ca76f6a2
commit c31f4ec2d7
9 changed files with 61 additions and 27 deletions

View File

@ -14,6 +14,8 @@
- add VIPS_META_PAGE_HEIGHT metadata
- IM6/IM7 magickload supports page/n/page-height, all_frames deprecated
- gifload supports n/page-height
- added #defines for VIPS_SONAME, VIPS_LIBRARY_CURRENT, VIPS_LIBRARY_REVISION,
VIPS_LIBRARY_AGE
8/12/16 started 8.4.5
- allow libgsf-1.14.26 to help centos, thanks tdiprima

View File

@ -64,6 +64,10 @@ EXTRA_DIST = \
CLEANFILES =
all-local:
echo '/* This file is autogenerated, do not edit. */' > include/vips/soname.h; \
source libvips.la; echo "#define VIPS_SONAME \"$$dlname\"" >> include/vips/soname.h;
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)

View File

@ -37,6 +37,7 @@ pkginclude_HEADERS = \
region.h \
resample.h \
semaphore.h \
soname.h \
threadpool.h \
thread.h \
transform.h \
@ -70,6 +71,7 @@ vips_scan_headers = \
${top_srcdir}/libvips/include/vips/morphology.h \
${top_srcdir}/libvips/include/vips/draw.h \
${top_srcdir}/libvips/include/vips/basic.h \
${top_srcdir}/libvips/include/vips/version.h \
${top_srcdir}/libvips/include/vips/object.h
enumtypes.h: $(vips_scan_headers) Makefile

View File

@ -56,11 +56,6 @@ extern "C" {
*/
#define VIPS_SIZEOF_HEADER (64)
/* Startup ABI check.
*/
int vips__init( const char *argv0 );
size_t vips__get_sizeof_vipsobject( void );
/* What we track for each mmap window. Have a list of these on an openin
* VipsImage.
*/
@ -183,6 +178,11 @@ void vips__demand_hint_array( struct _VipsImage *image,
int vips__image_copy_fields_array( struct _VipsImage *out,
struct _VipsImage *in[] );
/* Deprecated.
*/
int vips__init( const char *argv0 );
size_t vips__get_sizeof_vipsobject( void );
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -0,0 +1,2 @@
/* This file is autogenerated, do not edit. */
#define VIPS_SONAME "libvips.so.42"

View File

@ -10,6 +10,21 @@
#define VIPS_MINOR_VERSION (@VIPS_MINOR_VERSION@)
#define VIPS_MICRO_VERSION (@VIPS_MICRO_VERSION@)
/* The ABI version, as used for library versioning.
*/
#define VIPS_LIBRARY_CURRENT (@LIBRARY_CURRENT@)
#define VIPS_LIBRARY_REVISION (@LIBRARY_REVISION@)
#define VIPS_LIBRARY_AGE (@LIBRARY_AGE@)
/**
* VIPS_SONAME:
*
* The name of the shared object containing the vips library, for example
* "libvips.so.42", or "libvips-42.dll".
*/
#include "soname.h"
/* Not really anything to do with versions, but this is a handy place to put
* it.
*/

View File

@ -164,14 +164,15 @@ extern "C" {
* not have _().
*/
#define VIPS_INIT( ARGV0 ) \
(sizeof( VipsObject ) != vips__get_sizeof_vipsobject() ? ( \
(vips_version( 3 ) - vips_version( 5 ) != \
VIPS_LIBRARY_CURRENT - VIPS_LIBRARY_AGE ? ( \
vips_info( "vips_init", "ABI mismatch" ), \
vips_info( "vips_init", \
"library has sizeof(VipsObject) == %zd", \
vips__get_sizeof_vipsobject() ), \
"library has ABI version %d", \
vips_version( 3 ) - vips_version( 5 ) ), \
vips_info( "vips_init", \
"application has sizeof(VipsObject) == %zd", \
sizeof( VipsObject ) ), \
"application needs ABI version %d", \
VIPS_LIBRARY_CURRENT - VIPS_LIBRARY_AGE ), \
vips_error( "vips_init", "ABI mismatch" ), \
-1 ) : \
vips_init( ARGV0 ))

View File

@ -68,6 +68,7 @@ vips_scan_headers = \
${top_srcdir}/libvips/include/vips/morphology.h \
${top_srcdir}/libvips/include/vips/draw.h \
${top_srcdir}/libvips/include/vips/basic.h \
${top_srcdir}/libvips/include/vips/version.h \
${top_srcdir}/libvips/include/vips/object.h
enumtypes.c: $(vips_scan_headers) Makefile

View File

@ -432,20 +432,6 @@ vips_init( const char *argv0 )
return( 0 );
}
/* Return the sizeof() various important data structures. These are checked
* against the headers used to build our caller by vips_init().
*
* We allow direct access to members of VipsImage and VipsRegion (mostly for
* reasons of history), so any change to a superclass of either of these
* objects will break our ABI.
*/
size_t
vips__get_sizeof_vipsobject( void )
{
return( sizeof( VipsObject ) );
}
/* Call this before vips stuff that uses stuff we need to have inited.
*/
void
@ -1029,6 +1015,9 @@ vips_version_string( void )
* Get the major, minor or micro library version, with @flag values 0, 1 and
* 2.
*
* Get the ABI current, revision and age (as used by libtool) with @flag
* values 3, 4, 5.
*
* Returns: library version number
*/
int
@ -1037,15 +1026,24 @@ vips_version( int flag )
switch( flag ) {
case 0:
return( VIPS_MAJOR_VERSION );
case 1:
return( VIPS_MINOR_VERSION );
case 2:
return( VIPS_MICRO_VERSION );
case 3:
return( VIPS_LIBRARY_CURRENT );
case 4:
return( VIPS_LIBRARY_REVISION );
case 5:
return( VIPS_LIBRARY_AGE );
default:
vips_error( "vips_version", "%s", _( "flag not 0, 1, 2" ) );
vips_error( "vips_version", "%s", _( "flag not in [0, 5]" ) );
return( -1 );
}
}
@ -1064,3 +1062,12 @@ vips_leak_set( gboolean leak )
{
vips__leak = leak;
}
/* Deprecated.
*/
size_t
vips__get_sizeof_vipsobject( void )
{
return( sizeof( VipsObject ) );
}