Merge branch 'build-fix-mingw-libelf' into 'master'

gresource-tool: fix build in case libelf is available on Windows. Fixes #1466

Closes #1466

See merge request GNOME/glib!215
This commit is contained in:
Philip Withnall 2018-08-01 23:18:53 +00:00
commit 433770b681
2 changed files with 17 additions and 9 deletions

View File

@ -21,7 +21,8 @@ pacman --noconfirm -S --needed \
mingw-w64-$MSYS2_ARCH-python3 \
mingw-w64-$MSYS2_ARCH-python3-pip \
mingw-w64-$MSYS2_ARCH-toolchain \
mingw-w64-$MSYS2_ARCH-zlib
mingw-w64-$MSYS2_ARCH-zlib \
mingw-w64-$MSYS2_ARCH-libelf
curl -O -J -L "https://github.com/linux-test-project/lcov/releases/download/v1.13/lcov-1.13.tar.gz"
echo "44972c878482cc06a05fe78eaa3645cbfcbad6634615c3309858b207965d8a23 lcov-1.13.tar.gz" | sha256sum -c

View File

@ -31,6 +31,9 @@
#ifdef HAVE_LIBELF
#include <libelf.h>
#include <gelf.h>
#endif
#ifdef HAVE_MMAP
#include <sys/mman.h>
#endif
@ -42,6 +45,10 @@
#include "glib/glib-private.h"
#endif
#if defined(HAVE_LIBELF) && defined(HAVE_MMAP)
#define USE_LIBELF
#endif
/* GResource functions {{{1 */
static GResource *
get_resource (const gchar *file)
@ -133,7 +140,7 @@ extract_resource (GResource *resource,
/* Elf functions {{{1 */
#ifdef HAVE_LIBELF
#ifdef USE_LIBELF
static Elf *
get_elf (const gchar *file,
@ -353,7 +360,7 @@ print_section_name (GElf_Shdr *shdr,
return TRUE;
}
#endif /* HAVE_LIBELF */
#endif /* USE_LIBELF */
/* Toplevel commands {{{1 */
@ -365,7 +372,7 @@ cmd_sections (const gchar *file,
{
GResource *resource;
#ifdef HAVE_LIBELF
#ifdef USE_LIBELF
Elf *elf;
gint fd;
@ -388,7 +395,7 @@ cmd_sections (const gchar *file,
else
{
g_printerr ("Don't know how to handle %s\n", file);
#ifndef HAVE_LIBELF
#ifndef USE_LIBELF
g_printerr ("gresource is built without elf support\n");
#endif
}
@ -402,7 +409,7 @@ cmd_list (const gchar *file,
{
GResource *resource;
#ifdef HAVE_LIBELF
#ifdef USE_LIBELF
Elf *elf;
int fd;
@ -424,7 +431,7 @@ cmd_list (const gchar *file,
else
{
g_printerr ("Don't know how to handle %s\n", file);
#ifndef HAVE_LIBELF
#ifndef USE_LIBELF
g_printerr ("gresource is built without elf support\n");
#endif
}
@ -438,7 +445,7 @@ cmd_extract (const gchar *file,
{
GResource *resource;
#ifdef HAVE_LIBELF
#ifdef USE_LIBELF
Elf *elf;
int fd;
@ -461,7 +468,7 @@ cmd_extract (const gchar *file,
else
{
g_printerr ("Don't know how to handle %s\n", file);
#ifndef HAVE_LIBELF
#ifndef USE_LIBELF
g_printerr ("gresource is built without elf support\n");
#endif
}