Kaydet (Commit) 99f7690b authored tarafından Michael Meeks's avatar Michael Meeks

gallery: cleanup makefiles for new gallery naming and translation.

Change-Id: I9ec5192c007df6d0ce15f5e61cb53cf6ea04db08
üst 19276d3d
......@@ -11370,7 +11370,8 @@ for lang in $WITH_LANG; do
fi
done
if test "$vl" != "$lang"; then
AC_MSG_ERROR([invalid language: $lang; supported languages are: $ALL_LANGS])
# if you're reading this - you prolly quoted your languages remove the quotes ...
AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
fi
done
if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
......
......@@ -6,8 +6,9 @@
# 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/.
#
# this should probably be done with more general rules: but how ?
$(eval $(call gb_Gallery_Gallery,sound,extras/source/gallery/sounds,Sounds))
$(eval $(call gb_Gallery_Gallery,sound,extras/source/gallery/sounds))
$(eval $(call gb_Gallery_add_files,sound,\
extras/source/gallery/sounds/apert2.wav \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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/.
*/
[sound]
en-US = "Sounds"
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
# Translated by desktop-translate and ulfex
name = "Sounds"
......@@ -301,6 +301,7 @@ bool includeProject(const OString& rProject) {
"dictionaries",
"editeng",
"extensions",
"extras",
"filter",
"forms",
"formula",
......
......@@ -29,6 +29,7 @@ eval 'exec perl -wS $0 ${1+"$@"}'
my ($prefix, $ext, $key);
my $productname = "LibreOffice";
my $workdir = ".";
my $template_dir;
while ($_ = $ARGV[0], /^-/) {
shift;
......@@ -53,6 +54,14 @@ while ($_ = $ARGV[0], /^-/) {
$ext = $ARGV[0];
shift;
}
if (/^--template-dir/) {
$template_dir = $ARGV[0];
shift;
}
}
if (!defined $template_dir) {
$template_dir = "$workdir/$prefix";
}
# hack for unity section
......@@ -65,8 +74,7 @@ my %templates;
# open input file
unless (open(SOURCE, $ARGV[0])) {
print STDERR "Can't open $ARGV[0] file: $!\n";
return;
die "Can't open $ARGV[0] file: $!\n";
}
# currently read template
......@@ -81,7 +89,7 @@ while (<SOURCE>) {
my %entry;
# For every section in the specified ulf file there should exist
# a template file in $workdir ..
$entry{'outfile'} = "$workdir/$prefix$template.$ext";
$entry{'outfile'} = "$template_dir$template.$ext";
my %translations;
$entry{'translations'} = \%translations;
$templates{$template} = \%entry;
......@@ -115,7 +123,7 @@ foreach $template (keys %templates) {
# open the template file - ignore sections for which no
# templates exist
unless(open(TEMPLATE, $outfile)) {
print STDERR "Warning: No template found for item $_: $outfile: $!\n";
print STDERR "Warning: No template found for item '$template' : '$outfile' : '$_': $!\n";
exit -1;
}
......
......@@ -30,6 +30,8 @@ gb_Gallery__UNO_TYPES := \
offapi \
udkapi
gb_Gallery_TRANSLATE := $(SOLARENV)/bin/desktop-translate.pl
# TODO: this should be in RepositoryExternal.mk, but it would lead to
# duplication. Fix.
gb_Gallery_EXTRA_DEPENCENCIES := \
......@@ -93,15 +95,6 @@ $(call gb_Gallery_get_clean_target,%) :
$(call gb_Gallery_get_workdir,$*) \
)
$(WORKDIR)/Gallery/%.sdv :
touch $@
$(WORKDIR)/Gallery/%.thm :
touch $@
$(WORKDIR)/Gallery/%.sdg :
touch $@
gb_Gallery_get_packagename = Gallery/$(1)
# Create a gallery.
......@@ -115,21 +108,26 @@ $(call gb_Gallery__Gallery_impl,$(1),$(call gb_Gallery_get_packagename,$(1)),$(2
endef
gb_Gallery_basedir = $(patsubst %/,%,$(dir $(SRCDIR)/$(1)))
# gb_Gallery__Gallery_impl gallery package basedir name
define gb_Gallery__Gallery_impl
$(call gb_Package_Package_internal,$(2),$(call gb_Gallery_get_workdir,$(1)))
$(call gb_Package_set_outdir,$(2),$(INSTDIR))
$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).sdg,sg1.sdg)
$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).sdv,sg1.sdv)
$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).thm,sg1.thm)
$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).sdg,$(1).sdg)
$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).sdv,$(1).sdv)
$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).thm,$(1).thm)
$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).str,$(1).str)
# strip URL, without / to help the internal gallery system
$(call gb_Gallery_get_target,$(1)) : GALLERY_BASEDIR := $(patsubst %/,%,$(call gb_Helper_make_url,$(dir $(SRCDIR)/$(3))))
$(call gb_Gallery_get_target,$(1)) : GALLERY_BASEDIR := $(call gb_Helper_make_url,$(call gb_Gallery_basedir,$(3)))
$(call gb_Gallery_get_target,$(1)) : GALLERY_FILES :=
$(call gb_Gallery_get_target,$(1)) : GALLERY_NAME := $(4)
$(call gb_Gallery_get_target,$(1)) : GALLERY_NAME := $(1)
$(call gb_Gallery_get_workdir,$(1))/sg1.sdv \
$(call gb_Gallery_get_workdir,$(1))/sg1.thm : $(call gb_Gallery_get_target,$(1))
$(call gb_Gallery_get_workdir,$(1))/$(1).sdg \
$(call gb_Gallery_get_workdir,$(1))/$(1).sdv \
$(call gb_Gallery_get_workdir,$(1))/$(1).thm : $(call gb_Gallery_get_target,$(1))
$(call gb_Gallery__get_final_target,$(1)) : $(call gb_Package_get_target,$(2))
$(call gb_Gallery_get_clean_target,$(1)) : $(call gb_Package_get_clean_target,$(2))
$(call gb_Gallery_get_target,$(1)) :| $(dir $(call gb_Gallery_get_target,$(1))).dir \
......@@ -138,6 +136,31 @@ $(call gb_Gallery_get_target,$(1)) :| $(dir $(call gb_Gallery_get_target,$(1))).
$$(eval $$(call gb_Module_register_target,$(call gb_Gallery__get_final_target,$(1)),$(call gb_Gallery_get_clean_target,$(1))))
$(call gb_Helper_make_userfriendly_targets,$(1),Gallery,$(call gb_Gallery__get_final_target,$(1)))
# this should probably be done with more general rules: but how ?
ifneq ($(WITH_LANG),)
$$(call gb_Gallery_get_workdir,$(1))/$(1).ulf : \
$$(call gb_Gallery_basedir,$(3))/share/gallery_names.ulf | $$(call gb_Executable_get_runtime_dependencies,ulfex) \
$(call gb_Gallery_get_target,$(1)) # that rule pre-cleans our output directory
$$(call gb_Output_announce,$@,$(true),SUM,1)
MERGEINPUT=`$(gb_MKTEMP)` && \
echo $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $(3))).po) > $$$${MERGEINPUT} && \
$(call gb_Helper_abbreviate_dirs,\
$$(call gb_Executable_get_command,ulfex) -i $$< -o $$@ -m $$$${MERGEINPUT} -l all ) && \
rm -rf $$$${MERGEINPUT}
else
$$(call gb_Gallery_get_workdir,$(1))/$(1).ulf : $$(call gb_Gallery_basedir,$(3))/share/gallery_names.ulf
cp $< $@
endif
$(call gb_Gallery_get_workdir,$(1))/$(1).str : $(gb_Gallery_TRANSLATE) \
$$(call gb_Gallery_get_workdir,$(1))/$(1).ulf
cp -f $(SRCDIR)/$(3)/$(1).str $(call gb_Gallery_get_workdir,$(1))/$(1).str && \
$(PERL) $(gb_Gallery_TRANSLATE) -d $(WORKDIR)/$* \
--ext "str" --key "name" \
--template-dir $$(call gb_Gallery_get_workdir,$(1))/ \
$$(call gb_Gallery_get_workdir,$(1))/$(1).ulf
endef
# Add a file to the gallery.
......
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