1 # Maintainer: Thomas Jost <schnouki@schnouki.net>
2 # Contributor: Carson Reynolds <carson@k2.t.u-tokyo.ac.jp>
4 # A x86_64 binary version of this package is available from my custom
5 # repository. If you wish to use it, just add the following lines to your
8 # Server = http://repo.schnouki.net/archlinux/$arch
9 # Then run "pacman -Sy cuda-sdk" as root.
14 pkgdesc="NVIDIA's CUDA architecture can be programmed in the only C language environment that unlocks the processing power of GPUs to solve the most complex compute-intensive challenges."
15 arch=('i686' 'x86_64')
16 [ "$CARCH" = "i686" ] && ARCH=x86
17 [ "$CARCH" = "x86_64" ] && ARCH=x86_64
18 url="http://www.nvidia.com/object/cuda_home.html"
20 depends=("cuda-toolkit>=${pkgver}"
24 source=(http://developer.download.nvidia.com/compute/cuda/4_0/sdk/gpucomputingsdk_${pkgver}_linux.run
27 md5sums=('07393c5eb702485deaa06a37747391ea'
28 '61dcee30a4ca23e118edb862d55222ff'
29 '7c01194a59fdce68651f0a2b8f8c32aa')
37 msg2 "Uncompressing the CUDA SDK..."
38 sh gpucomputingsdk_${pkgver}_linux.run --noexec --keep --nox11 >/dev/null
41 #echo "Inspect srcdir"
44 # Patch Makefiles. It used to be simple, but CUDALibraries is a mess. Really.
45 msg2 "Patching Makefiles..."
46 patch -p0 -i "$srcdir/makefiles.patch"
48 # Funny stuff: some examples from CUDALibraries don't work when installed in
49 # /usr/... because they use wrong hard-coded relative paths. And the
50 # "shrFindFile()" function causes all OpenCL examples to fail because it does
51 # not look in the correct path.
52 msg2 "Patching paths to data files..."
53 patch -p0 -i "$srcdir/data-paths.patch"
55 # Ease building for people with hybrid nVidia graphics and "bumblebee"
56 # installed (courtesy of yl3gdy)
57 if [ -d /usr/lib/nvidia-bumblebee ]; then
58 export LIBRARY_PATH=/usr/lib:/usr/lib/nvidia-bumblebee
61 # Build all the examples. The little "sed" lines are here to enable parallel
62 # builds and to avoid being spammed with a warning message (see
63 # http://www.gnu.org/s/hello/manual/make/Error-Messages.html for details)
64 msg2 "Building the CUDA libraries examples..."
65 cd "$srcdir/pkg/sdk/CUDALibraries"
66 sed -i 's/make/$(MAKE)/' Makefile
69 msg2 "Building the CUDA C examples..."
70 cd "$srcdir/pkg/sdk/C"
71 sed -i 's/make/$(MAKE)/' Makefile
74 msg2 "Building the OpenCL examples..."
75 cd "$srcdir/pkg/sdk/OpenCL"
76 sed -i 's/make/$(MAKE)/' Makefile
82 mkdir -p "$pkgdir"/usr/share/licenses/$pkgname
83 mkdir -p "$pkgdir"/usr/share/doc/$pkgname/{C,CUDALibraries,OpenCL}/releaseNotesData
84 mkdir -p "$pkgdir"/usr/share/$pkgname/{C,CUDALibraries,OpenCL}/bin/data
86 # Install the binaries
87 for d in C CUDALibraries OpenCL; do
88 install -m755 "$srcdir"/pkg/sdk/$d/bin/linux/release/* "$pkgdir"/usr/share/$pkgname/$d/bin
91 # Install documentation files
92 cp -R "$srcdir"/pkg/sdk/doc/* "$pkgdir"/usr/share/doc/$pkgname
93 cp -R "$srcdir"/pkg/sdk/C/doc/* "$srcdir"/pkg/sdk/C/Samples.html "$pkgdir"/usr/share/doc/$pkgname/C
94 cp -R "$srcdir"/pkg/sdk/C/releaseNotesData/* "$pkgdir"/usr/share/doc/$pkgname/C/releaseNotesData
95 cp -R "$srcdir"/pkg/sdk/CUDALibraries/Samples.html "$pkgdir"/usr/share/doc/$pkgname/CUDALibraries
96 cp -R "$srcdir"/pkg/sdk/CUDALibraries/releaseNotesData/* "$pkgdir"/usr/share/doc/$pkgname/CUDALibraries/releaseNotesData
97 cp -R "$srcdir"/pkg/sdk/OpenCL/doc/* "$srcdir"/pkg/sdk/OpenCL/Samples.html "$pkgdir"/usr/share/doc/$pkgname/OpenCL
98 cp -R "$srcdir"/pkg/sdk/OpenCL/releaseNotesData/* "$pkgdir"/usr/share/doc/$pkgname/OpenCL/releaseNotesData
100 # Install license information
101 ln -s ../../doc/$pkgname/C/cudpp_license.txt "$pkgdir"/usr/share/licenses/$pkgname
102 ln -s ../../doc/$pkgname/C/License.txt "$pkgdir"/usr/share/licenses/$pkgname
104 # Copy over source and lib folders
105 cp -R "$srcdir"/pkg/sdk/C/{common,lib,src} "$pkgdir"/usr/share/$pkgname/C
106 cp -R "$srcdir"/pkg/sdk/CUDALibraries/{common,src} "$pkgdir"/usr/share/$pkgname/CUDALibraries
107 cp -R "$srcdir"/pkg/sdk/OpenCL/{common,src} "$pkgdir"/usr/share/$pkgname/OpenCL
108 cp -R "$srcdir"/pkg/sdk/shared "$pkgdir"/usr/share/$pkgname
110 # Remove left-over object and ptx files
111 find "$pkgdir"/usr/share/$pkgname -depth -type d -name 'obj' -exec rm -rf "{}" \;
112 find "$pkgdir"/usr/share/$pkgname -type f -name '*.ptx' -exec rm -rf "{}" \;
114 # Copy data files for SDK
115 for d in C CUDALibraries OpenCL; do
116 find "$srcdir"/pkg/sdk/$d/ -path '*/data/*' | \
117 xargs -I '{}' cp '{}' "$pkgdir"/usr/share/$pkgname/$d/bin/data
121 # NOTE: demos such as bandwidthTest, dxtc and simpleTexture may pass tests
122 # when run as root since the data directory is not writable by default.
123 # NOTE: when building your own programs with nvcc, use the following flags:
124 # --compiler-bindir=/opt/gcc-4.4