[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23384] trunk/blender: Better unix filesystem integration as documented here

Campbell Barton ideasman42 at gmail.com
Mon Sep 21 05:16:27 CEST 2009


Revision: 23384
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23384
Author:   campbellbarton
Date:     2009-09-21 05:16:26 +0200 (Mon, 21 Sep 2009)

Log Message:
-----------
Better unix filesystem integration as documented here
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/Unix_FHS

for scons WITH_BF_FHS enabled an alternative layout eg.
?\239?\187?\191scons WITH_BF_FHS=1 BF_INSTALLDIR="/usr/local"

for CMake just run "make install" after make (?\239?\187?\191CMAKE_INSTALL_PREFIX is used for the base path)

Currently only scripts use both the system and user path correctly, other areas of blender have their own path code inline with lots of ifdefs, needs to be carefully updated.

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/SConstruct
    trunk/blender/config/darwin-config.py
    trunk/blender/config/irix6-config.py
    trunk/blender/config/linux2-config.py
    trunk/blender/config/linuxcross-config.py
    trunk/blender/config/openbsd3-config.py
    trunk/blender/config/sunos5-config.py
    trunk/blender/config/win32-mingw-config.py
    trunk/blender/config/win32-vc-config.py
    trunk/blender/config/win64-vc-config.py
    trunk/blender/source/blender/blenlib/BLI_util.h
    trunk/blender/source/blender/blenlib/intern/util.c
    trunk/blender/source/blender/python/intern/bpy_interface.c
    trunk/blender/source/creator/CMakeLists.txt
    trunk/blender/source/creator/SConscript
    trunk/blender/source/creator/creator.c
    trunk/blender/source/gameengine/PyDoc/SConscript
    trunk/blender/tools/Blender.py
    trunk/blender/tools/btools.py

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt	2009-09-21 01:32:37 UTC (rev 23383)
+++ trunk/blender/CMakeLists.txt	2009-09-21 03:16:26 UTC (rev 23384)
@@ -51,6 +51,10 @@
 SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
 SET(LIBRARY_OUTPUT_PATH  ${CMAKE_BINARY_DIR}/lib)
 
+# Note! - Could create this from the blender version string
+# ...but thats quite involved, make sure this matches the blender version.
+SET(BLENDER_VERSION  2.5)
+
 #-----------------------------------------------------------------------------
 # Set default config options
 OPTION(WITH_PLAYER        "Build Player" OFF)

Modified: trunk/blender/SConstruct
===================================================================
--- trunk/blender/SConstruct	2009-09-21 01:32:37 UTC (rev 23383)
+++ trunk/blender/SConstruct	2009-09-21 03:16:26 UTC (rev 23384)
@@ -186,6 +186,15 @@
 SetOption('num_jobs', int(env['BF_NUMJOBS']))
 print "Build with %d parallel jobs" % (GetOption('num_jobs'))
 
+# BLENDERPATH is a unix only option to enable typical style paths this is
+# spesifically a data-dir, which is used a lot but cant replace BF_INSTALLDIR
+# because the blender binary is installed in $BF_INSTALLDIR/bin/blender
+
+if env['WITH_BF_FHS']:
+	BLENDERPATH = os.path.join(env['BF_INSTALLDIR'], 'share', 'blender', env['BF_VERSION'])
+else:
+	BLENDERPATH = env['BF_INSTALLDIR']
+
 # disable elbeem (fluidsim) compilation?
 if env['BF_NO_ELBEEM'] == 1:
 	env['CPPFLAGS'].append('-DDISABLE_ELBEEM')
@@ -198,7 +207,7 @@
 				env['CPPFLAGS'].append('/openmp')
 				env['CXXFLAGS'].append('/openmp')
 		else:
-			if env['CC'][-3:] == 'icc': # to be able to handle CC=/opt/bla/icc case
+			if env['CC'].endswith('icc'): # to be able to handle CC=/opt/bla/icc case
 				env.Append(LINKFLAGS=['-openmp', '-static-intel'])
 				env['CCFLAGS'].append('-openmp')
 				env['CPPFLAGS'].append('-openmp')
@@ -301,7 +310,7 @@
 
 # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
 B.root_build_dir = env['BF_BUILDDIR']
-B.doc_build_dir = env['BF_DOCDIR']
+B.doc_build_dir = os.path.join(BLENDERPATH, 'doc')
 if not B.root_build_dir[-1]==os.sep:
 	B.root_build_dir += os.sep
 if not B.doc_build_dir[-1]==os.sep:
@@ -426,7 +435,10 @@
 			source=[dp+os.sep+f for f in df]
 			blenderinstall.append(env.Install(dir=dir,source=source))
 else:
-	blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list)
+	if env['WITH_BF_FHS']:	dir= os.path.join(env['BF_INSTALLDIR'], 'bin')
+	else:					dir= env['BF_INSTALLDIR']
+	
+	blenderinstall = env.Install(dir=dir, source=B.program_list)
 
 #-- .blender
 #- dont do .blender and scripts for darwin, it is already in the bundle
@@ -450,7 +462,13 @@
 						continue
 				
 				dotblendlist.append(os.path.join(dp, f))
-				dottargetlist.append(env['BF_INSTALLDIR']+dp[3:]+os.sep+f)
+				if env['WITH_BF_FHS']:	dir= os.path.join(*([BLENDERPATH] + dp.split(os.sep)[2:]))	# skip bin/.blender
+				else:					dir= os.path.join(*([BLENDERPATH] + dp.split(os.sep)[1:]))	# skip bin
+				
+				# print dir+ os.sep + f
+				print dir
+				dottargetlist.append(dir + os.sep + f)
+					
 
 		dotblenderinstall = []
 		for targetdir,srcfile in zip(dottargetlist, dotblendlist):
@@ -464,8 +482,12 @@
 				for dp, dn, df in os.walk(scriptpath):
 					if '.svn' in dn:
 						dn.remove('.svn')
-					dir=env['BF_INSTALLDIR']+'/.blender/'+os.path.basename(scriptpath)+dp[len(scriptpath):]
-					source=[dp+os.sep+f for f in df]
+					
+					if env['WITH_BF_FHS']:		dir = BLENDERPATH
+					else:						dir = os.path.join(env['BF_INSTALLDIR'], '.blender')				
+					dir += os.sep + os.path.basename(scriptpath) + dp[len(scriptpath):]
+					
+					source=[os.path.join(dp, f) for f in df]
 					scriptinstall.append(env.Install(dir=dir,source=source))
 
 #-- icons
@@ -477,8 +499,8 @@
 		if '.svn' in tn:
 			tn.remove('.svn')
 		for f in tf:
-			iconlist.append(tp+os.sep+f)
-			icontargetlist.append(env['BF_INSTALLDIR']+tp[19:]+os.sep+f)
+			iconlist.append(os.path.join(tp, f))
+			icontargetlist.append( os.path.join(*([BLENDERPATH] + tp.split(os.sep)[2:] + [f])) )
 
 	iconinstall = []
 	for targetdir,srcfile in zip(icontargetlist, iconlist):
@@ -499,24 +521,25 @@
 	if '.svn' in tn:
 		tn.remove('.svn')
 	for f in tf:
-		pluglist.append(tp+os.sep+f)
-		plugtargetlist.append(env['BF_INSTALLDIR']+tp[7:]+os.sep+f)
+		pluglist.append(os.path.join(tp, f))
+		plugtargetlist.append( os.path.join(*([BLENDERPATH] + tp.split(os.sep)[1:] + [f])) )
 
+
 # header files for plugins
 pluglist.append('source/blender/blenpluginapi/documentation.h')
-plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'documentation.h')
+plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'documentation.h'))
 pluglist.append('source/blender/blenpluginapi/externdef.h')
-plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'externdef.h')
+plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'externdef.h'))
 pluglist.append('source/blender/blenpluginapi/floatpatch.h')
-plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'floatpatch.h')
+plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'floatpatch.h'))
 pluglist.append('source/blender/blenpluginapi/iff.h')
-plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'iff.h')
+plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'iff.h'))
 pluglist.append('source/blender/blenpluginapi/plugin.h')
-plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'plugin.h')
+plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'plugin.h'))
 pluglist.append('source/blender/blenpluginapi/util.h')
-plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep +'util.h')
+plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'util.h'))
 pluglist.append('source/blender/blenpluginapi/plugin.DEF')
-plugtargetlist.append(env['BF_INSTALLDIR'] + os.sep + 'plugins' + os.sep + 'include' + os.sep + 'plugin.def')
+plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'plugin.def'))
 
 plugininstall = []
 for targetdir,srcfile in zip(plugtargetlist, pluglist):
@@ -531,7 +554,7 @@
 	for f in tf:
 		textlist.append(tp+os.sep+f)
 
-textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
+textinstall = env.Install(dir=BLENDERPATH, source=textlist)
 
 if  env['OURPLATFORM']=='darwin':
 		allinstall = [blenderinstall, plugininstall, textinstall]

Modified: trunk/blender/config/darwin-config.py
===================================================================
--- trunk/blender/config/darwin-config.py	2009-09-21 01:32:37 UTC (rev 23383)
+++ trunk/blender/config/darwin-config.py	2009-09-21 03:16:26 UTC (rev 23384)
@@ -274,4 +274,3 @@
 
 BF_BUILDDIR='../build/darwin'
 BF_INSTALLDIR='../install/darwin'
-BF_DOCDIR='../install/doc'

Modified: trunk/blender/config/irix6-config.py
===================================================================
--- trunk/blender/config/irix6-config.py	2009-09-21 01:32:37 UTC (rev 23383)
+++ trunk/blender/config/irix6-config.py	2009-09-21 03:16:26 UTC (rev 23384)
@@ -189,7 +189,6 @@
 
 BF_BUILDDIR = '../build/irix6'
 BF_INSTALLDIR='../install/irix6'
-BF_DOCDIR='../install/doc'
 
 #Link against pthread
 LDIRS = []

Modified: trunk/blender/config/linux2-config.py
===================================================================
--- trunk/blender/config/linux2-config.py	2009-09-21 01:32:37 UTC (rev 23383)
+++ trunk/blender/config/linux2-config.py	2009-09-21 03:16:26 UTC (rev 23384)
@@ -189,9 +189,7 @@
 
 BF_BUILDDIR = '../build/linux2'
 BF_INSTALLDIR='../install/linux2'
-BF_DOCDIR='../install/doc'
 
-
 #Link against pthread
 PLATFORM_LINKFLAGS = ['-pthread']
 

Modified: trunk/blender/config/linuxcross-config.py
===================================================================
--- trunk/blender/config/linuxcross-config.py	2009-09-21 01:32:37 UTC (rev 23383)
+++ trunk/blender/config/linuxcross-config.py	2009-09-21 03:16:26 UTC (rev 23384)
@@ -139,4 +139,3 @@
 
 BF_BUILDDIR = '../build/linuxcross'
 BF_INSTALLDIR='../install/linuxcross'
-BF_DOCDIR='../install/doc'

Modified: trunk/blender/config/openbsd3-config.py
===================================================================
--- trunk/blender/config/openbsd3-config.py	2009-09-21 01:32:37 UTC (rev 23383)
+++ trunk/blender/config/openbsd3-config.py	2009-09-21 03:16:26 UTC (rev 23384)
@@ -151,4 +151,3 @@
 
 BF_BUILDDIR='../build/openbsd3'
 BF_INSTALLDIR='../install/openbsd3'
-BF_DOCDIR='../install/doc'

Modified: trunk/blender/config/sunos5-config.py
===================================================================
--- trunk/blender/config/sunos5-config.py	2009-09-21 01:32:37 UTC (rev 23383)
+++ trunk/blender/config/sunos5-config.py	2009-09-21 03:16:26 UTC (rev 23384)
@@ -165,7 +165,6 @@
 
 BF_BUILDDIR = '../build/sunos5'
 BF_INSTALLDIR='../install/sunos5'
-BF_DOCDIR='../install/doc'
 
 
 PLATFORM_LINKFLAGS = []

Modified: trunk/blender/config/win32-mingw-config.py
===================================================================
--- trunk/blender/config/win32-mingw-config.py	2009-09-21 01:32:37 UTC (rev 23383)
+++ trunk/blender/config/win32-mingw-config.py	2009-09-21 03:16:26 UTC (rev 23384)
@@ -152,4 +152,3 @@
 
 BF_BUILDDIR = '..\\build\\win32-mingw'
 BF_INSTALLDIR='..\\install\\win32-mingw'
-BF_DOCDIR = '..\\install\\doc'

Modified: trunk/blender/config/win32-vc-config.py
===================================================================
--- trunk/blender/config/win32-vc-config.py	2009-09-21 01:32:37 UTC (rev 23383)
+++ trunk/blender/config/win32-vc-config.py	2009-09-21 03:16:26 UTC (rev 23384)
@@ -173,4 +173,3 @@
 
 BF_BUILDDIR = '..\\build\\win32-vc'
 BF_INSTALLDIR='..\\install\\win32-vc'
-BF_DOCDIR='..\\install\\doc'

Modified: trunk/blender/config/win64-vc-config.py
===================================================================
--- trunk/blender/config/win64-vc-config.py	2009-09-21 01:32:37 UTC (rev 23383)
+++ trunk/blender/config/win64-vc-config.py	2009-09-21 03:16:26 UTC (rev 23384)
@@ -192,7 +192,6 @@
 
 BF_BUILDDIR = '..\\build\\blender25-win64-vc'

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list