$NetBSD: patch-aa,v 1.5 2013/01/11 13:23:33 joerg Exp $

--- Sconstruct.orig	2012-02-19 21:54:05.000000000 +0000
+++ Sconstruct
@@ -47,7 +47,7 @@ def get_platform_flags( opts ):
 
 	env = Environment( options = opts )
 
-	if sys.platform == "linux2" or sys.platform == "linux3" or sys.platform == "darwin":
+	if sys.platform == "linux2" or sys.platform == "linux3" or sys.platform == "darwin" or sys.platform[:6] == "netbsd":
 		if str(env['debug']) == "1":
 			cppflags += ['-Wall',  '-g2', '-ggdb', '-O0'] 
 			for flag in env["optflags"].split(" "):
@@ -75,6 +75,12 @@ def get_platform_flags( opts ):
 		    if str(env['bundle']) == "1": cppflags.append('-DBUNDLE_SUPPORT')
 
 		cppflags.append('-DLADSPA_SUPPORT')
+
+		includes.append( env['prefix'] + "/include" )
+		ldflags.append( "-L" + env['prefix'] + "/lib" )
+		ldflags.append( "-Wl,-R," + env['prefix'] + "/lib" )
+		# XXX: this should go in py4.py but i'm not sure where
+		ldflags.append( "-Wl,-R," + env['prefix'] + "/qt4/lib" )
 		
 
 	if str(env['gui']) == "0": cppflags.append('-DNO_GUI_SUPPORT')
@@ -96,6 +102,10 @@ def get_platform_flags( opts ):
 		ldflags.append('-lasound')
 	#	ldflags.append('-lrubberband')
 
+	elif sys.platform[:6] == 'netbsd':
+		cppflags.append('-pthread')
+		ldflags.append('-lossaudio')
+
 	elif sys.platform == "win32":
 		includes.append( '3rdparty\libsndfile-1_0_17' )
 		includes.append( 'build\pthreads\include' )
@@ -283,6 +293,9 @@ def get_hydrogen_gui( lib_hydrogen , opt
 		env.Append( LIBS = ["z"] )
 		env.Append( LIBS = ["pthread"] )
 
+	if sys.platform[:6] == "netbsd":
+		env.Append( LIBS = ["z"] )
+
 	if sys.platform == "darwin" and str(env['coreaudio']) == "1":
 		env.Append( LINKFLAGS = ['-framework','ApplicationServices'])
 		env.Append( LINKFLAGS = ['-framework','AudioUnit'])
@@ -302,7 +315,7 @@ def get_hydrogen_gui( lib_hydrogen , opt
 	env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/img"))
 
 	#add every img in ./data/img to the install list. 
-	os.path.walk("./data/img/",install_images,env) 
+	#os.path.walk("./data/img/",install_images,env) 
 
 
 	env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/drumkits"))
@@ -380,7 +393,7 @@ else:
 
 includes, a , b = get_platform_flags( opts )
 
-env = Environment(options = opts, CPPPATH = includes)
+env = Environment(options = opts, ENV=os.environ, CPPPATH = includes)
 
 
 Help(opts.GenerateHelpText(env))