diff options
Diffstat (limited to 'multimedia')
-rw-r--r-- | multimedia/munt/README | 17 | ||||
-rw-r--r-- | multimedia/munt/doinst.sh | 9 | ||||
-rw-r--r-- | multimedia/munt/interleave.c | 93 | ||||
-rw-r--r-- | multimedia/munt/munt.SlackBuild | 176 | ||||
-rw-r--r-- | multimedia/munt/munt.info | 18 | ||||
-rw-r--r-- | multimedia/munt/setcap.sh | 1 | ||||
-rw-r--r-- | multimedia/munt/slack-desc | 4 | ||||
-rw-r--r-- | multimedia/munt/system_rom_path.diff | 85 |
8 files changed, 372 insertions, 31 deletions
diff --git a/multimedia/munt/README b/multimedia/munt/README index e8d468e966cb..87eb3d3d6f7a 100644 --- a/multimedia/munt/README +++ b/multimedia/munt/README @@ -4,6 +4,19 @@ Munt is a multi-platform software synthesizer emulating (somewhat inaccurately) pre-GM MIDI devices such as the Roland MT-32, CM-32L, CM-64 and LAPC-1. -ROMS for these devices are not included. +A few ROMS for these devices are included: the v1.07 ROM for the MT-32 +and the v1.02 ROM for the CM-32L. The applications have been patched +to use the packaged ROMs by default, though you can use other ROMs +easily enough. -This will install both the desktop application and the shared library. +This will install the desktop applications (mt32emu-qt and xmt32), the +command-line tools (mt32emu-smf2wav and mt32d), the shared library, +and the headers. + +Optional dependency: jack (autodetected). If jack is present, +munt will be built with support for it. If this package is built +with jack, it uses POSIX filesystem capabilities to execute with +elevated privileges (required for realtime audio processing). This +may be considered a security/stability risk. Please read +http://www.slackbuilds.org/caps/ for more information. To disable +capabilities, pass SETCAP=no to the script. diff --git a/multimedia/munt/doinst.sh b/multimedia/munt/doinst.sh new file mode 100644 index 000000000000..3e5691a052b5 --- /dev/null +++ b/multimedia/munt/doinst.sh @@ -0,0 +1,9 @@ +if [ -x /usr/bin/update-desktop-database ]; then + /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 +fi + +if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then + if [ -x /usr/bin/gtk-update-icon-cache ]; then + /usr/bin/gtk-update-icon-cache usr/share/icons/hicolor >/dev/null 2>&1 + fi +fi diff --git a/multimedia/munt/interleave.c b/multimedia/munt/interleave.c new file mode 100644 index 000000000000..20b666ae1274 --- /dev/null +++ b/multimedia/munt/interleave.c @@ -0,0 +1,93 @@ +/* interleave.c - B. Watson, April 2023, WTFPL licensed. + + Given two files of the same size, creates a 3rd file whose contents are: + + file 1, byte 1 + file 2, byte 1 + file 1, byte 2 + file 2, byte 2 + file 1, byte 3 + file 2, byte 3 + ...etc. + + If file1 contains "foo" and file2 contains "bar", the output will + be "fboaor". The output is always twice the size of one of the + input files (or, the same size as both input files combined). + + Output file is silently overwritten if it already exists. + + Exit status is 0 for success, non-zero for failure, with a hopefully + useful error message. + + Compile me with: + gcc -Wall -O2 -o interleave interleave.c + + This could be done more efficiently and without an artificial file + size limit, but the current implementation reads everything into a + statically sized buffer for simpliticy. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#define MAX_SIZE (1024 * 1024) + +unsigned char blob1[MAX_SIZE + 1], blob2[MAX_SIZE + 1], output[MAX_SIZE * 2 + 1]; + +void die(const char *msg) { + if(msg) + fprintf(stderr, "interleave: %s\n", msg); + else + perror("interleave"); + exit(1); +} + +int read_file(const char *fname, unsigned char *dest) { + int bytes; + FILE *f = fopen(fname, "rb"); + + if(!f) die(NULL); + if( (bytes = fread(dest, 1, MAX_SIZE + 1, f)) < 1 ) die(NULL); + fclose(f); + + /* fprintf(stderr, "read %d bytes from %s\n", bytes, fname); */ + + return bytes; +} + +void write_output(const char *fname, int bytes) { + int i; + unsigned char *p = output; + FILE *f = fopen(fname, "wb"); + + if(!f) die(NULL); + + for(i = 0; i < bytes; i++) { + *p++ = blob1[i]; + *p++ = blob2[i]; + } + + if( (fwrite(output, 1, bytes * 2, f)) < (bytes * 2) ) die(NULL); + + fclose(f); +} + +int main(int argc, char **argv) { + int size1, size2; + + if(argc != 4) + die("usage:\n\tinterleave <input1> <input2> <output>"); + + size1 = read_file(argv[1], blob1); + size2 = read_file(argv[2], blob2); + + if(size1 > MAX_SIZE) + die("input file too big (max 1MB each)"); + if(size1 != size2) + die("input files are not the same size"); + + write_output(argv[3], size1); + + return 0; +} diff --git a/multimedia/munt/munt.SlackBuild b/multimedia/munt/munt.SlackBuild index 9dc62f2c5c12..96d924674170 100644 --- a/multimedia/munt/munt.SlackBuild +++ b/multimedia/munt/munt.SlackBuild @@ -3,6 +3,7 @@ # Slackware build script for munt # Copyright 2017 Dugan Chen Canada +# Copyright 2023 B. Watson # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -22,10 +23,26 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# 20230410 bkw: +# - new maintainer. +# - update for v2.7.0 (sourceforge => github). +# - include (some of) the ROMs in the package. +# - add the mt32emu_alsadrv binaries (mt32d, xmt32). +# - patch everything to use /usr/share/munt/roms/ as default path. +# user can still change this in the UI as needed, I just don't want +# it defaulting to ~/roms/ (need this so we can package the ROMs). +# - add doinst.sh, since the new version has icons and a .desktop. +# - add setcap stuff for jack. +# - update README to document jack optional dep and the fact that the +# ROMs are included. also mention the actual binary names, since +# neither one's called "munt". + +# TODO someday: man pages. + cd $(dirname $0) ; CWD=$(pwd) PRGNAM=munt -VERSION=${VERSION:-2.2.0} +VERSION=${VERSION:-2.7.0} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -38,14 +55,18 @@ if [ -z "$ARCH" ]; then esac fi -# If the variable PRINT_PACKAGE_NAME is set, then this script will report what -# the name of the created package would be, and then exit. This information -# could be useful to other scripts. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 fi +# 20230411 bkw: The various components have separate version numbers, +# and it looks like upstream's tags are named after whichever +# component was released last. The mt32emu_qt_1_11_1 tag includes +# the previous release (2.7.0) of mt32emu. This is kinda confusing, +# but whatever. +GIT_TAG=${GIT_TAG:-mt32emu_qt_1_11_1} + TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} @@ -69,16 +90,30 @@ set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP -rm -rf $PRGNAM-$VERSION -tar xvf $CWD/$PRGNAM-$VERSION.tar.gz -cd $PRGNAM-$VERSION +rm -rf $PRGNAM-$GIT_TAG +tar xvf $CWD/$PRGNAM-$GIT_TAG.tar.gz +cd $PRGNAM-$GIT_TAG chown -R root:root . -find -L . \ - \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ - -o -perm 511 \) -exec chmod 755 {} \; -o \ - \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ - -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ + +# 20230411 bkw: Patch mt32emu-qt, mt32emu-smf2wav, mt32d, xmt32 to +# look for ROMs in a systemwide directory (which is where we'll place +# the ROMs, below). +patch -p1 < $CWD/system_rom_path.diff + +# Allow mt32d, xmt32 to build in-tree, without the library already +# installed. Also apply our SLKCFLAGS. +sed -i \ + -e "s,-O2,$SLKCFLAGS -I../build/mt32emu/include," \ + -e "s,-lmt32emu,-L../build/mt32emu -lmt32emu," \ + mt32emu_alsadrv/Makefile + +# 20230411 bkw: fix desktop-file-validate nitpick (a "hint", not an error). +sed -i '/^Categories/s,$,Audio;,' mt32emu_qt/res/mt32emu-qt.desktop +# 20230411 bkw: cmake accepts and ignores (!) -DCMAKE_INSTALL_DOCDIR. +# Also there's no way to disable jack, if it's autodetected. mkdir -p build cd build cmake \ @@ -87,22 +122,121 @@ cd build -DCMAKE_INSTALL_PREFIX=/usr \ -DLIB_INSTALL_DIR=/usr/lib${LIBDIRSUFFIX} \ -DCMAKE_BUILD_TYPE=Release .. \ - -Dlibmt32emu_SHARED=ON + -Dlibmt32emu_SHARED=ON make - make install DESTDIR=$PKG + make install/strip DESTDIR=$PKG cd .. -find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ - | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true +# This stuff isn't built by cmake. It's considered outdated, but at least +# the mt32d binary might be useful for a headless/console-only system. +make -C mt32emu_alsadrv +install -s -m0755 mt32emu_alsadrv/{mt32d,xmt32} $PKG/usr/bin + +### Extract and install the ROMs. + +PKGROMS=$PKG/usr/share/$PRGNAM/roms +mkdir -p $PKGROMS + +# The ROM zip files have at least 2 possible names each, depending on +# what was used to download them. The URLs have spaces in them. The +# spec says spaces have to be hex-escaped as %20. Plus, we can't have +# spaces in the URLs in our .info files anyway: it would break every +# tool that parses .info files, plus it would prevent curl from being +# able to download them (it refuses to accept spaces in URLs). + +# So DOWNLOAD has the %20's in the URLs. But wget will "helpfully" +# transform them back into spaces. On the other hand, "curl -O" +# will save them as-is. I don't know what various browsers do, but +# hopefully I've covered it here... + +ok=0 +for i in \ + 'Roland - CM32L - CONTROL.1989-12-05.v1.02.ROM.zip' \ + 'Roland%20-%20CM32L%20-%20CONTROL.1989-12-05.v1.02.ROM.zip' +do + if [ -e "$CWD/$i" ]; then + unzip -p "$CWD/$i" \ + "Roland - CM32L - CONTROL.1989-12-05.v1.02.ROM" \ + > $PKGROMS/CM32L_CONTROL.ROM + ok=1 + break + fi +done + +[ "$ok" = "0" ] && echo "*** can't find CM32L control ROM zip file" && exit 1 +ok=0 +for i in \ + 'Roland - CM32L - PCM Maskrom.ROM.zip' \ + 'Roland%20-%20CM32L%20-%20PCM%20Maskrom.ROM.zip' +do + if [ -e "$CWD/$i" ]; then + unzip -p "$CWD/$i" \ + "Roland - CM32L - PCM Maskrom.ROM" \ + > $PKGROMS/CM32L_PCM.ROM + ok=1 + break + fi +done + +[ "$ok" = "0" ] && echo "*** can't find CM32L PCM ROM zip file" && exit 1 + +# We need 3 files from this one, and 2 of them have to be +# interleaved... wrote a little tool to do the job. Only +# including the v1.0.7 control ROM; it's the newest version +# in the zip file. Also, in case something saves the file with +# the ( character hex-escaped, allow for it. +ok=0 +for i in \ + 'Roland MT32 (various OS _ extra ROMs.zip' \ + 'Roland%20MT32%20(various%20OS%20_%20extra%20ROMs.zip' \ + 'Roland%20MT32%20%28various%20OS%20_%20extra%20ROMs.zip' +do + if [ -e "$CWD/$i" ]; then + unzip -p "$CWD/$i" r15449121.ic37.bin > $PKGROMS/MT32_PCM.ROM + unzip "$CWD/$i" mt32_1.0.7.ic26.bin mt32_1.0.7.ic27.bin + + # The ROMs are stored on 2 chips, one with the even-numbered + # addresses and one with the odd. In theory, munt can use them + # as-is (the source called them "Mux0" and "Mux1" ROMs), but + # I couldn't get that to work. Easy enough to merge them together. + gcc -Wall -O2 -o interleave "$CWD/interleave.c" + ./interleave mt32_1.0.7.ic27.bin mt32_1.0.7.ic26.bin $PKGROMS/MT32_CONTROL.ROM + + ok=1 + break + fi +done + +[ "$ok" = "0" ] && echo "*** can't find MT32 ROM zip file" && exit 1 + +### ROMs extracted/installed, back to regular SBo style stuffs. + +PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION mkdir -p $PKG/usr/doc -mv $PKG/usr/share/doc/$PRGNAM $PKG/usr/doc/$PRGNAM-$VERSION -rm -rf $PKG/usr/share -cp -a README.txt $PKG/usr/doc/$PRGNAM-$VERSION -cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +mv $PKG/usr/share/doc/$PRGNAM $PKGDOC +rm -rf $PKG/usr/share/doc +cp -a README* $PKGDOC +mkdir -p $PKGDOC/mt32emu_alsadrv +cp -a mt32emu_alsadrv/*.txt $PKGDOC/mt32emu_alsadrv +cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild mkdir -p $PKG/install -cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +WITHJACK=WITHOUT + +# Only add capability stuff if not disabled, and if JACK support was +# included. +if pkg-config --exists jack && [ "${SETCAP:-yes}" = "yes" ]; then + WITHJACK=WITH + cat $CWD/setcap.sh >> $PKG/install/doinst.sh + # Only allow execution by audio group + chown root:audio $PKG/usr/bin/mt32emu-qt + chmod 0750 $PKG/usr/bin/mt32emu-qt +fi + +sed "s,@WITHJACK@,$WITHJACK," < $CWD/slack-desc > $PKG/install/slack-desc cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/multimedia/munt/munt.info b/multimedia/munt/munt.info index 2e9c3d97756f..4c19c0f66481 100644 --- a/multimedia/munt/munt.info +++ b/multimedia/munt/munt.info @@ -1,10 +1,16 @@ PRGNAM="munt" -VERSION="2.2.0" -HOMEPAGE="http://munt.sourceforge.net/" -DOWNLOAD="https://downloads.sourceforge.net/project/munt/munt/2.2.0/munt-2.2.0.tar.gz" -MD5SUM="627a5c7a61c40a4e27025f6a6b912b63" +VERSION="2.7.0" +HOMEPAGE="https://github.com/munt/munt/" +DOWNLOAD="https://github.com/munt/munt/archive/mt32emu_qt_1_11_1/munt-mt32emu_qt_1_11_1.tar.gz \ + http://dbwbp.com/synthbin/Roland%20MT32%20(various%20OS%20_%20extra%20ROMs.zip \ + http://dbwbp.com/synthbin/Roland%20-%20CM32L%20-%20CONTROL.1989-12-05.v1.02.ROM.zip \ + http://dbwbp.com/synthbin/Roland%20-%20CM32L%20-%20PCM%20Maskrom.ROM.zip" +MD5SUM="5a167d0a101d3781a751b21e3e7f46f2 \ + 1635fd528b41fefd262e4b075cb583c0 \ + a84cd91f8959bcae86ba06661ce4791d \ + 8278cfbb6c6d55edb39168182ce322ed" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" -MAINTAINER="Dugan Chen" -EMAIL="thedoogster [at] gmail [dot] com" +MAINTAINER="B. Watson" +EMAIL="urchlay@slackware.uk" diff --git a/multimedia/munt/setcap.sh b/multimedia/munt/setcap.sh new file mode 100644 index 000000000000..460ce23b7fb1 --- /dev/null +++ b/multimedia/munt/setcap.sh @@ -0,0 +1 @@ +[ -x /sbin/setcap ] && /sbin/setcap cap_ipc_lock,cap_sys_nice=ep usr/bin/mt32emu-qt diff --git a/multimedia/munt/slack-desc b/multimedia/munt/slack-desc index 4784a90509d6..61d27ea3e22e 100644 --- a/multimedia/munt/slack-desc +++ b/multimedia/munt/slack-desc @@ -12,8 +12,8 @@ munt: Munt is a multi-platform software synthesizer emulating (somewhat munt: inaccurately) pre-GM MIDI devices such as the Roland MT-32, CM-32L, munt: CM-64 and LAPC-1. munt: -munt: http://munt.sourceforge.net/ -munt: +munt: This package built @WITHJACK@ jack support. munt: munt: +munt: http://munt.sourceforge.net/ munt: diff --git a/multimedia/munt/system_rom_path.diff b/multimedia/munt/system_rom_path.diff new file mode 100644 index 000000000000..3cc1e2933813 --- /dev/null +++ b/multimedia/munt/system_rom_path.diff @@ -0,0 +1,85 @@ +diff -Naur munt-mt32emu_qt_1_11_1/mt32emu_alsadrv/README.txt munt-mt32emu_qt_1_11_1.patched/mt32emu_alsadrv/README.txt +--- munt-mt32emu_qt_1_11_1/mt32emu_alsadrv/README.txt 2022-08-03 11:39:49.000000000 -0400 ++++ munt-mt32emu_qt_1_11_1.patched/mt32emu_alsadrv/README.txt 2023-04-11 14:52:33.660273547 -0400 +@@ -29,7 +29,7 @@ + mt32d and xmt32 will be installed to /usr/local/bin + + Please ensure that the ROM files are installed in +-/usr/share/mt32-rom-data ++/usr/share/munt/roms + + If the ROM files are correctly installed yet the + program cannot open them, check the filenames (case sensitive) +diff -Naur munt-mt32emu_qt_1_11_1/mt32emu_alsadrv/src/alsadrv.cpp munt-mt32emu_qt_1_11_1.patched/mt32emu_alsadrv/src/alsadrv.cpp +--- munt-mt32emu_qt_1_11_1/mt32emu_alsadrv/src/alsadrv.cpp 2022-08-03 11:39:49.000000000 -0400 ++++ munt-mt32emu_qt_1_11_1.patched/mt32emu_alsadrv/src/alsadrv.cpp 2023-04-11 14:54:40.209261637 -0400 +@@ -44,7 +44,7 @@ + FILE *recwav_file = NULL; + + #define PERC_CHANNEL 9 +-const char default_rom_dir[] = "/usr/share/mt32-rom-data/"; ++const char default_rom_dir[] = "/usr/share/munt/roms/"; + + #include <mt32emu/mt32emu.h> + +diff -Naur munt-mt32emu_qt_1_11_1/mt32emu_alsadrv/src/console.cpp munt-mt32emu_qt_1_11_1.patched/mt32emu_alsadrv/src/console.cpp +--- munt-mt32emu_qt_1_11_1/mt32emu_alsadrv/src/console.cpp 2022-08-03 11:39:49.000000000 -0400 ++++ munt-mt32emu_qt_1_11_1.patched/mt32emu_alsadrv/src/console.cpp 2023-04-11 14:54:09.900264489 -0400 +@@ -139,7 +139,7 @@ + + printf("\n"); + printf("-f romdir : Directory with ROM files to load\n" +- " (default: '/usr/share/mt32-rom-data/')\n"); ++ " (default: '/usr/share/munt/roms/')\n"); + printf("-o romsearch : Search algorithm to use when loading ROM files:\n" + " (0 - try both but CM32-L first, 1 - CM32-L only,\n" + " 2 - MT-32 only, default: 0)\n"); +diff -Naur munt-mt32emu_qt_1_11_1/mt32emu_alsadrv/src/xmt32.cpp munt-mt32emu_qt_1_11_1.patched/mt32emu_alsadrv/src/xmt32.cpp +--- munt-mt32emu_qt_1_11_1/mt32emu_alsadrv/src/xmt32.cpp 2022-08-03 11:39:49.000000000 -0400 ++++ munt-mt32emu_qt_1_11_1.patched/mt32emu_alsadrv/src/xmt32.cpp 2023-04-11 14:53:38.143267478 -0400 +@@ -489,7 +489,7 @@ + + printf("\n"); + printf("-f romdir : Directory with ROM files to load\n" +- " (default: '/usr/share/mt32-rom-data/')\n"); ++ " (default: '/usr/share/munt/roms/')\n"); + printf("-o romsearch : Search algorithm to use when loading ROM files:\n" + " (0 - try both but CM32-L first, 1 - CM32-L only,\n" + " 2 - MT-32 only, default: 0)\n"); +diff -Naur munt-mt32emu_qt_1_11_1/mt32emu_qt/src/Master.cpp munt-mt32emu_qt_1_11_1.patched/mt32emu_qt/src/Master.cpp +--- munt-mt32emu_qt_1_11_1/mt32emu_qt/src/Master.cpp 2022-08-03 11:39:49.000000000 -0400 ++++ munt-mt32emu_qt_1_11_1.patched/mt32emu_qt/src/Master.cpp 2023-04-11 14:56:27.938251499 -0400 +@@ -583,20 +583,7 @@ + } + + QString Master::getDefaultROMSearchPath() { +-#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) +- QString defaultPath; +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- if (env.contains("USERPROFILE")) { +- defaultPath = env.value("USERPROFILE"); +- } else if (env.contains("HOME")) { +- defaultPath = env.value("HOME"); +- } else { +- defaultPath = "."; +- } +- return defaultPath + "/roms/"; +-#else +- return "./roms/"; +-#endif ++ return "/usr/share/munt/roms/"; + } + + void Master::loadSynthProfile(SynthProfile &synthProfile, QString name) { +diff -Naur munt-mt32emu_qt_1_11_1/mt32emu_smf2wav/src/mt32emu-smf2wav.cpp munt-mt32emu_qt_1_11_1.patched/mt32emu_smf2wav/src/mt32emu-smf2wav.cpp +--- munt-mt32emu_qt_1_11_1/mt32emu_smf2wav/src/mt32emu-smf2wav.cpp 2022-08-03 11:39:49.000000000 -0400 ++++ munt-mt32emu_qt_1_11_1.patched/mt32emu_smf2wav/src/mt32emu-smf2wav.cpp 2023-04-11 14:56:27.938251499 -0400 +@@ -917,7 +917,7 @@ + + static bool loadROMs(MT32Emu::Service &service, const Options &options) { + const char *romDirNameUtf8 = options.romDir; +- if (romDirNameUtf8 == NULL) romDirNameUtf8 = "."; ++ if (romDirNameUtf8 == NULL) romDirNameUtf8 = "/usr/share/munt/roms"; + char *romDirName = g_filename_from_utf8(romDirNameUtf8, strlen(romDirNameUtf8), NULL, NULL, NULL); + GDir *romDir = g_dir_open(romDirName, 0, NULL); + if (NULL == romDir) { |