Name: hypersomnia Summary: Multiplayer top-down shooter URL: https://hypersomnia.io # AGPL-3.0-only: # - Hypersomnia itself. # # BSD-2-Clause: # - src/3rdparty/lz4/ # # BSD-3-Clause: # - src/3rdparty/yojimbo/ # # LicenseRef-Fedora-Public-Domain: # - src/3rdparty/stb/ # While stb is unbundled, it's a static library, so it's still included in the License tag. # # LGPL-2.1-only: # - src/3rdparty/streflop/ # # MIT: # - cmake/Introspector-generator # - src/3rdparty/cpp-httplib/ # - src/3rdparty/date/ # - src/3rdparty/imgui/ # - src/3rdparty/polypartition/ # - src/3rdparty/rapidjson/ # - src/3rdparty/rectpack2D/ # - src/3rdparty/alphanum.hpp # Though cpp-httplib is unbundled, it's a static library. # # Zlib: # - src/3rdparty/Box2D/ # - src/3rdparty/lodepng/ License: AGPL-3.0-only AND BSD-2-Clause AND BSD-3-Clause AND LicenseRef-Fedora-Public-Domain AND LGPL-2.1-only AND MIT AND Zlib %global git_tag 1.5.4 %global snapshot 0 %if 0%{?snapshot} %global snap_date 20250824 %global snap_commit b2508c72a012a7d1154f2bfd6892f133a163d346 %global snap_commit_short %(c="%{snap_commit}"; echo "${c:0:7}") %global version_suffix ^%{snap_date}.%{snap_commit_short} %global archive_suffix %{snap_commit} %else %global version_suffix %{nil} %global archive_suffix %{git_tag} %endif Version: %{git_tag}%{version_suffix} Release: 1%{?dist} Source0: %{name}-%{archive_suffix}.zip Source10: %{name}-wrapper.sh Source99: %{name}--generate-source.sh # Fix building with system-provided OpenAL Patch0: %{name}--system-openal.patch # Disable -Werror Patch10: %{name}--no-Werror.patch # https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval ExcludeArch: %{ix86} # RapidJSON in Fedora 42 and older is on version 1.1.0, dated 2016. # Upstream development is still active, but no new releases have been tagged. # Fedora 43 and newer have switched to packaging git snapshots. # # Hypersomnia bundles a 2023 snapshot and fails to build with v1.1.0. %if 0%{?fedora} <= 42 %global rapidjson_bundled 1 %global rapidjson_cmake OFF %else %global rapidjson_cmake ON %endif BuildRequires: cmake BuildRequires: desktop-file-utils BuildRequires: file BuildRequires: findutils BuildRequires: gcc-c++ BuildRequires: glad BuildRequires: ImageMagick BuildRequires: cmake(blake3) BuildRequires: cmake(glfw3) BuildRequires: cmake(httplib) BuildRequires: cmake(LibDataChannel) BuildRequires: cmake(nlohmann_json) BuildRequires: cmake(OpenAL) BuildRequires: cmake(SDL2) BuildRequires: pkgconfig(freetype2) BuildRequires: pkgconfig(libpipewire-0.3) BuildRequires: pkgconfig(libpulse) BuildRequires: pkgconfig(libsodium) BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(xcb) BuildRequires: pkgconfig(xcb-glx) BuildRequires: pkgconfig(xcb-keysyms) BuildRequires: stb_image-devel BuildRequires: stb_image_resize-devel BuildRequires: stb_vorbis-devel %if ! 0%{?rapidjson_bundled} BuildRequires: cmake(RapidJSON) %endif %global fontlist font(liberationsans) BuildRequires: fontconfig BuildRequires: %{fontlist} Requires: %{name}-data = %{version}-%{release} # This could possibly be unbundled. Needs investigating. Provides: bundled(lz4) = 1.9.4 # The game uses a forked version of the library. Provides: bundled(Box2D) # The game uses a forked version of the library. Provides: bundled(imgui) = 1.89.9 # Unversioned library. Provides: bundled(lodepng) # Unversioned library. Provides: bundled(polypartition) %if 0%{?rapidjson_bundled} Provides: bundled(rapidjson) = 1.1.0^20230306git083f359 %endif # Unversioned library, written by the same authors as the game. Provides: bundled(rectpack2D) # The game uses a forked version of the library. Provides: bundled(yojimbo) = 1.1 %description Hypersomnia is a competitive arena released as free software. It aims to be the ultimate open-source 2D shooter - a grand community project extensible without limit. Declare allegiance to one of the three factions whose apple of discord is a disparity between prevailing notions of moral excellence: Metropolis. Atlantis. Resistance. Will you take revenge for the unethical simulation of an inferior universe? Will you support the cruel experiments to win total control over metempsychosis? Or will you join the underground civilization that awaits the end of war in this dangerous afterlife reality? %package data Summary: Data files for Hypersomnia License: CC0-1.0 BuildArch: noarch Requires: %{fontlist} Requires: hicolor-icon-theme %description data Hypersomnia is a competitive 2D arena shooter. This package provides data files (graphics, sounds, etc.) required to play the game. %prep %autosetup -p1 -n hypersomnia-%{archive_suffix} %if ! 0%{?rapidjson_bundled} rm -rf src/3rdparty/rapidjson %endif # Replace all includes of bundled libraries with system-provided ones. # Could be done in a patch, but this is easier. sed -e 's|^#include "3rdparty/cpp-httplib/httplib.h"|#include |g' -i src/3rdparty/include_httplib.h sed -e 's|^#include "3rdparty/stb/|#include "stb/|g' -i src/augs/image/image.cpp # Delete glad headers shipped with the project and generate new ones glad --profile="core" --api="gl=4.6" --generator="c" --spec="gl" --local-files --extensions="" --reproducible --out-path generated/ glad --api="glx=1.4" --generator="c" --spec="glx" --extensions="GLX_EXT_swap_control,GLX_EXT_swap_control_tear,GLX_INTEL_swap_event,GLX_MESA_swap_control,GLX_NV_delay_before_swap,GLX_NV_swap_group,GLX_OML _swap_method,GLX_SGIX_swap_barrier,GLX_SGIX_swap_group,GLX_SGI_swap_control" --reproducible --out-path generated/ GLAD_DIR="$(pwd)/src/3rdparty/glad/" rm -rf "${GLAD_DIR}" && mkdir "${GLAD_DIR}" mv -t "${GLAD_DIR}" \ generated/glad.h \ generated/glad.c \ generated/khrplatform.h \ generated/include/glad/glad_glx.h \ generated/src/glad_glx.c %build %cmake \ -DADD_MCMODEL_LARGE_FLAG=OFF \ -DARCHITECTURE=native \ -DBUILD_UNIT_TESTS=OFF \ -DUSE_SDL2=ON \ -DUSE_SYSTEM_BLAKE3=ON \ -DUSE_SYSTEM_FREETYPE=ON \ -DUSE_SYSTEM_LIBDATACHANNEL=ON \ -DUSE_SYSTEM_OPENAL=ON \ -DUSE_SYSTEM_RAPIDJSON=%{rapidjson_cmake} \ -DGENERATE_DEBUG_INFORMATION=ON %cmake_build mkdir fedpkg pushd fedpkg # Generate .png icons from .ico file magick convert ../hypersomnia/content/gfx/necessary/app.ico ./layer.png for FILE in layer-*.png; do SIZE="$(file "${FILE}" | grep --only-matching -E -e 'PNG image data, [0-9]+ x [0-9]+' | grep --only-matching -E -e '[0-9]+$')" mv "${FILE}" "icon-${SIZE}.png" done # Substitute paths in wrapper script cp -a '%{SOURCE10}' '%{name}-wrapper.sh' sed \ -e 's|__BIN_PATH__|%{_bindir}/Hypersomnia|g' \ -e 's|__DATA_PATH__|%{_datadir}/%{name}|g' \ -i '%{name}-wrapper.sh' popd # Generate a .desktop file cat > fedpkg/%{name}.desktop << EOF [Desktop Entry] Type=Application Name=Hypersomnia Comment=Competitive 2D arena shooter Exec=%{name}-wrapper Icon=%{name} Categories=Game; Terminal=false StartupNotify=false EOF %install # %%cmake_install doesn't do anything, so we gotta copy stuff manually. install -m 755 -d %{buildroot}%{_bindir} install -m 755 %{__cmake_builddir}/Hypersomnia %{buildroot}%{_bindir}/Hypersomnia install -m 755 fedpkg/%{name}-wrapper.sh %{buildroot}%{_bindir}/hypersomnia-wrapper pushd fedpkg for FILE in icon-*.png; do SIZE="$(echo "${FILE}" | tr -cd '[0-9]')" ICONDIR="%{buildroot}%{_datadir}/icons/hicolor/${SIZE}x${SIZE}/apps" install -m 755 -d "${ICONDIR}" install -m 644 "${FILE}" "${ICONDIR}/%{name}.png" done install -m 755 -d %{buildroot}%{_datadir}/applications install -m 644 %{name}.desktop %{buildroot}%{_datadir}/applications/ popd install -m 755 -d %{buildroot}%{_datadir} cp -a hypersomnia %{buildroot}%{_datadir}/%{name} rm -rf %{buildroot}%{_datadir}/%{name}/detail/unix/ # Replace bundled fonts with symlinks ln -srf \ "%{buildroot}$(fc-match -f '%%{file}' 'Liberation Sans:Regular')" \ %{buildroot}%{_datadir}/hypersomnia/content/fonts/LiberationSans-Regular.ttf %check desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop %files %doc CHANGELOG.md %doc README.md README_SERVER.md %license LICENSE.md %{_bindir}/Hypersomnia %{_bindir}/hypersomnia-wrapper %{_datadir}/applications/%{name}.desktop %files data %{_datadir}/%{name} %{_datadir}/icons/hicolor/**/apps/%{name}.png %changelog * Mon Aug 25 2025 Artur Frenszek-Iwicki - 1.5.4-1 - Update to v1.5.4 - Unbundle cpp-httplib * Sat Aug 23 2025 Artur Frenszek-Iwicki - 1.5.1^20250823.b9bf658-1 - Initial packaging