abicheck.sh portability
Guido Berhoerster
gber at opensuse.org
Fri Mar 25 16:29:00 CET 2011
* 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?
>
> ${CPP:-cpp} -E -DINCLUDE_INTERNAL_SYMBOLS -DINCLUDE_VARIABLES
> -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
----
Some notes:
* the buildbot build script needs to set $CPP to "cc -E" for
SunStudio since it does not have an external preprocessor
* "-E" is only necessary for cc/c89/c99 not cpp
* nm output is sorted alphabetically by default
* diff and rm should not be chained so the temporary files get
deleted in any case
--
Guido Berhoerster
More information about the Xfce4-dev
mailing list