$NetBSD: patch-aa,v 1.5 2015/01/21 15:19:31 joerg Exp $

NetBSD config & path fixes

--- SConstruct.orig	2010-03-18 13:34:15.000000000 +0000
+++ SConstruct
@@ -19,7 +19,7 @@
 ##  along with this program; if not, write to the Free Software
 ##  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-import sys, os
+import sys, os, re
 import SCons.Util
 
 pingus_sources = [
@@ -348,7 +348,10 @@ def DefineOptions(filename, args):
 
    opts.Add(BoolVariable('with_xinput',        'Build with Xinput support', False))
    opts.Add(BoolVariable('with_linuxusbmouse', 'Build with Linux USB mouse support', True))
-   opts.Add(BoolVariable('with_linuxevdev',    'Build with Linux evdev support', True))
+   if sys.platform == 'linux':
+      opts.Add(BoolVariable('with_linuxevdev',    'Build with Linux evdev support', True))
+   else:
+      opts.Add(BoolVariable('with_linuxevdev',    'Build with Linux evdev support', False))
    opts.Add(BoolVariable('with_wiimote',       'Build with Wiimote support', False))
    opts.Add(BoolVariable('ignore_errors',      'Ignore any fatal configuration errors', False))
    opts.Add('optional_sources', 'Additional source files', [])
@@ -383,7 +386,10 @@ int main() {
    return 0;
 }
 """
-   config.CheckLibWithHeader('iconv', 'iconv.h', 'c++') # Ok to fail
+   if re.match("netbsd*", sys.platform):
+     config.CheckLibWithHeader('iconv_std', 'iconv.h', 'c++')
+   else:
+     config.CheckLibWithHeader('iconv', 'iconv.h', 'c++') # Ok to fail
    context.Message('Check how to call iconv...')
 
    for i in ['', 'const']:
@@ -408,7 +414,7 @@ if ('configure' in COMMAND_LINE_TARGETS)
    not (os.path.exists('config.py') and os.path.exists('config.h')) and \
    not GetOption('clean'):
     opts = DefineOptions(None, ARGUMENTS)
-    env = Environment(options = opts)
+    env = Environment(options = opts, ENV=os.environ)
     Help(opts.GenerateHelpText(env))
 
     opts.Update(env)
@@ -421,7 +427,7 @@ if ('configure' in COMMAND_LINE_TARGETS)
     if os.environ.has_key('PKG_CONFIG_PATH'):
         env['ENV']['PKG_CONFIG_PATH'] = os.environ['PKG_CONFIG_PATH']
     
-    env['CPPPATH'] += ['.', 'src/']
+    env['CPPPATH'] += '.:src/'
 
     config_h_defines = []      
 
@@ -535,7 +541,7 @@ if not ('configure' in COMMAND_LINE_TARG
         os.sys.exit(1)
         
     opts = DefineOptions("config.py", {})
-    env = Environment(options = opts)
+    env = Environment(options = opts, ENV=os.environ)
     Help(opts.GenerateHelpText(env))
 
     opts.Update(env)
