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