View Issue Details

IDProjectCategoryView StatusLast Update
0013486ScribusBuild Systempublic2016-02-17 09:32
Reporteruser5122Assigned Tocbradney  
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status closedResolutionwon't fix 
Summary0013486: Add a build option to run Scribus from source/build directory
DescriptionDuring development, one does not generally want to install Scribus into system paths, so being able to run it from build directory is desired. But currently Scribus fails because it can’t load any icons, so the attched patch does the following:
* Add and cmake option, WANT_RUN_WITHOUT_INSTALL
* When this option is TRUE, it sets SHAREDIR, ICONDIR, TEMPLATEDIR, and PLUGINDIR to points to either source or build directory as appropriate.
* Moves the *.xml files of the icon set to the top dir so that the current icon loading code can find them.
* Modifies the plugins loading code so that it does not require all the plugins to be in a flat directory, this is not bullet proof and it currently fails on loading gettext plugins. I can drop this part as I don’t mind running without any plugins (unless they are really needed, I don’t know).
* Removes a misleading warning in icon loading code that is currently triggered for any icon missing from the 1_5_1 set even though it will be successfully loaded from the 1_5_0 set as a fallback. There is a warning in place already in case the fallback failed.
TagsHOST-Oman
PatchYes

Activities

user5122

2015-11-01 10:25

 

run_from_source.diff (6,504 bytes)   
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 20509)
+++ CMakeLists.txt	(working copy)
@@ -255,6 +255,9 @@
 ELSE(WANT_VERSIONING)
 	SET(SHAREDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}/")
 ENDIF(WANT_VERSIONING)
+IF(WANT_RUN_WITHOUT_INSTALL)
+	SET(SHAREDIR "${CMAKE_SOURCE_DIR}/resources/")
+ENDIF(WANT_RUN_WITHOUT_INSTALL)
 IF(NOT IS_ABSOLUTE ${SHAREDIR})
 	ADD_DEFINITIONS("-DSHAREDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SHAREDIR}\\\"")
 ELSE()
@@ -287,6 +290,9 @@
 ELSE(WIN32)
 	SET(ICONDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}${TAG_VERSION}/icons/")
 ENDIF(WIN32)
+IF(WANT_RUN_WITHOUT_INSTALL)
+	SET(ICONDIR "${SHAREDIR}/iconsets/")
+ENDIF(WANT_RUN_WITHOUT_INSTALL)
 IF(NOT IS_ABSOLUTE ${ICONDIR})
 	ADD_DEFINITIONS("-DICONDIR=\\\"${CMAKE_INSTALL_PREFIX}/${ICONDIR}\\\"")
 ELSE()
@@ -315,6 +321,9 @@
 ELSE(WIN32)
 	SET(TEMPLATEDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}${TAG_VERSION}/templates/")
 ENDIF(WIN32)
+IF(WANT_RUN_WITHOUT_INSTALL)
+	SET(TEMPLATEDIR "${SHAREDIR}/templates/")
+ENDIF(WANT_RUN_WITHOUT_INSTALL)
 IF(NOT IS_ABSOLUTE ${TEMPLATEDIR})
 	ADD_DEFINITIONS("-DTEMPLATEDIR=\\\"${CMAKE_INSTALL_PREFIX}/${TEMPLATEDIR}\\\"")
 ELSE()
@@ -380,7 +389,14 @@
 		SET(PLUGINDIR "${LIB_DIR_NAME}/${MAIN_DIR_NAME}${TAG_VERSION}/plugins/")
 	ENDIF (APPLEBUNDLE)
 ENDIF(WIN32)
-ADD_DEFINITIONS("-DPLUGINDIR=\\\"${CMAKE_INSTALL_PREFIX}/${PLUGINDIR}\\\"")
+IF(WANT_RUN_WITHOUT_INSTALL)
+	SET(PLUGINDIR "${CMAKE_BINARY_DIR}/scribus/plugins")
+ENDIF(WANT_RUN_WITHOUT_INSTALL)
+IF(NOT IS_ABSOLUTE ${PLUGINDIR})
+	ADD_DEFINITIONS("-DPLUGINDIR=\\\"${CMAKE_INSTALL_PREFIX}/${PLUGINDIR}\\\"")
+ELSE()
+	ADD_DEFINITIONS("-DPLUGINDIR=\\\"${PLUGINDIR}\\\"")
+ENDIF()
 
 
 #INCLUDE
Index: resources/iconsets/1_5_0/1_5_0.xml
===================================================================
--- resources/iconsets/1_5_0/1_5_0.xml	(revision 20509)
+++ resources/iconsets/1_5_0/1_5_0.xml	(nonexistent)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf8"?>
-<iconset>
-	<author>Various</author>
-	<license>GPLv2+</license>
-	<path>1_5_0</path>
-	<activeversion>1.5.0</activeversion>
-	<nametext lang="en_US">Scribus 1.5.0</nametext> 
-	<nametext lang="fr">Scribus 1.5.0</nametext> 
-	<nametext lang="de_DE">Scribus 1.5.0</nametext>
-</iconset>

Property changes on: resources/iconsets/1_5_0/1_5_0.xml
___________________________________________________________________
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
Index: resources/iconsets/1_5_0.xml
===================================================================
Index: resources/iconsets/1_5_1/1_5_1.xml
===================================================================
--- resources/iconsets/1_5_1/1_5_1.xml	(revision 20509)
+++ resources/iconsets/1_5_1/1_5_1.xml	(nonexistent)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf8"?>
-<iconset>
-	<author>Dezso Markon</author>
-	<license>GPLv2+</license>
-	<path>1_5_1</path>
-	<activeversion>1.5.1</activeversion>
-	<nametext lang="en_US">Scribus 1.5.1</nametext>
-	<nametext lang="fr">Scribus 1.5.1</nametext>
-	<nametext lang="de_DE">Scribus 1.5.1</nametext>
-</iconset>

Property changes on: resources/iconsets/1_5_1/1_5_1.xml
___________________________________________________________________
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
Index: resources/iconsets/1_5_1.xml
===================================================================
Index: resources/iconsets/CMakeLists.txt
===================================================================
--- resources/iconsets/CMakeLists.txt	(revision 20509)
+++ resources/iconsets/CMakeLists.txt	(working copy)
@@ -32,7 +32,7 @@
 INSTALL(FILES ${SCRIBUS_ICONS_1_5_0_STYLE} DESTINATION ${ICONDIR}/1_5_0/stylesheet)
 
 #Install our XML
-FILE( GLOB SCRIBUS_XML_1_5_0 1_5_0/*.xml )
+FILE( GLOB SCRIBUS_XML_1_5_0 1_5_0.xml )
 INSTALL(FILES ${SCRIBUS_XML_1_5_0} DESTINATION ${ICONDIR})
 
 
@@ -64,7 +64,7 @@
 INSTALL(FILES ${SCRIBUS_ICONS_1_5_1_STYLE} DESTINATION ${ICONDIR}/1_5_1/stylesheet)
 
 #Install our XML
-FILE( GLOB SCRIBUS_XML_1_5_1 1_5_1/*.xml )
+FILE( GLOB SCRIBUS_XML_1_5_1 1_5_1.xml )
 INSTALL(FILES ${SCRIBUS_XML_1_5_1} DESTINATION ${ICONDIR})
 
 
Index: scribus/iconmanager.cpp
===================================================================
--- scribus/iconmanager.cpp	(revision 20509)
+++ scribus/iconmanager.cpp	(working copy)
@@ -273,7 +273,6 @@
 	if (QFile::exists(iconFilePath))
 		return iconFilePath;
 
-	qWarning("pathForIcon: Unable to load icon %s: File not found", iconFilePath.toLatin1().constData());
 	iconFilePath=QString("%1%2%3").arg(ScPaths::instance().iconDir()).arg(primaryIconSubdir).arg(nam);
 
 	if (QFile::exists(iconFilePath))
Index: scribus/pluginmanager.cpp
===================================================================
--- scribus/pluginmanager.cpp	(revision 20509)
+++ scribus/pluginmanager.cpp	(working copy)
@@ -9,6 +9,7 @@
 #include "loadsaveplugin.h"
 
 #include <QDir>
+#include <QDirIterator>
 #include <QEvent>
 #include <QMessageBox>
 
@@ -146,7 +147,7 @@
 int PluginManager::initPlugin(const QString fileName)
 {
 	PluginData pda;
-	pda.pluginFile = QString("%1/%2").arg(ScPaths::instance().pluginDir()).arg(fileName);
+	pda.pluginFile = fileName;
 	pda.pluginName = getPluginName(pda.pluginFile);
 	if (pda.pluginName.isNull())
 		// Couldn't determine plugname from filename. We've already complained, so
@@ -186,17 +187,32 @@
 				 libPattern, QDir::Name | QDir::Reversed,
 				 (QDir::Filter) PluginManager::platformDllSearchFlags());
 
-	if ((!dirList.exists()) || (dirList.count() == 0))
+	if (!dirList.exists())
 		return;
 	for (uint dc = 0; dc < dirList.count(); ++dc)
 	{
-		int res = initPlugin(dirList[dc]);
-		allPlugs[dirList[dc]] = res;
+		QString fileName = QString("%1/%2").arg(ScPaths::instance().pluginDir()).arg(dirList[dc]);
+		int res = initPlugin(fileName);
+		allPlugs[fileName] = res;
 		if (res != 0)
 			++loaded;
 		else
 			failedPlugs.append(dirList[dc]);
 	}
+
+	if (loaded == 0) {
+		QDirIterator dirit(dirList, QDirIterator::Subdirectories);
+		while (dirit.hasNext())
+		{
+			int res = initPlugin(dirit.next());
+			allPlugs[dirit.next()] = res;
+			if (res != 0)
+				++loaded;
+			else
+				failedPlugs.append(dirit.fileName());
+		}
+	}
+
 	/* Re-try the failed plugins again and again until it promote
 	any progress (changes variable is changing ;)) */
 	QMap<QString,int>::Iterator it;
run_from_source.diff (6,504 bytes)   

cbradney

2015-11-01 11:04

administrator   ~0037143

The reason for your patch is this "During development, one does not generally want to install Scribus into system paths".

The better answer to your patch is to use -DCMAKE_INSTALL_PREFIX:PATH=/some/path/a/user/can/write to.. eh /home/username/scribusinstall.

On my Mac, my cmake command (script) is:
cmake -DQT_PREFIX="/Users/craig/Qt/5.5/clang_64" \
    -DWANT_HUNSPELL=1 -DWANT_NOHEADERINSTALL=1 -DWANT_NOEXAMPLES=1 \
    -DWANT_NOTEMPLATES=1 -DWANT_GRAPHICSMAGICK=1 -DCMAKE_OSX_ARCHITECTURES="x86_64" -DBUILD_OSX_BUNDLE=1 \
    -DWANT_NOOSG=1 -DWANT_UNIVERSAL_BUNDLE=0 -DWANT_DEBUG=1 \
    -DWANT_SVNVERSION=1 \
    -DCMAKE_INSTALL_PREFIX:PATH=/Users/craig/Applications/Scribus.app/ ../trunkqt5/Scribus/

In that way you keep source separate and you can install and run from your home directory, without modifying system files.

user5122

2015-11-02 09:16

  ~0037147

The idea is to skip the installation step altogether, like most open source projects out there. That is simpler and faster, I’d had prefer to make this the default and not even require a separate cmake switch, but one step at a time.

cbradney

2015-11-02 09:19

administrator   ~0037148

There's too many possibilities for error with using whats in the build directory so we stopped supporting in build dir running years ago. Reduce your language file creation with -DWANT_GUI_LANG="en_GB;de;ru" or similar as you need to reduce the build time.

ale

2016-02-17 09:32

manager   ~0038806

personally, i would welcome being able to run scribus from the build directory...

make install is a bit slow in some cases... and manually copying the modified file(s) is a bit annoying...

Issue History

Date Modified Username Field Change
2015-11-01 10:25 user5122 New Issue
2015-11-01 10:25 user5122 File Added: run_from_source.diff
2015-11-01 10:26 user5122 Tag Attached: HOST-Oman
2015-11-01 11:04 cbradney Note Added: 0037143
2015-11-02 09:16 user5122 Note Added: 0037147
2015-11-02 09:19 cbradney Note Added: 0037148
2015-11-02 09:19 cbradney Status new => resolved
2015-11-02 09:19 cbradney Resolution open => won't fix
2015-11-02 09:19 cbradney Assigned To => cbradney
2016-02-13 19:51 cbradney Status resolved => closed
2016-02-17 09:32 ale Note Added: 0038806