summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/d3d1x/mstools/download-mstools
blob: 15a631718072ffe7a8c60845232447703c86cd15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
ok=1
for i in fxc.exe D3DCompiler_43.dll d3dx9_43.dll d3dx10_43.dll d3dx11_43.dll; do
	if ! test -e "$i"; then
		ok=
	fi
done

if test -n "$ok"; then
	exit 0
fi

echo "To compile HLSL shaders, the Microsoft HLSL compiler needs to be downloaded."
echo
echo "Downloading Microsoft DirectX June 2010 SDK and extracting files..."
echo "Please wait, this will need to download and unpack a 600 MB file..."
echo
echo "The contribution of a free HLSL compiler would be greatly appreciated!"
echo

ok=1
if ! which wget >/dev/null; then
        echo "Error: wget is required to download the files"
        echo "On Debian or Ubuntu, run the following command to install it:"
        echo "sudo apt-get install wget"
	echo
	ok=
fi

if ! which cabextract >/dev/null; then
	echo "Error: cabextract is required to unpack the files"
	echo "On Debian or Ubuntu, run the following command to install it:"
	echo "sudo apt-get install cabextract"
	echo
	ok=
fi

if test -z "$ok"; then
	exit 1
fi

dxsdk_file="DXSDK_Jun10.exe"
dxsdk_url="http://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe"
dxsdk_size=599452800

fxc_path="DXSDK/Utilities/bin/x86/fxc.exe"
d3dcompiler_cab_path="DXSDK/Redist/Jun2010_D3DCompiler_43_x86.cab"
d3dx9_cab_path="DXSDK/Redist/Jun2010_d3dx9_43_x86.cab"
d3dx10_cab_path="DXSDK/Redist/Jun2010_d3dx10_43_x86.cab"
d3dx11_cab_path="DXSDK/Redist/Jun2010_d3dx11_43_x86.cab"

if test "$(stat -c '%s' "$dxsdk_file" 2>/dev/null)" != $dxsdk_size; then
	wget --continue "$dxsdk_url"
	if test "$(stat -c '%s' "$dxsdk_file" 2>/dev/null)" != $dxsdk_size; then
		echo "Failed to download DirectX SDK: expected $dxsdk_file with size $dxsdk_size"
		echo "Download manually from $dxsdk_url"
		exit 1
	fi
fi

for i in "$fxc_path" "$d3dcompiler_cab_path" "$d3dx9_cab_path" "$d3dx10_cab_path" "$d3dx11_cab_path"; do
	if ! test -e "$i"; then
		echo "Please wait, this may take several minutes because a 600 MB archive may need to be fully decompressed..."
		cabextract -F "$i" "$dxsdk_file"
	fi
done

for i in "$d3dcompiler_cab_path" "$d3dx9_cab_path" "$d3dx10_cab_path" "$d3dx11_cab_path"; do
	cabextract -F "*.dll" "$i"
done

/bin/cp -dpf "$fxc_path" .