# Define the full and short commit hashes for easy updating %global commit eb126aaadff4359614fe676f782f47b79c0877a7 %global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: fastnoise Version: 1.1.2 Release: 1%{?dist} Summary: FastNoise, a comprehensive noise generation library (git snapshot) License: MIT URL: https://github.com/Auburn/FastNoise # This URL points to the source code tarball for the v1.1.2 tag Source0: https://github.com/say-paul/FastNoiseLite/archive/refs/tags/v%{version}.tar.gz#/fastnoise-%{version}.tar.gz BuildRequires: cmake BuildRequires: gcc-c++ %description A comprehensive noise generation library that supports various noise types. This package is built from git commit %{shortcommit}. %prep # The setup directory also uses the %{version} macro %setup -q -n FastNoiseLite-%{version} %build # Compile the .cpp file into a shared library (.so) # -fPIC is required for shared libraries # %{optflags} are the standard compiler flags provided by Fedora g++ %{optflags} -fPIC -shared FastNoise.cpp -o libfastnoiselite.so %install # Create the directories where the files will be installed install -d -m 755 %{buildroot}%{_libdir} install -d -m 755 %{buildroot}%{_includedir} # Install the shared library we just built install -m 755 FastNoiseLite/libfastnoiselite.so %{buildroot}%{_libdir}/ # Install the header file install -m 644 FastNoiseLite/FastNoise.h %{buildroot}%{_includedir}/ %files %{_libdir}/libFastNoiseLite.so %{_includedir}/FastNoise.h