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