]> git.pld-linux.org Git - packages/freecad.git/blame - freecad.spec
- initial, from fc
[packages/freecad.git] / freecad.spec
CommitLineData
dfd2f590
AM
1# Maintainers: keep this list of plugins up to date
2# List plugins in %%{_libdir}/freecad/lib, less '.so' and 'Gui.so', here
3%global plugins Assembly Complete Drawing Fem FreeCAD Image Import Inspection Mesh MeshPart Part Points QtUnit Raytracing ReverseEngineering Robot Sketcher Start Web PartDesignGui _PartDesign
4
5# Some plugins go in the Mod folder instead of lib. Deal with those here:
6%global mod_plugins Mod/PartDesign
7
8# This revision is 0.13 final.
9%global rev 3702
10
11# Temporary workaround for cmake/boost bug:
12# http://public.kitware.com/Bug/view.php?id=13446
13%if 0%{?rhel} && 0%{?rhel} <= 6
14%global cmake %cmake -DBoost_NO_BOOST_CMAKE=ON
15%endif
16
17# Some configuration options for other environments
18# rpmbuild --with=occ: Compile using OpenCASCADE instead of OCE
19%global occ %{?_with_occ:1} %{?!_with_occ: 0}
20# rpmbuild --with=bundled_zipios: use bundled version of zipios++
21%global bundled_zipios %{?_with_bundled_zipios:1} %{?!_with_bundled_zipios: 0}
22# rpmbuild --with=bundled_pycxx: use bundled version of pycxx
23%global bundled_pycxx %{?_with_bundled_pycxx:1} %{?!_with_bundled_pycxx: 0}
24# rpmbuild --with=bundled_smesh: use bundled version of Salome's Mesh
25%global bundled_smesh %{?_with_bundled_smesh:1} %{?!_with_bundled_smesh: 0}
26
27
28Summary: A general purpose 3D CAD modeler
29Name: freecad
30Version: 0.14
31Release: 0.1
32Group: Applications/Engineering
33
34License: GPL v2+
35URL: http://sourceforge.net/apps/mediawiki/free-cad/
36Source0: http://downloads.sourceforge.net/free-cad/%{name}-%{version}.%{rev}.tar.gz
37# Source0-md5: 234747bdff47a62fd10cb902f3dd772b
38Source101: %{name}.desktop
39Source102: %{name}.1
40Source103: %{name}.appdata.xml
41Source104: %{name}.sharedmimeinfo
42
43Patch0: %{name}-3rdParty.patch
44Patch1: %{name}-0.14-Xlib_h.patch
45Patch2: %{name}-0.14-smesh.patch
46# http://www.freecadweb.org/tracker/view.php?id=1757
47Patch3: %{name}-0.14-DraftSnap.patch
48#Patch4: %{name}-0.14-disable_auto_dxf_dl.patch
49
50
51# Utilities
52BuildRequires: cmake
53BuildRequires: desktop-file-utils
54BuildRequires: dos2unix
55BuildRequires: doxygen
56BuildRequires: gcc-gfortran
57BuildRequires: gettext
58BuildRequires: graphviz
59BuildRequires: swig
60%ifnarch ppc64
61BuildRequires: tbb-devel
62%endif
63# Development Libraries
64BuildRequires: freeimage-devel
65BuildRequires: mesa-libGLU-devel
66BuildRequires: xorg-lib-libXmu-devel
67%if %{occ}
68BuildRequires: OpenCASCADE-devel
69%else
70BuildRequires: OCE-devel
71%endif
72# Not yet in Fedora
73# https://bugzilla.redhat.com/show_bug.cgi?id=665733
74BuildRequires: Coin2-devel
75#BuildRequires: Coin3-devel
76BuildRequires: SoQt-devel
77BuildRequires: boost-devel
78BuildRequires: eigen3-devel
79BuildRequires: python-devel
80BuildRequires: qt-devel
81BuildRequires: qt-webkit-devel
82# Not used yet.
83BuildRequires: libspnav-devel
84#BuildRequires: ode-devel
85#BuildRequires: opencv-devel
86BuildRequires: python-pyside-devel
87BuildRequires: shiboken-devel
88BuildRequires: xerces-c
89BuildRequires: xerces-c-devel
90%if ! %{bundled_smesh}
91BuildRequires: smesh-devel
92%endif
93BuildRequires: netgen-mesher-devel
94%if ! %{bundled_zipios}
95BuildRequires: zipios++-devel
96%endif
97%if ! %{bundled_pycxx}
98BuildRequires: python-pycxx-devel
99%endif
100BuildRequires: libicu-devel
101BuildRequires: python-matplotlib
102
103# For appdata
104%if 0%{?fedora}
105BuildRequires: libappstream-glib
106%endif
107
108# Packages separated because they are noarch, but not optional so require them
109# here.
110Requires: %{name}-data = %{version}-%{release}
111# Obsolete old doc package since it's required for functionality.
112Obsoletes: freecad-doc < 0.13-5
113
114# Needed for plugin support and is not a soname dependency.
115%if ! 0%{?rhel} <= 6 && "%{_arch}" != "ppc64"
116# python-pivy does not build on EPEL 6 ppc64.
117Requires: python-pivy
118%endif
119Requires: hicolor-icon-theme
120Requires: python-collada
121Requires: python-matplotlib
122Requires: python-pyside
123
124# plugins and private shared libs in %%{_libdir}/freecad/lib are private;
125# prevent private capabilities being advertised in Provides/Requires
126%define plugin_regexp /^\\\(libFreeCAD.*%(for i in %{plugins}; do echo -n "\\\|$i\\\|$iGui"; done)\\\)\\\(\\\|Gui\\\)\\.so/d
127%{?filter_setup:
128%filter_provides_in %{_libdir}/%{name}/lib
129%filter_from_requires %{plugin_regexp}
130%filter_from_provides %{plugin_regexp}
131%filter_provides_in %{_libdir}/%{name}/Mod
132%filter_requires_in %{_libdir}/%{name}/Mod
133%filter_setup
134}
135
136
137%description
138FreeCAD is a general purpose Open Source 3D CAD/MCAD/CAx/CAE/PLM
139modeler, aimed directly at mechanical engineering and product design
140but also fits a wider range of uses in engineering, such as
141architecture or other engineering specialties. It is a feature-based
142parametric modeler with a modular software architecture which makes it
143easy to provide additional functionality without modifying the core
144system.
145
146
147%package data
148Summary: Data files for FreeCAD
149Requires: %{name} = %{version}-%{release}
150BuildArch: noarch
151
152%description data
153Data files for FreeCAD
154
155
156%prep
157%setup -q -n %{name}-%{version}.%{rev}
158%patch0 -p1 -b .3rdparty
159# Remove bundled pycxx if we're not using it
160%if ! %{bundled_pycxx}
161rm -rf src/CXX
162%endif
163%patch1 -p1 -b .Xlib_h
164%patch2 -p1 -b .smesh
165%patch3 -p1 -b .draftsnap
166# Patch comes from upstream/master, doesn't apply cleanly to 0.14.
167#patch4 -p1 -b .no_dxf_dl
168
169%if ! %{bundled_zipios}
170rm -rf src/zipios++
171%endif
172
173# Fix encodings
174dos2unix -k src/Mod/Test/unittestgui.py \
175 ChangeLog.txt \
176 copying.lib \
177 data/License.txt
178
179# Removed bundled libraries
180rm -rf src/3rdParty
181
182
183%build
184rm -rf build && mkdir build && pushd build
185
186# Deal with cmake projects that tend to link excessively.
187LDFLAGS='-Wl,--as-needed -Wl,--no-undefined'; export LDFLAGS"
188
189%cmake -DCMAKE_INSTALL_PREFIX=%{_libdir}/%{name} \
190 -DCMAKE_INSTALL_DATADIR=%{_datadir}/%{name} \
191 -DCMAKE_INSTALL_DOCDIR=%{_docdir}/%{name} \
192 -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} \
193 -DRESOURCEDIR=%{_datadir}/%{name} \
194 -DCOIN3D_INCLUDE_DIR=%{_includedir}/Coin2 \
195 -DCOIN3D_DOC_PATH=%{_datadir}/Coin2/Coin \
196 -DFREECAD_USE_EXTERNAL_PIVY=TRUE \
197%if %{occ}
198 -DUSE_OCC=TRUE \
199%endif
200%if ! %{bundled_smesh}
201 -DFREECAD_USE_EXTERNAL_SMESH=TRUE \
202 -DSMESH_INCLUDE_DIR=%{_includedir}/smesh \
203%endif
204%if ! %{bundled_zipios}
205 -DFREECAD_USE_EXTERNAL_ZIPIOS=TRUE \
206%endif
207%if ! %{bundled_pycxx}
208 -DPYCXX_INCLUDE_DIR=$(pkg-config --variable=includedir PyCXX) \
209 -DPYCXX_SOURCE_DIR=$(pkg-config --variable=srcdir PyCXX) \
210%endif
211 ../
212
213%{__make} %{?_smp_mflags}
214
215%{__make} doc
216
217
218%install
219rm -rf $RPM_BUILD_ROOT
220pushd build
221%{__make} install \
222 DESTDIR=$RPM_BUILD_ROOT
223popd
224
225# Symlink binaries to %{_bindir}
226install -d $RPM_BUILD_ROOT%{_bindir}
227pushd $RPM_BUILD_ROOT%{_bindir}
228ln -s ../%{_lib}/freecad/bin/FreeCAD .
229ln -s ../%{_lib}/freecad/bin/FreeCADCmd .
230popd
231
232# Fix problems with unittestgui.py
233#chmod +x $RPM_BUILD_ROOT%{_libdir}/%{name}/Mod/Test/unittestgui.py
234
235# Install desktop file
236desktop-file-install \
237 --dir=$RPM_BUILD_ROOT%{_desktopdir} \
238 %{SOURCE101}
239sed -i 's,@lib@,%{_lib},g' $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
240
241# Install desktop icon
242install -pD src/Gui/Icons/%{name}.svg \
243 $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
244
245# Install man page
246install -pD %{SOURCE102} \
247 $RPM_BUILD_ROOT%{_mandir}/man1/%{name}.1
248
249# Symlink manpage to other binary names
250pushd $RPM_BUILD_ROOT%{_mandir}/man1
251ln -sf %{name}.1.gz FreeCAD.1.gz
252ln -sf %{name}.1.gz FreeCADCmd.1.gz
253popd
254
255# Remove obsolete Start_Page.html
256rm -f $RPM_BUILD_ROOT%{_docdir}/%{name}/Start_Page.html
257
258# Install MimeType file
259install -d $RPM_BUILD_ROOT%{_datadir}/mime/packages
260install -pm 0644 %{SOURCE104} $RPM_BUILD_ROOT%{_datadir}/mime/packages/%{name}.xml
261
262# Install appdata file
263install -d $RPM_BUILD_ROOT%{_datadir}/appdata
264install -pm 0644 %{SOURCE103} $RPM_BUILD_ROOT%{_datadir}/appdata/
265
266# Bug maintainers to keep %%{plugins} macro up to date.
267#
268# Make sure there are no plugins that need to be added to plugins macro
269new_plugins=`ls $RPM_BUILD_ROOT%{_libdir}/freecad/lib | sed -e '%{plugin_regexp}'`
270if [ -n "$new_plugins" ]; then
271 echo -e "\n\n\n**** ERROR:\n" \
272 "\nPlugins not caught by regexp: " $new_plugins \
273 "\n\nPlugins in %{_libdir}/freecad/lib do not exist in" \
274 "\nspecfile %%{plugins} macro. Please add these to" \
275 "\n%%{plugins} macro at top of specfile and rebuild.\n****\n" 1>&2
276 exit 1
277fi
278# Make sure there are no entries in the plugins macro that don't match plugins
279for p in %{plugins}; do
280 if [ -z "`ls $RPM_BUILD_ROOT%{_libdir}/freecad/lib/$p*.so`" ]; then
281 set +x
282 echo -e "\n\n\n**** ERROR:\n" \
283 "\nExtra entry in %%{plugins} macro with no matching plugin:" \
284 "'$p'.\n\nPlease remove from %%{plugins} macro at top of" \
285 "\nspecfile and rebuild.\n****\n" 1>&2
286 exit 1
287 fi
288done
289
290
291
292%check
293%{?fedora:appstream-util validate-relax --nonet \
294 %{buildroot}/%{_datadir}/appdata/*.appdata.xml}
295
296
297%post
298/bin/%update_icon_cache_post hicolor &>/dev/null || :
299%{_bindir}/%update_desktop_database
300%{_bindir}/update-mime-database %{_datadir}/mime &> /dev/null || :
301
302%postun
303if [ $1 -eq 0 ] ; then
304 /bin/%update_icon_cache_post hicolor &>/dev/null
305 %{_bindir}/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
306fi
307%{_bindir}/%update_desktop_database
308%{_bindir}/update-mime-database %{_datadir}/mime &> /dev/null || :
309
310%posttrans
311%{_bindir}/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
312
313%clean
314rm -rf $RPM_BUILD_ROOT
315
316%files
317%defattr(644,root,root,755)
318%doc ChangeLog.txt copying.lib data/License.txt
319%exclude %{_docdir}/freecad/freecad.*
320%attr(755,root,root) %{_bindir}/*
321%{_datadir}/appdata/*.appdata.xml
322%{_desktopdir}/%{name}.desktop
323%{_iconsdir}/hicolor/scalable/apps/%{name}.svg
324%{_datadir}/mime/packages/%{name}.xml
325%dir %{_libdir}/%{name}
326%{_libdir}/%{name}/bin/
327%{_libdir}/%{name}/lib/
328%{_libdir}/%{name}/Mod/
329%{_mandir}/man1/*.1*
330
331%files data
332%defattr(644,root,root,755)
333%{_datadir}/%{name}/
334%{_docdir}/%{name}/freecad.q*
This page took 0.074152 seconds and 4 git commands to generate.