Skip to content

Commit d3b83f0

Browse files
alkavan1b00mosra
committed
package/rpm: add a RPM package together with a build script.
Co-authored-by: 1b00 <[email protected]> Co-authored-by: Vladimír Vondruš <[email protected]>
1 parent be1cca3 commit d3b83f0

File tree

3 files changed

+158
-0
lines changed

3 files changed

+158
-0
lines changed

Diff for: doc/building.dox

+26
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ control and @ref building-cross for cross-compiling to other platforms.
7272
- @ref building-packages-msys
7373
- @ref building-packages-deb
7474
- @ref building-packages-gentoo
75+
- @ref building-packages-rpm
7576
- @ref building-packages-brew
7677

7778
The engine itself is kept as small as possible with only minimal dependencies.
@@ -303,6 +304,31 @@ There are also Gentoo packages for @ref building-plugins-packages-gentoo "Magnum
303304
@ref building-extras-packages-gentoo "Magnum Extras" and
304305
@ref building-examples-packages-gentoo "Magnum Examples".
305306

307+
@subsection building-packages-rpm Packages for Fedora, openSUSE and other RPM-based Linux distributions
308+
309+
Spec files for RPM-based distributions are in the `package/rpm/` directory. In
310+
addition you will need to install the following dependencies in order to build
311+
the packages (assuming Fedora Linux):
312+
313+
@code{.sh}
314+
sudo dnf install fedora-packager rpmdevtools
315+
@endcode
316+
317+
After that, run the `build.sh` script. Internally it queries the Git version,
318+
makes a tarball, may ask you to install appropriate dependencies if not present
319+
already, and then builds the package.
320+
321+
@code{.sh}
322+
./package/rpm/build.sh
323+
@endcode
324+
325+
At the end, if everything succeeds, you'll have the newly built packages
326+
located in `~/rpmbuild/RPMS`. The script will print their names at the end.
327+
328+
If you want to pass additional flags to CMake or
329+
@ref building-features "enable / disable additional features", edit the
330+
`*.spec` file.
331+
306332
@subsection building-packages-brew Homebrew formulas for macOS
307333

308334
macOS [Homebrew](https://brew.sh) formulas building the latest Git revision are

Diff for: package/rpm/build.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
# Get version slug
6+
version_hash=$(git describe --match "v*" | sed 's/^v//' | sed 's/-/./g')
7+
echo "** repository hash: ${version_hash} ..."
8+
9+
# Create dir tree for rpmbuild in user dir
10+
rpmdev-setuptree
11+
12+
# Archive repository
13+
(cd ../.. && git archive --format=tar.gz --prefix=magnum-${version_hash}/ -o ~/rpmbuild/SOURCES/magnum-${version_hash}.tar.gz HEAD)
14+
echo "** created archive: ~/rpmbuild/SOURCES/magnum-${version_hash}.tar.gz"
15+
sleep 2
16+
17+
# Replace spec version
18+
sed -i "s/Version:.\+/Version: ${version_hash}/g" magnum.spec
19+
echo "** building package version: ${version_hash}"
20+
21+
# Check dependencies
22+
sudo dnf builddep -y magnum.spec
23+
24+
# Build package
25+
rpmbuild --define "debug_package %{nil}" --clean -ba magnum.spec
26+
27+
echo "** packages for magnum-${version_hash} complete:"
28+
ls ~/rpmbuild/RPMS/$(uname -m)/magnum-${version_hash}*.rpm | cat

Diff for: package/rpm/magnum.spec

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
Name: magnum
2+
URL: http://magnum.graphics
3+
Version: 2020.06.2972.g8b832382a
4+
Release: 1
5+
Summary: C++11/C++14 graphics middleware for games and data visualization
6+
License: MIT
7+
Source: %{name}-%{version}.tar.gz
8+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
9+
Requires: corrade, openal-soft, mesa-libGL, mesa-libEGL, SDL2, glfw, vulkan-loader, glslang
10+
BuildRequires: cmake, git, gcc-c++, openal-soft-devel, mesa-libGL-devel, mesa-libEGL-devel, SDL2-devel, glfw-devel, vulkan-loader-devel
11+
# Fedora 35 also seems to need the mesa-vulkan-devel package
12+
13+
%description
14+
Looking for an open-source library that gives you graphics abstraction
15+
and platform independence on major desktop, mobile and web platforms?
16+
Do you want it to have all the convenience utilities around yet stay small,
17+
powerful and not give up on flexibility?
18+
19+
%package devel
20+
Summary: Magnum development files
21+
Requires: %{name} = %{version}
22+
23+
%description devel
24+
Headers and tools needed for developing with Magnum engine.
25+
26+
%prep
27+
%setup -c -n %{name}-%{version}
28+
29+
%build
30+
mkdir build && cd build
31+
32+
# Configure CMake
33+
cmake ../%{name}-%{version} \
34+
-DCMAKE_BUILD_TYPE=Release \
35+
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
36+
-DMAGNUM_WITH_AUDIO=ON \
37+
-DMAGNUM_WITH_VK=ON \
38+
-DMAGNUM_WITH_GLFWAPPLICATION=ON \
39+
-DMAGNUM_WITH_GLXAPPLICATION=ON \
40+
-DMAGNUM_WITH_SDL2APPLICATION=ON \
41+
-DMAGNUM_WITH_XEGLAPPLICATION=ON \
42+
-DMAGNUM_WITH_WINDOWLESSEGLAPPLICATION=ON \
43+
-DMAGNUM_WITH_WINDOWLESSGLXAPPLICATION=ON \
44+
-DMAGNUM_WITH_EGLCONTEXT=ON \
45+
-DMAGNUM_WITH_GLXCONTEXT=ON \
46+
-DMAGNUM_WITH_OPENGLTESTER=ON \
47+
-DMAGNUM_WITH_ANYAUDIOIMPORTER=ON \
48+
-DMAGNUM_WITH_ANYIMAGECONVERTER=ON \
49+
-DMAGNUM_WITH_ANYIMAGEIMPORTER=ON \
50+
-DMAGNUM_WITH_ANYSCENECONVERTER=ON \
51+
-DMAGNUM_WITH_ANYSCENEIMPORTER=ON \
52+
-DMAGNUM_WITH_ANYSHADERCONVERTER=ON \
53+
-DMAGNUM_WITH_MAGNUMFONT=ON \
54+
-DMAGNUM_WITH_MAGNUMFONTCONVERTER=ON \
55+
-DMAGNUM_WITH_OBJIMPORTER=ON \
56+
-DMAGNUM_WITH_TGAIMAGECONVERTER=ON \
57+
-DMAGNUM_WITH_TGAIMPORTER=ON \
58+
-DMAGNUM_WITH_WAVAUDIOIMPORTER=ON \
59+
-DMAGNUM_WITH_DISTANCEFIELDCONVERTER=ON \
60+
-DMAGNUM_WITH_FONTCONVERTER=ON \
61+
-DMAGNUM_WITH_IMAGECONVERTER=ON \
62+
-DMAGNUM_WITH_SCENECONVERTER=ON \
63+
-DMAGNUM_WITH_SHADERCONVERTER=ON \
64+
-DMAGNUM_WITH_GL_INFO=ON \
65+
-DMAGNUM_WITH_VK_INFO=ON \
66+
-DMAGNUM_WITH_AL_INFO=ON
67+
68+
make %{?_smp_mflags}
69+
70+
%install
71+
rm -rf $RPM_BUILD_ROOT
72+
cd build
73+
make DESTDIR=$RPM_BUILD_ROOT install
74+
strip $RPM_BUILD_ROOT/%{_libdir}/*.so*
75+
strip $RPM_BUILD_ROOT/%{_libdir}/magnum/*/*.so*
76+
strip $RPM_BUILD_ROOT/%{_bindir}/*
77+
78+
%post -p /sbin/ldconfig
79+
80+
%postun -p /sbin/ldconfig
81+
82+
%clean
83+
rm -rf $RPM_BUILD_ROOT
84+
85+
%files
86+
%defattr(-,root,root,-)
87+
%{_bindir}/*
88+
%{_libdir}/*.a
89+
%{_libdir}/*.so*
90+
%{_libdir}/magnum/*/*.so*
91+
%{_libdir}/magnum/*/*.conf
92+
93+
%doc %{name}-%{version}/COPYING
94+
95+
%files devel
96+
%defattr(-,root,root,-)
97+
%{_includedir}/Magnum
98+
%{_includedir}/MagnumExternal
99+
%{_includedir}/MagnumPlugins
100+
%{_datadir}/cmake/Magnum
101+
%{_datadir}/gdb/python/magnum/
102+
103+
%changelog
104+
* Initial release.

0 commit comments

Comments
 (0)