Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/creator')
-rw-r--r--source/creator/CMakeLists.txt31
-rw-r--r--source/creator/SConscript5
-rw-r--r--source/creator/creator.c24
3 files changed, 60 insertions, 0 deletions
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 1256881182b..410e0808580 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -66,6 +66,13 @@ IF(NOT WITH_SDL)
ADD_DEFINITIONS(-DDISABLE_SDL)
ENDIF(NOT WITH_SDL)
+IF(UNIX AND NOT APPLE)
+ SET(BLENDERPATH ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION})
+ CMAKE_POLICY(SET CMP0005 NEW)
+ # blender_path in creator.c
+ ADD_DEFINITIONS(-DBLENDERPATH="${BLENDERPATH}")
+ENDIF(UNIX AND NOT APPLE)
+
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
ADD_DEFINITIONS(-DWITH_BINRELOC)
INCLUDE_DIRECTORIES(${BINRELOC_INC})
@@ -96,6 +103,9 @@ IF(WITH_INSTALL)
ENDIF(UNIX)
IF(UNIX AND NOT APPLE)
+
+ # Local installation, "make install" can be done after this optionally
+
ADD_CUSTOM_COMMAND(
TARGET blender POST_BUILD MAIN_DEPENDENCY blender
COMMAND rm -Rf ${TARGETDIR}/.blender
@@ -152,6 +162,27 @@ IF(WITH_INSTALL)
COMMAND find ${TARGETDIR} -name .svn -prune -exec rm -rf {} "\;"
)
+
+ # Above we bundle a portable distrobution in ./bin
+ # This is an optional "make install" which installs blender on the system.
+ INSTALL(
+ PROGRAMS ${TARGETDIR}/blender
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+ )
+
+ IF(WITH_GAMEENGINE AND WITH_PLAYER)
+ INSTALL(
+ PROGRAMS ${TARGETDIR}/blenderplayer
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+ )
+ ENDIF(WITH_GAMEENGINE AND WITH_PLAYER)
+
+ INSTALL(
+ DIRECTORY ${TARGETDIR}/.blender/
+ DESTINATION ${BLENDERPATH}
+ )
+ # end "make install"
+
ENDIF(UNIX AND NOT APPLE)
IF(APPLE)
diff --git a/source/creator/SConscript b/source/creator/SConscript
index 75e7494ebb5..7b3d1493ed2 100644
--- a/source/creator/SConscript
+++ b/source/creator/SConscript
@@ -1,5 +1,6 @@
#!/usr/bin/python
Import ('env')
+import os
sources = 'creator.c'
@@ -32,4 +33,8 @@ if env['WITH_BF_PYTHON']:
else:
defs.append('DISABLE_PYTHON')
+if env['WITH_BF_FHS']: # /usr -> /usr/share/blender/2.5
+ defs.append('BLENDERPATH=\\"' + os.path.join(env['BF_INSTALLDIR'], 'share', 'blender', env['BF_VERSION']) + '\\"')
+
+
env.BlenderLib ( libname = 'bf_creator', sources = Split(sources), includes = Split(incs), defines = defs, libtype='core', priority = 0 )
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 41b27b1c915..523273de9bf 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -116,6 +116,18 @@ extern int pluginapi_force_ref(void); /* from blenpluginapi:pluginapi.c */
char bprogname[FILE_MAXDIR+FILE_MAXFILE]; /* from blenpluginapi:pluginapi.c */
char btempdir[FILE_MAXDIR+FILE_MAXFILE];
+/* unix path support.
+ * defined by the compiler. eg "/usr/share/blender/2.5" "/opt/blender/2.5" */
+#ifndef BLENDERPATH
+#define BLENDERPATH ""
+#endif
+
+#if !(defined(__APPLE__) && defined(WIN32))
+char blender_path[FILE_MAXDIR+FILE_MAXFILE] = BLENDERPATH;
+#else
+char blender_path[FILE_MAXDIR+FILE_MAXFILE] = "";
+#endif
+
/* Initialise callbacks for the modules that need them */
static void setCallbacks(void);
@@ -221,6 +233,12 @@ static void print_help(void)
printf (" \t\t passed unchanged. Access via Python's sys.argv\n");
printf ("\nEnvironment Variables:\n");
printf (" $HOME\t\t\tStore files such as .blender/ .B.blend .Bfs .Blog here.\n");
+#if !(defined(__APPLE__) && defined(WIN32))
+ printf (" $BLENDERPATH\tSystem directory to use for data files and scripts.\n");
+ printf (" \tFor this build of blender the default BLENDERPATH is...\n");
+ printf (" \t\"%s\"\n", blender_path);
+ printf (" \tseting the $BLENDERPATH will override this\n");
+#endif
#ifdef WIN32
printf (" $TEMP\t\tStore temporary files here.\n");
#else
@@ -305,6 +323,12 @@ int main(int argc, char **argv)
BLI_where_am_i(bprogname, argv[0]);
+ { /* override the hard coded blender path */
+ char *blender_path_env = getenv("BLENDERPATH");
+ if(blender_path_env)
+ BLI_strncpy(blender_path, blender_path_env, sizeof(blender_path));
+ }
+
RNA_init();
RE_engines_init();