File ccx.spec of Package ccx

# spec file for package ccx
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           ccx
Version:        2.12
Release:        0
Summary:        An open source finite element package
License:        GPL-2.0 and BSD-3-Clause and SUSE-Public-Domain
Group:          Productivity/Scientific/Other
Patch0:         ccx-2.8-build.patch
Patch1:         ccx-1.2-doc-Makefile.patch
Patch3:         ccx-2.8-spooles-dynamic.patch
Patch4:         ccx-2.5-abaqus-shell-heat-transfer-elements-read.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  arpack-ng-devel
BuildRequires:  fdupes
BuildRequires:  gcc-fortran
BuildRequires:  lapack-devel
BuildRequires:  latex2html
BuildRequires:  sed
BuildRequires:  spooles-devel
%if 0%{?suse_version} > 1220
BuildRequires:  tex(pst-tools.tex)
BuildRequires:  texlive-pstricks
BuildRequires:  texlive-dvips

CalculiX is a package designed to solve field problems.
The method used is the finite element method. So far only
structural problems can be solved but it is planned to
extend the capabilities.

%package doc
Summary:        Example problems and documentation for CalculiX
Group:          Productivity/Scientific/Other
%if 0%{?suse_version} > 1130
BuildArch:      noarch

%description doc
CalculiX is a package designed to solve field problems.
The method used is the finite element method. %{name}-examples
contains examples problems, together with reference data
to check your installation.

%setup -c -q
%patch0 -p1
%setup -D -T -a 1 -q
%setup -D -T -a 2 -q
%patch1 -p1
%patch3 -p1
%patch4 -p1

# fixup dirs: very deep directory structure, not suitable for patching
cd ${RPM_BUILD_DIR}/%{name}-%{version}
mv CalculiX/ccx_%{version}/doc/* doc/
mv CalculiX/ccx_%{version}/src .
mv CalculiX/ccx_%{version}/test .
rmdir CalculiX/ccx_%{version}/doc
rmdir CalculiX/ccx_%{version}
rmdir CalculiX

cd ${RPM_BUILD_DIR}/%{name}-%{version}
# use rpm's proposal for CFLAGS
export GLOBAL_OFLAGS="$RPM_OPT_FLAGS -pthread"

# and now build calculix
cd src
make %{?_smp_mflags}

# build the documentation:
cd ../doc
# This hack fixes the documentation build which fails on recent
# texlive
ln -s %{_datadir}/texmf/fonts/enc/dvips/tex-gyre/q-texnansi.enc ./texnansi.enc
make %{?_smp_mflags}

# copy central descriptions to topmost folder, for %%doc directive
cd ${RPM_BUILD_DIR}/%{name}-%{version}
cp doc/*.pdf .

cd ${RPM_BUILD_DIR}/%{name}-%{version}
rm -rf $RPM_BUILD_ROOT/*
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
cp src/ccx_%{version} $RPM_BUILD_ROOT/%{_bindir}
chmod 755 $RPM_BUILD_ROOT/%{_bindir}/ccx_%{version}
# symlink needed or apps like FreeCAD won't find it
ln -s ccx_%{version} $RPM_BUILD_ROOT/%{_bindir}/ccx

mkdir -p $RPM_BUILD_ROOT/%{_datadir}/%{name}-examples-%{version}
cp test/* $RPM_BUILD_ROOT/%{_datadir}/%{name}-examples-%{version}
chmod 644 $RPM_BUILD_ROOT/%{_datadir}/%{name}-examples-%{version}/*
chmod 755 $RPM_BUILD_ROOT/%{_datadir}/%{name}-examples-%{version}/compare
chmod 755 $RPM_BUILD_ROOT/%{_datadir}/%{name}-examples-%{version}/
chmod 755 $RPM_BUILD_ROOT/%{_datadir}/%{name}-examples-%{version}/

%fdupes $RPM_BUILD_ROOT/%{_datadir}/%{name}-examples-%{version}

%doc BUGS
%doc TODO

%files doc
%doc *.pdf

openSUSE Build Service is sponsored by