summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a2296e47351baa85626577b7f97e106a2c6a62db (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
# Maintainer: Stephen Cox: stephencoxmail -at- gmail com
# Maintainer: Alexey Stukalov: astukalov -t- gmail com
# Contributor: Ignat Harczuk: ignathe -at- gmail com
# Contributor: Mark Wells: mwellsa -at- gmail com
# Contributor: Simone Riva: siomone.rva -a- gmail com
# Contributor: Hamada Badr: hamada.s.badr -a- gmail com

# Intel Parallel Studio XE 2019 for Linux - ( Intel compiler icc suite )
##########################################################################
# this PKGBUILD splits the main Parallel Studio XE package in 9 sub-packages:
#
# intel-common-libs:            Intel Common Libraries
# intel-openmp:                 Intel OpenMP Implementation
# intel-compiler-base:          Intel C/C++ compiler and base libs
# intel-fortran-compiler:       Intel Fortran compiler and base libs"
# intel-ipp:                    Intel Integrated Performance Primitives
# intel-mkl:                    Intel Math Kernel Library (IntelĀ® MKL)
# intel-mpi:                    Intel Message passing interface (MPI)
# intel-tbb_psxe:               Intel Threading Building Blocks (TBB)
# intel-vtune:                  Intel Vtune Amplifier
# intel-advisor:                Intel Advisor
# intel-inspector:              Intel Inspector
###########################################################################

# Parallel Studio XE PKGBUILD script
# Copyright (C) 2016-2019       Ignat Harczuk and contibutors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

pkgbase="intel-parallel-studio-xe"
pkgname=('intel-common-libs'
         'intel-openmp'
         'intel-compiler-base'
         'intel-fortran-compiler'
         'intel-ipp'
         'intel-mkl'
         'intel-mpi'
         'intel-tbb_psxe'
         'intel-advisor'
         'intel-vtune-amplifier'
         'intel-inspector')

if [ -z "$FORCE_PKGEXT" ]; then
  PKGEXT='.pkg.tar.lzo'
  msg "Overriding the default PKGEXT with '${PKGEXT}' to save compression time"
  msg "(change PKGEXT in the PKGBUILD or use FORCE_PKGEXT on the command line"
  msg " to override PKGEXT set by the package)."
else
  msg "Overriding PKGEXT with FORCE_PKGEXT='${FORCE_PKGEXT}'"
  PKGEXT=$FORCE_PKGEXT
fi

if [ "$PKGEXT" = ".pkg.tar.xz" ]; then
  plain   "--------------------------------------------------------------------"
  warning "This PKGBUILD may need up to 20 minutes when XZ compressor is used!"
  warning "  - The packaging of intel-mkl and intel-ipp is particularly slow"
  warning "  - Change PKGEXT in PKGBUILD or define FORCE_PKGEXT on the"
  warning "    command line to use a faster compressor, e.g. .pkg.tar.lzo"
  plain   "--------------------------------------------------------------------"
fi


########################################
#OPTIONS begin
# set to true if you want to remove documentations and examples form the packages.
#_remove_docs=TRUE
_remove_docs=true

# set to true if you want to remove the static objects from the libs.
#_remove_static_objects_mkl=true
_remove_static_objects_mkl=false

#_remove_static_objects_ipp=true
_remove_static_objects_ipp=false
########################################

_year='2019'
_v_a='3'
_v_b='199'
# year, version a and version b found in /opt/intel/compilers_and_libraries_YEAR_A_B

_update='3'

pkgrel=3


_sp='cluster_edition'
_icc_ver='19.0.3'
_vtune_ver='2019.3.0.591499'
_inspector_ver='2019.3.0.591484'
_advisor_ver='2019.3.0.591490'

pkgver=${_year}.${_v_a}.${_v_b}

# package download folders
_dir_nr='15268'
_mpi_dir_nr='15260'

options=(strip libtool staticlibs)

url="http://software.intel.com/en-us/articles/non-commercial-software-download/"
arch=('x86_64')
license=('custom')
makedepends=('libarchive' 'sed' 'gzip' 'lzop')

_parallel_studio_xe_dir="parallel_studio_xe${_year:+_${_year}}${_update:+_update${_update}}${_sp:+_${_sp}}"

source=(
  "http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/${_dir_nr}/${_parallel_studio_xe_dir}.tgz"
  "http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/${_mpi_dir_nr}/l_mpi_${_year}.${_v_a}.${_v_b}.tgz"
  'intel_compilers.sh'
  'intel_vtune-amplifier.sh'
  'intel_advisor.sh'
  'intel_inspector.sh'
  'intel-composer.install'
  'intel-common-libs.conf'
  'intel-fortran.conf'
  'intel-openmp.conf'
  'intel-mkl.conf'
  'intel-mpi.conf'
  'intel-ipp.conf'
  'intel-tbb.conf'
  'intel-mkl.sh'
  'intel-mkl.install'
  'intel-mkl-th.conf'
  'intel-tbb.install'
  'EULA.txt'
)


sha256sums=('b5b022366d6d1a98dbb63b60221c62bc951c9819653ad6f5142192e89f78cf63'
            '5304346c863f64de797250eeb14f51c5cfc8212ff20813b124f20e7666286990'
            '0704025fdfe40e4fce08e88b641128310c3a3b51332668aab60fb815b424f52b'
            '58bced75693b2f73480b89242b33c9a0ce565d6a12a17f84067bab351bde9be7'
            '63b12c66d9c8c2310a7bbd5206c82ba9667fb6ffb3dc7e3f9304a17ed8c8fbcd'
            'fd24842f29d50bc53779dd918fbc548ebf165ff664114e59195773ad04076b5d'
            '3f96dec03111e69d16bb363acf4d0570e8a9526c09e5e542a7558f1b26d043ef'
            '31ac4d0f30a93fe6393f48cb13761d7d1ce9719708c76a377193d96416bed884'
            '6151bc273b6f741a4ce93d8160b6f167c8ad499dbc6e8e3f6e08d48571d6a52a'
            '99cc9683cc75934cc21bb5a09f6ad83365ee48712719bfd914de9444695eed13'
            'a856326362e9b80c19dc237cbf66bf3d96a69bd7ad1baff99ec9849f8208348c'
            'ed02ea4a0ebc9c32b53155bc5e442c46257f8185ae17833be0b975558bbc951a'
            'da6f41c2e002c9a793c75a18c8d1c85ef7ef5bf83a7a0a158ff144481491aac8'
            '5d3ac1ba31d7fc5795821d95b17956b0c977c8f3576b02f664f8ebf476213a43'
            '5e68c529c65cac54218026c869e54b2ddb268179725fc1e6b56d920470dad999'
            '11398c0ae2e2011902b1d6356d916d41bb8b54d39d090c6c83630f4b0e84e93a'
            'e515cb28bf40cdb0db818db6a2688a0028575153a1b9d5acfb0bc5f13fe45722'
            'fde83eb0071a5bd2887de127b56cc573a254e30131ec7b2d956987512c3e90c2'
            '228ac25e147adb9b872e1a562e522d2fd48809ccae89b765112009896a6d55a5')

#_archive=l_ccompxe${_comp}_p_${pkgver}
if [ "$CARCH" = "i686" ]; then
  _i_arch='ia32'
  _i_arch2='i486'
  _bin_dir='bin32'

  _not_arch='intel64'
  _not_arch2='x86_64'
else
  _i_arch='intel64'
  _i_arch2='x86_64'
  _bin_dir='bin64'

  _not_arch='ia32'
  _not_arch2='i486'
fi

extract_rpm() {
  msg2 "  ${1##*/}"
  bsdtar -xf $1 -C $2
}

extract_rpms() {
  for rpm_file in ${rpm_dir}/$1 ; do
    extract_rpm ${rpm_file} $2
  done
}

extract_mpi_rpms() {
  for rpm_file in ${mpi_rpm_dir}/$1 ; do
    extract_rpm ${rpm_file} $2
  done
}

set_build_vars() {
  _pkg_ver=${pkgver}
  _composer_xe_dir="compilers_and_libraries_${_year}.${_v_a}.${_v_b}"
  rpm_dir=${srcdir}/${_parallel_studio_xe_dir}/rpm
  mpi_rpm_dir=${srcdir}/l_mpi_${_year}.${_v_a}.${_v_b}/rpm
  xe_build_dir=${srcdir}/cxe_build
  base_dir=`realpath ${srcdir}/..`
  _man_dir=${xe_build_dir}/usr/share/man/man1
}


build() {

  set_build_vars
  echo ${xe_build_dir}

  #  clean the builds dirs
  if [ -d ${srcdir}/opt ] ; then
    rm -rf ${srcdir}/opt
  fi

  if [ -d ${srcdir}/etc ] ; then
    rm -rf ${srcdir}/etc
  fi

  if [ -d ${srcdir}/usr ] ; then
    rm -rf ${srcdir}/usr
  fi

  if [ -d ${xe_build_dir} ] ; then
    rm -rf ${xe_build_dir}
  fi

  echo ${srcdir}

  mkdir -p ${xe_build_dir}

  # START !
  cd ${xe_build_dir}
  mkdir -p ${xe_build_dir}/etc/profile.d

  sed "s/<arch>/${_i_arch}/" < ${srcdir}/intel_compilers.sh > ${xe_build_dir}/etc/profile.d/intel_compilers.sh

  chmod a+x ${xe_build_dir}/etc/profile.d/intel_compilers.sh

  mkdir -p ${xe_build_dir}/etc/ld.so.conf.d

  _cnt=0
  for files in ${base_dir}/*.lic ; do
    _lic_file[_cnt]=${files}
    _cnt=$(($_cnt+1))
  done


  plain ""
  plain "-----------------------------------------------------------------------------------"
  mkdir -p ${xe_build_dir}/opt/intel/licenses
  if [ -f "${_lic_file[0]}" ]; then
    cp ${base_dir}/*.lic ${xe_build_dir}/opt/intel/licenses
    msg "Found Intel license files in ${base_dir}"
    msg "These will be installed into /opt/intel/licenses"
  else
    warning "No Intel license files found in ${base_dir}"
    warning "Remember to place license files in one of these locations:"
    warning "    /opt/intel/licenses"
    warning "    ~/Licenses"
    warning "Or the Intel compiler will not work!\e[0m"
  fi
  plain "-----------------------------------------------------------------------------------"
  plain ""

  cp ${srcdir}/${_parallel_studio_xe_dir}/license.txt ${xe_build_dir}/opt/intel/license.txt

  echo -e "-----------------------------------------------------------------------------------"
  echo -e "\e[1mIMPORTANT - READ BEFORE COPYING, INSTALLING, OR USING.\e[0m"
  echo -e ""
  echo -e "Do not copy, install, or use the \"Materials\" provided under this license agreement (\"Agreement\"), until you"
  echo -e "have carefully read the following terms and conditions."
  echo -e ""
  echo -e "By copying, installing, or otherwise using the Materials, you agree to be bound by the terms of this"
  echo -e "Agreement. If you do not agree to the terms of this Agreement, do not copy, install, or use the Materials."
  echo -e " - A copy of the EULA has been copied in the PKGBUILD directory; plase read carefully the terms and "
  echo -e " - conditions of the Intel license before installing the packages. "
  echo -e "-----------------------------------------------------------------------------------"
  plain ""

  plain "-------------------------------------------------------------------------------"
  warning "This PKGBUILD works with yaourt, but consumes a lot of RAM!"
  warning "Using the makepkg command for building this package is recommended."
  plain "-------------------------------------------------------------------------------"
  plain ""

  msg "Packaging Options:"
  if  ${_remove_docs} ; then
    msg2 "Remove Documentation: YES"
  else
    msg2 "Remove Documentation: NO"
  fi

  if  ${_remove_static_objects_mkl} ; then
    msg2 "Remove Static Objects from MKL: YES"
    warning "If your software is based on the static MKL objects, edit"
    warning "the _remove_static_objects_mkl option at the line 50 of this PKGBUILD"
  else
    msg2 "Remove Static Objects from MKL: NO"
  fi
  if  ${_remove_static_objects_ipp} ; then
    msg2 "Remove Static Objects from IPP: YES"
    warning "If your software is based on the static IPP objects, edit"
    warning "the _remove_static_objects_ipp option at the line 50 of this PKGBUILD"
  else
    msg2 "Remove Static Objects from IPP: NO"
  fi


  if [ -d ${pkgdir}/opt ] ; then
    rm -rf ${pkgdir}/opt
  fi ;

  cd  ${srcdir}/${_parallel_studio_xe_dir}/rpm
  rm -v -f *.${_not_arch2}.rpm
}

package_intel-common-libs() {
  set_build_vars

  pkgdesc="Intel Common Libraries $_icc_ver"
  pkgver=${_pkg_ver}

  mkdir -p ${xe_build_dir}
  cd ${xe_build_dir}
  mkdir -p ./opt
  mkdir -p ./etc/ld.so.conf.d

  cp ${srcdir}/intel-common-libs.conf ./etc/ld.so.conf.d/
  msg2 "Extracting RPMS"
  extract_rpms 'intel-comp-ps-ss-bec*.rpm'  $xe_build_dir
  extract_rpms 'intel-c-*.rpm'  $xe_build_dir

  msg2 "Moving package files"
  mkdir -p ${pkgdir}/etc
  mv ./opt ${pkgdir}
  # move ld.so configs, but keep profile.d (should be in intel-compiler-base)
  mv ./etc/ld.so.conf.d ${pkgdir}/etc/

  cd ${pkgdir}/opt/intel

  ln -s ./${_composer_xe_dir}/linux/compiler/lib/${_i_arch}_lin lib
}

package_intel-openmp() {
  set_build_vars

  pkgdesc="Intel OpenMP Implementation ${_icc_ver}"
  pkgver=${_pkg_ver}
  depends=("intel-common-libs=$pkgver")

  mkdir -p ${xe_build_dir}
  cd ${xe_build_dir}
  mkdir -p ./opt

  msg2 "Extracting RPMS"
  extract_rpms 'intel-openmp*.rpm'  $xe_build_dir

  msg2 "Moving package files"
  mv ./opt ${pkgdir}/
}

package_intel-compiler-base() {

  set_build_vars

  pkgdesc="Intel C/C++ $_icc_ver"
  pkgver=${_pkg_ver}
  depends=("intel-common-libs=$pkgver"
           "intel-openmp=$pkgver")
  install=intel-composer.install

  mkdir -p ${xe_build_dir}
  cd ${xe_build_dir}
  mkdir -p ./opt
  mkdir -p ./etc/profile.d
  mkdir -p ${_man_dir}

  msg2 "Extracting RPMS"
  extract_rpms 'intel-icc*.rpm' $xe_build_dir
  for rpm_file in `find ${rpm_dir} -iname 'intel-comp-*.rpm' ! -iname 'intel-comp-ps-ss-bec-*.rpm' -print` ; do
    extract_rpm $rpm_file $xe_build_dir
  done

  msg2 "Updating scripts"
  cd ./opt/intel/${_composer_xe_dir}/linux/bin

  #rm uninstall.sh
  rm *.csh

  for f in *.sh ; do
    sed -i 's/<PRODDIR>/\/opt\/intel/g' $f
    sed -i "s/<INSTALLDIR>/\/opt\/intel\/${_composer_xe_dir}\/linux/g" $f
  done

  cd $_i_arch
  sed -i "s/<INSTALLDIR>/\/opt\/intel\/${_composer_xe_dir}\/linux/g" loopprofileviewer.sh
  chmod a+x loopprofileviewer.sh
  rm loopprofileviewer.csh

  cd ${xe_build_dir}/opt/intel/${_composer_xe_dir}/linux
  if $_remove_docs ; then
    msg2 "Removing documentation"
    rm -rf ./documentation
    rm -rf ./Documentation
    rm -rf ./Samples
  fi

  msg2 "Copying man pages"
  mv ${xe_build_dir}/opt/intel/documentation_${_year}/en/man/common/man1/*.1 ${_man_dir}

  gzip ${_man_dir}/*.1

  msg2 "Moving package files"
  mv ${xe_build_dir}/opt ${pkgdir}/
  mv ${xe_build_dir}/etc ${pkgdir}/
  mv ${xe_build_dir}/usr ${pkgdir}/

  cd ${pkgdir}/opt/intel
  ln -s ./${_composer_xe_dir} composerxe
  ln -s ./${_composer_xe_dir}/linux/bin/${_i_arch} bin
  ln -s ./${_composer_xe_dir}/linux/pkg_bin pkg_bin

  #ln -s ./${_composer_xe_dir}/linux/debugger/lib/${_i_arch} debugger_lib
  #ln -s ./${_composer_xe_dir}/linux/man/ man
}

package_intel-fortran-compiler() {

  set_build_vars

  pkgdesc="Intel Fortran compiler $_icc_ver"
  pkgver=${_pkg_ver}
  depends=("intel-compiler-base=$pkgver")
  install=intel-composer.install

  mkdir -p ${xe_build_dir}
  cd ${xe_build_dir}
  mkdir -p ./opt
  mkdir -p ./etc/profile.d
  mkdir -p ./etc/ld.so.conf.d
  mkdir -p ${_man_dir}

  sed "s/<arch>/${_i_arch}/" < ${srcdir}/intel-fortran.conf > ./etc/ld.so.conf.d/intel-fortran.conf

  msg2 "Extracting RPMS"
  extract_rpms 'intel-ifort*.rpm'  $xe_build_dir

  msg2 "Updating scripts"
  rm ./opt/intel/${_composer_xe_dir}/linux/bin/*.csh

  #Remove duplicate logo and .css found in intel base
  rm ${xe_build_dir}/opt/intel/documentation_${_year}/en/compiler_f/ps${_year}/resources/{intel_gsp_styles.css,intel_logo.png}

  cd ${xe_build_dir}/opt/intel/${_composer_xe_dir}/linux
  if $_remove_docs ; then
    msg2 "Removing documentation"
    rm -rf ./documentation
    rm -rf ./Documentation
    rm -rf ./Samples
  fi

  msg2 "Copying man pages"
  mv ${xe_build_dir}/opt/intel/documentation_${_year}/en/man/common/man1/*.1 ${_man_dir}

  gzip ${_man_dir}/*.1

  # Remove duplicate headers found in intel base
  rm ./compiler/include/omp_lib.f90
  rm ./compiler/include/intel64/omp_lib.mod
  rm ./compiler/include/intel64/omp_lib_kinds.mod

  msg2 "Moving package files"
  mv ${xe_build_dir}/opt ${pkgdir}/
  mv ${xe_build_dir}/etc ${pkgdir}/
  mv ${xe_build_dir}/usr ${pkgdir}/
}

package_intel-ipp() {

  set_build_vars

  pkgdesc="Intel Integrated Performance Primitives"
  pkgver=${_pkg_ver}
  install=intel-composer.install

  mkdir -p ${xe_build_dir}
  cd ${xe_build_dir}
  mkdir -p ./opt
  mkdir -p ./etc/ld.so.conf.d

  sed "s/<arch>/${_i_arch}/" < ${srcdir}/intel-ipp.conf > ./etc/ld.so.conf.d/intel-ipp.conf

  msg2 "Extracting RPMS"
  extract_rpms 'intel-ipp-*.rpm'  $xe_build_dir

  msg2 "Updating scripts"
  cd ${xe_build_dir}/opt/intel/${_composer_xe_dir}/linux/ipp/bin
  rm ippvars.csh
  sed -i "s/<INSTALLDIR>/\/opt\/intel\/${_composer_xe_dir}\/linux/g" ippvars.sh

  cd ${xe_build_dir}/opt/intel/${_composer_xe_dir}/linux/
  if ${_remove_docs} ; then
    msg2 "Removing documentation"
    rm -rf ./Documentation
  fi

  if ${_remove_static_objects_ipp} ; then
    msg2 "Removing static objects"
    rm -f ./ipp/lib/${_i_arch}/libipp*.a
    rm -f ./ipp/lib/${_i_arch}/nonpic/libipp*.a
    rmdir ./ipp/lib/${_i_arch}/nonpic/
  fi

  msg2 "Moving package files"
  mv ${xe_build_dir}/opt ${pkgdir}/
  mv ${xe_build_dir}/etc ${pkgdir}/

  ln -s ./${_composer_xe_dir}/linux/ipp/ ${pkgdir}/opt/intel/ipp
}

package_intel-mkl() {

  set_build_vars

  pkgdesc="Intel Math Kernel Library (IntelĀ® MKL)"
  pkgver=${_pkg_ver}
  depends=("intel-common-libs=$pkgver")
  optdepends=("intel-openmp: Intel OpenMP Implementation")
  install=intel-mkl.install
  backup=('etc/intel-mkl-th.conf')

  mkdir -p ${xe_build_dir}
  cd ${xe_build_dir}
  mkdir -p ./opt
  mkdir -p ./etc/ld.so.conf.d
  mkdir -p ./etc/profile.d

  cp ${srcdir}/intel-mkl.sh ./etc/profile.d/
  chmod a+x ./etc/profile.d/intel-mkl.sh

  cp ${srcdir}/intel-mkl-th.conf ./etc/

  sed "s/<arch>/${_i_arch}/" < ${srcdir}/intel-mkl.conf > ./etc/ld.so.conf.d/intel-mkl.conf

  msg2 "Extracting RPMS"
  extract_rpms 'intel-mkl-*.rpm'  $xe_build_dir

  cd ./opt/intel/${_composer_xe_dir}/linux/mkl

  msg2 "Updating scripts"
  rm ./bin/mklvars.csh
  sed -i "s/<INSTALLDIR>/\/opt\/intel\/${_composer_xe_dir}\/linux/g" ./bin/mklvars.sh

  rm -rf ./${_not_arch}

  if ${_remove_docs} ; then
    msg2 "Removing documentation"
    rm -rf ./examples
    rm -rf ./benchmarks
  fi

  if ${_remove_static_objects_mkl} ; then
    msg2 "Removing static objects"
    rm -f ./lib/${_i_arch}/libmkl_*.a
    rm -f ./lib/mic/libmkl_*.a
  fi

  msg2 "Moving package files"
  mv ${xe_build_dir}/opt ${pkgdir}/
  mv ${xe_build_dir}/etc ${pkgdir}/

  ln -s ./${_composer_xe_dir}/linux/mkl/ ${pkgdir}/opt/intel/mkl
}

package_intel-mpi() {

  set_build_vars

  pkgdesc="Intel MPI library"
  pkgver=${_pkg_ver}

  mkdir -p ${xe_build_dir}
  cd ${xe_build_dir}
  mkdir -p ./opt
  mkdir -p ./bin
  mkdir -p ./etc/ld.so.conf.d

  sed "s/<arch>/${_i_arch}/" < ${srcdir}/intel-mpi.conf > ./etc/ld.so.conf.d/intel-mpi.conf

  msg2 "Extracting RPMS"
  extract_rpms 'intel-mpi-*.rpm'  $xe_build_dir
  extract_mpi_rpms 'intel-mpi-sdk-*.rpm'  $xe_build_dir

  msg2 "Updating scripts"
  cd ./opt/intel/${_composer_xe_dir}/linux/mpi/${_i_arch}/bin
  rm mpivars.csh

  #for i in mpd* mpi*    no mpd longer since 2017?
  for i in mpi* ; do
    sed -i "s/I_MPI_SUBSTITUTE_INSTALLDIR/\/opt\/intel\/${_composer_xe_dir}\/linux\/mpi/g" $i
  done

  chmod a+x mpivars.sh

  rm -rf ${xe_build_dir}/opt/intel/${_composer_xe_dir}/linux/mpi_2019
  rm -rf ${xe_build_dir}/opt/intel/${_composer_xe_dir}/licensing/mpi_2019

  msg2 "Moving package files"
  mv ${xe_build_dir}/opt ${pkgdir}
  mv ${xe_build_dir}/etc ${pkgdir}

  ln -s ./${_composer_xe_dir}/linux/mpi/ ${pkgdir}/opt/intel/mpi
}

package_intel-tbb_psxe() {

  set_build_vars

  pkgdesc="Intel Threading Building Blocks (TBB)"
  pkgver=${_pkg_ver}
  install=intel-tbb.install

  mkdir -p ${xe_build_dir}
  cd ${xe_build_dir}
  mkdir -p ./opt
  mkdir -p ./etc/ld.so.conf.d

  sed "s/<arch>/${_i_arch}/" < ${srcdir}/intel-tbb.conf > ./etc/ld.so.conf.d/intel-tbb.conf
  sed -i "s/<INSTALLDIR>/\/opt\/intel\/${_composer_xe_dir}/g" ./etc/ld.so.conf.d/intel-tbb.conf

  msg2 "Extracting RPMS"
  extract_rpms 'intel-tbb-*.rpm'  $xe_build_dir

  msg2 "Updating scripts"
  cd ./opt/intel/${_composer_xe_dir}/linux
  rm ./tbb/bin/tbbvars.csh
  sed -i "s/SUBSTITUTE_INSTALL_DIR_HERE/\/opt\/intel\/${_composer_xe_dir}\/linux\/tbb/g" ./tbb/bin/tbbvars.sh

  chmod a+x ./tbb/bin/tbbvars.sh

  msg2 "Removing unneeded libs and bin"
  rm -rf ./tbb/bin/${_not_arch}
  rm -rf ./tbb/lib/${_not_arch}

  if $_remove_docs ; then
    msg2 "Removing documentation"
    rm -rf ./Documentation
    rm -rf ./tbb/examples
  fi

  msg2 "Moving package files"
  mv ${xe_build_dir}/opt ${pkgdir}/
  mv ${xe_build_dir}/etc ${pkgdir}/

  ln -s ./${_composer_xe_dir}/linux/tbb/ ${pkgdir}/opt/intel/tbb
}

package_intel-vtune-amplifier() {

  set_build_vars

  pkgdesc="Performance profiler for serial and parallel performance analysis $_vtune_ver"
  pkgver=${_pkg_ver}
  depends=('pangox-compat')

  mkdir -p ${xe_build_dir}
  cd ${xe_build_dir}
  mkdir -p ./opt
  mkdir -p ./etc/ld.so.conf.d
  mkdir -p ./etc/profile.d
  mkdir -p ${_man_dir}

  msg2 "Updating scripts"
  sed -e "s/<arch>/${_bin_dir}/g" -e "s/<ver>/${_vtune_ver}/g" \
    < ${srcdir}/intel_vtune-amplifier.sh > etc/profile.d/intel_vtune-amplifier.sh
  chmod a+x ./etc/profile.d/intel_vtune-amplifier.sh

  msg2 "Extracting RPMS"
  extract_rpms 'intel-vtune-amplifier-*.rpm'  $xe_build_dir

  cd ${xe_build_dir}/opt/intel/vtune_amplifier_${_vtune_ver}

  msg2 "Copying man pages"
  if [[ -d ./man/man1 ]]; then
    mv ./man/man1/*.1 ${_man_dir}/
    gzip ${_man_dir}/*.1
  fi


  if $_remove_docs ; then
    msg2 "Removing documentation"
    rm -rf ./samples
    rm -rf ./documentation
  fi

  msg2 "Moving package files"
  mv ${xe_build_dir}/opt ${pkgdir}/
  mv ${xe_build_dir}/etc ${pkgdir}/
  mv ${xe_build_dir}/usr ${pkgdir}/
}

package_intel-advisor() {

  set_build_vars

  pkgdesc="Threading design and prototyping tool for software architects $_advisor_ver"
  pkgver=${_pkg_ver}
  conflicts=( 'intel-advisor-xe' )

  mkdir -p ${xe_build_dir}
  cd ${xe_build_dir}
  mkdir -p ./opt
  mkdir -p ./etc/ld.so.conf.d
  mkdir -p ./etc/profile.d
  mkdir -p ${_man_dir}

  msg2 "Updating scripts"
  sed -e "s/<arch>/${_bin_dir}/g" -e "s/<ver>/${_advisor_ver}/g" \
    < ${srcdir}/intel_advisor.sh > etc/profile.d/intel_advisor.sh
  chmod a+x ./etc/profile.d/intel_advisor.sh

  msg2 "Extracting RPMS"
  extract_rpms 'intel-advisor-*.rpm'  $xe_build_dir

  cd ${xe_build_dir}/opt/intel/advisor_${_advisor_ver}

  msg2 "Copying man pages"
  if [[ -d ./man/man1 ]]; then
    mv ./man/man1/*.1 ${_man_dir}/
    gzip ${_man_dir}/*.1
  fi


  if $_remove_docs ; then
    msg2 "Removing documentation"
    rm -rf ./samples
    rm -rf ./documentation
  fi

  msg2 "Moving package files"
  mv ${xe_build_dir}/opt ${pkgdir}/
  mv ${xe_build_dir}/etc ${pkgdir}/
  mv ${xe_build_dir}/usr ${pkgdir}/
}

package_intel-inspector() {
  set_build_vars
  pkgdesc="Memory and thread debugger $_inspector_ver"
  pkgver=${_pkg_ver}
  conflicts=('intel-inspector-xe')

  mkdir -p ${xe_build_dir}
  cd ${xe_build_dir}
  mkdir -p ./opt
  mkdir -p ./etc/ld.so.conf.d
  mkdir -p ./etc/profile.d
  mkdir -p ${_man_dir}

  msg2 "Updating scripts"
  sed -e "s/<arch>/${_bin_dir}/g" -e "s/<ver>/${_inspector_ver}/g" \
    < ${srcdir}/intel_inspector.sh > ./etc/profile.d/intel_inspector.sh
  chmod a+x ./etc/profile.d/intel_inspector.sh

  msg2 "Extracting RPMS"
  extract_rpms 'intel-inspector-*.rpm'  $xe_build_dir

  cd ${xe_build_dir}/opt/intel/inspector_${_inspector_ver}

  msg2 "Copying man pages"
  if [[ -d ./man/man1 ]]; then
    mv ./man/man1/*.1 ${_man_dir}/
    gzip ${_man_dir}/*.1
  fi


  if $_remove_docs ; then
    msg2 "Removing documentation"
    rm -rf ./samples
    rm -rf ./documentation
  fi

  msg2 "Moving package files"
  mv ${xe_build_dir}/opt ${pkgdir}/
  mv ${xe_build_dir}/etc ${pkgdir}/
  mv ${xe_build_dir}/usr ${pkgdir}/
}
pkgdesc="Intel C++ C and FORTRAN compiler - Intel Parallel Studio XE - Cluster Edition - icc icpc ifort ipp mkl"
depends=('bash' 'gcc')