updated on Wed Jan 25 08:34:36 UTC 2012
[aur-mirror.git] / ifort / PKGBUILD
blob287629b04926ebb635b04af09c97b6158e7106c4
1 # Contributor: Nicolas Bigaouette <nbigaouette@gmail.com>
2 # CARCH=i686
3 # ./install_fc.sh  --arch=x86_64 --nonrpm --run --log=log2.log --silent SilentInstallConfigFile.ini --tmp-path=/home/nicolas/tmp --install-path=/home/nicolas/test/ &> test.log
4 pkgname=ifort
5 _comp=f
6 _COMP=`echo "${_comp}" | tr "[a-z]" "[A-Z]"`
7 # pkgver=11.0.069
8 # _urlnumber=1259
9 pkgver=11.0.074
10 _urlnumber=1315
11 pkgrel=2
12 pkgdesc="The Intel Fortran 2003 Compiler"
13 url="http://developer.intel.com/software/products/compilers/flin/"
14 arch=('i686' 'x86_64')
15 license=('custom')
16 depends=("glibc" "libstdc++5" "intel-compilers-common==${pkgver}")
17 makedepends=(rpmextract)
18 source=(\
19     "NCOM_L_CMP_FOR_????-????????.lic" \
20     "intel-compilers-common-generic.txt" \
21     "profile.sh" \
22     "profile.csh" \
24 md5sums=('c71cf36585a317df87f3d7603b94858f' # <--- Change to your own license md5sum !!!
25          '31c1810fb4aab1a2d6c350ae5986283e' # intel-compilers-common-generic.txt
26          'd07d7716f677ca5f569254949002c400' # profile.sh
27          '99cbee1481571e15e0e78d1378d8c5fa' # profile.csh"
29 _archive=l_cpro${_comp}_p_${pkgver}
30 if [ "$CARCH" = "i686" ]; then
31     _intel_arch=i386
32     _bits=32
33     _intel_arch2=ia32
34     _intel_64char=
35     #depends=()
36     md5sums=('7d9221b5b59b2d6edc6e51c756be84bb' ${md5sums[@]})
37 else
38     _intel_arch=em64t
39     _bits=64
40     _intel_arch2=intel64
41     _intel_64char=e
42     #depends=(lib32-gcc lib32-libstdc++5)
43     md5sums=('6c7db08ec48665f81b29cafed81f2eac' ${md5sums[@]})
45 _archive_arch=${_archive}_${_intel_arch2}
46 source=(http://registrationcenter-download.intel.com/irc_nas/${_urlnumber}/${_archive_arch}.tgz ${source[@]})
47 install=${pkgname}.install
49 build() {
50     ######################################################################################
51     # Common part with icc and ifort
52     _intel_arch_file=`basename ${source[0]}`
53     _intel_arch_file=${_intel_arch_file/.tar.gz/}
54     _intel_arch_file=${_intel_arch_file##*_}
55     _compiler=${source[0]#*l_}
56     _compiler=${_compiler%%_*}
57     _comp_ver=`echo $source[0] | sed -e "s|.*/l_${_compiler}_||g" -e "s|_${pkgver}.*||g"`
59     _licensefile=${source[1]}
60     _major_version=${pkgver%%.*}
61     _build_version=${pkgver##*.}
62     _minor_version=`echo ${pkgver} | sed -e "s/${_major_version}.//g" -e "s/.${_build_version}//g"`
63     _compact_version=${_major_version}${_minor_version}${_build_version}
65     mkdir -p $startdir/src/unpacked
66     cd $startdir/src/unpacked
68     msg "Unpacking RPM archive (intel-cpro${_comp}${_compact_version}${_intel_64char}-${_major_version}.${_minor_version}-*.rpm)..."
69     i=../${_archive_arch}/${_archive}/intel-cpro${_comp}${_compact_version}${_intel_64char}-${_major_version}.${_minor_version}-*.rpm
70     rpmextract.sh $i &> /dev/null || return 1
72 #     msg "Unpacking the debugger..."
73 #     i=../l_${_compiler}_${_comp_ver}_${pkgver}_${_intel_arch_file}/data/intel-*idb${_intel_64char}*.${_intel_arch}.rpm
74 #     rpmextract.sh $i &> /dev/null || return 1
76     # The following variables are defined in the original install script
77     # They make copying the original code easier.
78     _INSTALLROOT=/opt/intel/Compiler
79     DESTINATION=${_INSTALLROOT}/${_major_version}.${_minor_version}/${_build_version}
80     SUPPORTFILE=${pkgdir}${DESTINATION}/doc/fsupport
82     msg "chmod'ing 755 directories..."
83     find ${srcdir}/unpacked -type d -exec chmod 755 {} \; || return 1
84     mv $startdir/src/unpacked/opt $startdir/pkg/ || return 1
86     # Way simpler then the UNTAG_CFG_FILES function of the original install script
87     msg "Updating INSTALLDIR values in script files..."
88     for FILE in $startdir/pkg${DESTINATION}/bin/*.*sh; do
89         sed -i s@\<INSTALLDIR\>@${DESTINATION}@g $FILE || return 1
90         #chmod 755 $FILE || return 1
91     done
92     for FILE in $startdir/pkg${DESTINATION}/bin/${_intel_arch2}/*; do
93         if [[ -f $FILE ]]; then
94             sed -i s@\<INSTALLDIR\>@${DESTINATION}@g $FILE || return 1
95             #chmod 755 $FILE || return 1
96         fi
97     done
99     #install -d $startdir/pkg/usr/lib/
100     #ln -s "${DESTINATION}/lib/ifcore_msg.cat" "$startdir/pkg/usr/lib/ifcore_msg.cat" || return 1
102     rm $startdir/pkg${DESTINATION}/bin/${_intel_arch2}/uninstall*.sh || return 1
104     cd $startdir/src
106     msg "Updating etc/profile.d/${pkgname}.sh..."
107     install -D -m 755 ${srcdir}/profile.sh \
108        ${pkgdir}/etc/profile.d/${pkgname}.sh || return 1
109     install -D -m 755 ${srcdir}/profile.csh \
110        ${pkgdir}/etc/profile.d/${pkgname}.csh || return 1
111     sed \
112         -e "s|DESTINATION|${DESTINATION}|g" \
113         -e "s|INTELARCH|${_intel_arch2}|g" \
114         -e "s|PKGNAME|${pkgname}|g" \
115         -i ${pkgdir}/etc/profile.d/${pkgname}.sh || return 1
117     msg "Copying license..."
118     install -D -m 644 \
119         $startdir/src/${_licensefile} \
120         $startdir/pkg${DESTINATION}/licenses/${_licensefile} || return 1
122     mkdir -p $startdir/pkg/usr/share/licenses/$pkgname/
123     cd $startdir/pkg${DESTINATION}/licenses/
124     for FILE in *; do
125         install -D -m 644 $FILE $startdir/pkg/usr/share/licenses/$pkgname/$FILE || return 1
126     done
128     msg "Copying release notes..."
129     install -D -m 644 \
130         $startdir/src/${_archive_arch}/Release_Notes${_COMP}.pdf \
131         $startdir/pkg${DESTINATION}/Release_Notes${_COMP}.pdf || return 1
132     rm -f $startdir/pkg/usr/share/licenses/$pkgname/*.lic || return 1
134     msg "Removing manpath from ${pkgname}vars_${_intel_arch2}.{sh,csh}..."
135     sed \
136         -e "s|:\$(manpath)||g" \
137         -i ${pkgdir}${DESTINATION}/bin/${_intel_arch2}/${pkgname}vars_${_intel_arch2}.sh \
138         || return 1
139     sed \
140         -e "s|:\`manpath\`||g" \
141         -i ${pkgdir}${DESTINATION}/bin/${_intel_arch2}/${pkgname}vars_${_intel_arch2}.csh \
142         || return 1
144     msg "Updating ${pkgname}.install to edit ld.so.conf correctly"
145     sed \
146         -e "s#echo \".*#echo \"${DESTINATION}/lib\" >> /etc/ld.so.conf#g" \
147         -e "s#sed -i \".*#sed -i \"${_INSTALLROOT}/.*/lib||g\" /etc/ld.so.conf#g" \
148         -i ${startdir}/${pkgname}.install \
149         || return 1
151     msg "Stripping package from icc and ifort common files (provided by intel-compilers-common)"
152     sed "s|ARCHDIR|${_intel_arch2}|g" ${srcdir}/intel-compilers-common-generic.txt > ${srcdir}/intel-compilers-common.txt || return 1
153     common_filenames=(`cat ${srcdir}/intel-compilers-common.txt`) || return 1
154     for f in ${common_filenames[*]}; do
155         dir=`dirname ${f}`
156         mkdir -p ${pkgdir}${DESTINATION}/${dir} || return 1
157         #msg "Removing ${pkgdir}${DESTINATION}/${f}"
158         rm -f ${pkgdir}${DESTINATION}/${f} || return 1
159     done
161     # End of common part with icc and ifort
162     ######################################################################################