%global debug_package %{nil}
%global ename GoatTracker
%global sname gt2stereo
%global ster Stereo
%if 0%{?fedora} >= 36
%undefine _package_note_file
%endif
Name: goattracker-%{ster}
Version: 2.77
Release: 13%{?dist}
Summary: Crossplatform C64 music tracker (%{ster})
Group: Applications/Multimedia
License: GPLv2+
URL: https://sourceforge.net/projects/goattracker2/
Source0: https://downloads.sourceforge.net/goattracker2/%{ename}_%{version}_%{ster}.zip
BuildRequires: gcc-c++
BuildRequires: SDL-devel
BuildRequires: dos2unix unix2dos
BuildRequires: devscripts
%description
Crossplatform C64 music tracker (%{ster}). Includes also the tools mod2sng2 and ss2stereo.
Install %ename package to get the other extra tools.
%prep
%setup -q -c %{sname}
# set full CFLAGS
sed -i 's|CFLAGS+=`sdl-config --cflags`|CFLAGS=`sdl-config --cflags` %{build_cflags} -fdata-sections -ffunction-sections %{build_ldflags} -Wl,-s,--gc-sections -Ibme -Iasm|' src/makefile
# set full CXXFLAGS
sed -i 's|CXXFLAGS+=$(CFLAGS) -fpermissive|CXXFLAGS=`sdl-config --cflags` %{build_cxxflags} -fdata-sections -ffunction-sections %{build_ldflags} -Wl,-s,--gc-sections -Ibme -Iasm|' src/makefile.common
# disable debug symbols
sed -i 's| -g -| -|' src/makefile
sed -i 's| -g -| -|' src/makefile.common
# no extra CFLAGS
sed -i 's|CFLAGS+=|#CFLAGS+=|' src/makefile.common
sed -i 's|CFLAGS+=|#CFLAGS+=|' src/bme/makefile
# force LDFLAGS (again)
sed -i 's|LIBS+=`sdl-config --libs`|LIBS=`sdl-config --libs` %{build_ldflags} -Wl,-s,--gc-sections|' src/makefile
sed -i 's|(CC) -o|(CC) %{build_ldflags} -Wl,-s,--gc-sections -o|' src/makefile.common
# avoid strip
sed -i '/strip/d' src/makefile.common
sed -i '/strip/d' src/bme/makefile
# Fix line and set UTF-8 encoding
dos2unix {authors,readme.txt}
iconv --from=ISO-8859-1 --to=UTF-8 readme.txt > readme.txt.utf8
mv -f readme.txt.utf8 readme.txt
cat > GTS_Fix_editor_player_not_updating.patch << EOF
--- /src/gplay.c 2021-05-13 14:08:28.000000000 +0200
+++ /src/gplay.c 2022-11-12 21:55:49.000000000 +0100
@@ -705,6 +705,7 @@
if (!param)
{
cptr->freq = targetfreq;
+ cptr->lastnote = cptr->note;
cptr->vibtime = 0;
}
else
@@ -722,6 +723,7 @@
if (cptr->freq > targetfreq)
{
cptr->freq = targetfreq;
+ cptr->lastnote = cptr->note;
cptr->vibtime = 0;
}
}
@@ -731,6 +733,7 @@
if (cptr->freq < targetfreq)
{
cptr->freq = targetfreq;
+ cptr->lastnote = cptr->note;
cptr->vibtime = 0;
}
}
@@ -964,6 +967,7 @@
if (!cptr->cmddata)
{
cptr->freq = targetfreq;
+ cptr->lastnote = cptr->note;
cptr->vibtime = 0;
}
else
@@ -981,6 +985,7 @@
if (cptr->freq > targetfreq)
{
cptr->freq = targetfreq;
+ cptr->lastnote = cptr->note;
cptr->vibtime = 0;
}
}
@@ -990,6 +995,7 @@
if (cptr->freq < targetfreq)
{
cptr->freq = targetfreq;
+ cptr->lastnote = cptr->note;
cptr->vibtime = 0;
}
}
EOF
dos2unix src/gplay.c
patch -p1 < GTS_Fix_editor_player_not_updating.patch
unix2dos src/gplay.c
%build
cd src
find . -type f -name '*.o' -exec rm {} +
%make_build
%install
mkdir -p %buildroot{%_bindir,%_datadir/%name,%_docdir/%name,%_datadir/applications,%_datadir/pixmaps}
cp -a linux/{%sname,mod2sng2,ss2stereo} %buildroot%_bindir
cp -ar examples %buildroot%_datadir/%name
cp -a goat_tracker_commands.pdf %buildroot%_docdir/%name
cp -a readme.txt %buildroot%_docdir/%name/README
cp -a authors copying %buildroot%_docdir/%name
cp -a morphos/%sname.info %buildroot%_datadir/pixmaps/%sname.png
cat > %buildroot%_datadir/applications/%name.desktop << EOF2
[Desktop Entry]
Name=%ename %ster
Exec=%sname
Comment=Crossplatform C64 music tracker
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=%sname.png
Categories=AudioVideo;AudioVideoEditing;
MimeType=audio/sng;
EOF2
hardening-check -v linux/{%sname,ss2stereo}
hardening-check -fv linux/mod2sng2
%files
%defattr(644, root, root, 755)
%attr(755,root,root) %_bindir/*
%_datadir/%name/*
%_docdir/%name/*
%_datadir/applications/%name.desktop
%_datadir/pixmaps/%sname.png
%changelog
* Sat May 15 2021 samoht0 2.77
- update 2.77
* Wed Jun 10 2020 samoht0 2.76
- intitial spec