]> git.pld-linux.org Git - packages/freecad.git/blob - freecad.spec
- initial, from fc
[packages/freecad.git] / freecad.spec
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
28 Summary:        A general purpose 3D CAD modeler
29 Name:           freecad
30 Version:        0.14
31 Release:        0.1
32 Group:          Applications/Engineering
33
34 License:        GPL v2+
35 URL:            http://sourceforge.net/apps/mediawiki/free-cad/
36 Source0:        http://downloads.sourceforge.net/free-cad/%{name}-%{version}.%{rev}.tar.gz
37 # Source0-md5:  234747bdff47a62fd10cb902f3dd772b
38 Source101:      %{name}.desktop
39 Source102:      %{name}.1
40 Source103:      %{name}.appdata.xml
41 Source104:      %{name}.sharedmimeinfo
42
43 Patch0:         %{name}-3rdParty.patch
44 Patch1:         %{name}-0.14-Xlib_h.patch
45 Patch2:         %{name}-0.14-smesh.patch
46 # http://www.freecadweb.org/tracker/view.php?id=1757
47 Patch3:         %{name}-0.14-DraftSnap.patch
48 #Patch4: %{name}-0.14-disable_auto_dxf_dl.patch
49
50
51 # Utilities
52 BuildRequires:  cmake
53 BuildRequires:  desktop-file-utils
54 BuildRequires:  dos2unix
55 BuildRequires:  doxygen
56 BuildRequires:  gcc-gfortran
57 BuildRequires:  gettext
58 BuildRequires:  graphviz
59 BuildRequires:  swig
60 %ifnarch ppc64
61 BuildRequires:  tbb-devel
62 %endif
63 # Development Libraries
64 BuildRequires:  freeimage-devel
65 BuildRequires:  mesa-libGLU-devel
66 BuildRequires:  xorg-lib-libXmu-devel
67 %if %{occ}
68 BuildRequires:  OpenCASCADE-devel
69 %else
70 BuildRequires:  OCE-devel
71 %endif
72 # Not yet in Fedora
73 # https://bugzilla.redhat.com/show_bug.cgi?id=665733
74 BuildRequires:  Coin2-devel
75 #BuildRequires:  Coin3-devel
76 BuildRequires:  SoQt-devel
77 BuildRequires:  boost-devel
78 BuildRequires:  eigen3-devel
79 BuildRequires:  python-devel
80 BuildRequires:  qt-devel
81 BuildRequires:  qt-webkit-devel
82 # Not used yet.
83 BuildRequires:  libspnav-devel
84 #BuildRequires:  ode-devel
85 #BuildRequires:  opencv-devel
86 BuildRequires:  python-pyside-devel
87 BuildRequires:  shiboken-devel
88 BuildRequires:  xerces-c
89 BuildRequires:  xerces-c-devel
90 %if ! %{bundled_smesh}
91 BuildRequires:  smesh-devel
92 %endif
93 BuildRequires:  netgen-mesher-devel
94 %if ! %{bundled_zipios}
95 BuildRequires:  zipios++-devel
96 %endif
97 %if ! %{bundled_pycxx}
98 BuildRequires:  python-pycxx-devel
99 %endif
100 BuildRequires:  libicu-devel
101 BuildRequires:  python-matplotlib
102
103 # For appdata
104 %if 0%{?fedora}
105 BuildRequires:  libappstream-glib
106 %endif
107
108 # Packages separated because they are noarch, but not optional so require them
109 # here.
110 Requires:       %{name}-data = %{version}-%{release}
111 # Obsolete old doc package since it's required for functionality.
112 Obsoletes:      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.
117 Requires:       python-pivy
118 %endif
119 Requires:       hicolor-icon-theme
120 Requires:       python-collada
121 Requires:       python-matplotlib
122 Requires:       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
138 FreeCAD is a general purpose Open Source 3D CAD/MCAD/CAx/CAE/PLM
139 modeler, aimed directly at mechanical engineering and product design
140 but also fits a wider range of uses in engineering, such as
141 architecture or other engineering specialties. It is a feature-based
142 parametric modeler with a modular software architecture which makes it
143 easy to provide additional functionality without modifying the core
144 system.
145
146
147 %package data
148 Summary:        Data files for FreeCAD
149 Requires:       %{name} = %{version}-%{release}
150 BuildArch:      noarch
151
152 %description data
153 Data 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}
161 rm -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}
170 rm -rf src/zipios++
171 %endif
172
173 # Fix encodings
174 dos2unix -k src/Mod/Test/unittestgui.py \
175             ChangeLog.txt \
176             copying.lib \
177             data/License.txt
178
179 # Removed bundled libraries
180 rm -rf src/3rdParty
181
182
183 %build
184 rm -rf build && mkdir build && pushd build
185
186 # Deal with cmake projects that tend to link excessively.
187 LDFLAGS='-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
219 rm -rf $RPM_BUILD_ROOT
220 pushd build
221 %{__make} install \
222         DESTDIR=$RPM_BUILD_ROOT
223 popd
224
225 # Symlink binaries to %{_bindir}
226 install -d $RPM_BUILD_ROOT%{_bindir}
227 pushd $RPM_BUILD_ROOT%{_bindir}
228 ln -s ../%{_lib}/freecad/bin/FreeCAD .
229 ln -s ../%{_lib}/freecad/bin/FreeCADCmd .
230 popd
231
232 # Fix problems with unittestgui.py
233 #chmod +x $RPM_BUILD_ROOT%{_libdir}/%{name}/Mod/Test/unittestgui.py
234
235 # Install desktop file
236 desktop-file-install                                   \
237     --dir=$RPM_BUILD_ROOT%{_desktopdir}         \
238     %{SOURCE101}
239 sed -i 's,@lib@,%{_lib},g' $RPM_BUILD_ROOT%{_desktopdir}/%{name}.desktop
240
241 # Install desktop icon
242 install -pD src/Gui/Icons/%{name}.svg \
243     $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
244
245 # Install man page
246 install -pD %{SOURCE102} \
247     $RPM_BUILD_ROOT%{_mandir}/man1/%{name}.1
248
249 # Symlink manpage to other binary names
250 pushd $RPM_BUILD_ROOT%{_mandir}/man1
251 ln -sf %{name}.1.gz FreeCAD.1.gz
252 ln -sf %{name}.1.gz FreeCADCmd.1.gz
253 popd
254
255 # Remove obsolete Start_Page.html
256 rm -f $RPM_BUILD_ROOT%{_docdir}/%{name}/Start_Page.html
257
258 # Install MimeType file
259 install -d $RPM_BUILD_ROOT%{_datadir}/mime/packages
260 install -pm 0644 %{SOURCE104} $RPM_BUILD_ROOT%{_datadir}/mime/packages/%{name}.xml
261
262 # Install appdata file
263 install -d $RPM_BUILD_ROOT%{_datadir}/appdata
264 install -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
269 new_plugins=`ls $RPM_BUILD_ROOT%{_libdir}/freecad/lib | sed -e  '%{plugin_regexp}'`
270 if [ -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
277 fi
278 # Make sure there are no entries in the plugins macro that don't match plugins
279 for 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
288 done
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
303 if [ $1 -eq 0 ] ; then
304     /bin/%update_icon_cache_post hicolor &>/dev/null
305     %{_bindir}/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
306 fi
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
314 rm -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.127547 seconds and 4 git commands to generate.