← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2471: 1. Consistently use SUFFIX for what is the same for debug and non-debug version, and libDir for p...

 

------------------------------------------------------------
revno: 2471
committer: Václav Šmilauer <eu@xxxxxxxx>
branch nick: yade
timestamp: Mon 2010-10-11 18:28:49 +0200
message:
  1. Consistently use SUFFIX for what is the same for debug and non-debug version, and libDir for plugin installation directory. Hopefully that cleans the mess we've had. That should also fix startup problems with --debug that Anton reported
  2. Do not #define PREFIX and SUFFIX as macros, since they are not used in the c++ code anymore (and should not be)
modified:
  SConstruct
  core/Omega.hpp
  core/SConscript
  core/main/main.py.in
  core/main/pyboot.cpp
  core/main/yade-batch.in
  debian/control-template
  debian/rules
  extra/SConscript
  gui/SConscript
  lib/SConscript
  lib/multimethods/DynLibDispatcher.hpp
  py/SConscript
  py/__init__.py.in
  py/config.py.in
  yadeSCons.py


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'SConstruct'
--- SConstruct	2010-10-01 11:56:04 +0000
+++ SConstruct	2010-10-11 16:28:49 +0000
@@ -109,10 +109,10 @@
 	### OLD: use PathOption with PathOption.PathIsDirCreate, but that doesn't exist in 0.96.1!
 	('PREFIX','Install path prefix','/usr/local'),
 	('runtimePREFIX','Runtime path prefix; DO NOT USE, inteded for packaging only.',None),
-	('variant','Build variant, will be suffixed to all files, along with version (beware: if PREFIX is the same, headers of the older version will still be overwritten','' if profile=='default' else '-'+profile,None,lambda x:x),
+	('variant','Build variant, will be suffixed to all files, along with version.','' if profile=='default' else '-'+profile,None,lambda x:x),
 	BoolVariable('debug', 'Enable debugging information',0),
 	BoolVariable('gprof','Enable profiling information for gprof',0),
-	BoolVariable('optimize','Turn on heavy optimizations',1),
+	('optimize','Turn on optimizations (-1, 0 or 1); negative value sets optimization based on debugging: not optimize with debugging and vice versa.',-1,None,int),
 	ListVariable('exclude','Yade components that will not be built','none',names=['gui','extra','common','dem','lattice','snow']),
 	EnumVariable('PGO','Whether to "gen"erate or "use" Profile-Guided Optimization','',['','gen','use'],{'no':'','0':'','false':''},1),
 	ListVariable('features','Optional features that are turned on','log4cxx,opengl,gts,openmp,vtk',names=['opengl','log4cxx','cgal','openmp','gts','vtk','python','gl2ps','devirt-functors','qt4','never_use_this_one']),
@@ -147,6 +147,8 @@
 if saveProfile: opts.Save(optsFile,env)
 # fix expansion in python substitution by assigning the right value if not specified
 if not env.has_key('runtimePREFIX') or not env['runtimePREFIX']: env['runtimePREFIX']=env['PREFIX']
+# set optimization based on debug, if required
+if env['optimize']<0: env['optimize']=not env['debug']
 
 # handle colon-separated lists:
 for k in ('CPPPATH','LIBPATH','QTDIR','PATH'):
@@ -185,11 +187,11 @@
 if not env.has_key('realVersion') or not env['realVersion']: env['realVersion']=yadeSCons.getRealVersion() or 'unknown' # unknown if nothing returned
 if not env.has_key('version'): env['version']=env['realVersion']
 
-env['SUFFIX_NODEBUG']='-'+env['version']+env['variant']
-env['SUFFIX']=env['SUFFIX_NODEBUG']+('' if not env['debug'] else '/dbg')
+env['SUFFIX']='-'+env['version']+env['variant']
+env['SUFFIX_DBG']=env['SUFFIX']+('' if not env['debug'] else '/dbg')
+env['LIBDIR']='$PREFIX/lib/yade$SUFFIX_DBG'
 print "Yade version is `%s' (%s), installed files will be suffixed with `%s'."%(env['version'],env['realVersion'],env['SUFFIX'])
-# make buildDir absolute, saves hassles later
-buildDir=os.path.abspath(env.subst('$buildPrefix/build$SUFFIX'))
+buildDir=os.path.abspath(env.subst('$buildPrefix/build$SUFFIX_DBG'))
 print "All intermediary files will be in `%s'."%env.subst(buildDir)
 env['buildDir']=buildDir
 # these MUST be first so that builddir's headers are read before any locally installed ones
@@ -362,12 +364,12 @@
 			env.EnableQt4Modules(['QtGui','QtCore','QtXml','QtOpenGL'])
 			if not conf.TryAction(env.Action('pyrcc4'),'','qrc'): featureNotOK('qt4','The pyrcc4 program is not operational (package pyqt4-dev-tools)')
 			if not conf.TryAction(env.Action('pyuic4'),'','ui'): featureNotOK('qt4','The pyuic4 program is not operational (package pyqt4-dev-tools)')
-			ok=conf.CheckLibWithHeader(['qglviewer-qt4'],'QGLViewer/qglviewer.h','c++','QGLViewer();',autoadd=1)
-			okFedora=conf.CheckLibWithHeader(['libQGLViewer'],'QGLViewer/qglviewer.h','c++','QGLViewer();',autoadd=1)
-			if not (ok or okFedora): featureNotOK('opengl','Building with Qt4 implies the QGLViewer library installed (package libqglviewer-qt4-dev package in debian/ubuntu or libQGLViewer in RPM-based distros)')
-			if ok: env['QGLVIEWER_LIB']='qglviewer-qt4';
-			if okFedora: env['QGLVIEWER_LIB']='libQGLViewer';
-			
+			if conf.CheckLibWithHeader(['qglviewer-qt4'],'QGLViewer/qglviewer.h','c++','QGLViewer();',autoadd=1):
+				env['QGLVIEWER_LIB']='qglviewer-qt4'
+			elif conf.CheckLibWithHeader(['libQGLViewer'],'QGLViewer/qglviewer.h','c++','QGLViewer();',autoadd=1):
+				env['QGLVIEWER_LIB']='libQGLViewer'
+			else: featureNotOK('qt4','Building with Qt4 implies the QGLViewer library installed (package libqglviewer-qt4-dev package in debian/ubuntu, libQGLViewer in RPM-based distributions)')
+
 	if 'vtk' in env['features']:
 		ok=conf.CheckLibWithHeader(['vtkCommon'],'vtkInstantiator.h','c++','vtkInstantiator::New();',autoadd=1)
 		env.Append(LIBS='vtkHybrid')
@@ -434,15 +436,13 @@
 
 libDirs=('extra','gui','lib','py','plugins')
 # where are we going to be installed... pkg/dem becomes pkg-dem
-instLibDirs=[os.path.join('$PREFIX','lib','yade$SUFFIX',x) for x in libDirs]
+instLibDirs=[os.path.join('$LIBDIR',x) for x in libDirs]
 ## runtime library search directories; there can be up to 2 levels of libs, so we do in in quite a crude way here:
 ## FIXME: use syntax as shown here: http://www.scons.org/wiki/UsingOrigin
-relLibDirs=['../'+x for x in libDirs]+['../../'+x for x in libDirs]+[env.subst('../lib/yade$SUFFIX/lib')]
+relLibDirs=['../'+x for x in libDirs]+['../../'+x for x in libDirs]+[env.subst('../lib/yade$SUFFIX_DBG/lib')]
 runtimeLibDirs=[env.Literal('\\$$ORIGIN/'+x) for x in relLibDirs]
-#runtimeLibDirs=[os.path.join(r"'$$$$ORIGIN'/../",x) for x in libDirs]+[os.path.join(r"'$$$$ORIGIN'/../../",x) for x in libDirs]+["'$$$$ORIGIN'/../lib/yade$SUFFIX/lib"]
 
 ### PREPROCESSOR FLAGS
-env.Append(CPPDEFINES=[('SUFFIX',r'\"$SUFFIX\"'),('PREFIX',r'\"$runtimePREFIX\"')])
 if env['QUAD_PRECISION']: env.Append(CPPDEFINES='QUAD_PRECISION')
 
 ### COMPILER
@@ -626,7 +626,7 @@
 ## to know what should be installed overall.
 if not COMMAND_LINE_TARGETS:
 	toInstall=set([str(node) for node in env.FindInstalledFiles()])
-	for root,dirs,files in os.walk(env.subst('$PREFIX/lib/yade${SUFFIX}')):
+	for root,dirs,files in os.walk(env.subst('$LIBDIR')):
 		# do not go inside the debug directly, plugins are different there
 		for f in files:
 			# skip debug files, if in the non-debug build

=== modified file 'core/Omega.hpp'
--- core/Omega.hpp	2010-08-16 21:31:08 +0000
+++ core/Omega.hpp	2010-10-11 16:28:49 +0000
@@ -115,6 +115,9 @@
 		Real getRealTime();
 		time_duration getRealTime_duration();
 
+		// configuration directory used for logging config and possibly other things
+		std::string confDir;
+
 	DECLARE_LOGGER;
 
 	Omega(){ LOG_DEBUG("Constructing Omega."); }

=== modified file 'core/SConscript'
--- core/SConscript	2010-09-30 09:05:24 +0000
+++ core/SConscript	2010-10-11 16:28:49 +0000
@@ -1,7 +1,7 @@
 # syntax: python
 Import('*')
 
-pyMain='$PREFIX/bin/yade$SUFFIX_NODEBUG'
+pyMain='$PREFIX/bin/yade$SUFFIX'
 main=env.ScanReplace('main/main.py.in')
 batch=env.ScanReplace('main/yade-batch.in')
 env.AlwaysBuild(main)
@@ -14,16 +14,11 @@
 if 'execCheck' in env and env['execCheck']!=env.subst(pyMain):
 	raise RuntimeError('execCheck option (%s) does not match what is about to be installed (%s)'%(env['execCheck'],env.subst(pyMain)))
 
-env.Install('$PREFIX/lib/yade$SUFFIX/py/yade',[
+env.Install('$LIBDIR/py/yade',[
 	env.SharedLibrary('boot',['main/pyboot.cpp'],SHLIBPREFIX='',LIBS=env['LIBS']+['yade-support','core'])
 ])
 
-# env.InstallAs('$PREFIX/bin/yade$SUFFIX-cxx',env.Program('yade',['main/main.cpp'],LIBS=env['LIBS']+['yade-support','core'],CPPDEFINES=env['CPPDEFINES']+[('YADE_VERSION','\\"'+env['version']+'\\"'),]))
-## remove old executable
-## might be removed in the future
-import os.path, os
-
-env.Install('$PREFIX/lib/yade$SUFFIX/lib',[
+env.Install('$LIBDIR/lib',[
 	env.SharedLibrary('core',
 		env.Combine('core.cpp',[
 			'Body.cpp',

=== modified file 'core/main/main.py.in'
--- core/main/main.py.in	2010-10-01 15:38:55 +0000
+++ core/main/main.py.in	2010-10-11 16:28:49 +0000
@@ -4,18 +4,19 @@
 
 import sys,os,os.path,time
 # get yade path (allow YADE_PREFIX to override)
-prefix,suffix='${runtimePREFIX}' if not os.environ.has_key('YADE_PREFIX') else os.environ['YADE_PREFIX'],'${SUFFIX_NODEBUG}'
+prefix,suffix='${runtimePREFIX}' if not os.environ.has_key('YADE_PREFIX') else os.environ['YADE_PREFIX'],'${SUFFIX}'
 # duplicate some items from yade.config here, so that we can increase verbosity when the c++ part is booting
 features,version='${features}'.split(','),'${realVersion}'
 
 ## find available builds
 nonDebugLibDir=prefix+'/lib/yade'+suffix
-hasDebug,hasNonDebug=os.path.exists(nonDebugLibDir+'/dbg/lib'),os.path.exists(nonDebugLibDir+'/lib')
-if not hasDebug and not hasNonDebug:
-	raise RuntimeError('Neither non-debug nor debug build found! ('+nonDebugLibDir+'/lib, '+nonDebugLibDir+'/dbg/lib)')
-elif hasDebug and hasNonDebug: buildsAvailable='both optimized and debug build'
+debugLibDir=nonDebugLibDir+'/dbg'
+hasDebug,hasNonDebug=os.path.exists(debugLibDir+'/lib'),os.path.exists(nonDebugLibDir+'/lib')
+if hasDebug and hasNonDebug: buildsAvailable='both non-debug and debug build'
 elif hasDebug and not hasNonDebug: buildsAvaible='debug build only'
-elif not hasDebug and hasNonDebug: buildsAvailable='optimized build only'
+elif not hasDebug and hasNonDebug: buildsAvailable='non-debug build only'
+else:
+	raise RuntimeError('Neither non-debug nor debug build found! ('+nonDebugLibDir+'/lib, '+debugLibDir+'/lib)')
 
 
 # handle command-line options first
@@ -42,7 +43,7 @@
 	import subprocess
 	# rebuild
 	sourceRoot,profile='${sourceRoot}','${profile}' # replaced at install-time
-	cmd=['scons','-Q','-C',sourceRoot,'profile=%s!'%profile,'debug=%d'%(1 if opts.debug else 0),'optimize=%d'%(0 if opts.debug else 1),'execCheck=%s'%(prefix+'/bin/yade'+suffix)]
+	cmd=['scons','-Q','-C',sourceRoot,'profile=%s!'%profile,'debug=%d'%(1 if opts.debug else 0),'execCheck=%s'%(prefix+'/bin/yade'+suffix)]
 	print 'Rebuilding yade using',' '.join(cmd)
 	if subprocess.call(cmd): raise RuntimeError('Error rebuilding Yade (--rebuild).')
 	# run ourselves
@@ -53,17 +54,18 @@
 if opts.debug:
 	if not hasDebug:
 		raise RuntimeError('Debug build not available with this installation (running with --rebuild might help)')
-	## fix the prefix, so that yade/__init__.py picks the right plugin files
-	suffix+='/dbg'
-
-	## remove later
-	## python2.5 relative module imports workaround
-	v=sys.version_info
-	if v[0]==2 and v[1]<=5:
-		for submodule in ('yade','gts','yade/tests'):
-			sys.path.append(os.path.join(prefix,'lib','yade'+suffix,'py',submodule))
-
-sys.path.append(os.path.join(prefix,'lib','yade'+suffix,'py'))
+	libDir=debugLibDir
+else:
+	libDir=nonDebugLibDir
+
+## remove later
+## python2.5 relative module imports workaround
+v=sys.version_info
+if v[0]==2 and v[1]<=5:
+	for submodule in ('yade','gts','yade/tests'):
+		sys.path.append(os.path.join(libDir,'py',submodule))
+
+sys.path.append(os.path.join(libDir,'py'))
 
 # run regression test suite and exit
 if opts.test:

=== modified file 'core/main/pyboot.cpp'
--- core/main/pyboot.cpp	2010-08-16 21:31:08 +0000
+++ core/main/pyboot.cpp	2010-10-11 16:28:49 +0000
@@ -50,14 +50,14 @@
 #endif
 
 /* Initialize yade, loading given plugins */
-void yadeInitialize(python::list& pp){
+void yadeInitialize(python::list& pp, const std::string& confDir){
 
 	PyEval_InitThreads();
 
 	Omega& O(Omega::instance());
 	O.init();
 	O.origArgv=NULL; O.origArgc=0; // not needed, anyway
-	std::string confDir=string(getenv("HOME"))+"/.yade" SUFFIX;
+	O.confDir=confDir;
 	O.initTemps();
 	#ifdef YADE_DEBUG
 		ofstream gdbBatch;

=== modified file 'core/main/yade-batch.in'
--- core/main/yade-batch.in	2010-10-01 15:38:55 +0000
+++ core/main/yade-batch.in	2010-10-11 16:28:49 +0000
@@ -9,9 +9,10 @@
 #socket.setdefaulttimeout(10) 
 
 ## replaced by scons automatically
-prefix,suffix,suffixNoDebug='${runtimePREFIX}' if not os.environ.has_key('YADE_PREFIX') else os.environ['YADE_PREFIX'],'${SUFFIX}','${SUFFIX_NODEBUG}'
-sys.path.append(os.path.join(prefix,'lib','yade'+suffix,'py'))
-executable=os.path.join(prefix,'bin','yade'+suffixNoDebug)
+prefix,suffix='${runtimePREFIX}' if not os.environ.has_key('YADE_PREFIX') else os.environ['YADE_PREFIX'],'${SUFFIX}'
+libDir=prefix+'/lib/yade'+suffix # run the batch always in non-debug mode (the spawned processes do honor debuggin flag, however)
+sys.path.append(os.path.join(libDir,'py'))
+executable=os.path.join(prefix,'bin','yade'+suffix)
 ## we just need this ...
 import yade, yade.utils, yade.config, yade.remote
 
@@ -281,8 +282,8 @@
 if opts.manpage:
 	import yade.manpage
 	yade.config.metadata['short_desc']='batch system for computational platform Yade'
-	yade.config.metadata['long_desc']='Manage batches of computation jobs for the Yade platform; batches are described using text-file tables with parameters which are passed to individual runs of yade. Jobs are being run with pre-defined number of computational cores as soon as the required number of cores is available. Logs of all computations are stored in files and the batch progress can be watched online at (usually) http://localhost:9080. Unless overridden, the executable yade%s is used to run jobs.'%(suffixNoDebug)
-	yade.manpage.generate_manpage(parser,yade.config.metadata,opts.manpage,section=1,seealso='yade%s (1)\n.br\nhttps://yade-dem.org/sphinx/user.html#batch-queuing-and-execution-yade-batch'%suffixNoDebug)
+	yade.config.metadata['long_desc']='Manage batches of computation jobs for the Yade platform; batches are described using text-file tables with parameters which are passed to individual runs of yade. Jobs are being run with pre-defined number of computational cores as soon as the required number of cores is available. Logs of all computations are stored in files and the batch progress can be watched online at (usually) http://localhost:9080. Unless overridden, the executable yade%s is used to run jobs.'%(suffix)
+	yade.manpage.generate_manpage(parser,yade.config.metadata,opts.manpage,section=1,seealso='yade%s (1)\n.br\nhttps://yade-dem.org/sphinx/user.html#batch-queuing-and-execution-yade-batch'%suffix)
 	print 'Manual page %s generated.'%opts.manpage
 	sys.exit(0)
 

=== modified file 'debian/control-template'
--- debian/control-template	2010-09-25 12:20:36 +0000
+++ debian/control-template	2010-10-11 16:28:49 +0000
@@ -15,7 +15,7 @@
 
 Package: yade@_VERSION@-dbg
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, python-numpy, ipython, gdb, python-matplotlib, python-tk, python-qt4, python-xlib, mencoder
+Depends: ${shlibs:Depends}, ${misc:Depends}, yade@_VERSION@, gdb
 Description: Platform for dynamical modeling.
  Yet Another Dynamic Engine. etc.
  .

=== modified file 'debian/rules'
--- debian/rules	2010-10-10 20:35:23 +0000
+++ debian/rules	2010-10-11 16:28:49 +0000
@@ -47,11 +47,9 @@
 	##TMP dh_clean -k 
 	dh_installdirs
 	## files VERSION and _VERSION contain snapshot version without/with leading '-' respectively (like svn1113 and -svn1113)
-	### WARNING: !!!! with jobs>1, fakeroot may hang; 2 workarounds:
-	###   (a) use fakeroot-tcp instead of fakeroot
-	###   (b) use just 1 job
 	#debug build
-	NO_SCONS_GET_RECENT= scons profile=default buildPrefix=debian runtimePREFIX=/usr version=${VERSION} brief=0 chunkSize=1 jobs=1 features=vtk,gts,opengl,openmp,qt4 PREFIX=debian/yade${_VERSION}/usr variant='' optimize=0 march= debug=1 CPPPATH=/usr/include/vtk-5.0:/usr/include/vtk-5.2:/usr/include/vtk-5.4:/usr/include/eigen2 QT4DIR=/usr/share/qt4
+	# the last argument specified that we only want files in lib installed -- common files (the executable) are already in the optimized package
+	NO_SCONS_GET_RECENT= scons profile=default buildPrefix=debian runtimePREFIX=/usr version=${VERSION} brief=0 chunkSize=1 jobs=1 features=vtk,gts,opengl,openmp,qt4 PREFIX=debian/yade${_VERSION}-dbg/usr variant='' optimize=0 march= debug=1 CPPPATH=/usr/include/vtk-5.0:/usr/include/vtk-5.2:/usr/include/vtk-5.4:/usr/include/eigen2 QT4DIR=/usr/share/qt4 debian/yade${_VERSION}-dbg/usr/lib
 	#optimized build
 	NO_SCONS_GET_RECENT= scons profile=default PREFIX=debian/yade${_VERSION}/usr variant='' optimize=1 debug=0
 	#install platform-independent files (docs, scripts, examples)

=== modified file 'extra/SConscript'
--- extra/SConscript	2009-12-04 21:56:59 +0000
+++ extra/SConscript	2010-10-11 16:28:49 +0000
@@ -5,7 +5,7 @@
 
 import os.path, os
 
-env.Install('$PREFIX/lib/yade$SUFFIX/extra',[
+env.Install('$LIBDIR/extra',[
 	# env.SharedLibrary('PeriodicInsertionSortCollider',['PeriodicInsertionSortCollider.cpp'],LIBS=env['LIBS']+linkPlugins(['InsertionSortCollider','Shop'])),
 ])
 

=== modified file 'gui/SConscript'
--- gui/SConscript	2010-09-18 14:10:30 +0000
+++ gui/SConscript	2010-10-11 16:28:49 +0000
@@ -3,7 +3,7 @@
 linkPlugins=env['linkPlugins']
 
 if 'qt4' in env['features']:
-	env.Install('$PREFIX/lib/yade$SUFFIX/py/yade/qt',[
+	env.Install('$LIBDIR/py/yade/qt',[
 		env.File('qt4/img_rc.py'),
 		env.File('qt4/ui_controller.py'),
 		env.File('qt4/SerializableEditor.py'),

=== modified file 'lib/SConscript'
--- lib/SConscript	2010-09-09 12:41:04 +0000
+++ lib/SConscript	2010-10-11 16:28:49 +0000
@@ -5,8 +5,7 @@
 
 # will switch according to scons configuration to one or another
 def yadeStaticOrSharedLib(*args,**kw):
-	return env.Install('$PREFIX/lib/yade$SUFFIX/lib',env.SharedLibrary(*args,**kw))
-	#return env.Install('$PREFIX/lib/yade$SUFFIX/lib',env.StaticLibrary(*args,**kw))
+	return env.Install('$LIBDIR/lib',env.SharedLibrary(*args,**kw))
 
 if 'opengl' in env['features']:
 	yadeStaticOrSharedLib('yade-opengl',env.Combine('yade-opengl.cpp',['opengl/GLUtils.cpp']),LIBS=env['LIBS']+['glut','GL','GLU']),

=== modified file 'lib/multimethods/DynLibDispatcher.hpp'
--- lib/multimethods/DynLibDispatcher.hpp	2010-08-15 12:48:54 +0000
+++ lib/multimethods/DynLibDispatcher.hpp	2010-10-11 16:28:49 +0000
@@ -328,10 +328,10 @@
 		
 
 		bool locateMultivirtualFunctor1D(int& index, shared_ptr<BaseClass1>& base) {
+			if(callBacks.empty()) return false;
 			index = base->getClassIndex();
 			assert( index >= 0 && (unsigned int)( index ) < callBacks.size());
-			if( callBacks[index] )
-				return true;
+			if(callBacks[index]) return true;
 			
 			int depth=1;
 			int index_tmp = base->getBaseClassIndex(depth);
@@ -361,6 +361,7 @@
 		bool locateMultivirtualFunctor2D(int& index1, int& index2, shared_ptr<BaseClass1>& base1,shared_ptr<BaseClass2>& base2) {
 			//#define _DISP_TRACE(msg) cerr<<"@DT@"<<__LINE__<<" "<<msg<<endl;
 			#define _DISP_TRACE(msg)
+			if(callBacks.empty()) return false;
 			index1=base1->getClassIndex(); index2 = base2->getClassIndex();
 			assert(index1>=0); assert(index2>=0); 
 			assert((unsigned int)(index1)<callBacks.size()); assert((unsigned int)(index2)<callBacks[index1].size());

=== modified file 'py/SConscript'
--- py/SConscript	2010-09-27 17:47:59 +0000
+++ py/SConscript	2010-10-11 16:28:49 +0000
@@ -3,7 +3,7 @@
 linkPlugins=env['linkPlugins']
 import os.path 
 
-env.Install('$PREFIX/lib/yade$SUFFIX/py/yade',[
+env.Install('$LIBDIR/py/yade',[
 	env.SharedLibrary('WeightedAverage2d',['WeightedAverage2d.cpp'],SHLIBPREFIX=''),
 	env.SharedLibrary('_eudoxos',['_eudoxos.cpp'],SHLIBPREFIX='',CXXFLAGS=env['CXXFLAGS']+([] if not os.path.exists('../../brefcom-mm.hh') else ['-include','../brefcom-mm.hh']),LIBS=env['LIBS']+[
 		linkPlugins(['Shop','ConcretePM']),
@@ -42,7 +42,7 @@
 	env.SharedLibrary('wrapper',['wrapper/yadeWrapper.cpp'],SHLIBPREFIX='',LIBS=linkPlugins(['Shop','Dispatching','InteractionLoop','ParallelEngine','Clump','STLImporter',])),
 	env.SharedLibrary('_customConverters',['wrapper/customConverters.cpp'],SHLIBPREFIX='',LIBS=env['LIBS']+linkPlugins(['Dispatching']))
 ])
-env.Install('$PREFIX/lib/yade$SUFFIX/py/yade/tests',[
+env.Install('$LIBDIR/py/yade/tests',[
 	env.File('__init__.py','tests'),
 	env.File('wrapper.py','tests'),
 	env.File('omega.py','tests')
@@ -50,13 +50,13 @@
 
 # 3rd party modules:
 # ==================
-env.Install('$PREFIX/lib/yade$SUFFIX/py',[
+env.Install('$LIBDIR/py',[
 	env.SharedLibrary('miniEigen',['mathWrap/miniEigen.cpp'],SHLIBPREFIX='',CPPPATH=env['CPPPATH']+['../lib/'],LIBS=env['LIBS']+['core']),
 	env.File('mtTkinter.py','3rd-party/mtTkinter-0.3'),
 ])
 
 if 'YADE_GTS' in env['CPPDEFINES']:
-	env.Install('$PREFIX/lib/yade$SUFFIX/py/gts',[
+	env.Install('$LIBDIR/py/gts',[
 		env.SharedLibrary('_gts',['3rd-party/pygts-0.3.1/cleanup.c','3rd-party/pygts-0.3.1/edge.c','3rd-party/pygts-0.3.1/face.c','3rd-party/pygts-0.3.1/object.c','3rd-party/pygts-0.3.1/point.c','3rd-party/pygts-0.3.1/pygts.c','3rd-party/pygts-0.3.1/segment.c','3rd-party/pygts-0.3.1/surface.c','3rd-party/pygts-0.3.1/triangle.c','3rd-party/pygts-0.3.1/vertex.c'],SHLIBPREFIX='',CPPDEFINES=env['CPPDEFINES']+['PYGTS_HAS_NUMPY'],CXXFLAGS=env['CXXFLAGS']+['-Wno-all']),
 		env.File('3rd-party/pygts-0.3.1/__init__.py'),
 		env.File('3rd-party/pygts-0.3.1/pygts.py')
@@ -67,7 +67,7 @@
 	# without further modifications). If the file were copied (installed 2 times), static data would be
 	# created twice and it would break python type identification (among other things).
 	#
-	env.Command('$PREFIX/lib/yade$SUFFIX/lib/lib_gts__python-module.so','$PREFIX/lib/yade$SUFFIX/py/gts/_gts.so','ln -s -f ../py/gts/_gts.so $TARGET')
+	env.Command('$LIBDIR/lib/lib_gts__python-module.so','$LIBDIR/py/gts/_gts.so','ln -s -f ../py/gts/_gts.so $TARGET')
 
 
 

=== modified file 'py/__init__.py.in'
--- py/__init__.py.in	2010-09-30 18:00:41 +0000
+++ py/__init__.py.in	2010-10-11 16:28:49 +0000
@@ -35,20 +35,17 @@
 # find plugin directory
 import os,os.path
 import config
-if 'YADE_PREFIX' in os.environ: libDir=os.environ['YADE_PREFIX']+'/lib/yade'+config.suffix
-else: libDir=config.libDir
-libDir=os.path.abspath(libDir) # needed if YADE_PREFIX is a relative path
 # find plugins recursively
 plugins=[]
 # might add followlinks=True to os.walk, for python>=2.6
-for root,dirs,files in os.walk(libDir):
+for root,dirs,files in os.walk(config.libDir):
 	# for some reason, does not really work?
 	#dirs=[d for d in dirs if d!='dbg']
 	for f in files:
 		# ouch, ugly!
 		if not config.debug and '/dbg/' in root: continue
 		if not (f.startswith('lib') and f.endswith('.so')): continue
-		plugin=os.path.join(libDir,root,f)
+		plugin=os.path.join(config.libDir,root,f)
 		plugins.append(plugin)
 if 'YADE_DEBUG' in os.environ:
 	print 'The following plugins will be loaded:'
@@ -56,7 +53,7 @@
 
 # c++ initialization code
 import boot
-boot.initialize(plugins)
+boot.initialize(plugins,config.confDir)
 import system
 system.setExitHandlers() # avoid backtrace if crash at finalization (log4cxx)
 

=== modified file 'py/config.py.in'
--- py/config.py.in	2010-09-02 09:11:04 +0000
+++ py/config.py.in	2010-10-11 16:28:49 +0000
@@ -4,17 +4,17 @@
 
 Template file is processed by scons to create the actual configuration at build-time.
 """
-import os,datetime
+import os,datetime,os.path
 prefix='${runtimePREFIX}' if not os.environ.has_key('YADE_PREFIX') else os.environ['YADE_PREFIX']
 suffix='${SUFFIX}'
+debug=bool(${debug})
+libDir=os.path.abspath('$runtimePREFIX/lib/yade$SUFFIX'+('/dbg' if debug else ''))
+confDir=os.environ['HOME']+'/.yade$SUFFIX'
 libstdcxx='${libstdcxx}'
 features='${features}'.split(',')
 revision='${realVersion}'
 version='${version}'
 sourceRoot='${sourceRoot}'
-debug=bool(${debug})
-
-libDir=prefix+'/lib/yade'+suffix
 
 # project metadata
 metadata=dict(

=== modified file 'yadeSCons.py'
--- yadeSCons.py	2010-09-27 17:47:59 +0000
+++ yadeSCons.py	2010-10-11 16:28:49 +0000
@@ -153,9 +153,9 @@
 			# thanks to http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python :
 			else: srcs=[env.CombineWrapper('$buildDir/'+obj+'%d.cpp'%j,srcs[i:i+chunkSize]) for j,i in enumerate(range(0,len(srcs),chunkSize))]
 		#if linkStrategy!='static':
-		env.Install('$PREFIX/lib/yade$SUFFIX/plugins',env.SharedLibrary(obj,srcs,LIBS=env['LIBS']+['yade-support','core']+list(objs[obj][1])))
+		env.Install('$LIBDIR/plugins',env.SharedLibrary(obj,srcs,LIBS=env['LIBS']+['yade-support','core']+list(objs[obj][1])))
 		#else:
-		#	env.Install('$PREFIX/lib/yade$SUFFIX/plugins',env.StaticLibrary(obj,srcs,LIBS=env['LIBS']+['yade-support','core']+list(objs[obj][1])))
+		#	env.Install('$LIBDIR/plugins',env.StaticLibrary(obj,srcs,LIBS=env['LIBS']+['yade-support','core']+list(objs[obj][1])))