diff options
author | Michael Meeks <michael.meeks@suse.com> | 2013-05-07 16:05:48 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-05-15 09:37:37 +0100 |
commit | 2941e5b354080a8e744676d88ad2849306c3d229 (patch) | |
tree | e78e997bf389db6c323e7f062d10f4087dedeea4 | |
parent | 4a816a816e8b4e213394898bd0e307dd90fcbb64 (diff) |
start of dynamic gallery building.
Change-Id: I488def80e855624ffd85a0b6c4cc19819c39ed01
-rw-r--r-- | extras/Gallery_test.mk | 18 | ||||
-rw-r--r-- | extras/Module_extras.mk | 1 | ||||
-rw-r--r-- | solenv/gbuild/Gallery.mk | 111 | ||||
-rw-r--r-- | solenv/gbuild/TargetLocations.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/gbuild.help.txt | 1 | ||||
-rw-r--r-- | solenv/gbuild/gbuild.mk | 1 | ||||
-rw-r--r-- | svx/source/gengal/gengal.cxx | 61 | ||||
-rwxr-xr-x[-rw-r--r--] | svx/source/gengal/gengal.sh | 0 |
8 files changed, 170 insertions, 25 deletions
diff --git a/extras/Gallery_test.mk b/extras/Gallery_test.mk new file mode 100644 index 000000000000..c82d03cc1f0c --- /dev/null +++ b/extras/Gallery_test.mk @@ -0,0 +1,18 @@ +# -*- 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: diff --git a/extras/Module_extras.mk b/extras/Module_extras.mk index 4103f66cf724..0250afee3220 100644 --- a/extras/Module_extras.mk +++ b/extras/Module_extras.mk @@ -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 \ diff --git a/solenv/gbuild/Gallery.mk b/solenv/gbuild/Gallery.mk new file mode 100644 index 000000000000..58477bf968fd --- /dev/null +++ b/solenv/gbuild/Gallery.mk @@ -0,0 +1,111 @@ +.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 diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index ff0ae8ff321c..5497d57f7f7c 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -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 \ diff --git a/solenv/gbuild/gbuild.help.txt b/solenv/gbuild/gbuild.help.txt index 730b34eb5433..8830b694776e 100644 --- a/solenv/gbuild/gbuild.help.txt +++ b/solenv/gbuild/gbuild.help.txt @@ -62,6 +62,7 @@ AVAILABLE TARGETS o Extension o ExternalPackage o ExternalProject + o Gallery o Helper o InstallModule o InstallScript diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk index a72591a788a8..866434d7e4d8 100644 --- a/solenv/gbuild/gbuild.mk +++ b/solenv/gbuild/gbuild.mk @@ -313,6 +313,7 @@ include $(foreach class, \ ExternalPackage \ CustomTarget \ ExternalProject \ + Gallery \ Pagein \ PrecompiledHeaders \ Pyuno \ diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx index 204bbed77c1c..74434a0f78e3 100644 --- a/svx/source/gengal/gengal.cxx +++ b/svx/source/gengal/gengal.cxx @@ -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" ) diff --git a/svx/source/gengal/gengal.sh b/svx/source/gengal/gengal.sh index 0ac61cf819ee..0ac61cf819ee 100644..100755 --- a/svx/source/gengal/gengal.sh +++ b/svx/source/gengal/gengal.sh |