]> git.donarmstrong.com Git - lilypond.git/blob - website.make
website.make: hardcode languages rather than running untrusted code.
[lilypond.git] / website.make
1 ################################################################
2 # website (without the rest of the docs)
3
4 ################################################################
5 #####  SECURITY -- check these values for lilypond.org #########
6 ################################################################
7 ifeq ($(WEBSITE_ONLY_BUILD),1)
8   ### for lilypond.org
9   TOP_SRC_DIR=$(HOME)/src/lilypond
10   TRUSTED_DIR=$(HOME)/lilypond/trusted-scripts
11   top-src-dir=$(TOP_SRC_DIR)
12   depth=.
13   trusted-dir=$(TRUSTED_DIR)
14   script-dir=$(trusted-dir)
15   texi2html-init-file=$(trusted-dir)/lilypond-texi2html.init
16   top-htaccess=$(trusted-dir)/lilypond.org.htaccess
17   dir-htaccess=$(trusted-dir)/website-dir.htaccess
18   TEXI2HTML_PROGRAM=$(HOME)/usr/bin/texi2html
19   EXAMPLES=$(HOME)/media/ly-examples/
20   PICTURES=$(HOME)/media/pictures
21 else
22   ### for normal git
23   script-dir=$(top-src-dir)/scripts/build/
24   texi2html-init-file=$(top-src-dir)/Documentation/lilypond-texi2html.init
25   top-htaccess=$(top-src-dir)/Documentation/web/server/lilypond.org.htaccess
26   dir-htaccess=$(top-src-dir)/Documentation/web/server/website-dir.htaccess
27   include $(config_make)
28   # I assume this is run from top-build-dir
29   EXAMPLES=Documentation/web/ly-examples/out-www/
30   PICTURES=Documentation/pictures/out-www/
31 endif
32
33
34 ################################################################
35 OUT=out-website
36 #WEB_LANGS=$(shell PYTHONPATH=$(top-src-dir)/python python $(top-src-dir)/python/langdefs.py)
37 WEB_LANGS = fr es de nl ja hu it
38
39 TEXI2HTML=ONLY_WEB=1 TOP_SRC_DIR=$(top-src-dir) DEPTH=$(depth) PERL_UNICODE=SD $(TEXI2HTML_PROGRAM)
40
41 EXTRACT_TEXI_FILENAMES=python $(script-dir)/extract_texi_filenames.py
42 CREATE_VERSION=python $(script-dir)/create-version-itexi.py
43 CREATE_WEBLINKS=python $(script-dir)/create-weblinks-itexi.py
44 MASS_LINK=python $(script-dir)/mass-link.py
45 WEB_POST=python $(script-dir)/website_post.py
46
47 SERVER_FILES=$(top-src-dir)/Documentation/web/server/
48
49 # don't include web
50 MANUALS=$(wildcard $(top-src-dir)/Documentation/*.tely)
51 MANUALS+=$(top-src-dir)/Documentation/contributor.texi
52
53 website-test:
54         echo $(TEXI2HTML)
55
56 website-version:
57         mkdir -p $(OUT)
58         $(CREATE_VERSION) $(top-src-dir) > $(OUT)/version.itexi
59         $(CREATE_WEBLINKS) $(top-src-dir) > $(OUT)/weblinks.itexi
60
61 website-xrefs: website-version
62         $(EXTRACT_TEXI_FILENAMES) -I $(top-src-dir)/Documentation/ \
63                 -I $(OUT) -o $(OUT) --split=node \
64                 $(top-src-dir)/Documentation/web.texi
65         # normal manuals
66         for m in $(MANUALS); do \
67                 b=`basename "$$m" .texi`; \
68                 d=`basename "$$b" .tely`; \
69                 $(EXTRACT_TEXI_FILENAMES) \
70                         -I $(top-src-dir)/Documentation/ \
71                         -I $(top-src-dir)/Documentation/"$$d"/ \
72                         -I $(OUT) -o $(OUT) "$$m" ; \
73         done
74         # translations
75         for l in $(WEB_LANGS); do \
76                 $(EXTRACT_TEXI_FILENAMES) \
77                         -I $(top-src-dir)/Documentation/ \
78                         -I $(top-src-dir)/Documentation/"$$l" \
79                         -I $(OUT) -o $(OUT) --split=node \
80                         $(top-src-dir)/Documentation/"$$l"/web.texi ;\
81                 for m in $(MANUALS); do \
82                         n=`echo "$$m" | sed 's/Documentation/Documentation\/'$$l'/'` ; \
83                         b=`basename "$$n" .texi`; \
84                         d=`basename "$$b" .tely`; \
85                         if [ -e "$$n" ] ; then \
86                                 $(EXTRACT_TEXI_FILENAMES) \
87                                 -I $(top-src-dir)/Documentation/ \
88                                 -I $(top-src-dir)/Documentation/"$$l" \
89                                 -I $(top-src-dir)/Documentation/"$$l"/"$$d"/ \
90                                 -I $(OUT) -o $(OUT) "$$n" ; \
91                         fi ; \
92                 done; \
93         done;
94
95
96
97 website-texinfo: website-version website-xrefs
98         $(TEXI2HTML) --prefix=index \
99                 --split=section \
100                 --I=$(top-src-dir)/Documentation/ \
101                 --I=$(OUT) \
102                 --init-file=$(texi2html-init-file) \
103                 -D web_version \
104                 --output=$(OUT)/website/ \
105                 $(top-src-dir)/Documentation/web.texi
106         # translations
107         for l in $(WEB_LANGS); do \
108                 $(TEXI2HTML) --prefix=index \
109                         --split=section \
110                         --I=$(top-src-dir)/Documentation/"$$l" \
111                         --I=$(top-src-dir)/Documentation/ \
112                         --I=$(OUT) \
113                         --lang="$$l" \
114                         --init-file=$(texi2html-init-file) \
115                         -D web_version \
116                         --output=$(OUT)/"$$l" \
117                         $(top-src-dir)/Documentation/"$$l"/web.texi ; \
118                 find $(OUT)/$$l/ -name '*.html' | xargs grep -L 'UNTRANSLATED NODE: IGNORE ME' | sed 's!$(OUT)/'$$l'/!!g' | xargs $(MASS_LINK) --prepend-suffix .$$l hard $(OUT)/$$l/ $(OUT)/website/ ; \
119         done
120
121
122 website-css:
123         cp $(top-src-dir)/Documentation/css/*.css $(OUT)/website/
124
125 website-pictures:
126         mkdir -p $(OUT)/website/pictures/
127         cp $(PICTURES)/* $(OUT)/website/pictures/
128         ln -sf website/pictures $(OUT)/pictures
129
130 website-examples:
131         mkdir -p $(OUT)/website/ly-examples
132         cp $(EXAMPLES)/* $(OUT)/website/ly-examples
133
134 web-post:
135         $(WEB_POST) $(OUT)/website/
136
137 website: website-texinfo website-css website-pictures website-examples web-post
138         cp $(SERVER_FILES)/favicon.ico $(OUT)/website/
139         cp $(SERVER_FILES)/robots.txt $(OUT)/website/
140         cp $(top-htaccess) $(OUT)/.htaccess
141         cp $(dir-htaccess) $(OUT)/website/.htaccess
142
143