%global debug_package %{nil}
%global ename GoatTracker
%global sname goattrk2
%if 0%{?fedora} >= 36
%undefine _package_note_file
%endif
Name: goattracker
Version: 2.76
Release: 13%{?dist}
Summary: Crossplatform C64 music tracker
Group: Applications/Multimedia
License: GPLv2+
URL: https://sourceforge.net/projects/goattracker2/
Source0: https://downloads.sourceforge.net/goattracker2/%{ename}_%{version}.zip
BuildRequires: gcc-c++
BuildRequires: SDL-devel
BuildRequires: dos2unix unix2dos
BuildRequires: devscripts
%description
Crossplatform C64 music tracker. Includes also the tools gt2reloc ins2snd2 mod2sng sngspli2.
%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 > GT_Fix_editor_player_not_updating.patch << EOF
--- /src/gplay.c 2021-05-15 12:59:32.000000000 +0200
+++ /src/gplay.c 2022-11-12 21:51:31.000000000 +0100
@@ -579,6 +579,7 @@
if (!param)
{
cptr->freq = targetfreq;
+ cptr->lastnote = cptr->note;
cptr->vibtime = 0;
}
else
@@ -596,6 +597,7 @@
if (cptr->freq > targetfreq)
{
cptr->freq = targetfreq;
+ cptr->lastnote = cptr->note;
cptr->vibtime = 0;
}
}
@@ -605,6 +607,7 @@
if (cptr->freq < targetfreq)
{
cptr->freq = targetfreq;
+ cptr->lastnote = cptr->note;
cptr->vibtime = 0;
}
}
@@ -807,6 +810,7 @@
if (!cptr->cmddata)
{
cptr->freq = targetfreq;
+ cptr->lastnote = cptr->note;
cptr->vibtime = 0;
}
else
@@ -824,6 +828,7 @@
if (cptr->freq > targetfreq)
{
cptr->freq = targetfreq;
+ cptr->lastnote = cptr->note;
cptr->vibtime = 0;
}
}
@@ -833,6 +838,7 @@
if (cptr->freq < targetfreq)
{
cptr->freq = targetfreq;
+ cptr->lastnote = cptr->note;
cptr->vibtime = 0;
}
}
EOF
dos2unix src/gplay.c
patch -p1 < GT_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,gt2reloc,ins2snd2,mod2sng,sngspli2} %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
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,gt2reloc,ins2snd2,sngspli2}
hardening-check -fv linux/mod2sng
%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.76
- update 2.76
* Wed Jun 10 2020 samoht0 2.75
- add icon from source
- spec cleanup
* Mon Jun 08 2020 samoht0 2.75
- spec cleanup
- extra linker options
* Sun Jun 07 2020 samoht0 2.75
- intitial spec
- spec cleanup