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