Skip to content

Instantly share code, notes, and snippets.

@Swyter
Last active April 7, 2026 01:29
Show Gist options
  • Select an option

  • Save Swyter/93f9e2e2976914e71ff7d0c4d68f1a0e to your computer and use it in GitHub Desktop.

Select an option

Save Swyter/93f9e2e2976914e71ff7d0c4d68f1a0e to your computer and use it in GitHub Desktop.
OpenBRF Redux Fedora RPM .spec file
# swy: reminder; these things get built with '$ spectool -g -R openbrf.spec' to download the sources
# and then '$ rpmbuild -ba openbrf.spec -vvv' to actually generate the source package and finally the binary package.
# pretty funky compared to a PKGBUILD, not gonna lie. and the documentation is terrible. either too basic or too scattered all over the place.
Name: openbrf
# swy: autogenerate the version from the current date and time, assuming the build gets kicked from a callback,
# use a global to grab the time only once, otherwise rpmbuild would call date various times and
# sometimes copr will fail because it generates multiple source package files, go figure
%global build_timestamp %(TZ=UTC date +'%Y.%m.%d_%H.00')
Version: %{build_timestamp}
Release: 1
Summary: Mount&Blade resource editor by Marco Tarini and Swyter
License: GPL-2.0-or-later
URL: https://forum.taleworlds.com/?threads/462517
Source0: https://github.com/Swyter/openbrf-redux/archive/refs/heads/redux.tar.gz
BuildRequires: gcc
BuildRequires: make
BuildRequires: git
BuildRequires: coreutils
BuildRequires: icoutils
# swy: these distros use a completely different package name, because of course they do
%if 0%{?suse_version} || 0%{?mageia}
BuildRequires: qt6-base-common-devel
BuildRequires: qt6-base-devel
BuildRequires: qt6-core-devel
BuildRequires: qt6-gui-devel
BuildRequires: qt6-xml-devel
BuildRequires: qt6-opengl-devel
BuildRequires: qt6-openglwidgets-devel
Requires: qt6-base
Requires: qt6-opengl
%else
BuildRequires: qt6-qtbase-devel
Requires: qt6-qtbase-common
%endif
%if 0%{?suse_version} || 0%{?mageia}
BuildRequires: glu-devel
Requires: glu
%else
BuildRequires: mesa-libGLU-devel
Requires: mesa-libGLU
%endif
Requires: hicolor-icon-theme
BuildArch: i686 x86_64 aarch64
%description
%{summary}
%prep
# swy: extract it, and because the .tar contents are in a 'openbrf-redux-redux' folder
# rename that to what we expect from the AUR
%{__rpmuncompress} -x -v "${RPM_SOURCE_DIR}/redux.tar.gz"
mv 'openbrf-redux-redux' 'openbrf-redux'
%build
cd "openbrf-redux/_build"
# extract all the Windows icon sub-images, we can later grab the 256px
# version and use it in Linux as XDG PNG icon.
icotool -x ../openBrf.ico
# build it as fast as possible, but leaving a free CPU core for other stuff!
qmake6 -makefile ../openBrf.pro
make -j $[ (n = `nproc` - 1) < 1 ? 1 : n ] # swy: don't make the thread count zero (-j 0) when there's only one available core (due to the system-threads - 1 thing)
%install
# swy: reuse the Arch Linux PKGBUILD lines
pkgdir="${RPM_BUILD_ROOT}"; srcdir="./"
mkdir -p "${pkgdir}/opt/openbrf"
mkdir -p "${pkgdir}/opt/openbrf/translations"
install -D -m711 -s "${srcdir}/openbrf-redux/_build/openBrf" "${pkgdir}/opt/openbrf/openbrf"
install -D -m644 "${srcdir}/openbrf-redux/_build/carry_positions.txt" "${pkgdir}/opt/openbrf"
install -D -m644 "${srcdir}/openbrf-redux/_build/customPreviewShaders.xml" "${pkgdir}/opt/openbrf"
install -D -m644 "${srcdir}/openbrf-redux/_build/reference.brf" "${pkgdir}/opt/openbrf"
install -D -m644 "${srcdir}/openbrf-redux/_build/translations/"* "${pkgdir}/opt/openbrf/translations"
mkdir -p "${pkgdir}/usr/bin"
echo '#!/usr/bin/env sh' > "${pkgdir}/usr/bin/openbrf"
echo 'env LC_NUMERIC=C /opt/openbrf/openbrf "$@"' >> "${pkgdir}/usr/bin/openbrf"
chmod 755 "${pkgdir}/usr/bin/openbrf"
install -D -m644 "${srcdir}/openbrf-redux/_build/openBrf_6_256x256x32.png" "${pkgdir}/opt/openbrf/openbrf.png"
install -D -m644 "${srcdir}/openbrf-redux/_build/openBrf_6_256x256x32.png" "${pkgdir}/usr/share/pixmaps/openbrf.png"
install -D -m644 "${srcdir}/openbrf-redux/_build/openBrf_9_16x16x32.png" "${pkgdir}/usr/share/icons/hicolor/16x16/apps/openbrf.png"
# add a shortcut that handles application/x-openbrf files
mkdir -p "${pkgdir}/usr/share/applications"
cat <<EOF > "${pkgdir}/usr/share/applications/openbrf.desktop"
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Terminal=false
Type=Application
Name=OpenBRF Redux
Comment=Mount&Blade resource editor by Marco Tarini and Swyter
Exec=openbrf
Icon=openbrf
MimeType=application/x-openbrf
Categories=Graphics
EOF
# add our custom mime type for application/x-openbrf => *.brf files
mkdir -p "${pkgdir}/usr/share/mime/packages"
cat <<EOF > "${pkgdir}/usr/share/mime/packages/openbrf.xml"
<?xml version="1.0" encoding="utf-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-openbrf">
<generic-icon name="openbrf"/>
<acronym>BRF</acronym>
<comment>Mount&amp;Blade Binary Resource File</comment>
<comment xml:lang="es">Recurso binario de Mount&amp;Blade</comment>
<glob pattern="*.brf"/>
</mime-type>
</mime-info>
EOF
%post
xdg-icon-resource forceupdate --theme hicolor &>/dev/null
update-mime-database /usr/share/mime &>/dev/null
update-desktop-database -q
%files
/usr/bin/openbrf
/opt/openbrf/openbrf
/opt/openbrf/openbrf.png
/opt/openbrf/carry_positions.txt
/opt/openbrf/customPreviewShaders.xml
/opt/openbrf/reference.brf
/opt/openbrf/translations/
/usr/share/applications/openbrf.desktop
/usr/share/mime/packages/openbrf.xml
/usr/share/pixmaps/openbrf.png
/usr/share/icons/hicolor/16x16/apps/openbrf.png
%changelog
* Mon Apr 06 2026 Swyter <[email protected]> - 0-1
- Blah blah blah.
@Swyter
Copy link
Copy Markdown
Author

Swyter commented Apr 6, 2026

imagen imagen imagen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment