psp: add a patch for GCC 4.7.4
[rofl0r-mmix-cross.git] / patches / patch-elfutils.sh
blobf38ae98f5ceaae7047598779ec26f98bd10fba1f
1 #!/bin/bash -x
2 # Patch elfutils bit by bit
4 if [ ! "$MUSL_CC_BASE" ]
5 then
6 MUSL_CC_BASE=`dirname "$0"`/..
7 fi
9 # Fail on any command failing:
10 set -e
12 if [ ! "$1" ]
13 then
14 echo 'Use: patch-elfutils.sh <path to elfutils-portability.patch>'
15 exit 1
18 patch -Np1 -i "$1"
19 patch -Np1 -i "$MUSL_CC_BASE/patches/elfutils-add_ar.h.patch"
20 patch -Np1 -i "$MUSL_CC_BASE/patches/elfutils-no_error.patch"
21 patch -Np1 -i "$MUSL_CC_BASE/patches/elfutils-no_fts.patch"
22 patch -Np1 -i "$MUSL_CC_BASE/patches/elfutils-libelf_only.patch"
24 find . -name Makefile.in -exec sed -i 's/-Werror//g' '{}' \;
25 sed -i 's@strndupa@strndup@g' libdwfl/find-debuginfo.c
26 sed -i -e "/canonicalize_file_name/s@)@, NULL)@" -e 's@canonicalize_file_name@realpath@' \
27 libdwfl/find-debuginfo.c libdwfl/dwfl_build_id_find_elf.c
28 sed -i 's@loff_t@off_t@g' libelf/libelf.h libdwfl/core-file.c
29 sed -i '/features.h/d' libelf/elf.h
30 sed -i "/ifndef LIB_SYSTEM_H/s@.*@#ifndef TEMP_FAILURE_RETRY\n#define TEMP_FAILURE_RETRY(x) x\n#define rawmemchr(s,c) memchr((s),(size_t)-1,(c))\n#endif\n\n&@" lib/system.h
31 sed -i "/libdwflP.h/s@.*@&\n#include <system.h>@" libdwfl/dwfl_module_getdwarf.c \
32 libdwfl/dwfl_build_id_find_elf.c
33 sed -i "/libdwP.h/s@.*@&\n#include <system.h>@" libdw/dwarf_getpubnames.c
34 sed -i -e '/cdefs/d' -e "/define CONCAT/s@.*@#define CONCAT1(x,y) x##y\n#define CONCAT(x,y) CONCAT1(x,y)@" lib/fixedsizehash.h
35 sed -i \
36 -e "s@__BEGIN_DECLS@#ifdef __cplusplus\nextern \"C\" {\n#endif@" \
37 -e "s@__END_DECLS@#ifdef __cplusplus\n}\n#endif@" libelf/elf.h
38 sed -i 's@__mempcpy@mempcpy@g' libelf/elf_begin.c
39 sed -i 's@^LIBS=$$@@' configure