# 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 BuildRequires: qt6-qtbase-devel Requires: qt6-qtbase-common %if 0%{?fedora} BuildRequires: mesa-libGLU-devel Requires: mesa-libGLU %else # 0%{?suse_version} || 0%{?mageia} (these distros use a completely different package name, because of course they do) Requires: glu %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_6_256x256x32.png" "${pkgdir}/usr/share/icons/hicolor/256x256/apps/openbrf.png" install -D -m644 "${srcdir}/openbrf-redux/_build/openBrf_7_48x48x32.png" "${pkgdir}/usr/share/icons/hicolor/48x48/apps/openbrf.png" install -D -m644 "${srcdir}/openbrf-redux/_build/openBrf_8_32x32x32.png" "${pkgdir}/usr/share/icons/hicolor/32x32/apps/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 < "${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 < "${pkgdir}/usr/share/mime/packages/openbrf.xml" BRF Mount&Blade Binary Resource File Recurso binario de Mount&Blade 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/256x256/apps/openbrf.png /usr/share/icons/hicolor/48x48/apps/openbrf.png /usr/share/icons/hicolor/32x32/apps/openbrf.png /usr/share/icons/hicolor/16x16/apps/openbrf.png %changelog * Mon Apr 06 2026 Swyter - 0-1 - Blah blah blah.