abicheck.sh portability

Nick Schermer nickschermer at gmail.com
Fri Mar 25 17:56:42 CET 2011

On Fri, Mar 25, 2011 at 4:29 PM, Guido Berhoerster <gber at opensuse.org> wrote:
> * Nick Schermer <nickschermer at gmail.com> [2011-03-25 11:36]:
>> The lines below work fine under linux for xfconf, ${CC:-cc} is not
>> working, since on linux it requires cpp, if $CC is defined it won't
>> work either, so maybe we can use $CPP to override the default cpp?
>> -DALL_FILES ${srcdir:-.}/xfconf.symbols | sed 's/ G_GNUC.*$//;s/
>> PRIVATE//;/^#.*$/d;/^$/d' | sort > expected-abi
>> nm -D -g -P .libs/libxfconf-0.so | awk '$2~/^[DRT]$/&&$1~/^[^_]/{print
>> $1}' | sort > actual-abi
>> diff -u expected-abi actual-abi && rm expected-abi actual-abi
> It fails because gcc does not like files with unknown filename
> extensions, it treats them as object files.
> I've verified that the following works with gcc 3.4.3, gcc 4.5.1,
> and SunStudio 12u1 on OpenIndiana b148 and openSUSE 11.4:
> ----
> #!/bin/sh
> trap 'rm expected-abi actual-abi' EXIT
> ${CPP:-cpp} -DINCLUDE_INTERNAL_SYMBOLS -DINCLUDE_VARIABLES -DALL_FILES ${srcdir:-.}/xfconf.symbols | sed 's/ G_GNUC.*$//;s/ PRIVATE//;/^ *$/d;/^#/d' | sort >expected-abi
> ${NM:-nm} -D -g -P .libs/libxfconf-0.so | awk '$2~/^[DRTG]$/&&$1~/^[^_]/{print $1}' >actual-abi
> diff -u expected-abi actual-abi

Looks good to me.
> ----
> Some notes:
> * the buildbot build script needs to set $CPP to "cc -E" for
>  SunStudio since it does not have an external preprocessor

You can set that yourself, if you add it in the environment and start
the slave from there it will pick it up.

> * "-E" is only necessary for cc/c89/c99 not cpp
> * nm output is sorted alphabetically by default

Not here, or atleast the sort order is different, so I added it.

> * diff and rm should not be chained so the temporary files get
>  deleted in any case

Yeah, using trap should be good.

I've pushed the changes to xfconf master for testing, will apply it to
other modules once it's tested a bit more.


More information about the Xfce4-dev mailing list