| 1 | #!/bin/sh |
| 2 | |
| 3 | cat > sdksyms.c << EOF |
| 4 | /* This file is automatically generated by sdksyms.sh. */ |
| 5 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
| 6 | |
| 7 | #ifdef HAVE_XORG_CONFIG_H |
| 8 | #include <xorg-config.h> |
| 9 | #endif |
| 10 | |
| 11 | |
| 12 | /* These must be included first */ |
| 13 | #include "misc.h" |
| 14 | #include "miscstruct.h" |
| 15 | |
| 16 | |
| 17 | /* render/Makefile.am */ |
| 18 | #include "picture.h" |
| 19 | #include "mipict.h" |
| 20 | #include "glyphstr.h" |
| 21 | #include "picturestr.h" |
| 22 | |
| 23 | |
| 24 | /* fb/Makefile.am -- module */ |
| 25 | /* |
| 26 | #include "fb.h" |
| 27 | #include "fbrop.h" |
| 28 | #include "fboverlay.h" |
| 29 | #include "wfbrename.h" |
| 30 | #include "fbpict.h" |
| 31 | */ |
| 32 | |
| 33 | |
| 34 | /* miext/shadow/Makefile.am -- module */ |
| 35 | /* |
| 36 | #include "shadow.h" |
| 37 | */ |
| 38 | |
| 39 | |
| 40 | /* miext/damage/Makefile.am */ |
| 41 | #include "damage.h" |
| 42 | #include "damagestr.h" |
| 43 | |
| 44 | /* miext/sync/Makefile.am */ |
| 45 | #include "misync.h" |
| 46 | #include "misyncstr.h" |
| 47 | #if HAVE_XSHMFENCE |
| 48 | #include "misyncshm.h" |
| 49 | #endif |
| 50 | |
| 51 | /* Xext/Makefile.am -- half is module, half is builtin */ |
| 52 | #ifdef XV |
| 53 | #include "xvdix.h" |
| 54 | #include "xvmcext.h" |
| 55 | #endif |
| 56 | #include "geext.h" |
| 57 | #include "geint.h" |
| 58 | #ifdef MITSHM |
| 59 | #include "shmint.h" |
| 60 | #endif |
| 61 | #include "syncsdk.h" |
| 62 | #if XINERAMA |
| 63 | # include "panoramiXsrv.h" |
| 64 | # include "panoramiX.h" |
| 65 | #endif |
| 66 | |
| 67 | |
| 68 | /* hw/xfree86/int10/Makefile.am -- module */ |
| 69 | /* |
| 70 | #include "xf86int10.h" |
| 71 | */ |
| 72 | |
| 73 | |
| 74 | /* hw/xfree86/i2c/Makefile.am -- "mostly" modules */ |
| 75 | #include "xf86i2c.h" |
| 76 | /* |
| 77 | #include "bt829.h" |
| 78 | #include "fi1236.h" |
| 79 | #include "msp3430.h" |
| 80 | #include "tda8425.h" |
| 81 | #include "tda9850.h" |
| 82 | #include "tda9885.h" |
| 83 | #include "uda1380.h" |
| 84 | #include "i2c_def.h" |
| 85 | */ |
| 86 | |
| 87 | |
| 88 | /* hw/xfree86/modes/Makefile.am */ |
| 89 | #include "xf86Crtc.h" |
| 90 | #include "xf86Modes.h" |
| 91 | #include "xf86RandR12.h" |
| 92 | /* #include "xf86Rename.h" */ |
| 93 | |
| 94 | |
| 95 | /* hw/xfree86/ddc/Makefile.am */ |
| 96 | #include "edid.h" |
| 97 | #include "xf86DDC.h" |
| 98 | |
| 99 | |
| 100 | /* hw/xfree86/dri2/Makefile.am -- module */ |
| 101 | #if DRI2 |
| 102 | # include "dri2.h" |
| 103 | #endif |
| 104 | |
| 105 | # include "dri3.h" |
| 106 | |
| 107 | /* hw/xfree86/vgahw/Makefile.am -- module */ |
| 108 | /* |
| 109 | #include "vgaHW.h" |
| 110 | */ |
| 111 | |
| 112 | |
| 113 | /* hw/xfree86/fbdevhw/Makefile.am -- module */ |
| 114 | /* |
| 115 | #include "fbdevhw.h" |
| 116 | */ |
| 117 | |
| 118 | |
| 119 | /* hw/xfree86/common/Makefile.am */ |
| 120 | #include "compiler.h" |
| 121 | #include "fourcc.h" |
| 122 | #include "xf86.h" |
| 123 | #include "xf86Module.h" |
| 124 | #include "xf86Opt.h" |
| 125 | #ifdef XSERVER_LIBPCIACCESS |
| 126 | #include "xf86VGAarbiter.h" |
| 127 | #endif |
| 128 | #include "xf86Priv.h" |
| 129 | #include "xf86Privstr.h" |
| 130 | #include "xf86cmap.h" |
| 131 | #include "xf86fbman.h" |
| 132 | #include "xf86str.h" |
| 133 | #include "xf86Xinput.h" |
| 134 | #include "xisb.h" |
| 135 | #if XV |
| 136 | # include "xf86xv.h" |
| 137 | # include "xf86xvmc.h" |
| 138 | # include "xf86xvpriv.h" |
| 139 | #endif |
| 140 | #if XF86VIDMODE |
| 141 | # include "vidmodeproc.h" |
| 142 | #endif |
| 143 | #include "xorgVersion.h" |
| 144 | #if defined(__sparc__) || defined(__sparc) |
| 145 | # include "xf86sbusBus.h" |
| 146 | #endif |
| 147 | |
| 148 | |
| 149 | /* hw/xfree86/ramdac/Makefile.am */ |
| 150 | #include "BT.h" |
| 151 | #include "IBM.h" |
| 152 | #include "TI.h" |
| 153 | #include "xf86Cursor.h" |
| 154 | #include "xf86RamDac.h" |
| 155 | |
| 156 | |
| 157 | /* hw/xfree86/shadowfb/Makefile.am -- module */ |
| 158 | /* |
| 159 | #include "shadowfb.h" |
| 160 | */ |
| 161 | |
| 162 | |
| 163 | /* hw/xfree86/os-support/solaris/Makefile.am */ |
| 164 | #if defined(sun386) |
| 165 | # include "agpgart.h" |
| 166 | #endif |
| 167 | |
| 168 | |
| 169 | /* hw/xfree86/os-support/Makefile.am */ |
| 170 | #include "xf86_OSproc.h" |
| 171 | #include "xf86_OSlib.h" |
| 172 | |
| 173 | |
| 174 | /* hw/xfree86/os-support/bus/Makefile.am */ |
| 175 | #ifdef XSERVER_LIBPCIACCESS |
| 176 | # include "xf86Pci.h" |
| 177 | #endif |
| 178 | #if defined(__sparc__) || defined(__sparc) |
| 179 | # include "xf86Sbus.h" |
| 180 | #endif |
| 181 | |
| 182 | |
| 183 | /* hw/xfree86/dixmods/extmod/Makefile.am -- module */ |
| 184 | #ifdef XFreeXDGA |
| 185 | #include "dgaproc.h" |
| 186 | #endif |
| 187 | |
| 188 | |
| 189 | /* hw/xfree86/parser/Makefile.am */ |
| 190 | #include "xf86Parser.h" |
| 191 | #include "xf86Optrec.h" |
| 192 | |
| 193 | |
| 194 | /* hw/xfree86/vbe/Makefile.am -- module */ |
| 195 | /* |
| 196 | #include "vbe.h" |
| 197 | #include "vbeModes.h" |
| 198 | */ |
| 199 | |
| 200 | |
| 201 | /* hw/xfree86/dri/Makefile.am -- module */ |
| 202 | #if XF86DRI |
| 203 | # include "dri.h" |
| 204 | # include "sarea.h" |
| 205 | # include "dristruct.h" |
| 206 | #endif |
| 207 | |
| 208 | |
| 209 | /* mi/Makefile.am */ |
| 210 | #include "micmap.h" |
| 211 | #include "miline.h" |
| 212 | #include "mipointer.h" |
| 213 | #include "mi.h" |
| 214 | #include "migc.h" |
| 215 | #include "mipointrst.h" |
| 216 | #include "mizerarc.h" |
| 217 | #include "micoord.h" |
| 218 | #include "mifillarc.h" |
| 219 | #include "mispans.h" |
| 220 | #include "miwideline.h" |
| 221 | #include "mistruct.h" |
| 222 | #include "mifpoly.h" |
| 223 | #include "mioverlay.h" |
| 224 | |
| 225 | |
| 226 | /* randr/Makefile.am */ |
| 227 | #include "randrstr.h" |
| 228 | #include "rrtransform.h" |
| 229 | |
| 230 | |
| 231 | /* dbe/Makefile.am -- module */ |
| 232 | #ifdef DBE |
| 233 | #include "dbestruct.h" |
| 234 | #endif |
| 235 | |
| 236 | |
| 237 | /* exa/Makefile.am -- module */ |
| 238 | /* |
| 239 | #include "exa.h" |
| 240 | */ |
| 241 | |
| 242 | #ifdef COMPOSITE |
| 243 | #include "compositeext.h" |
| 244 | #endif |
| 245 | |
| 246 | /* xfixes/Makefile.am */ |
| 247 | #include "xfixes.h" |
| 248 | |
| 249 | |
| 250 | /* include/Makefile.am */ |
| 251 | #include "XIstubs.h" |
| 252 | #include "Xprintf.h" |
| 253 | #include "closestr.h" |
| 254 | #include "closure.h" |
| 255 | #include "colormap.h" |
| 256 | #include "colormapst.h" |
| 257 | #include "hotplug.h" |
| 258 | #include "client.h" |
| 259 | #include "cursor.h" |
| 260 | #include "cursorstr.h" |
| 261 | #include "dix.h" |
| 262 | #include "dixaccess.h" |
| 263 | #include "dixevents.h" |
| 264 | #include "dixfont.h" |
| 265 | #include "dixfontstr.h" |
| 266 | #include "dixfontstubs.h" |
| 267 | #include "dixgrabs.h" |
| 268 | #include "dixstruct.h" |
| 269 | #include "exevents.h" |
| 270 | #include "extension.h" |
| 271 | #include "extnsionst.h" |
| 272 | #include "gc.h" |
| 273 | #include "gcstruct.h" |
| 274 | #include "globals.h" |
| 275 | #include "input.h" |
| 276 | #include "inputstr.h" |
| 277 | /* already included */ |
| 278 | /* |
| 279 | #include "misc.h" |
| 280 | #include "miscstruct.h" |
| 281 | */ |
| 282 | #include "opaque.h" |
| 283 | #include "os.h" |
| 284 | #include "pixmap.h" |
| 285 | #include "pixmapstr.h" |
| 286 | #include "privates.h" |
| 287 | #include "property.h" |
| 288 | #include "propertyst.h" |
| 289 | #include "ptrveloc.h" |
| 290 | #include "region.h" |
| 291 | #include "regionstr.h" |
| 292 | #include "registry.h" |
| 293 | #include "resource.h" |
| 294 | #include "rgb.h" |
| 295 | #include "screenint.h" |
| 296 | #include "scrnintstr.h" |
| 297 | #include "selection.h" |
| 298 | #include "servermd.h" |
| 299 | #include "site.h" |
| 300 | #include "swaprep.h" |
| 301 | #include "swapreq.h" |
| 302 | #include "validate.h" |
| 303 | #include "window.h" |
| 304 | #include "windowstr.h" |
| 305 | #include "xace.h" |
| 306 | #include "xkbfile.h" |
| 307 | #include "xkbsrv.h" |
| 308 | #include "xkbstr.h" |
| 309 | #include "xkbrules.h" |
| 310 | #include "xserver-properties.h" |
| 311 | |
| 312 | EOF |
| 313 | |
| 314 | topdir=$1 |
| 315 | shift |
| 316 | LC_ALL=C |
| 317 | export LC_ALL |
| 318 | ${CPP:-cpp} "$@" sdksyms.c > /dev/null || exit $? |
| 319 | ${CPP:-cpp} "$@" sdksyms.c | ${AWK:-awk} -v topdir=$topdir ' |
| 320 | BEGIN { |
| 321 | sdk = 0; |
| 322 | print("/*"); |
| 323 | print(" * These symbols are referenced to ensure they"); |
| 324 | print(" * will be available in the X Server binary."); |
| 325 | print(" */"); |
| 326 | printf("/* topdir=%s */\n", topdir); |
| 327 | print("_X_HIDDEN void *xorg_symbols[] = {"); |
| 328 | |
| 329 | printf("sdksyms.c:") > "sdksyms.dep"; |
| 330 | } |
| 331 | /^# [0-9]+ "/ { |
| 332 | # Process text after a include in a relative path or when the |
| 333 | # processed file has a basename matching $top_srcdir. |
| 334 | # Note that indexing starts at 1; 0 means no match, and there |
| 335 | # is a starting ". |
| 336 | sdk = $3 !~ /^"\// || index($3, topdir) == 2; |
| 337 | |
| 338 | if (sdk && $3 ~ /\.h"$/) { |
| 339 | # remove quotes |
| 340 | gsub(/"/, "", $3); |
| 341 | line = $2; |
| 342 | header = $3; |
| 343 | if (! headers[$3]) { |
| 344 | printf(" \\\n %s", $3) >> "sdksyms.dep"; |
| 345 | headers[$3] = 1; |
| 346 | } |
| 347 | } |
| 348 | next; |
| 349 | } |
| 350 | |
| 351 | /^extern[ ]/ { |
| 352 | if (sdk) { |
| 353 | n = 3; |
| 354 | |
| 355 | # skip attribute, if any |
| 356 | while ($n ~ /^(__attribute__|__global)/ || |
| 357 | # skip modifiers, if any |
| 358 | $n ~ /^\*?(unsigned|const|volatile|struct|_X_EXPORT)$/ || |
| 359 | # skip pointer |
| 360 | $n ~ /^[a-zA-Z0-9_]*\*$/) |
| 361 | n++; |
| 362 | |
| 363 | # type specifier may not be set, as in |
| 364 | # extern _X_EXPORT unsigned name(...) |
| 365 | if ($n !~ /[^a-zA-Z0-9_]/) |
| 366 | n++; |
| 367 | |
| 368 | # go back if we are at the parameter list already |
| 369 | if ($n ~ /^[(]([^*].*)?$/) |
| 370 | n--; |
| 371 | |
| 372 | # match |
| 373 | # extern _X_EXPORT type (* name[])(...) |
| 374 | if ($n ~ /^[^a-zA-Z0-9_]+$/) |
| 375 | n++; |
| 376 | |
| 377 | # match |
| 378 | # extern _X_EXPORT const name *const ... |
| 379 | if ($n ~ /^([^a-zA-Z0-9_]+)?const$/) |
| 380 | n++; |
| 381 | |
| 382 | # actual name may be in the next line, as in |
| 383 | # extern _X_EXPORT type |
| 384 | # possibly ending with a * |
| 385 | # name(...) |
| 386 | if ($n == "" || $n ~ /^\*+$/) { |
| 387 | getline; |
| 388 | n = 1; |
| 389 | # indent may have inserted a blank link |
| 390 | if ($0 == "") |
| 391 | getline; |
| 392 | } |
| 393 | |
| 394 | # dont modify $0 or $n |
| 395 | symbol = $n; |
| 396 | |
| 397 | # remove starting non word chars |
| 398 | sub(/^[^a-zA-Z0-9_]+/, "",symbol); |
| 399 | |
| 400 | # remove from first non word to end of line |
| 401 | sub(/[^a-zA-Z0-9_].*/, "", symbol); |
| 402 | |
| 403 | #print; |
| 404 | printf(" (void *) &%-50s /* %s:%s */\n", symbol ",", header, line); |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | { |
| 409 | line++; |
| 410 | } |
| 411 | |
| 412 | END { |
| 413 | print("};"); |
| 414 | |
| 415 | print("") >> "sdksyms.dep"; |
| 416 | }' > _sdksyms.c |
| 417 | |
| 418 | STATUS=$? |
| 419 | |
| 420 | cat _sdksyms.c >> sdksyms.c |
| 421 | rm _sdksyms.c |
| 422 | |
| 423 | [ $? != 0 ] && exit $? |
| 424 | |
| 425 | exit $STATUS |