scripts/mk-patch.sh
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Wed Dec 14 16:55:22 2011 +0100 (2011-12-14)
branch1.13
changeset 2848 1ff89596dab0
parent 2075 edc7c7958e80
permissions -rwxr-xr-x
libc/eglibc: fix localedef 2.14 build

The localedef of eglibc 2.14 requires NOT_IN_libc to be defined in order to
compile intl/l10nflist.c.

This is because localedef is built separately from eglibc and uses some parts of
eglibc that don't compile in standalone without this preprocessor definition.

This fixes the following error:

[ALL ] gcc -g -O2 -DNO_SYSCONF -DNO_UNCOMPRESS
-DLOCALE_PATH='"/usr/lib/locale:/usr/share/i18n"'
-DLOCALEDIR='"/usr/lib/locale"' -DLOCALE_ALIAS_PATH='"/usr/share/locale"'
-DCHARMAP_PATH='"/usr/share/i18n/charmaps"'
-DREPERTOIREMAP_PATH='"/usr/share/i18n/repertoiremaps"'
-DLOCSRCDIR='"/usr/share/i18n/locales"' -Iglibc/locale/programs -Iglibc/locale
-I/<snip>/.build/src/eglibc-localedef-2_14/include
-I/<snip>/.build/src/eglibc-localedef-2_14 -I.
-include /<snip>/.build/src/eglibc-localedef-2_14/include/always.h -Wall
-Wno-format -c -o locarchive.o glibc/locale/programs/locarchive.c
[ALL ] glibc/locale/programs/locarchive.c: In function 'enlarge_archive':
[ALL ] glibc/locale/programs/locarchive.c:303:21: warning: variable
'oldlocrectab' set but not used [-Wunused-but-set-variable]
[ALL ] In file included from glibc/locale/programs/locarchive.c:651:0:
[ALL ] glibc/locale/programs/../../intl/l10nflist.c: In function
'_nl_normalize_codeset':
[ERROR] glibc/locale/programs/../../intl/l10nflist.c:342:9: error:
'_nl_C_locobj_ptr' undeclared (first use in this function)
[ALL ] glibc/locale/programs/../../intl/l10nflist.c:342:9: note: each
undeclared identifier is reported only once for each function it appears in
[ALL ] glibc/locale/programs/locarchive.c: In function
'add_locales_to_archive':
[ALL ] glibc/locale/programs/locarchive.c:1450:7: warning: passing argument
1 of '__xpg_basename' discards 'const' qualifier from pointer target type
[enabled by default]
[ALL ] /usr/include/libgen.h:35:14: note: expected 'char *' but argument is
of type 'const char *'
[ERROR] make[1]: *** [locarchive.o] Error 1

Signed-off-by: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
(transplanted from 4cd9134739b594451794cf61a6e1b137422cdafd)
yann@1888
     1
#!/bin/sh
yann@1888
     2
yann@1888
     3
repos="$1"
yann@1888
     4
pdir="$2"
yann@1888
     5
if [ -z "${repos}" -o ! -d "${repos}" -o -z "${pdir}" -o ! -d "${pdir}" ];then
yann@1888
     6
    printf "Usage: ${0##*/} <repos_dir> <patch_dir>\n"
yann@1888
     7
    exit 1
yann@1888
     8
fi
yann@1888
     9
yann@1888
    10
pdir="$( cd "${pdir}"; pwd)"
yann@1888
    11
version="$( echo "${pdir}" |sed -r -e 's,.*/([^/]+)/*$,\1,' )"
yann@1888
    12
branch="${version%.*}"
yann@1888
    13
n=$( ls -1 "${pdir}" 2>/dev/null |wc -l )
yann@1888
    14
yann@1888
    15
r1="$( hg -R "${repos}" log -b "${branch}"  \
yann@1888
    16
       |awk '
yann@1888
    17
            $1=="changeset:" {
yann@1888
    18
                prev=rev;
yann@1888
    19
                split($2,a,":");
yann@1888
    20
                rev=a[1];
yann@1888
    21
            }
yann@1888
    22
            $0~/^summary:[[:space:]]+'"${branch}: (bump|update) version to ${version}\+hg"'$/ {
yann@1888
    23
                printf( "%d\n", prev );
yann@1888
    24
            }
yann@1888
    25
            '
yann@1888
    26
     )"
yann@1888
    27
yann@1888
    28
i=0
yann@1888
    29
hg -R "${repos}" log -b "${branch}" -r "${r1}:tip" --template '{rev}\n'    \
yann@1888
    30
|while read rev; do
yann@1888
    31
    p="$( printf "%03d" ${i} )"
yann@1888
    32
    i=$((i+1))
yann@1888
    33
    if [ $( ls -1 "${pdir}/${p}-"*.patch 2>/dev/null |wc -l ) -ne 0 ]; then
yann@1888
    34
        continue
yann@1888
    35
    fi
yann@1888
    36
    plog=$( hg -R "${repos}" log -r ${rev} --template '{desc|firstline}\n'  \
yann@2403
    37
            |sed -r -e 's,[^[:alnum:]],_,g; s/_+/_/g;'                      \
yann@1888
    38
          )
yann@1888
    39
    pname="${p}-${plog}.patch"
yann@1888
    40
    printf "Revision '%d' --> '%s'\n" ${rev} "${pname}"
yann@1888
    41
    hg -R "${repos}" diff -c ${rev} --color=never >"${pdir}/${pname}"
yann@1888
    42
    pdate="$( hg -R "${repos}" log -r ${rev} --template '{date|isodate}\n' )"
yann@1888
    43
    touch -d "${pdate}" "${pdir}/${pname}"
yann@1888
    44
done