Kaydet (Commit) 2941e5b3 authored tarafından Michael Meeks's avatar Michael Meeks

start of dynamic gallery building.

Change-Id: I488def80e855624ffd85a0b6c4cc19819c39ed01
üst 4a816a81
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_Gallery_Gallery,extras/source/gallery,gallery,Fun Gallery))
$(eval $(call gb_Gallery_add_files,extras/source/gallery, \
extras/source/gallery/bigapple.gif \
extras/source/gallery/sky.gif \
extras/source/gallery/flower.gif \
extras/source/gallery/apples.gif ))
# vim: set noet sw=4 ts=4:
......@@ -13,6 +13,7 @@ $(eval $(call gb_Module_add_targets,extras,\
AllLangPackage_autotextshare \
CustomTarget_autocorr \
CustomTarget_glade \
Gallery_test \
Package_autocorr \
Package_autotextuser \
Package_cfgsrvbitmapunx \
......
.PHONY : $(call gb_Gallery_get_clean_target,%)
$(call gb_Gallery_get_clean_target,%) :
$(call gb_Helper_abbreviate_dirs,\
rm -f $(call gb_Gallery_get_target,$*) $(call gb_Gallery_get_target,$*).log)
.PHONY : $(call gb_Gallery_get_target,%)
$(call gb_Gallery_get_target,%) :| $(call gb_Gallery_get_target,$(1))/$(2).thm
@echo "foo"
define gb_Gallery_Gallery
$(call gb_Gallery_get_target,$(1)) : CONFIGURATION_LAYERS :=
$(call gb_Gallery_get_target,$(1)) : URE := $(false)
$(call gb_Gallery_get_target,$(1)) : UNO_SERVICES :=
$(call gb_Gallery_get_target,$(1)) : UNO_TYPES :=
$(call gb_Gallery_get_target,$(1)) : IMAGE_FILES :=
$(call gb_Gallery_get_target,$(1)) :| $(dir $(call gb_Gallery_get_target,$(1))).dir
$(dir $(call gb_Gallery_get_target,$(1))).dir :
mkdir -p $(dir $(call gb_Gallery_get_target,$(1)))
touch $(dir $(call gb_Gallery_get_target,$(1))).dir
$(eval $(call gb_Module_register_target,$(call gb_Gallery_get_target,$(1)),$(call gb_Gallery_get_clean_target,$(1))))
$(call gb_Helper_make_userfriendly_targets,$(1),Gallery)
$(eval $(call gb_Gallery_use_components,$(1), \
comphelper/util/comphelp \
configmgr/source/configmgr \
fileaccess/source/fileacc \
i18npool/util/i18npool \
package/source/xstor/xstor \
package/util/package2 \
sfx2/util/sfx \
svx/util/svx \
svx/util/svxcore \
ucb/source/core/ucb1 \
ucb/source/ucp/file/ucpfile1 \
unoxml/source/service/unoxml \
))
# setup URE
$(eval $(call gb_Gallery__use_configuration,$(1),xcsxcu,$(gb_Configuration_registry)))
$(eval $(call gb_Gallery__use_configuration,$(1),module,$(gb_Configuration_registry)/spool))
$(eval $(call gb_Gallery__use_configuration,$(1)/,xcsxcu,$(OUTDIR)/unittest/registry))
$(eval $(call gb_Gallery__use_api,$(1),udkapi))
$(eval $(call gb_Gallery__use_api,$(1),offapi))
$(call gb_Gallery_get_target,$(1)) : \
$(call gb_Gallery_get_target,$(1))/$(2).thm
# main gallery build rule
$(call gb_Gallery_get_target,$(1))/$(2).thm : \
$(call gb_Executable_get_runtime_dependencies,gengal)
$(call gb_Output_announce,building gallery: $*,$(true),MOD,1)
$(call gb_Helper_abbreviate_dirs, \
$(call gb_Executable_get_command,gengal) \
$(call gb_Gallery_make_args) \
--name "$(3)" \
--path $(call gb_Gallery_get_target,$(1))) \
$(foreach item,$(IMAGE_FILES),$(item)) && \
mv -f $(call gb_Gallery_get_target,$(1))/001.thm $(call gb_Gallery_get_target,$(1))/$(2).thm
endef
# horrendous cut/paste from CppunitTest
define gb_Gallery_use_component
$(call gb_Gallery_get_target,$(1)) : \
$(call gb_ComponentTarget_get_outdir_target,$(2))
$(call gb_Gallery_get_target,$(1)) : \
UNO_SERVICES += $(call gb_ComponentTarget_get_outdir_target,$(2))
endef
define gb_Gallery__use_api
$(call gb_Gallery_get_target,$(1)) : $(call gb_UnoApi_get_target,$(2))
$(call gb_Gallery_get_target,$(1)) : UNO_TYPES += $(call gb_UnoApi_get_target,$(2))
endef
define gb_Gallery__use_configuration
$(call gb_Gallery_get_target,$(1)) : CONFIGURATION_LAYERS += $(2):$(call gb_Helper_make_url,$(3))
endef
define gb_Gallery_use_components
$(foreach component,$(call gb_CppunitTest__filter_not_built_components,$(2)),$(call gb_Gallery_use_component,$(1),$(component)))
endef
define gb_Gallery_make_args
--build-tree \
$(if $(strip $(UNO_SERVICES)),\
"-env:UNO_SERVICES=$(foreach item,$(UNO_SERVICES),$(call gb_Helper_make_url,$(item)))") \
$(if $(strip $(CONFIGURATION_LAYERS)),\
"-env:CONFIGURATION_LAYERS=$(strip $(CONFIGURATION_LAYERS))") \
$(if $(strip $(UNO_TYPES)),\
"-env:UNO_TYPES=$(foreach item,$(UNO_TYPES),$(call gb_Helper_make_url,$(item)))") \
$(foreach dir,URE_INTERNAL_LIB_DIR LO_LIB_DIR,\
-env:$(dir)=$(call gb_Helper_make_url,$(gb_Helper_OUTDIRLIBDIR)))
endef
define gb_Gallery_add_file
$(call gb_Gallery_get_target,$(1)) : IMAGE_FILES += $(call gb_Helper_make_url,$(2))
endef
define gb_Gallery_add_files
$(foreach fname,$(2),$(call gb_Gallery__add_file,$(1),$(fname)))
endef
......@@ -118,6 +118,7 @@ gb_ExternalProject_get_statedir = $(WORKDIR)/ExternalProject/$(1)
gb_ExternalProject_get_preparation_target = $(WORKDIR)/ExternalProject/$(1).prepare
gb_ExternalProject_get_state_target = $(WORKDIR)/ExternalProject/$(1)/$(2)
gb_ExternalProject_get_target = $(WORKDIR)/ExternalProject/$(1).done
gb_Gallery_get_target = $(WORKDIR)/Gallery/$(1).done
gb_GeneratedPackage_get_target = $(WORKDIR)/GeneratedPackage/$(1).filelist
gb_HelpIndexTarget_get_target = $(WORKDIR)/HelpIndexTarget/$(1).done
gb_HelpJarTarget_get_target = $(WORKDIR)/HelpJarTarget/$(1).done
......@@ -272,6 +273,7 @@ $(eval $(call gb_Helper_make_clean_targets,\
Dictionary \
ExternalPackage \
ExtensionTarget \
Gallery \
GeneratedPackage \
HelpTarget \
HelpIndexTarget \
......
......@@ -62,6 +62,7 @@ AVAILABLE TARGETS
o Extension
o ExternalPackage
o ExternalProject
o Gallery
o Helper
o InstallModule
o InstallScript
......
......@@ -313,6 +313,7 @@ include $(foreach class, \
ExternalPackage \
CustomTarget \
ExternalProject \
Gallery \
Pagein \
PrecompiledHeaders \
Pyuno \
......
......@@ -41,7 +41,9 @@ typedef ::std::list<OUString> FileNameList;
class GalApp : public Application
{
bool mbInBuildTree;
public:
GalApp() : mbInBuildTree( false ) {}
virtual int Main();
protected:
......@@ -141,6 +143,7 @@ static int PrintHelp()
fprintf( stdout, "\t\t\ttheme files.\n");
fprintf( stdout, " files\t\t\tlists files to be added to the gallery. Absolute paths\n");
fprintf( stdout, "\t\t\tare required.\n");
// --build-tree not documented - only useful during the build ...
return EXIT_SUCCESS;
}
......@@ -154,37 +157,43 @@ static OUString Smartify( const OUString &rPath )
void GalApp::Init()
{
if( getenv( "OOO_INSTALL_PREFIX" ) == NULL ) {
OUString fileName = GetAppFileName();
int lastSlash = fileName.lastIndexOf( '/' );
try {
if( !mbInBuildTree && getenv( "OOO_INSTALL_PREFIX" ) == NULL ) {
OUString fileName = GetAppFileName();
int lastSlash = fileName.lastIndexOf( '/' );
#ifdef WNT
// Don't know which directory separators GetAppFileName() returns on Windows.
// Be safe and take into consideration they might be backslashes.
if( fileName.lastIndexOf( '\\' ) > lastSlash )
lastSlash = fileName.lastIndexOf( '\\' );
if( fileName.lastIndexOf( '\\' ) > lastSlash )
lastSlash = fileName.lastIndexOf( '\\' );
#endif
OUString baseBinDir = fileName.copy( 0, lastSlash );
OUString installPrefix = baseBinDir + OUString::createFromAscii( "/../.." );
OUString envVar( "OOO_INSTALL_PREFIX");
osl_setEnvironment(envVar.pData, installPrefix.pData);
}
OSL_TRACE( "OOO_INSTALL_PREFIX=%s", getenv( "OOO_INSTALL_PREFIX" ) );
uno::Reference<uno::XComponentContext> xComponentContext
= ::cppu::defaultBootstrap_InitialComponentContext();
xMSF = uno::Reference<lang::XMultiServiceFactory>
( xComponentContext->getServiceManager(), uno::UNO_QUERY );
if( !xMSF.is() )
{
fprintf( stderr, "Failed to bootstrap\n" );
OUString baseBinDir = fileName.copy( 0, lastSlash );
OUString installPrefix = baseBinDir + OUString::createFromAscii( "/../.." );
OUString envVar( "OOO_INSTALL_PREFIX");
osl_setEnvironment(envVar.pData, installPrefix.pData);
}
OSL_TRACE( "OOO_INSTALL_PREFIX=%s", getenv( "OOO_INSTALL_PREFIX" ) );
uno::Reference<uno::XComponentContext> xComponentContext
= ::cppu::defaultBootstrap_InitialComponentContext();
xMSF = uno::Reference<lang::XMultiServiceFactory>
( xComponentContext->getServiceManager(), uno::UNO_QUERY );
if( !xMSF.is() )
{
fprintf( stderr, "Failed to bootstrap\n" );
exit( 1 );
}
::comphelper::setProcessServiceFactory( xMSF );
// For backwards compatibility, in case some code still uses plain
// createInstance w/o args directly to obtain an instance:
com::sun::star::ucb::UniversalContentBroker::create(xComponentContext);
} catch (const uno::Exception &e) {
fprintf( stderr, "Bootstrap exception '%s'\n",
rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
exit( 1 );
}
::comphelper::setProcessServiceFactory( xMSF );
// For backwards compatibility, in case some code still uses plain
// createInstance w/o args directly to obtain an instance:
com::sun::star::ucb::UniversalContentBroker::create(xComponentContext);
}
int GalApp::Main()
......@@ -202,6 +211,8 @@ int GalApp::Main()
continue;
else if ( aParam == "--help" || aParam == "-h" )
return PrintHelp();
else if ( aParam == "--build-tree" )
mbInBuildTree = true;
else if ( aParam == "--name" )
aName = GetCommandLineParam( ++i );
else if ( aParam == "--path" )
......
File mode changed from 100644 to 100755
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment