1#!/bin/bash 2 3set -e 4 5WINE_DIR=$1 6 7if test -z $WINE_DIR; then 8 echo "Usage: wine-impot.sh wine_dir" 9 exit 1 10fi 11 12import_header() { 13 dstfile=$2/$1 14 srcfile=$WINE_DIR/include/$1 15 rm -f $dstfile 16 unicode_fix= 17 if test -n "$(grep WINELIB_NAME_AW\\\|DECL_WINELIB_TYPE_AW $srcfile)"; then 18 unicode_fix="yes" 19 echo '#include <_mingw_unicode.h>' >>$dstfile 20 fi 21 if test -n "$(grep -w INTERFACE $srcfile)"; then 22 echo '#undef INTERFACE' >>$dstfile 23 fi 24 cat $srcfile >>$dstfile 25 if test -n "$(grep WINELIB_NAME_AW\\\|DECL_WINELIB_TYPE_AW $srcfile)"; then 26 sed -i 's/\bWINELIB_NAME_AW\b/__MINGW_NAME_AW/g' $dstfile 27 sed -i 's/\bDECL_WINELIB_TYPE_AW\b/__MINGW_TYPEDEF_AW/g' $dstfile 28 fi 29 sed -i 's/\bBOOL /WINBOOL /g' $dstfile 30 sed -i 's/\bBOOL\b/WINBOOL/g' $dstfile 31 sed -i 's/DECLSPEC_HIDDEN//g' $dstfile 32} 33 34import_idl() { 35 dstfile=$2/$1 36 srcfile=$WINE_DIR/include/$1 37 cp $srcfile $dstfile 38 39 # HACK: 40 sed -i 's/cpp_quote\(.*\)\bBOOL\b/cpp_quote\1WINBOOL/' $dstfile 41 sed -i 's/cpp_quote\(.*\)\bBOOL\b/cpp_quote\1WINBOOL/' $dstfile 42 sed -i 's/cpp_quote\(.*\)\bBOOL\b/cpp_quote\1WINBOOL/' $dstfile 43} 44 45# headers 46for f in \ 47 corerror.h \ 48 mscat.h \ 49 propkey.h \ 50 propkeydef.h \ 51 rpcsal.h \ 52 t2embapi.h \ 53 uiautomation.h \ 54 uiautomationcoreapi.h \ 55 winhttp.h \ 56 winineti.h; do 57 import_header $f include 58done 59 60# IDLs 61for f in \ 62 ctfutb \ 63 devicetopology \ 64 downloadmgr \ 65 drmexternals \ 66 endpointvolume \ 67 fusion \ 68 icftypes \ 69 mmdeviceapi \ 70 mscoree \ 71 msctf \ 72 netfw \ 73 netlistmgr \ 74 objectarray \ 75 optary \ 76 taskschd \ 77 uiautomationclient \ 78 uiautomationcore \ 79 urlhist \ 80 wmdrmsdk \ 81 wmsbuffer \ 82 wmsdkidl \ 83 wpcapi \ 84 xmllite; do 85 import_idl $f.idl include 86done 87 88# DirectX headers 89for f in \ 90 amaudio.h \ 91 audevcod.h \ 92 d3d.h \ 93 d3d10_1shader.h \ 94 d3d10effect.h \ 95 d3d10misc.h \ 96 d3d10shader.h \ 97 d3d11shader.h \ 98 d3d8.h \ 99 d3d8caps.h \ 100 d3d8types.h \ 101 d3d9.h \ 102 d3d9caps.h \ 103 d3d9types.h \ 104 d3dcaps.h \ 105 d3dcompiler.h \ 106 d3dhal.h \ 107 d3drm.h \ 108 d3drmdef.h \ 109 d3drmobj.h \ 110 d3dtypes.h \ 111 d3dx9.h \ 112 d3dx9anim.h \ 113 d3dx9core.h \ 114 d3dx9effect.h \ 115 d3dx9math.h \ 116 d3dx9math.inl \ 117 d3dx9mesh.h \ 118 d3dx9shader.h \ 119 d3dx9shape.h \ 120 d3dx9tex.h \ 121 d3dx9xof.h \ 122 d3dvec.inl \ 123 dls1.h \ 124 dls2.h \ 125 dmerror.h \ 126 dmo.h \ 127 dmoreg.h \ 128 dmort.h \ 129 dmplugin.h \ 130 dmusbuff.h \ 131 dmusicc.h \ 132 dmusicf.h \ 133 dmusici.h \ 134 dmusics.h \ 135 dpaddr.h \ 136 dplay.h \ 137 dplay8.h \ 138 dplobby.h \ 139 dplobby8.h \ 140 dpnathlp.h \ 141 dshow.h \ 142 dvdmedia.h \ 143 dxdiag.h \ 144 dxerr8.h \ 145 dxerr9.h \ 146 dxfile.h \ 147 errors.h \ 148 evcode.h \ 149 mediaerr.h \ 150 vfwmsgs.h \ 151 xinput.h; do 152 import_header $f direct-x/include 153done 154 155# DirectX IDLs 156for f in \ 157 amstream \ 158 amvideo \ 159 austream \ 160 d3d10 \ 161 d3d10_1 \ 162 d3d10sdklayers \ 163 d3d11 \ 164 d3d11_1 \ 165 d3d11_2 \ 166 d3d11_3 \ 167 d3d11_4 \ 168 d3d11sdklayers \ 169 d3dcommon \ 170 ddstream \ 171 dxgi \ 172 dxgi1_2 \ 173 dxgi1_3 \ 174 dxgi1_4 \ 175 dxgi1_5 \ 176 dxgi1_6 \ 177 mediaobj \ 178 dxgicommon \ 179 dxgiformat \ 180 dxgitype \ 181 mmstream \ 182 qedit; do 183 import_idl $f.idl direct-x/include 184done 185 186echo Import complete. You need to update headers generated from IDL files now: 187echo $ ./configure --with-widl --host=i686-w64-mingw32 188echo $ make 189echo $ make distclean 190 191