Browse Source

xap/zynaddsubfx: Upgraded to zynaddsubfx-2.5.4.

slackware-14.2
Damien Goutte-Gattat 6 years ago
parent
commit
e62b491103
  1. 17
      xap/zynaddsubfx/ZynAddSubFX-2.4.3-homedir.diff
  2. 82
      xap/zynaddsubfx/ZynAddSubFX-2.4.3-xdgconfig.diff
  3. 1
      xap/zynaddsubfx/ZynAddSubFX-2.4.3.tar.bz2.sha1
  4. 115
      xap/zynaddsubfx/zynaddsubfx-2.5.4-xdgconfig.patch
  5. 1
      xap/zynaddsubfx/zynaddsubfx-2.5.4.tar.bz2.sha1
  6. 28
      xap/zynaddsubfx/zynaddsubfx.SlackBuild
  7. 11
      xap/zynaddsubfx/zynaddsubfx.desktop
  8. BIN
      xap/zynaddsubfx/zynaddsubfx.png

17
xap/zynaddsubfx/ZynAddSubFX-2.4.3-homedir.diff

@ -1,17 +0,0 @@
diff --git a/src/Misc/Bank.cpp b/src/Misc/Bank.cpp
index 1a673da..e23cecc 100644
--- a/src/Misc/Bank.cpp
+++ b/src/Misc/Bank.cpp
@@ -349,6 +349,12 @@ void Bank::rescanforbanks()
void Bank::scanrootdir(string rootdir)
{
+ if(rootdir[0] == '~') {
+ const char *home;
+ if((home = getenv("HOME")))
+ rootdir.replace(0, 1, home);
+ }
+
DIR *dir = opendir(rootdir.c_str());
if(dir == NULL)
return;

82
xap/zynaddsubfx/ZynAddSubFX-2.4.3-xdgconfig.diff

@ -1,82 +0,0 @@
diff --git a/src/Misc/Config.cpp b/src/Misc/Config.cpp
index 9e2a430..34bd0ef 100644
--- a/src/Misc/Config.cpp
+++ b/src/Misc/Config.cpp
@@ -27,6 +27,7 @@
#include "Config.h"
#include "XMLwrapper.h"
+#include "Util.h"
using namespace std;
@@ -235,6 +236,8 @@ void Config::readConfig(const char *filename)
void Config::saveConfig(const char *filename)
{
+ makedir(filename, 0700);
+
XMLwrapper *xmlcfg = new XMLwrapper();
xmlcfg->beginbranch("CONFIGURATION");
@@ -295,6 +298,11 @@ void Config::saveConfig(const char *filename)
void Config::getConfigFileName(char *name, int namesize)
{
+ const char *cfg_dir;
+
name[0] = 0;
- snprintf(name, namesize, "%s%s", getenv("HOME"), "/.zynaddsubfxXML.cfg");
+ if((cfg_dir = getenv("XDG_CONFIG_HOME")))
+ snprintf(name, namesize, "%s/zynaddsubfx/zynaddsubfxXML.cfg", cfg_dir);
+ else
+ snprintf(name, namesize, "%s/.config/zynaddsubfx/zynaddsubfxXML.cfg", getenv("HOME"));
}
diff --git a/src/Misc/Util.cpp b/src/Misc/Util.cpp
index d75ab2f..66d6b29 100644
--- a/src/Misc/Util.cpp
+++ b/src/Misc/Util.cpp
@@ -117,6 +117,30 @@ bool fileexists(const char *filename)
return false;
}
+int makedir(const char *path, int mode)
+{
+ char *p;
+ int ret;
+ struct stat st_buf;
+
+ for(p = (char *)(path + 1), ret = 0; *(p - 1) && ret == 0; ++p) {
+ if(*p == '/' ) {
+ *p = '\0';
+
+ if(stat(path, &st_buf) == -1)
+ ret = mkdir(path, mode);
+ else if(!S_ISDIR(st_buf.st_mode)) {
+ errno = ENOTDIR;
+ ret = -1;
+ }
+
+ *p = '/';
+ }
+ }
+
+ return ret;
+}
+
void set_realtime()
{
sched_param sc;
diff --git a/src/Misc/Util.h b/src/Misc/Util.h
index 1c1545d..4d79dc7 100644
--- a/src/Misc/Util.h
+++ b/src/Misc/Util.h
@@ -34,6 +34,8 @@ extern float VelF(float velocity, unsigned char scaling);
bool fileexists(const char *filename);
+int makedir(const char *path, int mode);
+
#define N_DETUNE_TYPES 4 //the number of detune types
extern float getdetune(unsigned char type,
unsigned short int coarsedetune,

1
xap/zynaddsubfx/ZynAddSubFX-2.4.3.tar.bz2.sha1

@ -1 +0,0 @@
af375f51093fecc9c80064295b3938b9e70b2edf ZynAddSubFX-2.4.3.tar.bz2

115
xap/zynaddsubfx/zynaddsubfx-2.5.4-xdgconfig.patch

@ -0,0 +1,115 @@
diff --git a/src/Misc/Config.cpp b/src/Misc/Config.cpp
index 0819d12..937cf87 100644
--- a/src/Misc/Config.cpp
+++ b/src/Misc/Config.cpp
@@ -21,6 +21,7 @@
#include "Config.h"
#include "../src/globals.h"
#include "XMLwrapper.h"
+#include "Util.h"
#define rStdString(name, len, ...) \
{STRINGIFY(name) "::s", rMap(length, len) rProp(parameter) DOC(__VA_ARGS__), NULL, rStringCb(name,len)}
@@ -186,6 +187,7 @@ void Config::init()
char filename[MAX_STRING_SIZE];
getConfigFileName(filename, MAX_STRING_SIZE);
+ migrateOldConfig(filename);
readConfig(filename);
if(cfg.bankRootDirList[0].empty()) {
@@ -346,6 +348,8 @@ void Config::readConfig(const char *filename)
void Config::saveConfig(const char *filename) const
{
+ makedir(filename, 0700);
+
XMLwrapper *xmlcfg = new XMLwrapper();
xmlcfg->beginbranch("CONFIGURATION");
@@ -401,6 +405,25 @@ void Config::saveConfig(const char *filename) const
void Config::getConfigFileName(char *name, int namesize) const
{
+ const char *cfg_dir;
+
name[0] = 0;
- snprintf(name, namesize, "%s%s", getenv("HOME"), "/.zynaddsubfxXML.cfg");
+ if((cfg_dir = getenv("XDG_CONFIG_HOME")))
+ snprintf(name, namesize, "%s/zynaddsubfx/zynaddsubfxXML.cfg", cfg_dir);
+ else
+ snprintf(name, namesize, "%s/.config/zynaddsubfx/zynaddsubfxXML.cfg", getenv("HOME"));
+}
+
+void Config::migrateOldConfig(const char *new_cfg_file)
+{
+ char old_cfg_file[MAX_STRING_SIZE];
+
+ if(!fileexists(new_cfg_file)) {
+ snprintf(old_cfg_file, sizeof(old_cfg_file), "%s/.zynaddsubfxXML.cfg", getenv("HOME"));
+
+ if(fileexists(old_cfg_file)) {
+ makedir(new_cfg_file, 0700);
+ rename(old_cfg_file, new_cfg_file);
+ }
+ }
}
diff --git a/src/Misc/Config.h b/src/Misc/Config.h
index 3f453dc..0fb8054 100644
--- a/src/Misc/Config.h
+++ b/src/Misc/Config.h
@@ -71,5 +71,6 @@ class Config
void readConfig(const char *filename);
void saveConfig(const char *filename) const;
void getConfigFileName(char *name, int namesize) const;
+ void migrateOldConfig(const char *new_cfg_file);
};
#endif
diff --git a/src/Misc/Util.cpp b/src/Misc/Util.cpp
index 626920b..7782810 100644
--- a/src/Misc/Util.cpp
+++ b/src/Misc/Util.cpp
@@ -114,6 +114,30 @@ bool fileexists(const char *filename)
return false;
}
+int makedir(const char *path, int mode)
+{
+ char *p;
+ int ret;
+ struct stat st_buf;
+
+ for(p = (char *)(path + 1), ret = 0; *(p - 1) && ret == 0; ++p) {
+ if(*p == '/' ) {
+ *p = '\0';
+
+ if(stat(path, &st_buf) == -1)
+ ret = mkdir(path, mode);
+ else if(!S_ISDIR(st_buf.st_mode)) {
+ errno = ENOTDIR;
+ ret = -1;
+ }
+
+ *p = '/';
+ }
+ }
+
+ return ret;
+}
+
void set_realtime()
{
#ifdef HAVE_SCHEDULER
diff --git a/src/Misc/Util.h b/src/Misc/Util.h
index 9bd424a..2629801 100644
--- a/src/Misc/Util.h
+++ b/src/Misc/Util.h
@@ -30,6 +30,8 @@ extern bool isPlugin;
bool fileexists(const char *filename);
+int makedir(const char *path, int mode);
+
#define N_DETUNE_TYPES 4 //the number of detune types
extern float getdetune(unsigned char type,
unsigned short int coarsedetune,

1
xap/zynaddsubfx/zynaddsubfx-2.5.4.tar.bz2.sha1

@ -0,0 +1 @@
48ace6b5996103b6889db96a5201eb5c2c1b62bc zynaddsubfx-2.5.4.tar.bz2

28
xap/zynaddsubfx/zynaddsubfx.SlackBuild

@ -1,6 +1,6 @@
#!/bin/bash
# Build script for Slackware
# Copyright (C) 2011,2012 Damien Goutte-Gattat
# Copyright (C) 2011,2012,2016 Damien Goutte-Gattat
#
# Redistribution and use of this script, with or without modifications,
# is permitted provided that the following conditions are met:
@ -25,12 +25,12 @@
# Latest ZynAddSubFX sourcecode is available at:
# <http://zynaddsubfx.sourceforge.net/>.
#
# Depends: l/fltk, l/mxml
# Depends: l/fltk, l/mxml, l/liblo
# Recommends: ap/jack
# Source package infos
NAMESRC=${NAMESRC:-ZynAddSubFX}
VERSION=${VERSION:-2.4.3}
NAMESRC=${NAMESRC:-zynaddsubfx}
VERSION=${VERSION:-2.5.4}
ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION.tar.bz2}
WGET=${WGET:-http://downloads.sourceforge.net/zynaddsubfx/$ARCHIVE}
@ -87,27 +87,17 @@ cd $TMP
echo "Building $ARCHIVE..."
tar xf $CWD/$ARCHIVE
cd $NAME
# Recognize ~ when scanning banks directories
patch -p 1 < $CWD/ZynAddSubFX-2.4.3-homedir.diff
# Place config file in XDG_HOME_DIR
patch -p 1 < $CWD/ZynAddSubFX-2.4.3-xdgconfig.diff
patch -p 1 < $CWD/zynaddsubfx-2.5.4-xdgconfig.patch
mkdir build && cd build
CFLAGS=$CPUOPT \
CXXFLAGS=$CPUOPT \
cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
-DPluginLibDir=lib$LIBDIRSUFFIX \
..
make -j $JOBS
make install DESTDIR=$PKG
# Strip binaries
find $PKG | xargs file | grep "ELF \(32\|64\)-bit LSB" | cut -d : -f 1 | \
xargs strip --strip-unneeded 2> /dev/null
# Install banks and examples
mkdir -p $PKG/usr/share/zynaddsubfx
cp -r ../instruments/banks ../instruments/examples \
$PKG/usr/share/zynaddsubfx/
make install/strip DESTDIR=$PKG
# Add bank numbers
(
@ -125,10 +115,6 @@ mv $PKG/usr/share/doc/zynaddsubfx $PKG/usr/doc/$NAMEPKG-$VERSION
rmdir $PKG/usr/share/doc
cp -r ../doc $PKG/usr/doc/$NAMEPKG-$VERSION/docs
# Install desktop files
install -D -m 644 $CWD/zynaddsubfx.png $PKG/usr/share/pixmaps/zynaddsubfx.png
install -D -m 644 $CWD/zynaddsubfx.desktop $PKG/usr/share/applications/zynaddsubfx.desktop
# Copy slack-desc and doinst.sh files
install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc
install -m 755 $CWD/doinst.sh $PKG/install/doinst.sh

11
xap/zynaddsubfx/zynaddsubfx.desktop

@ -1,11 +0,0 @@
[Desktop Entry]
Name=ZynAddSubFX
Comment=Software Synthesizer
Exec=zynaddsubfx
Icon=/usr/share/pixmaps/zynaddsubfx.png
Terminal=false
Type=Application
Categories=AudioVideo;Audio;
StartupNotify=false
X-KDE-StartupNotify=false
X-DCOP-ServiceType=Multi

BIN
xap/zynaddsubfx/zynaddsubfx.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Loading…
Cancel
Save