Tizen 2.1 base
[sdk/emulator/qemu.git] / gl / mesa / src / gallium / state_trackers / d3d1x / mstools / download-mstools
1 #!/bin/bash
2 ok=1
3 for i in fxc.exe D3DCompiler_43.dll d3dx9_43.dll d3dx10_43.dll d3dx11_43.dll; do
4         if ! test -e "$i"; then
5                 ok=
6         fi
7 done
8
9 if test -n "$ok"; then
10         exit 0
11 fi
12
13 echo "To compile HLSL shaders, the Microsoft HLSL compiler needs to be downloaded."
14 echo
15 echo "Downloading Microsoft DirectX June 2010 SDK and extracting files..."
16 echo "Please wait, this will need to download and unpack a 600 MB file..."
17 echo
18 echo "The contribution of a free HLSL compiler would be greatly appreciated!"
19 echo
20
21 ok=1
22 if ! which wget >/dev/null; then
23         echo "Error: wget is required to download the files"
24         echo "On Debian or Ubuntu, run the following command to install it:"
25         echo "sudo apt-get install wget"
26         echo
27         ok=
28 fi
29
30 if ! which cabextract >/dev/null; then
31         echo "Error: cabextract is required to unpack the files"
32         echo "On Debian or Ubuntu, run the following command to install it:"
33         echo "sudo apt-get install cabextract"
34         echo
35         ok=
36 fi
37
38 if test -z "$ok"; then
39         exit 1
40 fi
41
42 dxsdk_file="DXSDK_Jun10.exe"
43 dxsdk_url="http://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe"
44 dxsdk_size=599452800
45
46 fxc_path="DXSDK/Utilities/bin/x86/fxc.exe"
47 d3dcompiler_cab_path="DXSDK/Redist/Jun2010_D3DCompiler_43_x86.cab"
48 d3dx9_cab_path="DXSDK/Redist/Jun2010_d3dx9_43_x86.cab"
49 d3dx10_cab_path="DXSDK/Redist/Jun2010_d3dx10_43_x86.cab"
50 d3dx11_cab_path="DXSDK/Redist/Jun2010_d3dx11_43_x86.cab"
51
52 if test "$(stat -c '%s' "$dxsdk_file" 2>/dev/null)" != $dxsdk_size; then
53         wget --continue "$dxsdk_url"
54         if test "$(stat -c '%s' "$dxsdk_file" 2>/dev/null)" != $dxsdk_size; then
55                 echo "Failed to download DirectX SDK: expected $dxsdk_file with size $dxsdk_size"
56                 echo "Download manually from $dxsdk_url"
57                 exit 1
58         fi
59 fi
60
61 for i in "$fxc_path" "$d3dcompiler_cab_path" "$d3dx9_cab_path" "$d3dx10_cab_path" "$d3dx11_cab_path"; do
62         if ! test -e "$i"; then
63                 echo "Please wait, this may take several minutes because a 600 MB archive may need to be fully decompressed..."
64                 cabextract -F "$i" "$dxsdk_file"
65         fi
66 done
67
68 for i in "$d3dcompiler_cab_path" "$d3dx9_cab_path" "$d3dx10_cab_path" "$d3dx11_cab_path"; do
69         cabextract -F "*.dll" "$i"
70 done
71
72 /bin/cp -dpf "$fxc_path" .
73