I see what you're trying to do is build a package using the intel compiler suite rather than the usual gcc toolchain. A few years ago I needed to do that for packaging molpro locally, so I am attaching that spec file which may give you some hints on how to go about it. Bare in mind that I haven't thought about this for a few years, so probably won't be able to answer any questions on it, but it might start you off in the right direction. On 8 September 2015 at 12:07, arnaud gaboury <arnaud.gaboury@xxxxxxxxx> wrote: > I am building a rpm package. For make to success and have the correct > env variables, I need to source a few scripts and unset a few > variables. > rpmbuild does not understand the source and unset commands. > > How shall I proceed to get the desired variables? > > Thank you > > -- > > google.com/+arnaudgabourygabx > -- > devel mailing list > devel@xxxxxxxxxxxxxxxxxxxxxxx > https://admin.fedoraproject.org/mailman/listinfo/devel > Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
# Intel compiler details # Disable by default, add --with intel to the rpmbuild command line to enable %bcond_with intel # Block is an add-in for Molpro available from # http://www.princeton.edu/chemistry/chan/software/dmrg/ # Disabled by default, add --with block to the rpmbuild command line to enable %global block_ver 0.9.6 %bcond_with block %if %{with intel} # The following are for the Intel 2013 compiler which produces a buggy build. # %global intelpath /opt/intel/composer_xe_2013.1.117 # %global intelarch intel64 # %global intelserver "28518@xxxxxxxxxxxxxxxxxxx" # %global intelver 117 # %global intelmkldev intel-mkl-devel-%{intelver} # %global intelcompilervars intel-compilerpro-vars-%{intelver} # %global intelfortcompilerdev intel-compilerprof-devel-%{intelver} # %global intelccompilerdev intel-compilerproc-devel-%{intelver} # %global intelcompilerdev intel-compilerpro-devel-%{intelver} # %global intelmkl intel-mkl-%{intelver} # %global intelfortcompiler intel-compilerprof-%{intelver} # %global intelccompiler intel-compilerproc-%{intelver} # Intel 2011 compiler. %global intelpath /opt/intel/composer_xe_2011_sp1.8.273/ %global intelarch intel64 %global intelserver "28518@xxxxxxxxxxxxxxxxxxx" %global intelver 273 %global intelmkldev intel-mkl-sp1-devel-%{intelver} %global intelcompilervars intel-compilerpro-vars-%{intelver} %global intelfortcompilerdev intel-compilerprof-devel-%{intelver} %global intelccompilerdev intel-compilerproc-devel-%{intelver} %global intelcompilerdev intel-compilerpro-devel-%{intelver} %global intelmkl intel-mkl-sp1-%{intelver} %global intelfortcompiler intel-compilerprof-%{intelver} %global intelccompiler intel-compilerproc-%{intelver} # During the binary compilation (i.e. during make, not during make # install) the molpro binary ends up containing strings referring to # the buildroot, which makes the /usr/lib/rpm/check-buildroot script # fail. So, for now disable it. This is probably specific to the Intel # compiler. %global __arch_install_post %{nil} # Don't build debug packages - the Intel compiler isn't set up to do # this in the way rpm expects. %global debug_package %{nil} # Unfortunately the Intel MKL rpm doesn't have properly generated # provides information and so doesn't satisfy the requirements that # building this packge creates automatically during package # building. Therefore turn off automatic dependency generation for the # libmkl libraries, and Require the mkl package manually below. %filter_from_requires libmkl.* %filter_setup %endif # Don't build debug packages - the Intel compiler isn't set up to do # this in the way rpm expects. %global debug_package %{nil} Name: molpro2012 Version: 2012.1.0 Release: 5%{?dist} Summary: Programs for molecular electronic structure calculations Group: Applications/Scientific License: Molpro URL: http://www.molpro.net ExclusiveArch: x86_64 Source0: molpro.%{version}.tar.gz Source1: molpro2012.token Source2: molpro2012.module.in # Block, and add-in for Molpro # http://www.princeton.edu/chemistry/chan/software/dmrg/ %global block_ver 0.9.6 Source10: http://www.princeton.edu/chemistry/chan/software/dmrg/Block-%{block_ver}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: openmpi-devel # These are required for the gcc build BuildRequires: gcc-gfortran atlas-devel Requires: openmpi Requires: environment-modules %if %{with intel} BuildRequires: %{intelmkldev} BuildRequires: %{intelcompilervars} BuildRequires: %{intelfortcompilerdev} BuildRequires: %{intelccompilerdev} BuildRequires: %{intelcompilerdev} Requires: %{intelmkl} Requires: %{intelfortcompiler} Requires: %{intelccompiler} %endif # This is a workaround to allow openmpi to run inside a mock chroot # See http://permalink.gmane.org/gmane.comp.clustering.open-mpi.user/966 BuildRequires: rsh %description Molpro is a complete system of ab initio programs for molecular electronic structure calculations. %prep %if %{with block} %setup -q -c -n molpro-%{version} -T -a0 -a10 mv Block-%block_ver Molpro/src/Block %else %setup -q -c -n molpro-%{version} -T -a0 %endif # Duplicate the source tree for each configuration we want to build cp -ar Molpro gcc cp -ar Molpro gcc-openmpi %if %{with intel} cp -ar Molpro intel cp -ar Molpro intel-openmpi %endif %build %global molpro_key %(cat %SOURCE1) export MOLPRO_KEY="%{molpro_key}" # GCC compiled version pushd gcc ./configure -batch \ -blas -blaspath %{_libdir}/atlas \ %if %{with block} -Block \ %endif -lapack -lapackpath %{_libdir}/atlas #\ # -prefix $RPM_BUILD_ROOT%{instdir}/gcc make %{?_smp_mflags} popd # GCC compiled version with openmpi pushd gcc-openmpi %_openmpi_load ./configure -batch \ -openmpi -mpp -mppbase $MPI_INCLUDE \ %if %{with block} -Block \ %endif -blas -blaspath %{_libdir}/atlas \ -lapack -lapackpath %{_libdir}/atlas #\ # -prefix $RPM_BUILD_ROOT%{instdir}/gcc-openmpi make %{?_smp_mflags} popd %_openmpi_unload # Intel compiled version %if %{with intel} export INTEL_LICENSE_FILE=%{intelserver} export INTELPATH=%{intelpath} source ${INTELPATH}/bin/compilervars.sh %{intelarch} #source ${INTELPATH}/mkl/bin/mklvars.sh {intelarch} pushd intel ./configure -batch \ -openmp \ -icc -ifort \ %if %{with block} -Block \ %endif -blaspath ${INTELPATH}/mkl/lib/%{intelarch} \ -lapack -lapackpath ${INTELPATH}/mkl/lib/%{intelarch} #\ # -prefix $RPM_BUILD_ROOT%{instdir}/intel make %{?_smp_mflags} popd # Intel compiled version with openmpi %_openmpi_load pushd intel-openmpi ./configure -batch \ -openmp \ -icc -ifort \ %if %{with block} -Block \ %endif -blaspath ${INTELPATH}/mkl/lib/%{intelarch} \ -lapack -lapackpath ${INTELPATH}/mkl/lib/%{intelarch} \ -openmpi -mpp -mppbase $MPI_INCLUDE #\ #-prefix $RPM_BUILD_ROOT%{instdir}/intel-openmpi make %{?_smp_mflags} popd %_openmpi_unload %endif %install rm -rf $RPM_BUILD_ROOT export MOLPRO_KEY="%{molpro_key}" %global targetdirs gcc gcc-openmpi %if %{with intel} %global targetdirs %{targetdirs} intel intel-openmpi %endif # Installation directory %global instdir /opt/Molpro2012 for i in %{targetdirs} ; do pushd ${i} make install PREFIX=${RPM_BUILD_ROOT}%{instdir}/${i} popd done for i in `find $RPM_BUILD_ROOT%{instdir} -name bin -type d` ; do # Remove the unneeded uninstall files which in any case contain # hardcoded buidroots and so cause package building errors rm -f ${i}/uninstall* # Remove buildroot from environment sed -i -e "s|$RPM_BUILD_ROOT||g" ${i}/molpro done # Package up doc files mkdir -p $RPM_BUILD_ROOT%{instdir}/doc cp -a gcc/doc/*.pdf $RPM_BUILD_ROOT%{instdir}/doc cp -ar gcc/examples $RPM_BUILD_ROOT%{instdir}/doc # Set up environment modules install -d $RPM_BUILD_ROOT%{_sysconfdir}/modulefiles/molpro2012 for i in %{targetdirs} ; do binpath=$(find $RPM_BUILD_ROOT%{instdir}/$i -name bin -type d) binpath=${binpath#$(echo $RPM_BUILD_ROOT)} sed "s|@MOLPROBINPATH@|${binpath}|g" < %SOURCE2 > $RPM_BUILD_ROOT%{_sysconfdir}/modulefiles/molpro2012/${i} done %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %{instdir} %{_sysconfdir}/modulefiles/molpro2012 %changelog * Thu Apr 25 2013 Jonathan G. Underwood <j.underwood@xxxxxxxxx> - 2012.1-5 - Spec file cleanups - Revert to using the 2011 Intel compilers as the 2013 compiler produces buggy code * Thu Apr 25 2013 Jonathan G. Underwood <j.underwood@xxxxxxxxx> - 2012.1-4 - Add option to build with Block * Mon Apr 10 2013 Jonathan G. Underwood <j.underwood@xxxxxxxxx> - 2012.1-3 - Rebuild with version 2013 of the Intel compilers * Fri Mar 15 2013 Jonathan G. Underwood <j.underwood@xxxxxxxxx> - 2012.1-2 - Update license token * Thu Mar 14 2013 Jonathan G. Underwood <j.underwood@xxxxxxxxx> - 2012.1-1 - Update to version 2012 - Change the package name to include the major release version for parallel installability with previous major releases * Thu Jan 19 2012 Jonathan G. Underwood <j.underwood@xxxxxxxxx> - 2010.1.25-4 - Add configure options to link to the Intel lapack libraries for the intel builds * Wed Jan 18 2012 Jonathan G. Underwood <j.underwood@xxxxxxxxx> - 2010.1.25-3 - Conditionalize the intel compiler builds - Use intel C/C++ comipiler * Mon Jan 16 2012 Jonathan G. Underwood <j.underwood@xxxxxxxxx> - 2010.1.25-2 - Fix up mkl-devel BuildRequires * Tue Jan 10 2012 Jonathan G. Underwood <j.underwood@xxxxxxxxx> - 2010.1.25-1 - Update to 2010.1.25 - Re-enable openmp - Build gcc and gcc-openmpi versions - Add environment modules support - Drop initialization script - Cleanups * Mon Oct 24 2011 Jonathan G. Underwood <j.underwood@xxxxxxxxx> - 2010.1.23-5 - Remove -openmpi from build options to fix convergence issues * Thu Sep 15 2011 Jonathan G. Underwood <j.underwood@xxxxxxxxx> - 2010.1.23-4 - Remove buildroot from molpro{p,s} enviroment variables * Thu Sep 15 2011 Jonathan G. Underwood <j.underwood@xxxxxxxxx> - 2010.1.23-3 - Turn off debuginfo generation - Build both serial and parallel versions - Use openmpi rather than mpich2 - Remove tests for now - Move license token into a file - Add openmp support to both serial and parallel versions * Thu Sep 15 2011 Jonathan G. Underwood <j.underwood@xxxxxxxxx> - 2010.1.23-2 - Turn off automatic dependency generation for the MKL libraries - Properly setup mpich2 environment before running tests * Thu Sep 15 2011 Jonathan G. Underwood <j.underwood@xxxxxxxxx> - 2010.1.23-1 - Initial package build
-- devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/devel Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct