updated on Wed Jan 25 20:08:56 UTC 2012
[aur-mirror.git] / cuda-toolkit / PKGBUILD
blob5fee52f72c11fca7c15d12e080a84d2301bb32d7
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
6 # /etc/pacman.conf:
7 #   [schnouki]
8 #   Server = http://repo.schnouki.net/archlinux/$arch
9 # Then run "pacman -Sy cuda-toolkit" as root.
11 pkgname=cuda-toolkit
12 pkgver=4.0.17
13 _shortver=4.0
14 pkgrel=2
15 _fedver=13
16 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."
17 arch=('i686' 'x86_64')
19 url="http://www.nvidia.com/object/cuda_home.html"
20 license=('custom')
22 depends=('gcc44' 'gcc-libs' 'nvidia>=270.41' 'ncurses' 'zlib')
23 optdepends=('libpng12: for the Compute Visual Profiler'
24             'libxext: for the Compute Visual Profiler'
25             'qt: for the Compute Visual Profiler'
26             'qt-assistant-compat: for the Compute Visual Profiler')
28 provides=("opencl-headers" "thrust")
29 conflicts=("opencl-headers" "thrust")
30 replaces=("thrust")
32 if [ "$CARCH" = "i686" ]; then
33   _bits=32
34   md5sums=('20d69b2d5bb7043ca7c2ad679c2825ed'
35            '6426892e521b931a18b57e3680b1cc4e')
36 else
37   _bits=64
38   md5sums=('152e1069f39fc8bbece875a1b9f576b6'
39            '1fc9673eccb604ed6e386397b995ec25')
40   optdepends=("${optdepends[@]}"
41               'lib32-nvidia-utils: for profiling 32 bits CUDA applications')
44 source=(http://developer.download.nvidia.com/compute/cuda/4_0/toolkit/cudatoolkit_${pkgver}_linux_${_bits}_fedora${_fedver}.run
45         http://developer.download.nvidia.com/compute/cuda/4_0/ToolsSDK/cudatools_${pkgver}_linux_${_bits}.run)
47 #PKGEXT=".pkg.tar.gz"
49 build() {
50   cd "$srcdir"
51   
52   msg2 "Uncompressing the CUDA toolkit..."
53   sh cudatoolkit_${pkgver}_linux_${_bits}_fedora${_fedver}.run --noexec --keep --target toolkit >/dev/null
55   msg2 "Uncompressing the CUDA tools SDK..."
56   sh cudatools_${pkgver}_linux_${_bits}.run --noexec --keep --target tools >/dev/null
58   msg2 "Patching nvcc.profile..."
59   # Thanks Valentine Sinitsyn for the idea!
60   echo '' >> toolkit/bin/nvcc.profile
61   echo '# Arch-specific paths' >> toolkit/bin/nvcc.profile
62   echo 'INCLUDES        += "-I$(TOP)/include/cuda" $(_SPACE_)' >> toolkit/bin/nvcc.profile
63   echo 'compiler-bindir  = /opt/gcc-4.4' >> toolkit/bin/nvcc.profile
65   #Inspection hook
66   #echo "Inspect srcdir"
67   #read 
70 package() {
71   # Installing by hand will be easier than using the stupid install scripts. And cleaner too.
73   ### TOOLKIT ###
74   msg2 "Installing the CUDA Toolkit..."
75   cd "$srcdir/toolkit"
77   # Binaries
78   plain "binaries"
79   find bin/ -type f -exec install -Dm755 "{}" "$pkgdir/usr/{}" \;
80   chmod 644 "$pkgdir/usr/bin/nvcc.profile"
81   install -Dm755 computeprof/bin/computeprof "$pkgdir/usr/bin/computeprof"
82   install -Dm755 open64/bin/nvopencc "$pkgdir/usr/bin/nvopencc"
84   # Headers
85   plain "headers"
86   cd include
87   find . -type f -exec install -Dm644 "{}" "$pkgdir/usr/include/cuda/{}" \;
88   mv "$pkgdir/usr/include/cuda/CL" "$pkgdir/usr/include/CL"
90   # Doc
91   plain "documentation"
92   cd ../doc
93   find . -type f -exec install -Dm644 "{}" "$pkgdir/usr/share/doc/$pkgname/{}" \;
94   cd ../computeprof/doc
95   find . -type f -exec install -Dm644 "{}" "$pkgdir/usr/share/doc/$pkgname/computeprof/{}" \;
96   cd ../..
97   install -Dm644 computeprof/Compute_Visual_Profiler_Release_Notes_Linux.txt "$pkgdir/usr/share/doc/$pkgname/"
98   mkdir -p "$pkgdir/usr/share/licenses/$pkgname"
99   ln -s ../../doc/$pkgname/EULA.txt "$pkgdir/usr/share/licenses/$pkgname/EULA.txt"
101   # Libraries
102   plain "libraries"
103   if [ "$CARCH" = "i686" ]; then
104     find lib/ -type f -exec install -Dm755 "{}" "$pkgdir/usr/{}" \;
105     install -Dm755 computeprof/bin/cudaapitrace32.so "$pkgdir/usr/lib/"
106   else
107     find lib/ lib64/ -type f -exec install -Dm755 "{}" "$pkgdir/usr/{}" \;
108     rm -rf "$pkgdir/usr/lib32"
109     mv "$pkgdir/usr/lib" "$pkgdir/usr/lib32"
110     mv "$pkgdir/usr/lib64" "$pkgdir/usr/lib"
111     install -Dm755 computeprof/bin/cudaapitrace32.so "$pkgdir/usr/lib32/"
112     install -Dm755 computeprof/bin/cudaapitrace64.so "$pkgdir/usr/lib/"
113   fi
114   cd open64
115   find lib/ -type f -exec install -Dm755 "{}" "$pkgdir/usr/{}" \;
116   cd ..
118   # Examples
119   plain "examples"
120   find computeprof/projects/ src/ -type f -exec install -Dm644 "{}" "$pkgdir/usr/share/$pkgname/{}" \;
122   ### TOOLS ###
123   # (untested, not sure it really belongs in this package)
124   msg2 "Installing the CUDA tools SDK..."
125   cd "$srcdir/tools"
127   # CUPTI
128   plain "CUPTI"
129   cd CUPTI/include
130   find . -type f -exec install -Dm644 "{}" "$pkgdir/usr/include/cuda/cupti/{}" \;
131   cd ../doc
132   find . -type f -exec install -Dm644 "{}" "$pkgdir/usr/share/doc/$pkgname/cupti/{}" \;
133   cd ..
134   find lib/ -type f -exec install -Dm755 "{}" "$pkgdir/usr/{}" \;
135   find sample/ -type f -exec install -Dm644 "{}" "$pkgdir/usr/share/$pkgname/cupti/{}" \;
137   # Debugger
138   plain "debugger"
139   cd ../Debugger/doc
140   find . -type f -exec install -Dm644 "{}" "$pkgdir/usr/share/doc/$pkgname/{}" \;
141   cd ../include
142   find . -type f -exec install -Dm644 "{}" "$pkgdir/usr/include/cuda/{}" \;
144   # NVML
145   plain "NVML"
146   cd ../../NVML
147   find . -type f -name '*.h' -exec install -Dm644 "{}" "$pkgdir/usr/include/cuda/{}" \;
148   find . -type f -name '*.dtd' -exec install -Dm644 "{}" "$pkgdir/usr/share/cuda/nvml/{}" \;
149   cd doxygen
150   find . -type f -exec install -Dm644 "{}" "$pkgdir/usr/share/doc/cuda/nvml/{}" \;
151   # Don't install nvidia-smi, the library and the manpage, they are already in nvidia-utils
152   
153   ### COMMON ###
154   msg2 "Creating required symlinks..."
156   # Create required symlinks to libraries
157   for _lib in $(find "$pkgdir" -name '*.so*'); do
158     _soname="$(dirname ${_lib})/$(readelf -d "$_lib" | sed -nr 's/.*Library soname: \[(.*)\].*/\1/p')"
159     if [ ! -e "${_soname}" ]; then
160       ln -s "$(basename ${_lib})" "${_soname}"
161       ln -s "$(basename ${_soname})" "${_soname/.[0-9]*/}"
162     fi
163   done
165   # Hack: cuda-gdb needs libtinfo.so.5, which is apparently now in ncurses
166   ln -s libncurses.so.5 "$pkgdir/usr/lib/libtinfo.so.5"
168   #Inspection hook
169   #echo "Inspect pkgdir"
170   #read 
173 # Local Variables:
174 # pkgbuild-update-sums-on-save: nil
175 # End: