Commit 433770b6 authored by Philip Withnall's avatar Philip Withnall

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
parents 83a4cab1 70ad4845
......@@ -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
......
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment