Drop support for legacy -config scripts

We used to call gnome-config, gtk-config, glib-config and so on, which
was useful in the beginning of pkg-config.  This hasn't served any
practical purpose in recent years, so drop the support.
This commit is contained in:
Tollef Fog Heen 2010-09-01 20:48:57 +02:00
parent 2b86e9b466
commit 03bd4a5528
3 changed files with 4 additions and 353 deletions

334
parse.c
View file

@ -1225,337 +1225,3 @@ try_command (const char *command)
return WIFEXITED(status) && (WEXITSTATUS(status) == 0);
#endif
}
Package *
get_compat_package (const char *name)
{
#ifdef G_OS_WIN32
/* There has never been any of these legacy *-config scripts on
* Windows as far as I know. No use trying to execute them, will
* only confuse users to see the "blabla is not recognized as an
* internal or external command, operable program or batch file"
* messages.
*/
return NULL;
#else
Package *pkg;
if (name_ends_in_uninstalled (name))
debug_spew ("Suspiciously looking for compat package for -uninstalled: %s\n", name);
debug_spew ("Looking for '%s' using legacy -config scripts\n", name);
pkg = g_new0 (Package, 1);
pkg->path_position = G_MAXINT;
if (strcmp (name, "glib") == 0)
{
char *output;
debug_spew ("Calling glib-config\n");
pkg->version = backticks ("glib-config --version");
if (pkg->version == NULL)
{
g_free (pkg);
return NULL;
}
pkg->name = g_strdup ("GLib");
pkg->key = g_strdup ("glib");
pkg->description = g_strdup ("C Utility Library");
output = backticks ("glib-config --libs");
parse_libs (pkg, output, "glib-config");
g_free (output);
output = backticks ("glib-config --cflags");
parse_cflags (pkg, output, "glib-config");
g_free (output);
return pkg;
}
else if (strcmp (name, "gtk+") == 0)
{
char *output;
debug_spew ("Calling gtk-config\n");
pkg->version = backticks ("gtk-config --version");
if (pkg->version == NULL)
{
g_free (pkg);
return NULL;
}
pkg->name = g_strdup ("GTK+");
pkg->key = g_strdup ("gtk+");
pkg->description = g_strdup ("GIMP Tool Kit");
output = backticks ("gtk-config --libs");
parse_libs (pkg, output, "gtk-config");
g_free (output);
output = backticks ("gtk-config --cflags");
parse_cflags (pkg, output, "gtk-config");
g_free (output);
return pkg;
}
else if (strcmp (name, "libgnomevfs") == 0)
{
char *output;
debug_spew ("Calling gnome-vfs-config\n");
pkg->version = backticks ("gnome-vfs-config --version");
if (pkg->version == NULL)
{
g_free (pkg);
return NULL;
}
pkg->name = g_strdup ("GNOME VFS");
pkg->key = g_strdup ("libgnomevfs");
pkg->description = g_strdup ("GNOME Virtual File System");
output = backticks ("gnome-vfs-config --libs");
parse_libs (pkg, output, "gnome-vfs-config");
g_free (output);
output = backticks ("gnome-vfs-config --cflags");
parse_cflags (pkg, output, "gnome-vfs-config");
g_free (output);
return pkg;
}
else if (strcmp (name, "imlib") == 0)
{
char *output;
debug_spew ("Calling imlib-config\n");
pkg->version = backticks ("imlib-config --version");
if (pkg->version == NULL)
{
g_free (pkg);
return NULL;
}
pkg->name = g_strdup ("Imlib");
pkg->key = g_strdup ("imlib");
pkg->description = g_strdup ("Imlib image loading library");
output = backticks ("imlib-config --libs-gdk");
parse_libs (pkg, output, "imlib-config");
g_free (output);
output = backticks ("imlib-config --cflags-gdk");
parse_cflags (pkg, output, "imlib-config");
g_free (output);
return pkg;
}
else if (strcmp (name, "orbit-client") == 0)
{
char *output;
char *p;
debug_spew ("Calling orbit-config\n");
output = backticks ("orbit-config --version");
if (output == NULL)
{
g_free (pkg);
return NULL;
}
p = output;
while (*p && isspace ((guchar)*p))
++p;
if (*p == '\0')
{
/* empty output */
g_free (output);
g_free (pkg);
return NULL;
}
/* only heuristic; find a number or . */
while (*p && ! (isdigit ((guchar)*p) || *p == '.'))
++p;
pkg->version = g_strdup (p);
g_free (output);
pkg->name = g_strdup ("ORBit Client");
pkg->key = g_strdup ("orbit-client");
pkg->description = g_strdup ("ORBit Client Libraries");
output = backticks ("orbit-config --libs client");
parse_libs (pkg, output, "orbit-config");
g_free (output);
output = backticks ("orbit-config --cflags client");
parse_cflags (pkg, output, "orbit-config");
g_free (output);
return pkg;
}
else if (strcmp (name, "orbit-server") == 0)
{
char *output;
char *p;
debug_spew ("Calling orbit-config\n");
output = backticks ("orbit-config --version");
if (output == NULL)
{
g_free (pkg);
return NULL;
}
p = output;
while (*p && isspace ((guchar)*p))
++p;
if (*p == '\0')
{
/* empty output */
g_free (output);
g_free (pkg);
return NULL;
}
/* only heuristic; find a number or . */
while (*p && ! (isdigit ((guchar)*p) || *p == '.'))
++p;
pkg->version = g_strdup (p);
g_free (output);
pkg->name = g_strdup ("ORBit Server");
pkg->key = g_strdup ("orbit-server");
pkg->description = g_strdup ("ORBit Server Libraries");
output = backticks ("orbit-config --libs server");
parse_libs (pkg, output, "orbit-config");
g_free (output);
output = backticks ("orbit-config --cflags server");
parse_cflags (pkg, output, "orbit-config");
g_free (output);
return pkg;
}
else
{
/* Check for the module in gnome-config */
char *output;
char *p;
char *command;
debug_spew ("Calling gnome-config\n");
/* Annoyingly, --modversion doesn't return a failure
* code if the lib is unknown, so we have to use --libs
* for that.
*/
command = g_strdup_printf ("gnome-config --libs %s",
name);
if (!try_command (command))
{
g_free (command);
g_free (pkg);
return NULL;
}
else
g_free (command);
command = g_strdup_printf ("gnome-config --modversion %s",
name);
output = backticks (command);
g_free (command);
if (output == NULL)
{
g_free (pkg);
return NULL;
}
/* Unknown modules give "Unknown library `foo'" from gnome-config
* (but on stderr so this is useless, nevermind)
*/
if (strstr (output, "Unknown") || *output == '\0')
{
g_free (output);
g_free (pkg);
return NULL;
}
/* gnome-config --modversion gnomeui outputs e.g. "gnome-libs-1.2.4"
* or libglade-0.12
*/
p = output;
while (*p && isspace ((guchar)*p))
++p;
if (*p == '\0')
{
/* empty output */
g_free (output);
g_free (pkg);
return NULL;
}
/* only heuristic; find a number or . */
while (*p && ! (isdigit ((guchar)*p) || *p == '.'))
++p;
pkg->version = g_strdup (p);
g_free (output);
/* Strip newline */
p = pkg->version;
while (*p)
{
if (*p == '\n')
*p = '\0';
++p;
}
pkg->name = g_strdup (name);
pkg->key = g_strdup (name);
pkg->description = g_strdup ("No description");
command = g_strdup_printf ("gnome-config --libs %s", name);
output = backticks (command);
g_free (command);
parse_libs (pkg, output, "gnome-config");
g_free (output);
command = g_strdup_printf ("gnome-config --cflags %s", name);
output = backticks (command);
g_free (command);
parse_cflags (pkg, output, "gnome-config");
g_free (output);
return pkg;
}
#endif
}

View file

@ -26,8 +26,6 @@ Package *parse_package_file (const char *path, gboolean ignore_requires,
gboolean ignore_private_libs,
gboolean ignore_requires_private);
Package *get_compat_package (const char *name);
GSList *parse_module_list (Package *pkg, const char *str, const char *path);
#endif

21
pkg.c
View file

@ -279,7 +279,7 @@ file_readable (const char *path)
static Package *
internal_get_package (const char *name, gboolean warn, gboolean check_compat)
internal_get_package (const char *name, gboolean warn)
{
Package *pkg = NULL;
const char *location;
@ -307,7 +307,7 @@ internal_get_package (const char *name, gboolean warn, gboolean check_compat)
un = g_strconcat (name, "-uninstalled", NULL);
pkg = internal_get_package (un, FALSE, FALSE);
pkg = internal_get_package (un, FALSE);
g_free (un);
@ -321,19 +321,6 @@ internal_get_package (const char *name, gboolean warn, gboolean check_compat)
location = g_hash_table_lookup (locations, name);
}
if (location == NULL && check_compat)
{
pkg = get_compat_package (name);
if (pkg)
{
debug_spew ("Returning values for '%s' from a legacy -config script\n",
name);
return pkg;
}
}
if (location == NULL)
{
if (warn)
@ -394,13 +381,13 @@ internal_get_package (const char *name, gboolean warn, gboolean check_compat)
Package *
get_package (const char *name)
{
return internal_get_package (name, TRUE, TRUE);
return internal_get_package (name, TRUE);
}
Package *
get_package_quiet (const char *name)
{
return internal_get_package (name, FALSE, TRUE);
return internal_get_package (name, FALSE);
}
static GSList*