FreeCAD/FreeCAD.spec

231 lines
7.1 KiB
RPMSpec

#
# spec file for package FreeCAD
#
# Copyright (c) 2017 SUSE LINUX 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 http://bugs.opensuse.org/
#
%define x_prefix %{_libdir}/%{name}
Name: FreeCAD
Version: 0.16.6712
Release: 0
Summary: General Purpose 3D CAD Modeler
License: LGPL-2.0+ and GPL-2.0+
Group: Productivity/Graphics/CAD
Url: http://www.freecadweb.org/
Source0: %{name}-%{version}.tar.xz
Source2: FreeCAD_shared_mimeinfo
BuildRequires: Coin-devel
BuildRequires: SoQt-devel
%if 0%{?suse_version} >= 1330
BuildRequires: libboost_filesystem-devel >= 1.55
BuildRequires: libboost_graph-devel >= 1.55
BuildRequires: libboost_program_options-devel >= 1.55
BuildRequires: libboost_python-devel >= 1.55
BuildRequires: libboost_regex-devel >= 1.55
BuildRequires: libboost_signals-devel >= 1.55
BuildRequires: libboost_system-devel >= 1.55
BuildRequires: libboost_thread-devel >= 1.55
%else
BuildRequires: boost-devel >= 1.55
%endif
BuildRequires: cmake
BuildRequires: dos2unix
BuildRequires: doxygen
BuildRequires: f2c
BuildRequires: fdupes
BuildRequires: freeglut-devel
BuildRequires: gcc-fortran
BuildRequires: git
BuildRequires: hdf5-devel
BuildRequires: libXerces-c-devel
BuildRequires: libeigen3-devel
BuildRequires: libqt4-devel
BuildRequires: libshiboken-devel
BuildRequires: libspnav-devel
BuildRequires: oce-devel
BuildRequires: opencv-devel
BuildRequires: pkgconfig
BuildRequires: python-CXX-devel
BuildRequires: python-devel
BuildRequires: python-matplotlib
BuildRequires: python-pyside
BuildRequires: python-pyside-devel
BuildRequires: python-pyside-tools
BuildRequires: python-xml
BuildRequires: swig
BuildRequires: unzip
BuildRequires: update-desktop-files
BuildRequires: zlib-devel
BuildRequires: pkgconfig(QtWebKit)
Requires: python-CXX
Requires: python-pyside
%if 0%{?suse_version} <= 1320
Requires(post): shared-mime-info
Requires(postun): shared-mime-info
%endif
Recommends: python-pivy
%description
Note: This package contains the current development version and thus might
be unstable!
FreeCAD is a general purpose 3D CAD modeler. The development will be completely
Open Source. As with many modern 3D CAD modelers it will have a 2D component in
order to extract design detail from the 3D model to create 2D production
drawings, although 2D (e.g. AutoCAD LT) is not the focus, neither are animation
and organic shapes (e.g. Maya, 3D StudioMAX and Cinema 4D).
%package devel
Summary: Development Files for %{name}
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
%description devel
This package contains the files needed for development with FreeCAD.
%prep
%setup -q
# Fix "wrong-file-end-of-line-encoding" rpmlint warning
sed -i 's/\r$//' ChangeLog.txt
sed -i 's/\r$//' copying.lib
# Fix "wrong-script-end-of-line-encoding" rpmlint warning
sed -i 's/\r$//' src/Mod/PartDesign/Scripts/Spring.py
sed -i 's/\r$//' src/Mod/Robot/MovieTool.py
# Remove 3rd party libs
rm src/3rdparty/Pivy -fr
rm src/3rdparty/Pivy-0.5 -fr
# fix env-script-interpreter
sed -i '1c#!%{__python2}' \
src/Mod/Test/testmakeWireString.py \
src/Mod/Test/unittestgui.py
%build
mkdir build && cd build
# cmake macro would set standard libdir
# it needs an older specific zipios version -DFREECAD_USE_EXTERNAL_ZIPIOS=TRUE
cmake \
-DCMAKE_INSTALL_PREFIX=%{_libdir}/%{name} \
-DCMAKE_INSTALL_DATADIR=%{_datadir}/%{name} \
-DCMAKE_INSTALL_DOCDIR=%{_docdir}/%{name} \
-DCMAKE_INSTALL_INCLUDEDIR=%{_includedir}/%{name} \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \
-DOCC_INCLUDE_DIR=%{_includedir}/oce \
-DRESOURCEDIR=%{_datadir}/%{name} \
-DCMAKE_BUILD_TYPE=Release \
%if %{with netgen}
-DBUILD_FEM_NETGEN=ON \
%else
-DBUILD_FEM_NETGEN=OFF \
%endif
../
make VERBOSE=1 %{?_smp_mflags} all
# # Build documentation last, somehow
# # this triggers a rebuild
# mkdir build_doc
# pushd build_doc
# cmake \
# -DCMAKE_INSTALL_PREFIX=%%{_prefix} \
# -DLIB_SUFFIX=%%{_lib} \
# -DCMAKE_INSTALL_DATADIR=%%{_datadir}/%%{name} \
# -DCMAKE_INSTALL_DOCDIR=%%{_docdir}/%%{name} \
# -DCMAKE_INSTALL_INCLUDEDIR=%%{_includedir}/%%{name} \
# -DCMAKE_BUILD_TYPE=Release \
# -DFREECAD_USE_EXTERNAL_ZIPIOS=TRUE \
# -DFREECAD_USE_EXTERNAL_PIVY=TRUE \
# ../
# # Needs an updated opencascade
# #-DOCE_DIR=/opt/OpenCASCADE/%%{_lib}
#
# nice make VERBOSE=1 DevDoc
# popd
%install
pushd build
nice make VERBOSE=1 %{?_smp_mflags} install DESTDIR=%{buildroot}
popd
# pushd build_doc
# nice make VERBOSE=1 %%{?_smp_mflags} install DESTDIR=%%{buildroot}
# popd
# Install the Qt plugin
#install -Dpm 0755 src/Tools/plugins/widget/libFreeCAD_widgets.so %%{buildroot}/usr/%%{_lib}/qt4/plugins/designer/libFreeCAD_widgets.so
# Fix "non-executable-script" rpmlint warning
chmod 755 %{buildroot}%{x_prefix}/Mod/Robot/MovieTool.py \
%{buildroot}%{x_prefix}/Mod/Test/testmakeWireString.py \
%{buildroot}%{x_prefix}/Mod/Test/unittestgui.py
# Move desktop icon in the correct location
mkdir -p %{buildroot}%{_datadir}/pixmaps
mv %{buildroot}%{_datadir}/%{name}/freecad.xpm %{buildroot}%{_datadir}/pixmaps/freecad.xpm
# Install additional documentation files
install -pm 0644 ChangeLog.txt copying.lib %{buildroot}%{_docdir}/%{name}/
%suse_update_desktop_file -c %{name} "%{name}" "3D CAD Modeler" %{name} "freecad" Education Engineering
# Install mime type
install -Dpm 0644 %{SOURCE2} %{buildroot}/%{_datadir}/mime/packages/%{name}.xml
# Remove unneeded files
find %{buildroot} -type f -name "*.la" -delete -print
# Fix rpmlint warning "doc-file-dependency"
rm -f html/installdox
# Install development documentation manually in order to fix rpmlint warning "files-duplicate"
mkdir -p %{buildroot}%{_docdir}/%{name}-devel
#cp -a html/ %%{buildroot}%%{_docdir}/%%{name}-devel/
# Correct line endings
dos2unix %{buildroot}%{x_prefix}/Mod/PartDesign/Scripts/FilletArc.py
dos2unix %{buildroot}%{x_prefix}/Mod/PartDesign/Scripts/Parallelepiped.py
dos2unix %{buildroot}%{x_prefix}/Mod/Test/unittestgui.py
dos2unix %{buildroot}%{x_prefix}/Mod/Part/MakeBottle.py
# Link binaries
mkdir -p %{buildroot}%{_bindir}
ln -s -t %{buildroot}%{_bindir} %{x_prefix}/bin/FreeCAD
ln -s -t %{buildroot}%{_bindir} %{x_prefix}/bin/FreeCADCmd
%fdupes -s %{buildroot}
%post
/sbin/ldconfig
%mime_database_post
%postun
/sbin/ldconfig
%mime_database_postun
%files
%{_bindir}/FreeCAD*
%doc %{_docdir}/%{name}/
%{_libdir}/%{name}
%{_datadir}/%{name}/
%{_datadir}/mime/packages/%{name}.xml
%{_datadir}/pixmaps/freecad.xpm
%{_datadir}/applications/%{name}.desktop
%changelog