Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-release-src > by-pkgid > f77529d644cb7c7bfa260b2fde9fc03c > files > 7

openfoam-4.1-2.mga6.src.rpm

%define oname           OpenFOAM
%define osrcname        %{oname}-%{version}
%define libfoamdir      %{_libdir}/%{name}
%define binfoamdir      %{_libexecdir}/%{name}
%define datafoamdir     %{_datadir}/%{oname}-%{version}
%define pvversion       5.3

Name:          openfoam
Version:       4.1
Release:       %mkrel 2
Summary:       The open source CFD toolbox
License:       GPLv3+
Group:         Sciences/Physics
Url:           http://www.openfoam.org
Source0:       http://downloads.sourceforge.net/foam/%{osrcname}.tar.gz
Source1:       openfoam

#find system include and libraries for scotch
Patch0:        openfoam-4.1-scotch.patch


#find system include and libraries for paraview
Patch1:        openfoam-4.1-paraview-%{pvversion}.patch

#API breaks of paraview-5.3 not yet supported by openfoam (this patch
#removes paraview built)
#https://bugs.openfoam.org/view.php?id=2480)
Patch11:       openfoam-4.1-nobuild-paraview-%{pvversion}.patch


#tentative fix for arm, set WM_ARCH_OPTION to 32
Patch2:        openfoam-4.1-arm-arch32.patch

BuildRequires: bison
BuildRequires: boost-devel
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: flex
BuildRequires: mpfr-devel
BuildRequires: pkgconfig(ompi)
BuildRequires: pkgconfig(zlib)
BuildRequires: ptscotch-openmpi-devel
BuildRequires: libptscotch-parmetis-openmpi-devel
BuildRequires: cgal-devel
BuildRequires: paraview-devel
BuildRequires: paraview-static-devel
BuildRequires: qt4-devel
BuildRequires: protobuf-devel
BuildRequires: netcdf-cxx-devel
BuildRequires: libxt-devel
Requires:      gcc-c++
Obsoletes:     openfoam-doc < 4.1

%description
OpenFOAM is a free, open source computational fluid dynamcis (CFD)
software package released by the OpenFOAM Foundation. It has a large
user base across most areas of engineering and science, from both
commercial and academic organisations. OpenFOAM has an extensive range
of features to solve anything from complex fluid flows involving
chemical reactions, turbulence and heat transfer, to solid dynamics
and electromagnetics. This package provides the platform specific
binaries and modules located in %{binfoamdir} and %{libfoamdir},
respectively.



%package       tutorials
Summary:       Development files for %{name}
Group:         Sciences/Physics
Requires:      %{name} = %{version}

%description   tutorials
The %{name}-tutorials package contains tutorials and examples
for %{oname}.


%prep
%setup -q -n %{osrcname}
#autopatch -p1
%patch0 -p1 -b .orig
%__sed -i "s|libARCH|%{_lib}|g" ./etc/config.sh/scotch
%patch1 -p1 -b .orig
%__sed -i "s|libARCH|%{_lib}|g" ./etc/config.sh/paraview

%patch11 -p1 -b .nopv53

%patch2 -p1 -b .arm

%build
#Welcome to the best non-portable build system ever invented...

#Let's set mga compile flags in such a simple way
source %{_builddir}/%{osrcname}/etc/bashrc
%__sed -i "s/^cOPT.*$/cOPT = %{optflags}/" wmake/rules/linux*Gcc/cOpt
%__sed -i "s/^c++OPT.*$/c++OPT = %{optflags}/" wmake/rules/linux*Gcc/c++Opt

#Let's also specify parallel make by hand
./Allwmake %{?_smp_mflags}




%install
#Clean object files, build residuals and other shits
find ./platforms/*/applications \( -name \*.o -o -name \*.dep \) -delete
find ./platforms/*/src \( -name \*.o -o -name \*.dep \) -delete
find ./platforms -name '*.la' -delete
find ./tutorials -name '.keep' -delete

#to be checked for arm?
%ifarch x86_64
PLATFORMDIR=./platforms/linux64GccDPInt32Opt
%endif
%ifarch %{ix86}
PLATFORMDIR=./platforms/linuxGccDPInt32Opt
%endif
%ifarch %{arm}
PLATFORMDIR=./platforms/linuxARM7GccDPInt32Opt
%endif

pushd $PLATFORMDIR
%__install -D ./bin/* -t %{buildroot}%{binfoamdir}
%__install -D ./lib/*.so -t %{buildroot}%{libfoamdir}
%__install -D ./lib/dummy/*.so -t %{buildroot}%{libfoamdir}/dummy
#broken with pv5.3
#__install -D ./lib/paraview-%{pvversion}/*.so -t %{buildroot}%{libfoamdir}/paraview-%{pvversion}
%__install -D ./lib/openmpi-system/*.so -t %{buildroot}%{libfoamdir}/openmpi-system
popd

%__mkdir_p %{buildroot}%{datafoamdir}
%__cp -r -f tutorials -t %{buildroot}%{datafoamdir}/
%__cp -r -f bin -t %{buildroot}%{datafoamdir}/
%__cp -r -f etc -t %{buildroot}%{datafoamdir}/


# ld.conf.d file
%__install -d %{buildroot}%{_sysconfdir}/ld.so.conf.d
echo %{libfoamdir} > %{buildroot}%{_sysconfdir}/ld.so.conf.d/openfoam.conf
echo %{libfoamdir}/dummy >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/openfoam.conf
echo %{libfoamdir}/paraview-%{pvversion} >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/openfoam.conf
echo %{libfoamdir}/openmpi-system >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/openfoam.conf


# replace duplicates by symlinks
%fdupes -s %{buildroot}%{datafoamdir}/tutorials
%fdupes -s %{buildroot}%{datafoamdir}/doc

%__install -D -m 755 %{SOURCE1} %{buildroot}%{_bindir}/openfoam

%files
%doc doc/Guides/*.pdf
%config(noreplace) %{_sysconfdir}/ld.so.conf.d/openfoam.conf
%{_bindir}/openfoam
%{datafoamdir}/bin
%{datafoamdir}/etc
%{binfoamdir}
%{libfoamdir}


%files tutorials
%{datafoamdir}/tutorials


%changelog
* Wed May 03 2017 eatdirt <eatdirt> 4.1-2.mga6
+ Revision: 1098848
- Rebuild for new paraview

* Thu Dec 15 2016 eatdirt <eatdirt> 4.1-1.mga6
+ Revision: 1075397
- Tentative patch to fix arm built failures
- Fix missing BuildRequires
- Add environment launcher + fix module paths
- Upgrade to version 4.1

* Fri Dec 02 2016 tmb <tmb> 2.4.0-6.mga6
+ Revision: 1071630
- rebuild for new openmpi

* Tue Oct 18 2016 pterjan <pterjan> 2.4.0-5.mga6
+ Revision: 1061717
- Use of flags on armv7hl

* Tue Feb 16 2016 umeabot <umeabot> 2.4.0-4.mga6
+ Revision: 961946
- Mageia 6 Mass Rebuild

* Sun Dec 27 2015 daviddavid <daviddavid> 2.4.0-3.mga6
+ Revision: 915535
- rebuild for new boost 1.60.0

* Wed Sep 30 2015 daviddavid <daviddavid> 2.4.0-2.mga6
+ Revision: 885268
- rebuild for new openmpi 1.10.0

* Tue Sep 29 2015 tv <tv> 2.4.0-1.mga6
+ Revision: 885144
- new release

* Sun Sep 27 2015 tv <tv> 2.3.1-3.mga6
+ Revision: 884211
- rebuild for new boost

* Sun Aug 02 2015 daviddavid <daviddavid> 2.3.1-2.mga6
+ Revision: 860795
- rebuild for new boost-1.58.0

* Sun Feb 08 2015 akien <akien> 2.3.1-1.mga5
+ Revision: 814142
- Fix launcher script when tutorials are not installed
- Version 2.3.1

* Wed Oct 15 2014 umeabot <umeabot> 2.3.0-6.mga5
+ Revision: 745859
- Second Mageia 5 Mass Rebuild

* Fri Sep 26 2014 tv <tv> 2.3.0-5.mga5
+ Revision: 725152
- rebuild for bogus file deps

* Tue Sep 16 2014 umeabot <umeabot> 2.3.0-4.mga5
+ Revision: 683210
- Mageia 5 Mass Rebuild

* Tue Aug 26 2014 akien <akien> 2.3.0-3.mga5
+ Revision: 668501
- Build requires boost-devel

* Sat Jun 21 2014 akien <akien> 2.3.0-2.mga5
+ Revision: 638237
- Improve %%description
- Add a launcher script to start the OpenFOAM bash environment

* Tue Feb 18 2014 akien <akien> 2.3.0-1.mga5
+ Revision: 594265
- Update to version 2.3.0: http://www.openfoam.org/version2.3.0/
- Add BR on mpfr-devel

* Mon Dec 02 2013 philippem <philippem> 2.2.2-0.mga4
+ Revision: 554606
- imported package openfoam