media-sound/chuck: version bump to 1.4.0.0.
authormil <m@userbound.com>
Mon, 20 Aug 2018 02:11:57 +0000 (21:11 -0500)
committerPatrice Clement <monsieurp@gentoo.org>
Tue, 21 Aug 2018 08:29:03 +0000 (10:29 +0200)
Closes: https://github.com/gentoo/gentoo/pull/9631

media-sound/chuck/Manifest
media-sound/chuck/chuck-1.4.0.0.ebuild [new file with mode: 0644]
media-sound/chuck/files/chuck-1.4.0.0-hid-smc.patch [new file with mode: 0644]
media-sound/chuck/files/chuck-1.4.0.0-makefile.patch [new file with mode: 0644]

index cd50c692d2783bc7697ecee9eff7a4f7ddcbbf1f..c06bb1ac9810db13fe7eb32921b92c1efacab0e6 100644 (file)
@@ -1,2 +1,3 @@
 DIST chuck-1.3.5.1.tgz 14686970 BLAKE2B 4ce0427d26070ed86b2ec3f788eff88944bf32eec42790a1126641e111bb41abe4e67b4a16b61a6a93524eb2b34d4460fa7ccb9b3656bdcc60cc23189a67ec3b SHA512 450237207150b285954dc2661d6f7829424d4353cdc457a7dce637b6877247b106ad0ed58bdbded17c1f7558e0f01daa7a06642f2727136f6edca5a64d202f73
 DIST chuck-1.3.5.2.tgz 14687476 BLAKE2B 35c3803ba1291bbfedd31d7c2845d20e32af4e91ea77e0790f429465b98d6d3ff91e321f036e3c2294d900d746741d987ac3a231bd6db01e3edaab006d507c97 SHA512 00407b0f20fa9adcd9d0c31078ef7593f8a5b026f19086942c3fa56128fd07e202848651e5e8f41f1d70566de766e84f4a049ca4013e65a61b6f6fb10d69ffbc
+DIST chuck-1.4.0.0.tgz 14664130 BLAKE2B 2009cc3f6905c7e4361aefdbcc89cab08d21328c6fe8ea366aad32a862428a5ffb16d45b1717e849d174f52e104ff0394a0aa2f93cfceed066e7b393edaabb1e SHA512 198b3c08a79bbbd2c0cdd5d9a7a11b8b58f09e949a3f5dd3f330af7d80fdb2861ca53dce807df555aed6ba917e72001ef7147b62a3ada57c34154102388dece1
diff --git a/media-sound/chuck/chuck-1.4.0.0.ebuild b/media-sound/chuck/chuck-1.4.0.0.ebuild
new file mode 100644 (file)
index 0000000..874e0f1
--- /dev/null
@@ -0,0 +1,70 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit toolchain-funcs flag-o-matic
+
+DESCRIPTION="Strongly-timed, concurrent, and on-the-fly audio programming language"
+HOMEPAGE="http://chuck.cs.princeton.edu/"
+SRC_URI="http://chuck.cs.princeton.edu/release/files/${P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+alsa jack examples"
+REQUIRED_USE="|| ( alsa jack )"
+
+RDEPEND="app-eselect/eselect-chuck
+       media-libs/libsndfile
+       alsa? ( media-libs/alsa-lib )
+       jack? ( media-sound/jack-audio-connection-kit )"
+DEPEND="${RDEPEND}
+       sys-devel/bison
+       sys-devel/flex"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.4.0.0-hid-smc.patch
+       "${FILESDIR}"/${PN}-1.4.0.0-makefile.patch
+)
+
+compile_backend() {
+       backend=$1
+       pushd "${S}/src" &>/dev/null || die
+       einfo "Compiling against ${backend}"
+       emake CC=$(tc-getCC) CXX=$(tc-getCXX) linux-${backend}
+       mv chuck{,-${backend}} || die
+       emake clean
+       popd &>/dev/null || die
+}
+
+src_compile() {
+       # when compile with athlon or athlon-xp flags
+       # chuck crashes on removing a shred with a double free or corruption
+       # it happens in Chuck_VM_Stack::shutdown() on the line
+       #   SAFE_DELETE_ARRAY( stack );
+       replace-cpu-flags athlon athlon-xp i686
+
+       use jack && compile_backend jack
+       use alsa && compile_backend alsa
+}
+
+src_install() {
+       use jack && dobin src/chuck-jack
+       use alsa && dobin src/chuck-alsa
+
+       dodoc AUTHORS DEVELOPER PROGRAMMER QUICKSTART README THANKS TODO VERSIONS
+       if use examples; then
+               insinto /usr/share/doc/${PF}/
+               doins -r examples
+               docompress -x /usr/share/doc/${PF}/examples
+       fi
+}
+
+pkg_postinst() {
+       if [[ -z ${REPLACING_VERSIONS} ]]; then
+               elog "Chuck now can use multiple audio engines, so you can specify"
+               elog "the preferred audio engine with chuck-{jack,alsa}"
+               elog "Or you can use 'eselect chuck' to set the audio engine"
+       fi
+       eselect chuck update --if-unset
+}
diff --git a/media-sound/chuck/files/chuck-1.4.0.0-hid-smc.patch b/media-sound/chuck/files/chuck-1.4.0.0-hid-smc.patch
new file mode 100644 (file)
index 0000000..0f608f5
--- /dev/null
@@ -0,0 +1,148 @@
+--- chuck-1.4.0.0~/src/core/util_hid.cpp
++++ chuck-1.4.0.0/src/core/util_hid.cpp
+@@ -7175,14 +7175,139 @@
+ int WiiRemote_send( const HidMsg * msg ){ return -1; }
+ const char * WiiRemote_name( int wr ){ return NULL; }
++#define SYSFS_TILTSENSOR_FILE "/sys/devices/platform/applesmc/position"
++#define TILTSENSOR_BUF_LEN 32
++
++static struct t_TiltSensor_data
++{
++      union
++      {
++              struct t_macbook
++              {
++                      int x;
++                      int y;
++                      int z;
++              } macbook;
++      } data;
++      int dataType;
++      int detected;
++      int refcount;
++
++      t_TiltSensor_data()
++      {
++              refcount = 0;
++              dataType = -1;
++              detected = 0;
++      }
++
++} TiltSensor_data;
++enum
++{
++      linuxAppleSMCMacBookDataType
++};
++static int TiltSensor_detect()
++{
++      int fd;
++
++      fd = open(SYSFS_TILTSENSOR_FILE, O_RDONLY);
++
++      if (fd > 0)
++      {
++              TiltSensor_data.dataType = linuxAppleSMCMacBookDataType;
++              TiltSensor_data.detected = 1;
++              close(fd);
++              return 1;
++      }
++
++      TiltSensor_data.detected = -1;
++
++      return 0;
++}
++
++static int TiltSensor_do_read()
++{
++
++      switch(TiltSensor_data.dataType)
++      {
++              case linuxAppleSMCMacBookDataType:
++                      char buf[TILTSENSOR_BUF_LEN];
++                      int ret, fd;
++                      fd = open(SYSFS_TILTSENSOR_FILE, O_RDONLY);
++
++                      if (fd < 0) {
++                              return -1;
++                      }
++                      ret = read(fd, buf, TILTSENSOR_BUF_LEN);
++                      if (ret < 0) {
++                              close(fd);
++                              return -1;
++                      }
++                      if (sscanf(buf, "(%d,%d,%d)\n", &TiltSensor_data.data.macbook.x, &TiltSensor_data.data.macbook.y, &TiltSensor_data.data.macbook.z) != 3) {
++                              close(fd);
++                              return -1;
++                      }
++                      close(fd);
++                      break;
++              default:
++                      return 0;
++      }
++      return 1;
++}
+ void TiltSensor_init(){}
+ void TiltSensor_quit(){}
+ void TiltSensor_probe(){}
+-int TiltSensor_count(){ return 0; }
+-int TiltSensor_open( int ts ){ return -1; }
+-int TiltSensor_close( int ts ){ return -1; }
+-int TiltSensor_read( int ts, int type, int num, HidMsg * msg ){ return -1; }
+-const char * TiltSensor_name( int ts ){ return NULL; }
++int TiltSensor_count()
++{
++      if(TiltSensor_data.detected == 0)
++              TiltSensor_detect();
++
++      if(TiltSensor_data.detected == -1)
++              return 0;
++      else if(TiltSensor_data.detected == 1)
++              return 1;
++
++      return 0;
++}
++int TiltSensor_open( int ts )
++{
++      if(TiltSensor_data.detected == 0)
++              TiltSensor_detect();
++
++      if(TiltSensor_data.detected == -1)
++              return -1;
++
++      TiltSensor_data.refcount++;
++
++      return 0;
++}
++int TiltSensor_close( int ts )
++{
++      TiltSensor_data.refcount--;
++
++      return 0;
++}
++int TiltSensor_read( int ts, int type, int num, HidMsg * msg )
++{
++
++      if(TiltSensor_data.detected == -1)
++              return -1;
++
++      if(!TiltSensor_do_read())
++              return -1;
++
++      if(TiltSensor_data.dataType == linuxAppleSMCMacBookDataType)
++      {
++              msg->idata[0] = TiltSensor_data.data.macbook.x;
++              msg->idata[1] = TiltSensor_data.data.macbook.y;
++              msg->idata[2] = TiltSensor_data.data.macbook.z;
++      }
++
++      return 0;
++}
++const char * TiltSensor_name( int ts )
++{
++      return "Apple Sudden Motion Sensor";
++}
+ #endif
+Only in chuck-1.4.0.0/src/core: util_hid.cpp.orig
diff --git a/media-sound/chuck/files/chuck-1.4.0.0-makefile.patch b/media-sound/chuck/files/chuck-1.4.0.0-makefile.patch
new file mode 100644 (file)
index 0000000..b601726
--- /dev/null
@@ -0,0 +1,27 @@
+--- chuck-1.4.0.0/src/makefile
++++ chuck-1.4.0.0/src/makefile
+@@ -40,8 +40,6 @@
+ ifneq ($(CHUCK_DEBUG),)
+ CFLAGS+= -g
+-else
+-CFLAGS+= -O3
+ endif
+ ifneq ($(USE_64_BIT_SAMPLE),)
+--- chuck-1.4.0.0/src/core/makefile.x/makefile.alsa
++++ chuck-1.4.0.0/src/core/makefile.x/makefile.alsa
+@@ -1,4 +1,4 @@
+-CFLAGS+= -D__LINUX_ALSA__ -D__PLATFORM_LINUX__ -O3 -fno-strict-aliasing -D__CK_SNDFILE_NATIVE__
++CFLAGS+= -D__LINUX_ALSA__ -D__PLATFORM_LINUX__ -fno-strict-aliasing -D__CK_SNDFILE_NATIVE__
+ LDFLAGS+= -lasound -lstdc++ -ldl -lm -lsndfile -lpthread
+--- chuck-1.4.0.0/src/core/makefile.x/makefile.jack
++++ chuck-1.4.0.0/src/core/makefile.x/makefile.jack
+@@ -1,4 +1,4 @@
+-CFLAGS+= -D__UNIX_JACK__ -D__PLATFORM_LINUX__ -O3 -fno-strict-aliasing -D__CK_SNDFILE_NATIVE__
++CFLAGS+= -D__UNIX_JACK__ -D__PLATFORM_LINUX__ -fno-strict-aliasing -D__CK_SNDFILE_NATIVE__
+ LDFLAGS+= -lasound -ljack -lstdc++ -ldl -lm -lsndfile -lpthread