Building shared-mime-info-1.4 on a machine with a very old glib passes ./configure (including the glib tests): checking for ALL... yes checking for GIO... yes but then compiling fails: CC update_mime_database-update-mime-database.o update-mime-database.c:3548:2: error: use of undeclared identifier 'GStatBuf' GStatBuf statbuf; ^ update-mime-database.c:3553:31: error: use of undeclared identifier 'statbuf'; did you mean 'setbuf'? retval = g_stat(packagedir, &statbuf); ^~~~~~~ g_stat() has long existed, but the GStatBuf type was only added in glib-2.26.0, but ALL/GIO tests only require >= 2.6.0. It appears that struct GStatBuf is just struct stat on most platforms (all it is is a typedef wrapper in gstdio.h). So it seems easy enough to add backward-compatibility, as in: http://sourceforge.net/p/viking/bugs/104/
commit 573329b89e5e6ac3f503ec074e874f5ca92b103e Author: Bastien Nocera <hadess@hadess.net> Date: Mon Mar 9 15:14:25 2015 +0100 Fix compilation with glib < 2.26 https://bugs.freedesktop.org/show_bug.cgi?id=89448
The fix committed for update-mime-database.c:newest_mtime() is not correct: #if !GLIB_CHECK_VERSION(2,26,0) struct stat GStatBuf; #else GStatBuf statbuf; #endif For <2.26, GStatBuf appears to be defined as a variable. Instead, either statbuf needs to be declared as the variable (solution 1): #if !GLIB_CHECK_VERSION(2,26,0) struct stat statuf; #else GStatBuf statbuf; #endif or else GstatBuf needs to be defined as a typedef and then the statbuf variable declared as the variable for both branches (solution 2): #if !GLIB_CHECK_VERSION(2,26,0) typedef struct stat GStatBuf; #endif GStatBuf statbuf; And update-mime-database.c:is_cache_up_to_date() also uses a GStatBuf, so it needs a similar fix. Maybe cleaner to put the "solution 2" typedef declaration up in the block of #include for the whole .c rather than having to remember to do it in each separate function.
Created attachment 124610 [details] [review] Patch against 1.6 to fix building with glib<2.26 Here's the patch we're using in fink.
The 1.7 release still fails to build and the patch I gave in Comment #3 still fixes it. Any thoughts about committing it?
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/shared-mime-info/issues/73.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.