--- sdksyms.sh.orig 2014-11-25 16:16:47.000000000 -0500 +++ sdksyms.sh 2014-11-25 16:18:15.000000000 -0500 @@ -1,5 +1,15 @@ #!/bin/sh +# i didn't decide to remove sdksym.c and create .sh: X11R7.6 comes that way +# i found problems stopping build and fixed things that stop build or Xorg bin +# had &void as reference, had included XV if !XV, had n missing symbols + +# top of file makes list of .h > file, cat file | cpp | script +# (cpp outputs #include lines and contest of files.h, in a format) +# the AWK script further below: +# 1) for each #include "header.h", add to sdksyms.dep header list +# 2) for each "extern type ident" print just ident for symbol tab + cat > sdksyms.c << EOF /* This file is automatically generated by sdksyms.sh. */ #pragma GCC diagnostic ignored "-Wdeprecated-declarations" @@ -29,13 +39,13 @@ #include "fboverlay.h" #include "wfbrename.h" #include "fbpict.h" - */ +*/ /* miext/shadow/Makefile.am -- module */ /* #include "shadow.h" - */ +*/ /* miext/damage/Makefile.am */ @@ -47,7 +57,7 @@ /* #include "xvdix.h" #include "xvmcext.h" - */ +*/ #include "geext.h" #include "geint.h" #include "shmint.h" @@ -60,7 +70,7 @@ /* hw/xfree86/int10/Makefile.am -- module */ /* #include "xf86int10.h" - */ +*/ /* hw/xfree86/i2c/Makefile.am -- "mostly" modules */ @@ -74,7 +84,7 @@ #include "tda9885.h" #include "uda1380.h" #include "i2c_def.h" - */ +*/ /* hw/xfree86/modes/Makefile.am */ @@ -94,19 +104,19 @@ #if DRI2 # include "dri2.h" #endif - */ +*/ /* hw/xfree86/vgahw/Makefile.am -- module */ /* #include "vgaHW.h" - */ +*/ /* hw/xfree86/fbdevhw/Makefile.am -- module */ /* #include "fbdevhw.h" - */ +*/ /* hw/xfree86/common/Makefile.am */ @@ -125,16 +135,17 @@ #include "xf86VGAarbiter.h" #include "xisb.h" #if XV -# include "xf86xv.h" -# include "xf86xvmc.h" -# include "xf86xvpriv.h" +#include "xf86xv.h" +#include "xf86xvmc.h" +#include "xf86xvpriv.h" +/* currently, "xvdix.h" is indirectly included by others */ #endif /* XF86VidMode code is in libextmod module */ /* #if XF86VIDMODE # include "vidmodeproc.h" #endif - */ +*/ #include "xorgVersion.h" #if defined(__sparc__) || defined(__sparc) # include "xf86sbusBus.h" @@ -152,7 +163,7 @@ /* hw/xfree86/shadowfb/Makefile.am -- module */ /* #include "shadowfb.h" - */ +*/ /* hw/xfree86/os-support/solaris/Makefile.am */ @@ -179,13 +190,13 @@ #include "xaalocal.h" #include "xaarop.h" #include "xaaWrapper.h" - */ +*/ /* hw/xfree86/dixmods/extmod/Makefile.am -- module */ /* #include "dgaproc.h" - */ +*/ /* hw/xfree86/parser/Makefile.am */ @@ -197,7 +208,7 @@ /* #include "vbe.h" #include "vbeModes.h" - */ +*/ /* hw/xfree86/dri/Makefile.am -- module */ @@ -207,13 +218,13 @@ # include "sarea.h" # include "dristruct.h" #endif - */ +*/ /* hw/xfree86/xf8_16bpp/Makefile.am -- module */ /* #include "cfb8_16.h" - */ +*/ /* mi/Makefile.am */ @@ -242,13 +253,13 @@ /* dbe/Makefile.am -- module */ /* #include "dbestruct.h" - */ +*/ /* exa/Makefile.am -- module */ /* #include "exa.h" - */ +*/ /* xfixes/Makefile.am */ @@ -286,7 +297,7 @@ /* #include "misc.h" #include "miscstruct.h" - */ +*/ #include "opaque.h" #include "os.h" #include "pixmap.h" @@ -317,96 +328,162 @@ #include "xkbrules.h" #include "xserver-properties.h" +#if XV +#define XVFUNDONT +#endif +#ifndef XVFUNDONT +/* for xf86XVClipVideoHelper xf86Ctrc.c */ +#include "../../../include/miscstruct.h" +#include +#include +#include +extern _X_EXPORT Bool +xf86XVClipVideoHelper( + BoxPtr dst, + INT32 *xa, + INT32 *xb, + INT32 *ya, + INT32 *yb, + RegionPtr reg, + INT32 width, + INT32 height +){return 0;} +#endif + EOF topdir=$1 shift LC_ALL=C export LC_ALL -${CPP:-cpp} "$@" -DXorgLoader sdksyms.c | ${AWK:-awk} -v topdir=$topdir ' -BEGIN { - sdk = 0; - print("/*"); - print(" * These symbols are referenced to ensure they"); - print(" * will be available in the X Server binary."); - print(" */"); - printf("/* topdir=%s */\n", topdir); - print("_X_HIDDEN void *xorg_symbols[] = {"); - printf("sdksyms.c:") > "sdksyms.dep"; +[ -n "$DEBUG" ] && { ${CPP:-cpp} "$@" sdksyms.c > sdksyms.sh.in || true ; } + +rm sdksyms.skipped 2>>/dev/null || true + +# we need separable expressions RS="^#|extern|;" and gsub {..} -> ; does that +# the nesting is do delete body of "extern static inline fun{body;{{{}};...}" +# awk removes RS+FS separators we "need" as tags, so add tags !<> + +${CPP:-cpp} "$@" sdksyms.c | \ +${AWK:-awk} \ +'BEGIN{RS="pheebor";FS="borphee"} +{ + nesting=7 ; while(--nesting >= 0) + while(gsub("[{][^{}]*[}]",";")>=1); + print +}' | \ +${AWK:-awk} '{ gsub("#","#!");gsub("extern","<> ") ; print}' | \ +${AWK:-awk} -v topdir=$topdir -v xv="$XV" ' + +BEGIN { + sdk = 0 + print "/*" + print " * These symbols are referenced to ensure they" + print " * will be available in the X Server binary." + print " */" + print "/* topdir=" topdir " */" + print "_X_HIDDEN void *xorg_symbols[] = {" + printf "sdksyms.c:" > "sdksyms.dep" + # split on extern < but leaves us a clue > + RS="#|;|<" } -/^# [0-9]+ "/ { - # Process text after a include in a relative path or when the - # processed file has a basename matching $top_srcdir. - # Note that indexing starts at 1; 0 means no match, and there - # is a starting ". - sdk = $3 !~ /^"\// || index($3, topdir) == 2; - - if (sdk && $3 ~ /\.h"$/) { - # remove quotes - gsub(/"/, "", $3); - if (! headers[$3]) { - printf(" \\\n %s", $3) >> "sdksyms.dep"; - headers[$3] = 1; - } + +# $1 ~ /#/ # ! + +/^[!] [[:digit:]]+ "/ { + + # Process text after a include in a relative path or when the + # processed file has a basename matching $top_srcdir. + # Note that indexing starts at 1; 0 means no match, and there + # is a starting ". + + keepok=0 ; if( sdk && lastline+1==NR ) { keepok=1 } ; lastline=NR + + if( !xv && $0 ~ "kxv|xf86xv|xf86xvmc|xf86xvpriv|xvmodproc|xvdisp|xvdix|xvmcext" ) next + + sdk = $3 !~ /^"\// || index($3, topdir) == 2 + + if (sdk && $3 ~ /\.h"$/) { + # remove quotes + gsub(/"/, "", $3) + if (! headers[$3]) { + printf " \\\n %s", $3 >> "sdksyms.dep" + headers[$3] = 1 } + } + if( keepok ) sdk=1 + next } -/^extern[ ]/ { - if (sdk) { - n = 3; - - # skip attribute, if any - while ($n ~ /^(__attribute__|__global)/ || - # skip modifiers, if any - $n ~ /^\*?(unsigned|const|volatile|struct)$/ || - # skip pointer - $n ~ /\*$/) - n++; - - # type specifier may not be set, as in - # extern _X_EXPORT unsigned name(...) - if ($n !~ /[^a-zA-Z0-9_]/) - n++; - - # match - # extern _X_EXPORT type (* name[])(...) - if ($n ~ /^[^a-zA-Z0-9_]+$/) - n++; - - # match - # extern _X_EXPORT const name *const ... - if ($n ~ /^([^a-zA-Z0-9_]+)?const$/) - n++; - - # actual name may be in the next line, as in - # extern _X_EXPORT type - # possibly ending with a * - # name(...) - if ($n == "" || $n ~ /^\*+$/) { - getline; - n = 1; - } - - # dont modify $0 or $n - symbol = $n; +# due to RS, multiline is a breeze, why RS is chosen as +{ + if(!sdk) next ; gsub("\n"," ") + print "NR=" NR " " $0 >> "x1" +} + +# see notes +# $0 ~ /[[:space:]]*extern[[:space:]]+/ # > + +/>/{ - # remove starting non word chars - sub(/^[^a-zA-Z0-9_]+/, "",symbol); + # if( !sdk ) next - # remove from first non word to end of line - sub(/[^a-zA-Z0-9_].*/, "", symbol); + if( !xv && $0 ~ "xf86XVClipVideoHelper|xf86FindXvOptions" ) next - #print; - printf(" (void *) &%s,\n", symbol); + # remove what we dont want to see and note FS re-splits $0 automatically + gsub("__attribute.*","") + gsub("[*&;]","") + gsub("[(]"," ( ") + gsub("[)]"," ) ") + gsub("[\\[].*[\\]]","") + gsub(","," , ") + pair=0 ; nn=NF+1 + while( --nn > 0 ) { + # variable ident + if ( nn == NF ) + if ( $nn ~ "^_[[:alpha:]][,[:alnum:]_]*$|^[[:alpha:]][,[:alnum:]_]*$" ) { + if( ! seenit[$nn] ) { + if( comma == 1 ) print "," +if($nn=="if") print $0 >> "x3" + printf " (void *) &%s", $nn + comma=1 ; seenit[$nn]=1 + } + while ( nn > 1 ) { + --nn + if ( $nn == "," ) { --nn } else { FS=" " ; break } + if ( $nn ~ "^_[[:alpha:]][[:alnum:]_]*$|^[[:alpha:]][[:alnum:]_]*$" ) { + if(!seenit[$nn]) { +if($nn=="if") print $0 >> "x3" + print "," ; printf " (void *) &%s", $nn ; seenit[$nn]=1 + } + } + } + break } + # fun ident + if( $nn == ")") --pair + if( $nn == "(") ++pair + if( $nn == "(" && pair == 0 ) { + --nn + # ex. (*ident)(parms_opt) + if( $nn == ")") --nn + if ( $nn ~ "^_[[:alpha:]][[:alnum:]_]*$|^[[:alpha:]][[:alnum:]_]*$" ) + { + if(!seenit[$nn]) { +if($nn=="if") print $0 >> "x3" + if(comma == 1) print "," ; printf " (void *) &%s", $nn ; comma=1 + seenit[$nn]=1 + } + } + else { print >> "sdksyms.skipped" } + } + } } -END { - print("};"); +END { print last ; print "};" ; print "" >> "sdksyms.dep" } - print("") >> "sdksyms.dep"; -}' > _sdksyms.c +' > _sdksyms.c STATUS=$? @@ -416,3 +493,18 @@ [ $? != 0 ] && exit $? exit $STATUS + +X11R7.6/xorg/xorg-server-1.9.3/hw/xfree86/loader/sdksyms.sh + +changelog: + +sdksyms.sh (1.9.3.1) beta; urgency=medium + * note an sdksyms.c that is correct may have been provided by distros + this refers to a clean download and make of tarballs on x.org + * 128 syms not found, void identifiers error, trailing "," error, fixed + * did not test if filtering syms by cpp's header nums is firm policy + appears more reasonable exporting xf86qsort, and is as Xorg had it, + can easily be "full" with the if(! sdk) line removed (is that wise?) + + -- John Hendrickson Mon, 17 Nov 2014 22:53:12 -0500 +