~ubuntu-branches/ubuntu/vivid/ubuntu-kylin-docs/vivid

« back to all changes in this revision

Viewing changes to html/Makefile

  • Committer: Package Import Robot
  • Author(s): Lei Luo
  • Date: 2014-04-10 14:58:12 UTC
  • Revision ID: package-import@ubuntu.com-20140410145812-9mfgq3xleqy0l89f
Tags: 14.04.3

* Add "Replaces" field in debian control file to automatically remove
  ubuntu-docs before installation.
* Merge ubuntu-docs changes.
* Update zh_CN tranlation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
####################################################################################           
 
2
# Makefile for the GNOME Ubuntu Documentation
 
3
# Copyright (C) 2005-2006 Ubuntu Documentation Project (ubuntu-doc@lists.ubuntu.com)
 
4
#    This program is free software; you can redistribute it and/or modify
 
5
#    it under the terms of the GNU General Public License as published by
 
6
#    the Free Software Foundation; either version 2 of the License, or
 
7
#    (at your option) any later version. 
 
8
#
 
9
#    This program is distributed in the hope that it will be useful,
 
10
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
#    GNU General Public License for more details.
 
13
#
 
14
#    You should have received a copy of the GNU General Public License
 
15
#    along with this program; if not, write to the Free Software
 
16
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
17
#    On Debian based systems a copy of the GPL can be found 
 
18
#    at /usr/share/common-licenses/GPL
 
19
#
 
20
####################################################################################
 
21
 
 
22
MAKECMD=make
 
23
HTMLDESTDIR=build
 
24
SRCDIR=../ubuntu-kylin-help
 
25
SED=/bin/sed
 
26
INSTALLDIR=/var/www/14.04/
 
27
URLFIXER=fix-urls.sed
 
28
 
 
29
# Space-separated list of language codes for documents. HTML will only be
 
30
# built for those codes in the list
 
31
# Ex. HELP_LINGUAS=ja it for Japanese and Italian
 
32
# Note that the corresponding .page files for the locales must have been built
 
33
# for the HTML to be built in turn. This means all the locales for which
 
34
# HTML output is needed will have to have been specified in the main
 
35
# HELP_LINGUAS variable in the ubuntu-kylinkylin-help Makefile
 
36
HELP_LINGUAS = zh_CN
 
37
 
 
38
index_file_exists = $(wildcard $(SRCDIR)/$(lingua)/index.page)
 
39
linguas := $(HELP_LINGUAS)
 
40
help_linguas := \
 
41
    $(foreach lingua, $(linguas), \
 
42
        $(if $(index_file_exists), \
 
43
            $(lingua), \
 
44
            $(warning Cannot find source index page for locale: $(lingua), \
 
45
                skipping. You will probably have to build it adding it to \
 
46
                the HELP_LINGUAS variable in the Makefile at $(SRCDIR) \
 
47
                and rebuild)))
 
48
 
 
49
# Ubuntu Mallard Customization Layer
 
50
UBUNTUXSL=ubuntu.xsl
 
51
 
 
52
# Builds the HTML files for all specified language codes, specifiying the
 
53
# language in the final documents and performing some other necessary
 
54
# text replacements not handled by yelp-build.
 
55
# Language codes are normalized to IETF format, as opposed to glibc format
 
56
ubuntu-kylin-help: clean style
 
57
        for lc in C $(help_linguas); do \
 
58
                lang=`echo $$lc | $(SED) -e 's/[@_]/-/'`; \
 
59
                if test "$$lang" = "C"; then lang=en; fi; \
 
60
                if test "$$lang" = "gl"; then lang=gl-GL; fi; \
 
61
                if test "$$lang" = "ms"; then lang=ms-MS; fi; \
 
62
                if test "$$lang" = "pl"; then lang=pl-PL; fi; \
 
63
                yelp-build html -o "$(HTMLDESTDIR)/$$lang/" -x $(UBUNTUXSL) \
 
64
                        "$(SRCDIR)/$$lc/"; \
 
65
                $(SED) -i \
 
66
                        -e '1s/^/<!DOCTYPE html\>\n/' \
 
67
                        -e "s/<html>/<html lang="$$lang">/" \
 
68
                        -e 's|/usr/share/icons/.*/\(.*\.svg\)|img/\1|'\
 
69
                        "$(HTMLDESTDIR)/$$lang/"*.html; \
 
70
                $(SED) -i -f "$(URLFIXER)" "$(HTMLDESTDIR)/$$lang/"*.html; \
 
71
                echo "\nSearching for yelp help system internal links and either changing them to equivalent or related external links or deleting them:"; \
 
72
                $(SED) -i -e '/help:language-selector/d' "$(HTMLDESTDIR)/$$lang/"session*.html; \
 
73
                grep "href=\"ghelp:" "$(HTMLDESTDIR)/$$lang/"*.html; \
 
74
                rm -rf "$(HTMLDESTDIR)/$$lang/usr"; \
 
75
        done
 
76
 
 
77
clean:
 
78
        rm -rf build
 
79
 
 
80
# Copy style sheet and common images to build directory
 
81
# TODO: copy C/figures to destination only for those cases where there are
 
82
# no localized figures
 
83
style:
 
84
        for lc in C $(help_linguas); do \
 
85
                lang=`echo $$lc | $(SED) -e 's/[@_]/-/'`; \
 
86
                if test "$$lang" = "C"; then lang=en; fi; \
 
87
                if test "$$lang" = "gl"; then lang=gl-GL; fi; \
 
88
                if test "$$lang" = "ms"; then lang=ms-MS; fi; \
 
89
                if test "$$lang" = "pl"; then lang=pl-PL; fi; \
 
90
                mkdir -p "$(HTMLDESTDIR)/$$lang/img"; \
 
91
                mkdir -p "$(HTMLDESTDIR)/$$lang/figures"; \
 
92
                cp img/* "$(HTMLDESTDIR)/$$lang/img"; \
 
93
                cp "$(SRCDIR)/C/figures/"* "$(HTMLDESTDIR)/$$lang/figures"; \
 
94
        done
 
95
 
 
96
# Installs all HTML files to a multilingual site (e.g. run with Apache and
 
97
# MultiViews enabled)
 
98
install:
 
99
        rm -Rf "$(INSTALLDIR)"/*; \
 
100
        cp -R "$(HTMLDESTDIR)/"* "$(INSTALLDIR)"; \
 
101
        for lc in C $(help_linguas); do \
 
102
                lang=`echo $$lc | $(SED) -e 's/[@_]/-/'`; \
 
103
                if test "$$lang" = "C"; then lang=en; fi; \
 
104
                if test "$$lang" = "gl"; then lang=gl-GL; fi; \
 
105
                if test "$$lang" = "ms"; then lang=ms-MS; fi; \
 
106
                if test "$$lang" = "pl"; then lang=pl-PL; fi; \
 
107
                find "$(INSTALLDIR)/$$lang" -type f -exec mv {} {}.$$lang \; ; \
 
108
                cp -af "$(INSTALLDIR)/$$lang"/* "$(INSTALLDIR)"; \
 
109
                rm -Rf "$(INSTALLDIR)/$$lang" ; \
 
110
        done