mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
build: Make netpbm and icoutils into proper optional dependencies.
Netpbm and icoutils (wrestool) have always been dependencies. Since they are not always present, make these into optional dependencies (which they were, sort of, before). Also document these dependencies in the README file.
This commit is contained in:
3
README
3
README
@@ -97,6 +97,9 @@ For basic functionality and the C tools:
|
||||
|
||||
- getfacl, getfattr libraries and programs (optional)
|
||||
|
||||
- netpbm, icoutils (optional)
|
||||
These programs are used to render icons from guests.
|
||||
|
||||
To build FUSE support (guestmount):
|
||||
|
||||
- FUSE libraries and kernel module (optional)
|
||||
|
||||
24
configure.ac
24
configure.ac
@@ -466,6 +466,30 @@ if test "x$DB_LOAD" != "xno"; then
|
||||
AC_DEFINE_UNQUOTED([DB_LOAD],["$DB_LOAD"],[Name of db_load program.])
|
||||
fi
|
||||
|
||||
dnl Check for netpbm programs (optional).
|
||||
AC_CHECK_PROGS([PBMTEXT],[pbmtext],[no])
|
||||
AC_CHECK_PROGS([PNMTOPNG],[pnmtopng],[no])
|
||||
AC_CHECK_PROGS([BMPTOPNM],[bmptopnm],[no])
|
||||
AC_CHECK_PROGS([PAMCUT],[pamcut],[no])
|
||||
if test "x$PBMTEXT" != "xno"; then
|
||||
AC_DEFINE_UNQUOTED([PBMTEXT],["$PBMTEXT"],[Name of pbmtext program.])
|
||||
fi
|
||||
if test "x$PNMTOPNG" != "xno"; then
|
||||
AC_DEFINE_UNQUOTED([PNMTOPNG],["$PNMTOPNG"],[Name of pnmtopng program.])
|
||||
fi
|
||||
if test "x$BMPTOPNM" != "xno"; then
|
||||
AC_DEFINE_UNQUOTED([BMPTOPNM],["$BMPTOPNM"],[Name of bmptopnm program.])
|
||||
fi
|
||||
if test "x$PAMCUT" != "xno"; then
|
||||
AC_DEFINE_UNQUOTED([PAMCUT],["$PAMCUT"],[Name of pamcut program.])
|
||||
fi
|
||||
|
||||
dnl Check for icoutils (optional).
|
||||
AC_CHECK_PROGS([WRESTOOL],[wrestool],[no])
|
||||
if test "x$WRESTOOL" != "xno"; then
|
||||
AC_DEFINE_UNQUOTED([WRESTOOL],["$WRESTOOL"],[Name of wrestool program.])
|
||||
fi
|
||||
|
||||
dnl Check for QEMU for running binaries on this $host_cpu, fall
|
||||
dnl back to basic 'qemu'. Allow the user to override it.
|
||||
default_qemu="qemu-kvm kvm qemu-system-$host_cpu qemu"
|
||||
|
||||
@@ -33,6 +33,15 @@
|
||||
#include "guestfs-internal-actions.h"
|
||||
#include "guestfs_protocol.h"
|
||||
|
||||
/* External tools are required for some icon types. Check we have them. */
|
||||
#if defined(PBMTEXT) && defined (PNMTOPNG)
|
||||
#define CAN_DO_CIRROS 1
|
||||
#endif
|
||||
#if defined(WRESTOOL) && defined(BMPTOPNM) && defined(PNMTOPNG) && \
|
||||
defined(PAMCUT)
|
||||
#define CAN_DO_WINDOWS 1
|
||||
#endif
|
||||
|
||||
static int read_whole_file (guestfs_h *g, const char *filename, char **data_r, size_t *size_r);
|
||||
|
||||
/* All these icon_*() functions return the same way. One of:
|
||||
@@ -56,8 +65,12 @@ static char *icon_debian (guestfs_h *g, struct inspect_fs *fs, size_t *size_r);
|
||||
static char *icon_ubuntu (guestfs_h *g, struct inspect_fs *fs, size_t *size_r);
|
||||
static char *icon_mageia (guestfs_h *g, struct inspect_fs *fs, size_t *size_r);
|
||||
static char *icon_opensuse (guestfs_h *g, struct inspect_fs *fs, size_t *size_r);
|
||||
#if CAN_DO_CIRROS
|
||||
static char *icon_cirros (guestfs_h *g, struct inspect_fs *fs, size_t *size_r);
|
||||
#endif
|
||||
#if CAN_DO_WINDOWS
|
||||
static char *icon_windows (guestfs_h *g, struct inspect_fs *fs, size_t *size_r);
|
||||
#endif
|
||||
|
||||
/* Dummy static object. */
|
||||
static char *NOT_FOUND = (char *) "not_found";
|
||||
@@ -144,7 +157,9 @@ guestfs__inspect_get_icon (guestfs_h *g, const char *root, size_t *size_r,
|
||||
break;
|
||||
|
||||
case OS_DISTRO_CIRROS:
|
||||
#if CAN_DO_CIRROS
|
||||
r = icon_cirros (g, fs, &size);
|
||||
#endif
|
||||
break;
|
||||
|
||||
/* These are just to keep gcc warnings happy. */
|
||||
@@ -164,11 +179,13 @@ guestfs__inspect_get_icon (guestfs_h *g, const char *root, size_t *size_r,
|
||||
break;
|
||||
|
||||
case OS_TYPE_WINDOWS:
|
||||
#if CAN_DO_WINDOWS
|
||||
/* We don't know how to get high quality icons from a Windows guest,
|
||||
* so disable this if high quality was specified.
|
||||
*/
|
||||
if (!highquality)
|
||||
r = icon_windows (g, fs, &size);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case OS_TYPE_FREEBSD:
|
||||
@@ -331,6 +348,8 @@ icon_opensuse (guestfs_h *g, struct inspect_fs *fs, size_t *size_r)
|
||||
return get_png (g, fs, OPENSUSE_ICON, size_r, 2048);
|
||||
}
|
||||
|
||||
#if CAN_DO_CIRROS
|
||||
|
||||
/* Cirros's logo is a text file! */
|
||||
#define CIRROS_LOGO "/usr/share/cirros/logo"
|
||||
|
||||
@@ -363,7 +382,7 @@ icon_cirros (guestfs_h *g, struct inspect_fs *fs, size_t *size_r)
|
||||
/* Use pbmtext to render it. */
|
||||
pngfile = safe_asprintf (g, "%s/cirros.png", g->tmpdir);
|
||||
|
||||
cmd = safe_asprintf (g, "pbmtext < %s | pnmtopng > %s",
|
||||
cmd = safe_asprintf (g, PBMTEXT " < %s | " PNMTOPNG " > %s",
|
||||
local, pngfile);
|
||||
r = system (cmd);
|
||||
if (r == -1 || WEXITSTATUS (r) != 0) {
|
||||
@@ -386,6 +405,10 @@ icon_cirros (guestfs_h *g, struct inspect_fs *fs, size_t *size_r)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CAN_DO_CIRROS */
|
||||
|
||||
#if CAN_DO_WINDOWS
|
||||
|
||||
/* Windows, as usual, has to be much more complicated and stupid than
|
||||
* anything else.
|
||||
*
|
||||
@@ -413,8 +436,8 @@ icon_windows_xp (guestfs_h *g, struct inspect_fs *fs, const char *explorer,
|
||||
pngfile = safe_asprintf (g, "%s/windows-xp-icon.png", g->tmpdir);
|
||||
|
||||
cmd = safe_asprintf (g,
|
||||
"wrestool -x --type=2 --name=143 %s | "
|
||||
"bmptopnm | pnmtopng > %s",
|
||||
WRESTOOL " -x --type=2 --name=143 %s | "
|
||||
BMPTOPNM " | " PNMTOPNG " > %s",
|
||||
explorer, pngfile);
|
||||
r = system (cmd);
|
||||
if (r == -1 || WEXITSTATUS (r) != 0) {
|
||||
@@ -448,8 +471,8 @@ icon_windows_7 (guestfs_h *g, struct inspect_fs *fs, const char *explorer,
|
||||
pngfile = safe_asprintf (g, "%s/windows-7-icon.png", g->tmpdir);
|
||||
|
||||
cmd = safe_asprintf (g,
|
||||
"wrestool -x --type=2 --name=6801 %s | "
|
||||
"bmptopnm | pamcut -bottom 54 | pnmtopng > %s",
|
||||
WRESTOOL " -x --type=2 --name=6801 %s | "
|
||||
BMPTOPNM " | " PAMCUT " -bottom 54 | " PNMTOPNG " > %s",
|
||||
explorer, pngfile);
|
||||
r = system (cmd);
|
||||
if (r == -1 || WEXITSTATUS (r) != 0) {
|
||||
@@ -511,6 +534,8 @@ icon_windows (guestfs_h *g, struct inspect_fs *fs, size_t *size_r)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CAN_DO_WINDOWS */
|
||||
|
||||
/* Read the whole file into a memory buffer and return it. The file
|
||||
* should be a regular, local, trusted file.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user