rungccxml.sh.in 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/bin/bash
  2. #
  3. # Runs gccxml on the wxWidgets include folder, in order to build the XML
  4. # file to fetch to ifacecheck to check the coherency of the wxWidgets
  5. # interface headers with the "real" ones.
  6. ## CONSTANTS
  7. ############
  8. gccxmloutput="wxapi.xml" # the file where we store the gccXML output
  9. preprocoutput="wxapi-preproc.txt" # the file where we store the preprocessor's #define values
  10. allheaders="/tmp/wx-all.h" # the header which includes all wx public headers (autogenerated)
  11. # the list of all wxWidgets public headers
  12. listcmd="ls wx/*.h wx/aui/*.h wx/html/*.h wx/protocol/*.h wx/richtext/*.h wx/stc/*.h wx/xml/*.h wx/xrc/*.h"
  13. ## MAIN
  14. #######
  15. if [[ ! -z "$1" ]]; then
  16. echo "This script does not accept arguments."
  17. echo "Usage: $0"
  18. echo "Creates a '$gccxmloutput' file which you can pass to ifacecheck."
  19. exit 1
  20. fi
  21. me=$(basename $0)
  22. current=$(pwd)/${0%%/$me} # current path
  23. gccxmloutput="$current/$gccxmloutput"
  24. cd @top_srcdir@/include # go to wx include folder
  25. # now filter it
  26. headerlist=`$listcmd | grep -v wxshl | grep -v wx_cw | grep -v setup | grep -v xti | grep -v dde.h | grep -v fmappriv`
  27. cd $current # return to the original path
  28. # create the header file to pass to gccxml
  29. echo "Creating the $allheaders dummy file which #includes all wxWidgets interface header files..."
  30. if [[ -f $allheaders ]]; then rm $allheaders; fi
  31. for f in $headerlist; do
  32. echo "#include <$f>" >> $allheaders
  33. done
  34. # filter the configure flags to pass to gccxml
  35. wx_top_builddir="@wx_top_builddir@"
  36. top_srcdir="@top_srcdir@"
  37. flags="@CPPFLAGS@ @CXXFLAGS@"
  38. # NOTE: it's important to define __WXDEBUG__ because some functions of wx
  39. # are declared (and thus parsed by gcc) only if that symbol is defined.
  40. # So we remove it from $flags (in case it's defined) and then readd it.
  41. flags=`echo "$flags" | sed -e 's/-pthread//g' | sed -e 's/__WXDEBUG__//g'`
  42. # append some other flags:
  43. flags="-I . -I @top_srcdir@/include $flags -D__WXDEBUG__ -D__WX@TOOLKIT@__ -DWXBUILDING $allheaders"
  44. # run gccxml with the same flag used for the real compilation of wx sources:
  45. echo "Running gccxml on the $allheaders file... results in $gccxmloutput"
  46. if [[ -f "$gccxmloutput" ]]; then rm $gccxmloutput; fi
  47. gccxml $flags -fxml=$gccxmloutput
  48. if [[ $? != 0 ]]; then
  49. echo "Errors running gccxml... aborting."
  50. exit
  51. fi
  52. # now get the list of the #defined values for wx headers, so that the result
  53. # can be passed to ifacecheck to aid the comparison
  54. echo "Running gccxml's preprocessor on the $allheaders file... results in $preprocoutput"
  55. gccxml -E -dM $flags >$preprocoutput
  56. if [[ $? != 0 ]]; then
  57. echo "Errors running gccxml preprocessor... aborting."
  58. exit
  59. fi
  60. # cleanup
  61. rm $allheaders