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