From 808e0c9b1729c21f10f77d952292a6a5fb4aa97d Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Thu, 1 Sep 2022 14:40:00 +0200 Subject: [PATCH] Ports: Add TiMidity++ Also add it as a dependency for the `SDL_mixer` and `SDL2_mixer` ports. Eawpats GUS patches are installed as part of the port, because without patches TiMidity++ is not able to generate any sound. The license for these is "fameware", credit to Andrew Suffield: https://lists.debian.org/debian-legal/2002/09/msg00137.html --- Ports/AvailablePorts.md | 1 + Ports/SDL2_mixer/package.sh | 2 +- Ports/SDL_mixer/package.sh | 2 +- Ports/timidity/package.sh | 30 ++++++++++ ...ulate-Newton-coefficients-on-the-fly.patch | 60 +++++++++++++++++++ Ports/timidity/patches/ReadMe.md | 10 ++++ 6 files changed, 103 insertions(+), 2 deletions(-) create mode 100755 Ports/timidity/package.sh create mode 100644 Ports/timidity/patches/0001-Calculate-Newton-coefficients-on-the-fly.patch create mode 100644 Ports/timidity/patches/ReadMe.md diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index bee16c0916..89ac58840d 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -238,6 +238,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`termcap`](termcap/) | GNU termcap | 1.3.1 | https://www.gnu.org/software/termutils/ | | [`thesilversearcher`](thesilversearcher/) | The Silver Searcher: A fast code-searching tool | 2.2.0 | https://github.com/ggreer/the_silver_searcher | | [`tig`](tig/) | Tig: text-mode interface for Git | 2.5.5 | https://jonas.github.io/tig/ | +| [`timidity`](timidity/) | TiMidity++ | 2.15.0 | http://timidity.sourceforge.net | | [`tinycc`](tinycc/) | Tiny C Compiler (TinyCC) | dev | https://github.com/TinyCC/tinycc | | [`tinyscheme`](tinyscheme/) | TinyScheme Interpreter | 1.42 | https://sourceforge.net/projects/tinyscheme/ | | [`tr`](tr/) | tr (OpenBSD) | 6.7 | https://github.com/ibara/libpuffy | diff --git a/Ports/SDL2_mixer/package.sh b/Ports/SDL2_mixer/package.sh index aa30acd6d3..3c9871b214 100755 --- a/Ports/SDL2_mixer/package.sh +++ b/Ports/SDL2_mixer/package.sh @@ -4,7 +4,7 @@ version='2.6.2' useconfigure='true' files="https://github.com/libsdl-org/SDL_mixer/releases/download/release-${version}/SDL2_mixer-${version}.tar.gz SDL2_mixer-${version}.tar.gz 8cdea810366decba3c33d32b8071bccd1c309b2499a54946d92b48e6922aa371" auth_type='sha256' -depends=("libmodplug" "libmpg123" "libvorbis" "SDL2") +depends=("libmodplug" "libmpg123" "libvorbis" "SDL2" "timidity") configure() { export LIBS="-L${SERENITY_INSTALL_ROOT}/usr/local/lib" diff --git a/Ports/SDL_mixer/package.sh b/Ports/SDL_mixer/package.sh index a67b092679..ef92ceeb41 100755 --- a/Ports/SDL_mixer/package.sh +++ b/Ports/SDL_mixer/package.sh @@ -7,7 +7,7 @@ use_fresh_config_sub=true config_sub_paths=("build-scripts/config.sub") files="https://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-${version}.tar.gz SDL_mixer-${version}.tar.gz 1644308279a975799049e4826af2cfc787cad2abb11aa14562e402521f86992a" auth_type=sha256 -depends=("libmikmod" "libvorbis" "sdl12-compat") +depends=("libmikmod" "libvorbis" "sdl12-compat" "timidity") # Explicitly point to the config binaries installed by our ports. Otherwise, it will # only work if by chance your host machine has those binaries in $PATH. diff --git a/Ports/timidity/package.sh b/Ports/timidity/package.sh new file mode 100755 index 0000000000..7bc9eae585 --- /dev/null +++ b/Ports/timidity/package.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env -S bash ../.port_include.sh +port='timidity' +useconfigure='true' +version='2.15.0' +files="https://netcologne.dl.sourceforge.net/project/timidity/TiMidity%2B%2B/TiMidity%2B%2B-${version}/TiMidity%2B%2B-${version}.tar.xz timidity-${version}.tar.xz 9eaf4fadb0e19eb8e35cd4ac16142d604c589e43d0e8798237333697e6381d39 +https://www.quaddicted.com/files/idgames/sounds/eawpats.zip eawpats.zip.no_extract 19087fa4a40e25ec39a09cffcc9f775fc22d88bc971a7a9831e075cdae2ee1e3" +auth_type='sha256' +workdir="TiMidity++-${version}" +use_fresh_config_sub='true' +config_sub_paths=('autoconf/config.sub') +depends=() +configopts=( + 'lib_cv___va_copy=no' + 'lib_cv_va_copy=no' + 'lib_cv_va_val_copy=no' +) + +post_install() { + # Unpack Eawpats + eaw_pats_dir='/usr/local/share/eawpats' + eaw_pats_host_dir="${SERENITY_INSTALL_ROOT}${eaw_pats_dir}" + mkdir -p "${eaw_pats_host_dir}" + run unzip -qo -d "${eaw_pats_host_dir}" '../eawpats.zip.no_extract' + + # Set up timidity.cfg + timidity_cfg_path="${SERENITY_INSTALL_ROOT}/etc/timidity.cfg" + mkdir -p "$(dirname ${timidity_cfg_path})" + cp "${eaw_pats_host_dir}/timidity.cfg" "${timidity_cfg_path}" + sed -i "s#^dir .*#dir ${eaw_pats_dir}#g" "${timidity_cfg_path}" +} diff --git a/Ports/timidity/patches/0001-Calculate-Newton-coefficients-on-the-fly.patch b/Ports/timidity/patches/0001-Calculate-Newton-coefficients-on-the-fly.patch new file mode 100644 index 0000000000..3b2db116f8 --- /dev/null +++ b/Ports/timidity/patches/0001-Calculate-Newton-coefficients-on-the-fly.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jelle Raaijmakers +Date: Thu, 1 Sep 2022 13:47:34 +0200 +Subject: [PATCH] Calculate Newton coefficients on the fly + +Since we are cross-compiling, we do not get a binary we can run on the +host that is able to generate `newton_table.c`, so fall back to the old +way of generating the table. +--- + timidity/Makefile.in | 2 -- + timidity/resample.c | 5 +---- + 2 files changed, 1 insertion(+), 6 deletions(-) + +diff --git a/timidity/Makefile.in b/timidity/Makefile.in +index e4ee43c..a93105e 100644 +--- a/timidity/Makefile.in ++++ b/timidity/Makefile.in +@@ -1956,8 +1956,6 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am + version.$(OBJEXT): version.c ../configure + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(CFLAGS) -c $(srcdir)/version.c + +-resample.c: newton_table.c +- + @VCPP_TRUE@newton_table.c: calcnewt$(EXEEXT) + @VCPP_TRUE@ ./calcnewt $@ + +diff --git a/timidity/resample.c b/timidity/resample.c +index cd6b8e6..a878526 100644 +--- a/timidity/resample.c ++++ b/timidity/resample.c +@@ -46,7 +46,6 @@ + + /* for start/end of samples */ + static float newt_coeffs[58][58] = { +-#include "newton_table.c" + }; + + int sample_bounds_min, sample_bounds_max; /* min/max bounds for sample data */ +@@ -468,7 +467,6 @@ void free_gauss_table(void) + gauss_table[0] = NULL; + } + +-#if 0 /* NOT USED */ + /* the was calculated statically in newton_table.c */ + static void initialize_newton_coeffs(void) + { +@@ -499,12 +497,11 @@ static void initialize_newton_coeffs(void) + for (j = 0, sign = pow(-1, i); j <= i; j++, sign *= -1) + newt_coeffs[i][j] *= sign; + } +-#endif /* NOT USED */ + + /* initialize the coefficients of the current resampling algorithm */ + void initialize_resampler_coeffs(void) + { +- /* initialize_newton_coeffs(); */ ++ initialize_newton_coeffs(); + initialize_gauss_table(gauss_n); + /* we don't have to initialize newton table any more */ + diff --git a/Ports/timidity/patches/ReadMe.md b/Ports/timidity/patches/ReadMe.md new file mode 100644 index 0000000000..8184f7523f --- /dev/null +++ b/Ports/timidity/patches/ReadMe.md @@ -0,0 +1,10 @@ +# Patches for timidity on SerenityOS + +## `0001-Calculate-Newton-coefficients-on-the-fly.patch` + +Calculate Newton coefficients on the fly + +Since we are cross-compiling, we do not get a binary we can run on the +host that is able to generate `newton_table.c`, so fall back to the old +way of generating the table. +