forked from leozide/leocad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleocad.spec
291 lines (269 loc) · 7.57 KB
/
leocad.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
%define qt5 1
%if 0%{?suse_version}
%define dist .openSUSE%(echo %{suse_version} | sed 's/0$//')
%endif
%if 0%{?sles_version}
%define dist .SUSE%(echo %{sles_version} | sed 's/0$//')
%endif
%if %(if [[ "%{vendor}" == obs://* ]] ; then echo 1 ; else echo 0 ; fi)
%define opensuse_bs 1
%endif
%if 0%{?centos_ver}
%define centos_version %{centos_ver}00
%endif
Summary: CAD program for creating virtual LEGO models
Name: leocad
URL: http://leocad.org
%if 0%{?suse_version} || 0%{?sles_version}
Group: Productivity/Graphics/Viewers
%endif
%if 0%{?mdkversion} || 0%{?rhel_version}
Group: Graphics
%endif
%if 0%{?fedora} || 0%{?centos_version}
Group: Amusements/Graphics
%endif
Version: 21.03
%if 0%{?opensuse_bs}
Release: <CI_CNT>.<B_CNT>%{?dist}
%else
Release: 1%{?dist}
%endif
%if 0%{?mdkversion} || 0%{?rhel_version} || 0%{?fedora} || 0%{?centos_version} || 0%{?scientificlinux_version} || 0%{?mageia}
License: GPLv2+
%endif
%if 0%{?suse_version} || 0%{?sles_version}
License: GPL-2.0+
BuildRequires: fdupes
%endif
Packager: Peter Bartfai <[email protected]>
BuildRoot: %{_builddir}/%{name}
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?scientificlinux_version}
%if ( 0%{?centos_version}>=600 || 0%{?rhel_version}>=600 || 0%{?scientificlinux_version}>=600 )
%if 0%{?qt5}
BuildRequires: qt5-qtbase-devel >= 5.4.0, qt5-linguist
%else
BuildRequires: qt-devel >= 1:4.7.0
%endif
%endif
%endif
%if 0%{?fedora}
%if 0%{?qt5}
BuildRequires: qt5-qtbase-devel >= 5.4.0, qt5-linguist, qt5-qtgamepad-devel
%else
BuildRequires: qt-devel
%endif
%endif
%if 0%{?opensuse_bs}!=1
BuildRequires: git
%endif
%if (0%{?rhel_version}<700 && 0%{?centos_version}<700 && 0%{?scientificlinux_version}<600)
%else
BuildRequires: libjpeg-turbo-devel
%endif
BuildRequires: gcc-c++, libpng-devel, make
%if 0%{?fedora}
BuildRequires: libjpeg-turbo-devel
%if 0%{?opensuse_bs}
BuildRequires: samba4-libs
%if 0%{?fedora_version}==22
BuildRequires: qca
%endif
%if 0%{?fedora_version}==23
BuildRequires: qca, gnu-free-sans-fonts
%endif
%endif
%endif
%if 0%{?suse_version}
BuildRequires: update-desktop-files
%if 0%{?qt5}
BuildRequires: libqt5-qtbase-devel >= 5.4.0, zlib-devel, libqt5-linguist
%else
BuildRequires: libqt4-devel
%endif
Requires(pre): gconf2
%if 0%{?suse_version} > 1220
BuildRequires: glu-devel
%endif
%if 0%{?opensuse_bs}
BuildRequires: -post-build-checks
%endif
%endif
%if 0%{?sles_version}
%if 0%{?opensuse_bs}
BuildRequires: -post-build-checks
%endif
Requires(post): desktop-file-utils
%endif
%if 0%{?mageia}
%if 0%{?qt5}
BuildRequires: qttools5
%ifarch x86_64
BuildRequires: lib64qt5base5-devel
%else
BuildRequires: libqt5base5-devel
%endif
%if 0%{?opensuse_bs}
%ifarch x86_64
BuildRequires: lib64sane1, lib64proxy-webkit
%else
BuildRequires: libsane1, libproxy-webkit
%endif
%endif
%else
BuildRequires: libqt4-devel
%if 0%{?opensuse_bs}
%ifarch x86_64
BuildRequires: lib64sane1, lib64uuid-devel, lib64proxy-webkit
%else
BuildRequires: libsane1, libuuid-devel, libproxy-webkit
%endif
%endif
%endif
%endif
%if 0%{?mdkversion}
BuildRequires: libqt4-devel
# For openSUSE Build Service
%if 0%{?opensuse_bs}
%if (0%{?mdkversion} != 200910) && (0%{?mdkversion} != 201000)
BuildRequires: kde-l10n-en_GB
%endif
BuildRequires: aspell-en, myspell-en_US
%endif
%endif
%if ( 0%{?centos_version}<600 && 0%{?centos_version}>=500 ) || ( 0%{?rhel_version}<600 && 0%{?rhel_version}>=500 )
BuildRequires: qt4-devel >= 1:4.7.0
%endif
%description
CAD program for creating virtual LEGO models.
It has an intuitive interface, designed to allow
new users to start creating new models without
having to spend too much time learning the
application.
%prep
cd $RPM_SOURCE_DIR
if [ -s leocad.tar.gz ] ; then
if [ -d leocad ] ; then rm -rf leocad ; fi
tar zxf leocad.tar.gz
else
if [ -f leocad-git.tar.gz ] ; then
if [ -d leocad ] ; then rm -rf leocad ; fi
mkdir leocad
cd leocad
tar zxf ../leocad-git.tar.gz --strip=1
elif [ -d leocad ] ; then
cd leocad
git pull
cd ..
else
git clone https://github.com/leozide/leocad
fi
fi
%build
cd $RPM_SOURCE_DIR/leocad
%ifarch i386 i486 i586 i686
%define qplatform linux-g++-32
%endif
%ifarch x86_64
%define qplatform linux-g++-64
%endif
%if ( 0%{?centos_version}<600 && 0%{?centos_version}>=500 ) || ( 0%{?rhel_version}<600 && 0%{?rhel_version}>=500 )
if [ -x %{_libdir}/qt4/bin/qmake ] ; then
export PATH=%{_libdir}/qt4/bin:$PATH
fi
%endif
%if (0%{?qt5}!=1)
%ifarch x86_64
export RPM_OPT_FLAGS="$RPM_OPT_FLAGS -I%{_libdir}/qt4/include"
%endif
%endif
%if 0%{?fedora}==23
%ifarch x86_64
export RPM_OPT_FLAGS="$RPM_OPT_FLAGS -fPIC"
export Q_CXXFLAGS="$Q_CXXFLAGS -fPIC"
%endif
%endif
%if 0%{?qt5}
export RPM_OPT_FLAGS="$RPM_OPT_FLAGS -fPIC"
if which qmake-qt5 >/dev/null 2>/dev/null ; then
qmake-qt5 -spec %{qplatform} DISABLE_UPDATE_CHECK=1 LDRAW_LIBRARY_PATH=/usr/share/ldraw QMAKE_CXXFLAGS+="$Q_CXXFLAGS"
else
qmake -spec %{qplatform} DISABLE_UPDATE_CHECK=1 LDRAW_LIBRARY_PATH=/usr/share/ldraw QMAKE_CXXFLAGS+="$Q_CXXFLAGS"
fi
%else
if which qmake-qt4 >/dev/null 2>/dev/null ; then
qmake-qt4 -spec %{qplatform} DISABLE_UPDATE_CHECK=1 LDRAW_LIBRARY_PATH=/usr/share/ldraw QMAKE_CXXFLAGS+="$Q_CXXFLAGS"
else
qmake -spec %{qplatform} DISABLE_UPDATE_CHECK=1 LDRAW_LIBRARY_PATH=/usr/share/ldraw QMAKE_CXXFLAGS+="$Q_CXXFLAGS"
fi
%endif
make clean
make TESTING="$RPM_OPT_FLAGS"
%if 0%{?qt5}
if which lrelease-qt5 >/dev/null 2>/dev/null ; then
lrelease-qt5 leocad.pro
else
lrelease leocad.pro
fi
%else
if which lrelease-qt4 >/dev/null 2>/dev/null ; then
lrelease-qt4 leocad.pro
else
lrelease leocad.pro
fi
%endif
%if 0%{?qt5} != 1
%endif
%install
cd $RPM_SOURCE_DIR/leocad
install -d $RPM_BUILD_ROOT%{_bindir}
install -d $RPM_BUILD_ROOT%{_datadir}/leocad
install -d $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/scalable/mimetypes
install -d $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/scalable/apps
install -d $RPM_BUILD_ROOT%{_mandir}/man1
install -m 755 build/release/leocad $RPM_BUILD_ROOT%{_bindir}/leocad
install -m 644 docs/README.md $RPM_BUILD_ROOT%{_datadir}/leocad/README.md
install -m 644 docs/CREDITS.txt $RPM_BUILD_ROOT%{_datadir}/leocad/CREDITS.txt
install -m 644 docs/COPYING.txt $RPM_BUILD_ROOT%{_datadir}/leocad/COPYING.txt
install -m 644 docs/leocad.1 $RPM_BUILD_ROOT%{_mandir}/man1/leocad.1
gzip -f $RPM_BUILD_ROOT%{_mandir}/man1/leocad.1
mkdir -p $RPM_BUILD_ROOT%{_datadir}/mime/packages/
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications/
install -m 644 qt/leocad.xml \
$RPM_BUILD_ROOT%{_datadir}/mime/packages/leocad.xml
install -m 644 qt/leocad.desktop \
$RPM_BUILD_ROOT%{_datadir}/applications/leocad.desktop
install -m 644 tools/icon/scalable/mimetypes/application-vnd.leocad.svg \
$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/scalable/mimetypes/application-vnd.leocad.svg
install -m 644 tools/icon/scalable/apps/leocad.svg \
$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/scalable/apps/leocad.svg
%if 0%{?suse_version}
%suse_update_desktop_file leocad Graphics
%endif
%files
%if 0%{?sles_version} || 0%{?suse_version}
%defattr(-,root,root)
%endif
%{_bindir}/leocad
%dir %{_datadir}/leocad
%doc %{_datadir}/leocad/README.md
%doc %{_datadir}/leocad/CREDITS.txt
%doc %{_datadir}/leocad/COPYING.txt
%{_datadir}/mime/packages/leocad.xml
%{_datadir}/applications/leocad.desktop
%{_datadir}/icons/hicolor/scalable/mimetypes/application-vnd.leocad.svg
%{_datadir}/icons/hicolor/scalable/apps/leocad.svg
%if 0%{?mdkversion} || 0%{?mageia}
%{_mandir}/man1/leocad.1.xz
%else
%{_mandir}/man1/leocad.1.gz
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%changelog
* Sat May 08 2021 - sT331h0rs3 (at) gmail.com 0.91
- Build with Qt5 by default
- Actualize LeoCAD version
- Fix paths to SVG files
* Tue Sep 16 2016 - pbartfai (at) stardust.hu 0.90
- Initial version