Hi!
I've ported pd-0.43.0 to NetBSD. It compiles fine and it does stuff. I'm new to pd, so I can't evaluate yet if everything's fine. I've imported the resulting package into pkgsrc as pkgsrc/audio/pd. It will soon be visible at http://pkgsrc.se/audio/pd
The patches might need cleanup before they can be included into pd, but even in their current state they show the issues I had to solve.
There are three more issues I fixed with sed: 1. hardcoded path to tclsh in tcl/pkg_mkIndex.tcl 2. path to audio device in src/s_audio_oss.c 3. paths to documentation, which I moved to ${PREFIX}/share/doc/pd to follow pkgsrc conventions
Please let me know about the best way to get these or similar patches integrated.
Thanks, Thomas
Hi all --
I can't evaluate the changes here that have to do with the build system but can work on getting rid of alloca dependencies. I didn't know there were any platforms left that didn't support alloca. (In fact I was celebrating that I would be able to replace more malloc calls with alloca to simplify things here and there.)
cheers Miller
On Thu, Sep 15, 2011 at 03:15:05AM +0200, Thomas Klausner wrote:
Hi!
I've ported pd-0.43.0 to NetBSD. It compiles fine and it does stuff. I'm new to pd, so I can't evaluate yet if everything's fine. I've imported the resulting package into pkgsrc as pkgsrc/audio/pd. It will soon be visible at http://pkgsrc.se/audio/pd
The patches might need cleanup before they can be included into pd, but even in their current state they show the issues I had to solve.
There are three more issues I fixed with sed:
- hardcoded path to tclsh in tcl/pkg_mkIndex.tcl
- path to audio device in src/s_audio_oss.c
- paths to documentation, which I moved to ${PREFIX}/share/doc/pd to
follow pkgsrc conventions
Please let me know about the best way to get these or similar patches integrated.
Thanks, Thomas
$NetBSD: patch-Makefile.am,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
Fix path to documentation (installed following pksrc conventions). Avoid creating unnecessary(?) empty directory.
--- Makefile.am.orig 2010-08-18 23:42:59.000000000 +0000 +++ Makefile.am @@ -37,11 +37,7 @@ endif ## FIXXXME ## $(pkglibdir) is used throughout the other Makefile.amS ## simply ignoring the special case for other OSs... -if LINUX -libpddir = $(pkglibdir) -else -libpddir = $(prefix) -endif +libpddir = $(prefix)/share/doc/pd
# Symlinks don't work on Windows/MinGW but they do on Cygwin. bin: @@ -51,6 +47,7 @@ locales: make -C po all
install-data-local: +mingw-install-data-local: $(INSTALL) -d $(DESTDIR)$(libpddir)/startup $(INSTALL) -d $(DESTDIR)$(libpddir)/startup/disabled
$NetBSD: patch-extra_bonk~_bonk~.c,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
alloca.h is not portable.
--- extra/bonk~/bonk~.c.orig 2010-08-19 01:37:00.000000000 +0000 +++ extra/bonk~/bonk~.c @@ -82,11 +82,7 @@ void *bonk_class; static t_class *bonk_class; #endif
-#ifdef _WIN32 #include <malloc.h> -#elif ! defined(_MSC_VER) -#include <alloca.h> -#endif
/* ------------------------ bonk~ ----------------------------- */
$NetBSD: patch-extra_pd~_pd~.c,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
Add missing include (for SIGPIPE). Define extensions for NetBSD.
--- extra/pd~/pd~.c.orig 2010-07-28 20:55:17.000000000 +0000 +++ extra/pd~/pd~.c @@ -6,6 +6,7 @@ */
#include <stdio.h> +#include <signal.h> #include <string.h> #include <unistd.h> #include <stdlib.h> @@ -56,6 +57,15 @@ static char pd_tilde_dllextent[] = ".l_i pd_tilde_dllextent2[] = ".pd_linux"; #endif #endif +#if defined(__NetBSD__) +#ifdef __x86_64__ +static char pd_tilde_dllextent[] = ".n_ia64",
- pd_tilde_dllextent2[] = ".pd_netbsd";
+#else +static char pd_tilde_dllextent[] = ".n_i386",
- pd_tilde_dllextent2[] = ".pd_netbsd";
+#endif +#endif #ifdef __APPLE__ static char pd_tilde_dllextent[] = ".d_fat", pd_tilde_dllextent2[] = ".pd_darwin";
$NetBSD: patch-extra_sigmund~_sigmund~.c,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
alloca.h is not portable.
--- extra/sigmund~/sigmund~.c.orig 2010-07-28 20:55:17.000000000 +0000 +++ extra/sigmund~/sigmund~.c @@ -26,11 +26,7 @@ for example, defines this in the file d_ #include <math.h> #include <stdio.h> #include <string.h> -#ifdef _WIN32 #include <malloc.h> -#elif ! defined(_MSC_VER) -#include <alloca.h> -#endif #include <stdlib.h> #ifdef _MSC_VER #pragma warning( disable : 4244 )
$NetBSD: patch-src_Makefile.am,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
Add missing libraries to linker line.
--- src/Makefile.am.orig 2011-02-27 03:22:57.000000000 +0000 +++ src/Makefile.am @@ -6,7 +6,7 @@ pd_LDFLAGS = pdsend_CFLAGS = pdreceive_CFLAGS = pd_watchdog_CFLAGS = -LIBS = +LIBS = $(LIBOSSAUDIO) $(PTHREAD_LDFLAGS) $(PTHREAD_LIBS) -lm INCLUDES = @INCLUDES@
SUFFIXES = .@EXTENSION@ .@SHARED_LIB@
$NetBSD: patch-src_configure,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
Fix unportable test(1) construct.
--- src/configure.orig 2011-03-21 01:41:34.000000000 +0000 +++ src/configure @@ -5407,7 +5407,7 @@ then then fat="no" fi
- if test "x$fat" == "xyes";
- if test "x$fat" = "xyes"; then MORECFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk \ -arch i386 -arch ppc -Wno-error"
$NetBSD: patch-src_d__array.c,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
Detect endianness on NetBSD.
--- src/d_array.c.orig 2010-07-28 20:55:17.000000000 +0000 +++ src/d_array.c @@ -502,7 +502,7 @@ static void tabread4_tilde_setup(void) #include <sys/endian.h> #endif
-#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__FreeBSD_kernel__) +#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) #include <machine/endian.h> #endif
$NetBSD: patch-src_d__osc.c,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
Detect endianness on NetBSD.
--- src/d_osc.c.orig 2010-07-28 20:55:17.000000000 +0000 +++ src/d_osc.c @@ -15,7 +15,7 @@ #include <sys/endian.h> #endif
-#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__FreeBSD_kernel__) +#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) #include <machine/endian.h> #endif
$NetBSD: patch-src_m__binbuf.c,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
alloca.h is not portable.
--- src/m_binbuf.c.orig 2011-03-10 06:02:41.000000000 +0000 +++ src/m_binbuf.c @@ -530,11 +530,7 @@ done:
#define SMALLMSG 5 #define HUGEMSG 1000 -#ifdef MSW #include <malloc.h> -#else -#include <alloca.h> -#endif #if HAVE_ALLOCA #define ATOMS_ALLOCA(x, n) ((x) = (t_atom *)((n) < HUGEMSG ? \ alloca((n) * sizeof(t_atom)) : getbytes((n) * sizeof(t_atom))))
$NetBSD: patch-src_s__audio__oss.c,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
Use proper soundcard.h include on NetBSD and add missing argument to ioctl().
--- src/s_audio_oss.c.orig 2011-03-07 01:33:39.000000000 +0000 +++ src/s_audio_oss.c @@ -5,7 +5,7 @@
/* this file inputs and outputs audio using the OSS API available on linux. */
-#if defined(__FreeBSD_kernel__) +#if defined(__FreeBSD_kernel__) || defined(__NetBSD__) # include <sys/soundcard.h> #else # include <linux/soundcard.h> @@ -120,7 +120,7 @@ typedef struct _multidev {
int oss_reset(int fd) { int err;
if ((err = ioctl(fd,SNDCTL_DSP_RESET)) < 0)
if ((err = ioctl(fd,SNDCTL_DSP_RESET,0)) < 0) error("OSS: Could not reset"); return err;
}
$NetBSD: patch-src_s__file.c,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
File handling under NetBSD is the same as under Linux.
--- src/s_file.c.orig 2011-03-19 22:22:27.000000000 +0000 +++ src/s_file.c @@ -36,7 +36,7 @@ int sys_defeatrt; t_symbol *sys_flags = &s_; void sys_doflags( void);
-#if defined(__linux__) || defined(__CYGWIN__) || defined(__FreeBSD_kernel__) || defined(__GNU__) || defined(ANDROID) +#if defined(__linux__) || defined(__CYGWIN__) || defined(__FreeBSD_kernel__) || defined(__GNU__) || defined(ANDROID) || defined(__NetBSD__)
static char *sys_prefbuf; static int sys_prefbufsize;
$NetBSD: patch-src_s__loader.c,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
Define extensions for NetBSD.
--- src/s_loader.c.orig 2010-07-29 03:50:34.000000000 +0000 +++ src/s_loader.c @@ -38,6 +38,12 @@ a fat binary or an indication of the ins
#ifdef __FreeBSD__ static char sys_dllextent[] = ".b_i386", sys_dllextent2[] = ".pd_freebsd"; +#elif defined(__NetBSD__) +# ifdef __x86_64__ +static char sys_dllextent[] = ".n_ia64", sys_dllextent2[] = ".pd_netbsd"; +# else +static char sys_dllextent[] = ".n_i386", sys_dllextent2[] = ".pd_netbsd"; +# endif #elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__) # ifdef __x86_64__ static char sys_dllextent[] = ".l_ia64", sys_dllextent2[] = ".pd_linux";
$NetBSD: patch-src_s__stuff.h,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
Use OSS on NetBSD.
--- src/s_stuff.h.orig 2011-03-13 00:19:29.000000000 +0000 +++ src/s_stuff.h @@ -204,7 +204,7 @@ void sys_setalarm(int microsec); #define API_DEFAULT API_DUMMY #define API_DEFSTRING "dummy audio" #else -#if defined(__linux__) || defined(__FreeBSD_kernel__) +#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) # define API_DEFAULT API_OSS # define API_DEFSTRING "OSS" #endif
$NetBSD: patch-src_s__utf8.c,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
alloca.h is not portable.
--- src/s_utf8.c.orig 2010-08-18 03:51:01.000000000 +0000 +++ src/s_utf8.c @@ -18,11 +18,7 @@ #include <stdio.h> #include <string.h> #include <stdarg.h> -#ifdef WIN32 #include <malloc.h> -#else -#include <alloca.h> -#endif
#include "s_utf8.h"
$NetBSD: patch-src_x__list.c,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
alloca.h is not portable.
--- src/x_list.c.orig 2010-07-21 18:37:47.000000000 +0000 +++ src/x_list.c @@ -4,11 +4,7 @@
#include "m_pd.h" /* #include <string.h> */ -#ifdef MSW #include <malloc.h> -#else -#include <alloca.h> -#endif
extern t_pd *newest;
$NetBSD: patch-src_x__misc.c,v 1.1.1.1 2011/09/15 01:05:05 wiz Exp $
Define missing symbol the same as on FreeBSD/Mac OS X.
--- src/x_misc.c.orig 2010-07-28 20:55:17.000000000 +0000 +++ src/x_misc.c @@ -20,7 +20,7 @@ #include <unistd.h> #endif /* _WIN32 */
-#if defined (__APPLE__) || defined (__FreeBSD__) +#if defined (__APPLE__) || defined (__FreeBSD__) || defined(__NetBSD__) #define CLOCKHZ CLK_TCK #endif #if defined (__linux__) || defined (__CYGWIN__) || defined (ANDROID)
Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Hi Miller,
I can't evaluate the changes here that have to do with the build system but can work on getting rid of alloca dependencies. I didn't know there were any platforms left that didn't support alloca. (In fact I was celebrating that I would be able to replace more malloc calls with alloca to simplify things here and there.)
Thanks for the reply.
The problem is not that alloca() is not supported, it's just that the alloca.h header is not available on all systems.
Gnulib documents it as: Portability problems fixed by Gnulib:
This header file is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 4.3.2, mingw.
http://www.gnu.org/software/hello/manual/gnulib/alloca_002eh.html
The ubuntu man page says:
BUGS
The alloca() function is machine and compiler dependent. On many systems its implementation is buggy. Its use is discouraged.
The Mac OS X man page claims similarly. The NetBSD man page says:
CAVEATS Few limitations can be mentioned:
o The alloca() function is machine dependent; its use is discouraged.
o The alloca() function is slightly unsafe because it cannot ensure that the pointer returned points to a valid and usable block of mem- ory. The allocation made may exceed the bounds of the stack, or even go further into other objects in memory, and alloca() cannot deter- mine such an error. Avoid alloca() with large unbounded allocations.
o Since alloca() modifies the stack at runtime, it causes problems to certain security features. See security(7) for a discussion.
On NetBSD, alloca() is provided by stdlib.h.
Perhaps the easiest way is to let configure check for alloca.h and stdlib.h and include one or the other, depending on what's available on the system. Would you like diffs for that? Thomas
Oh... that's good news.
I think I'd better pump 0.43-1 out first and then apply this for 0.42 since if there are more tweaks needed it will take time for them to become apparent.
cheers Miller
On Sat, Sep 17, 2011 at 01:22:21AM +0200, Thomas Klausner wrote:
Hi Miller,
I can't evaluate the changes here that have to do with the build system but can work on getting rid of alloca dependencies. I didn't know there were any platforms left that didn't support alloca. (In fact I was celebrating that I would be able to replace more malloc calls with alloca to simplify things here and there.)
Thanks for the reply.
The problem is not that alloca() is not supported, it's just that the alloca.h header is not available on all systems.
Gnulib documents it as: Portability problems fixed by Gnulib:
This header file is missing on some platforms: FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 4.3.2, mingw.
http://www.gnu.org/software/hello/manual/gnulib/alloca_002eh.html
The ubuntu man page says:
BUGS
The alloca() function is machine and compiler dependent. On
many systems its implementation is buggy. Its use is discouraged.
The Mac OS X man page claims similarly. The NetBSD man page says:
CAVEATS Few limitations can be mentioned:
o The alloca() function is machine dependent; its use is discouraged. o The alloca() function is slightly unsafe because it cannot ensure that the pointer returned points to a valid and usable block of mem- ory. The allocation made may exceed the bounds of the stack, or even go further into other objects in memory, and alloca() cannot deter- mine such an error. Avoid alloca() with large unbounded allocations. o Since alloca() modifies the stack at runtime, it causes problems to certain security features. See security(7) for a discussion.
On NetBSD, alloca() is provided by stdlib.h.
Perhaps the easiest way is to let configure check for alloca.h and stdlib.h and include one or the other, depending on what's available on the system. Would you like diffs for that? Thomas
On Fri, Sep 16, 2011 at 06:00:00PM -0700, Miller Puckette wrote:
Perhaps the easiest way is to let configure check for alloca.h and stdlib.h and include one or the other, depending on what's available on the system. Would you like diffs for that?
The attached changes use alloca.h or malloc.h, whichever's available, and still compiles for me. I hope this still works on Windows, otherwise I don't expect problems. (I didn't resend the unaffected patches from the patchset.) Thomas
On Sep 18, 2011, at 1:00 PM, Thomas Klausner wrote:
On Fri, Sep 16, 2011 at 06:00:00PM -0700, Miller Puckette wrote:
Perhaps the easiest way is to let configure check for alloca.h and stdlib.h and include one or the other, depending on what's available on the system. Would you like diffs for that?
The attached changes use alloca.h or malloc.h, whichever's available, and still compiles for me. I hope this still works on Windows, otherwise I don't expect problems. (I didn't resend the unaffected patches from the patchset.) Thomas <patch-configure.ac><patch-extra_bonk~_bonk~.c><patch- extra_sigmund~_sigmund~.c><patch-src_m__binbuf.c><patch- src_s__utf8.c><patch-src_x__list.c>
Hey Thomas,
Your best bet to getting these included is to submit them to the patch tracker: http://puredata.info/dev/patchtracker
.hc
----------------------------------------------------------------------------
News is what people want to keep hidden and everything else is publicity. - Bill Moyers
On Mon, Sep 19, 2011 at 12:47:20PM -0400, Hans-Christoph Steiner wrote:
Your best bet to getting these included is to submit them to the patch tracker: http://puredata.info/dev/patchtracker
Thanks for the pointer. I've opened three bug reports there. https://sourceforge.net/tracker/?func=detail&atid=478072&aid=3411730... https://sourceforge.net/tracker/?func=detail&atid=478072&aid=3411732... https://sourceforge.net/tracker/?func=detail&atid=478072&aid=3411735...
Cheers, Thomas