-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathopenmodelica.spec.tpl
More file actions
262 lines (225 loc) · 7.68 KB
/
openmodelica.spec.tpl
File metadata and controls
262 lines (225 loc) · 7.68 KB
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
# See also Jenkinsfile in apt-build repository for stuff that is installed BEFORE everything here
# Don't try fancy stuff like debuginfo, which is useless on binary-only
# packages. Don't strip binary too
# Be sure buildpolicy set to do nothing
%define __spec_install_post %{nil}
%define debug_package %{nil}
%define __os_install_post %{_dbpath}/brp-compress
Summary: OpenModelica
Name: NAME
Version: RPMVERSION
Release: RELEASENUM%{?dist}
License: OSMC-PL
Group: Development/Tools
# spectool -g -R SPECS/xxx.spec
# sudo yum-builddep SPECS/xxx.spec
SOURCE0 : https://build.openmodelica.org/apt/pool/contrib/openmodelica_DEBVERSION.orig.tar.xz
SOURCE1 : https://openmodelica.org/doc/openmodelica-doc-DOCUMENTATIONVERSION.tar.xz
PATCHES
URL: https://openmodelica.org/
%if 0%{?rhel} == 6
Autoreq: 0
Requires: readline
Requires: qt5-qtbase
Requires: qt5-qtsvg
Requires: qt5-qtwebkit
Requires: qt5-qtxmlpatterns
Requires: libffi
%endif
Autoprov: 0
Prefix: /opt/%{name}
Prefix: %{_bindir}
%global __requires_exclude ^(PRIVATELIBS)$
# Recommended (for the repo): git rpm-build rpmdevtools epel-release
%if 0%{?rhel} > 0
# CentOS / RHEL requires the EPEL repository (for omniORB, etc)
BuildRequires: epel-release
Requires: epel-release
%endif
Requires: lapack-devel
Requires: make
Requires: gcc
Requires: gcc-gfortran
Requires: gcc-c++
BuildRequires: automake
%if 0%{?rhel} >= 8
%define withomniorb --without-omniORB
%else
%define withomniorb --with-omniORB
BuildRequires: omniORB-devel
BuildRequires: lpsolve-devel
%endif
BuildRequires: expat-devel
BuildRequires: bison
BuildRequires: flex
BuildRequires: lapack-devel
BuildRequires: libtool
BuildRequires: uuid
BuildRequires: uuid-devel
BuildRequires: hdf5-devel
BuildRequires: boost-devel
BuildRequires: boost-static
BuildRequires: hwloc-devel
BuildRequires: readline-devel
BuildRequires: libffi-devel
BuildRequires: curl-devel
BuildRequires: gettext
BuildRequires: make
BuildRequires: java
BuildRequires: tar
BuildRequires: xz
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: gcc-gfortran
%if 0%{?rhel} <= 9
BuildRequires: qt5-qtwebkit-devel
BuildRequires: qt5-linguist
BuildRequires: qt5-qttools
BuildRequires: qt5-qtbase-devel
BuildRequires: qt5-qtsvg-devel
BuildRequires: qt5-qtxmlpatterns-devel
%else
# el 10 does not have qt5-qtwebkit anymore, use qt6
BuildRequires: qt6-qtwebengine-devel
BuildRequires: qt6-linguist
BuildRequires: qt6-qttools
BuildRequires: qt6-qtbase-devel
BuildRequires: qt6-qtsvg-devel
BuildRequires: qt6-qt3d-devel
BuildRequires: qt6-qt5compat-devel
BuildRequires: qt6-qthttpserver-devel
%endif
%if 0%{?rhel} >= 7
BuildRequires: qt5-qt3d-devel
%endif
# Use cmake versions > 3. On EL7 this is provided by cmake3 package.
# On EL > 7 it is just cmake.
%if 0%{?rhel} == 7
BuildRequires: cmake3
%define cmakecommand CMAKE=cmake3
%else
BuildRequires: cmake
%define cmakecommand CMAKE=cmake
%endif
# The base centos:8 image (we use for our build-deps:el8 image) comes with
# broken cmake package due to old libarchive (v3.3.2). v3.3.3 Seems to work.
# Once the base image is updated this can be removed.
%if 0%{?rhel} == 8
BuildRequires: libarchive >= 3.3.3
%endif
# Use gcc-11 on EL8 as well. devtoolset does not seem to be available on
# EL8. One is supposed to use gcc-toolset instead.
%{?el8:Requires: gcc-toolset-11-gcc gcc-toolset-11-gcc-c++ gcc-toolset-11-gcc-gfortran}
%if 0%{?rhel} == 8
BuildRequires: gcc-toolset-11-gcc gcc-toolset-11-gcc-c++ gcc-toolset-11-gcc-gfortran
%define devtoolsconfigureflags CC=/opt/rh/gcc-toolset-11/root/usr/bin/gcc CXX=/opt/rh/gcc-toolset-11/root/usr/bin/g++ FC=/opt/rh/gcc-toolset-11/root/usr/bin/gfortran AS=/opt/rh/gcc-toolset-11/root/usr/bin/as
%endif
# EL7 has -static-libstdc++ inside devtools (but the system g++ does not know the flag) -- adrpo: check this, also for el6
%{?el7:Requires: devtoolset-11-gcc}
%{?el7:Requires: devtoolset-11-gcc-c++}
%{?el7:Requires: devtoolset-11-gcc-gfortran}
%if 0%{?rhel} <= 7 && 0%{?rhel} >= 1
BuildRequires: devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-gcc-gfortran
%define devtoolsconfigureflags CC=/opt/rh/devtoolset-11/root/usr/bin/gcc CXX=/opt/rh/devtoolset-11/root/usr/bin/g++ FC=/opt/rh/devtoolset-11/root/usr/bin/gfortran
%endif
%if 0%{?fedora} >= 25
BuildRequires: OpenSceneGraph-devel
%endif
%if 0%{?rhel} >= 10
%define withqt6 --with-qt6
%define omqtversion=QT6
%else
%define withqt6 ''
%define omqtversion=QT5
%endif
# We should use clang, but OMEdit does not compile with it due to odd default qmake flags
Requires: gcc
Requires: gcc-c++
Requires: lapack-devel
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
# CentOS does not have suggests
%if 0%{?fedora} >= 24 || 0%{?rhel} >= 8
Suggests: boost-devel
Suggests: boost-static
Suggests: lapack-static
Suggests: openblas-static
%else
Requires: boost-devel
Requires: boost-static
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%description
%{summary}
%prep
%setup -q -n openmodelica_DEBVERSION
tar xJf %{_sourcedir}/openmodelica-doc-DOCUMENTATIONVERSION.tar.xz
PATCHCMDS
%if 0%{?rhel} <= 7 && 0%{?rhel} >= 1
source /opt/rh/devtoolset-11/enable
%endif
%if 0%{?rhel} == 8
source /opt/rh/gcc-toolset-11/enable
%endif
export LANG=C.UTF-8
autoreconf --install
./configure CFLAGS="-Os" CXXFLAGS="-Os" QTDIR=/usr/%{_lib}/{omqtversion} %{withomniorb} %{withqt6} CONFIGUREFLAGS %{?devtoolsconfigureflags} --without-omc --prefix=/opt/%{name} --without-omlibrary %{cmakecommand}
%build
%if 0%{?rhel} <= 7 && 0%{?rhel} >= 1
source /opt/rh/devtoolset-11/enable
%endif
%if 0%{?rhel} == 8
source /opt/rh/gcc-toolset-11/enable
%endif
make -j8
test ! -f libraries/install-index.json || make -j8 omlibrary
%install
rm -rf %{buildroot}
make install DESTDIR="%{buildroot}"
mkdir -p %{buildroot}/opt/%{name}/lib/ %{buildroot}/opt/%{name}/share/doc/omc/ %{buildroot}%{_bindir}
ln -s /usr/lib/omlibrary %{buildroot}/opt/%{name}/lib/
ln -s /opt/%{name}/bin/omc %{buildroot}%{_bindir}/omc-BRANCH
ln -s /opt/%{name}/bin/OMEdit %{buildroot}%{_bindir}/OMEdit-BRANCH
ln -s /opt/%{name}/bin/OMShell %{buildroot}%{_bindir}/OMShell-BRANCH
ln -s /opt/%{name}/bin/OMShell-terminal %{buildroot}%{_bindir}/OMShell-terminal-BRANCH
ln -s /opt/%{name}/bin/OMNotebook %{buildroot}%{_bindir}/OMNotebook-BRANCH
ln -s /opt/%{name}/bin/OMPlot %{buildroot}%{_bindir}/OMPlot-BRANCH
touch %{buildroot}%{_bindir}/omc
touch %{buildroot}%{_bindir}/OMEdit
touch %{buildroot}%{_bindir}/OMShell
touch %{buildroot}%{_bindir}/OMShell-terminal
touch %{buildroot}%{_bindir}/OMNotebook
touch %{buildroot}%{_bindir}/OMPlot
cp -a openmodelica-doc*/* %{buildroot}/opt/%{name}/share/doc/omc/
%postun
if [ "$1" -ge "1" ]; then
if [ "`readlink %{_sysconfdir}/alternatives/openmodelica`" == "%{_bindir}/omc-BRANCH" ]; then
%{_sbindir}/alternatives --set openmodelica %{_bindir}/omc-BRANCH
fi
fi
%post
%{_sbindir}/update-alternatives --install %{_bindir}/omc openmodelica %{_bindir}/omc-BRANCH PRIORITY \
--slave %{_bindir}/OMEdit openmodelica-OMEdit %{_bindir}/OMEdit-BRANCH \
--slave %{_bindir}/OMShell openmodelica-OMShell %{_bindir}/OMShell-BRANCH \
--slave %{_bindir}/OMShell-terminal openmodelica-OMShell-terminal %{_bindir}/OMShell-terminal-BRANCH \
--slave %{_bindir}/OMNotebook openmodelica-OMNotebook %{_bindir}/OMNotebook-BRANCH \
--slave %{_bindir}/OMPlot openmodelica-OMPlot %{_bindir}/OMPlot-BRANCH
%preun
if [ $1 = 0 ]; then
%{_sbindir}/update-alternatives --remove openmodelica %{_bindir}/omc-BRANCH
fi
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
/opt/%{name}/*
%{_bindir}/*-BRANCH
%ghost %{_bindir}/omc
%ghost %{_bindir}/OMEdit
%ghost %{_bindir}/OMShell
%ghost %{_bindir}/OMShell-terminal
%ghost %{_bindir}/OMNotebook
%ghost %{_bindir}/OMPlot
%changelog
* DATE OpenModelica <openmodelica@ida.liu.se> ${version}-1
- First Build