Subversion Repositories svn LFS-FR

Rev

Rev 7368 | Rev 7374 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7156 jlepiller 1
#!/usr/bin/make -f
2
 
7371 jlepiller 3
# Use make L=... to build only a subset of the languages.
7156 jlepiller 4
 
7371 jlepiller 5
LANGUAGES := fr
6
LANG_fr := fr_FR.UTF-8
7
L = all
7156 jlepiller 8
 
7371 jlepiller 9
# Use config.mk to configure username and password for download and upload
10
include config.mk
11
 
7156 jlepiller 12
ORIGDIR := blfs-en
13
 
7371 jlepiller 14
FR_REPO:=svn://svn.linuxfromscratch.org/fr-lfs
15
EN_REPO:=svn://svn.linuxfromscratch.org/BLFS
16
 
17
RENDERTMP=~/tmp
18
 
19
 
20
# Note for releasing a new stable version:
21
# ----------------------------------------
22
#
23
# When a new stable version is released upstream, this Makefile will automatically
24
# track it, so translate it as usual. Once the stable version is translated,
25
# create a new branch that keeps tracking this release:
26
#
27
#   svn cp http://svn.linuxfromscratch.org/fr-lfs/trunk/blfs \
28
#          http://svn.linuxfromscratch.org/fr-lfs/branches/blfs-$(MILESTONE)
29
#
30
# Once this is done, you can publish the new version by running:
31
#
32
#   make upload
33
#
34
# Then, update the MILESTONE to the next (unreleased) version of LFS in the
35
# development branch and commit.
36
 
37
# What we follow from upstream.
38
MILESTONE := 8.3
39
 
40
# Select the current version we are tracking from master
41
EN_CURR_VER := $(shell svn info $(ORIGDIR) | grep ^URL | sed 's|^[^s]*||')
42
REVISION := $(shell svn info $(ORIGDIR) | grep ^Revision | sed 's|^.* ||')
43
 
44
# If the version we are tracking is released, there should be a tag named $(MILESTONE).
45
# If this tag doesn't exist, it means the version is not released yet. Try to
46
# list files in this tag. If it succeeds, it exists, if it fails it doesn't
47
# exist. From that, choose what tag to follow: $(MILESTONE) or trunk.
48
TAG := $(shell (svn ls svn://svn.linuxfromscratch.org/BLFS/tags/$(MILESTONE) --depth empty >/dev/null 2>&1 && $(MILESTONE)) || echo trunk)
49
 
50
# Depending on what we track, we choose the correct branch from upstream.
51
ifeq ($(TAG), trunk)
52
EN_VER := trunk/BOOK
53
else
54
EN_VER := tags/$(TAG)
55
endif
56
 
57
# Files that are needed for the build process once translations are generated.
7156 jlepiller 58
filestocopy := INSTALL obfuscate.sh README
7371 jlepiller 59
# Additional files that may require some changes.
7156 jlepiller 60
filestoget := $(filestocopy) general.ent gnome.ent packages.ent tidy.conf Makefile
61
 
7371 jlepiller 62
# Use REV=sysv or REV=systemd to only build that version.
63
REV=all
64
 
65
ifeq ($(REV), all)
66
SYSV=1
67
SYSD=1
68
REVS=sysv systemd
69
else
7156 jlepiller 70
ifeq ($(REV), systemd)
7371 jlepiller 71
SYSV=
72
SYSD=1
73
REVS=systemd
74
else
75
SYSV=1
76
SYSD=
77
REVS=sysv
7156 jlepiller 78
endif
7371 jlepiller 79
endif
7156 jlepiller 80
 
7371 jlepiller 81
# The complete upstream URI we follow.
82
SVN_en := "$(EN_REPO)/$(EN_VER)"
7156 jlepiller 83
 
84
 
7371 jlepiller 85
IMAGES := $(shell find images -type f)
86
STYLESHEETS := $(shell find stylesheets -type f)
87
CSS := $(shell ls stylesheets/lfs-xsl/*.css)
88
 
89
CHUNK_QUIET = 1
90
 
7164 jlepiller 91
.PHONY: svnup
7156 jlepiller 92
 
7371 jlepiller 93
# Don't delete intermediates (.po files).
94
.SECONDARY:
95
 
96
default:
97
	@echo 'Hi!'
98
	@echo 'To build the HTML documentation, please run `make genhtml`. For'
99
	@echo 'the PDF version, run `make genpdf`. For both run `make all`.'
100
	@echo 'Restrict to a subset of the available language with L=... and'
101
	@echo 'to a subset of the versions with REV=<sysv or systemd>.'
102
	@echo 'Good luck!'
103
 
104
all: genhtml genpdf
7156 jlepiller 105
	@echo DONE
106
 
7371 jlepiller 107
include include.mk
7156 jlepiller 108
 
7371 jlepiller 109
config.mk:
110
	@echo 'Hi!'
111
	@echo 'To use this Makefile, you will need a config.mk file, with your username'
112
	@echo 'and password in it. That is required for uploading to the lfs website.'
113
	@echo 'An example config.mk is simply:'
114
	@echo ''
115
	@echo 'USER:=my-user'
116
	@echo 'PRIVKEY:=~/.ssh/id_rsa'
117
	@echo 'USE_SSH_AGENT:=yes'
118
	@echo 'DOCBOOK_LOCATION:=/usr/share/xml/xsl/docbook-xsl-1.79.1'
119
	@false
7156 jlepiller 120
 
7371 jlepiller 121
# So, if USE_SSH_AGENT = yes ...
122
ifeq ($(USE_SSH_AGENT), yes)
123
SSH_AGENT:=ssh-agent
124
else
125
SSH_AGENT:=
126
endif
7156 jlepiller 127
 
7371 jlepiller 128
init: $(ORIGDIR)
7156 jlepiller 129
 
7371 jlepiller 130
$(ORIGDIR):
131
	[ -d $@ ] || svn co $(SVN_en) $(ORIGDIR)/
7156 jlepiller 132
 
7371 jlepiller 133
# When updating, check that we still want to follow the checked-out branch.
134
# If not, remove it and check out the new branch.
135
svnup: init
136
	v=$$(svn info $(ORIGDIR) | grep ^URL | sed 's|^[^s]*||') ;\
137
	if [ "$$v" != "$(SVN_en)" ]; then \
138
		echo $$v ;\
139
		rm -rf $(ORIGDIR);\
140
		svn co $(SVN_en) $(ORIGDIR)/ >/dev/null;\
141
	else \
142
		if [ "$$(svn status -u $(ORIGDIR) | wc -l)" != "1" ]; then \
143
			LANG=en_US.UTF-8 svn update $(ORIGDIR);\
144
		fi ;\
145
	fi
7156 jlepiller 146
 
7371 jlepiller 147
clean: clean-gen clean-product
148
	rm -rf $(ORIGDIR) include.mk
7160 jlepiller 149
 
7371 jlepiller 150
# include.mk contains most of the logic of the Makefile.
151
# We generate lists of XML files to translated, PO files that contain translations,
152
# images and stylesheet files, and the list of files to copy from the english repo.
153
#
154
# It also contains targets to build different html versions, to refresh the PO
155
# files and to generate the translated XML files. We need to use this target
156
# because the language in the name of the target and the file name are both
157
# wildcards, which cannot be used.
158
include.mk: include.in $(ORIGDIR) Makefile
159
	echo '# This file is generated by Makefile, please do not modify it directly.' > $@.tmp
160
	echo 'PO :=' >> $@.tmp
161
	for lang in $(LANGUAGES); do \
162
		sed -e "s|MLANG|$$lang|g" include.in >> $@.tmp;\
163
	done
164
	mv $@.tmp $@
7156 jlepiller 165
 
7371 jlepiller 166
clean-gen: $(addprefix clean-gen-,$(LANGUAGES))
167
clean-product: $(addprefix clean-product-,$(LANGUAGES))
7156 jlepiller 168
 
7371 jlepiller 169
ifeq ($(L),all)
170
L=$(LANGUAGES)
171
endif
172
 
173
HTMLDEPS=
174
ifeq ($(SYSV),1)
175
HTMLDEPS+=$(addsuffix -sysv,$(addprefix genhtml-,$(L)))
176
endif
177
ifeq ($(SYSD),1)
178
HTMLDEPS+=$(addsuffix -sysd,$(addprefix genhtml-,$(L)))
179
endif
180
 
181
PDFDEPS=
182
ifeq ($(SYSV),1)
183
PDFDEPS+=$(addsuffix -sysv,$(addprefix genpdf-,$(L)))
184
endif
185
ifeq ($(SYSD),1)
186
PDFDEPS+=$(addsuffix -sysd,$(addprefix genpdf-,$(L)))
187
endif
188
 
189
TARDEPS=
190
ifeq ($(SYSV),1)
191
TARDEPS+=$(addsuffix -sysv,$(addprefix gentar-,$(L)))
192
endif
193
ifeq ($(SYSD),1)
194
TARDEPS+=$(addsuffix -sysd,$(addprefix gentar-,$(L)))
195
endif
196
 
197
EPUBDEPS=
198
ifeq ($(SYSV),1)
199
EPUBDEPS+=$(addsuffix -sysv,$(addprefix genepub-,$(L)))
200
endif
201
ifeq ($(SYSD),1)
202
EPUBDEPS+=$(addsuffix -sysd,$(addprefix genepub-,$(L)))
203
endif
204
 
205
UPDEPS=
206
ifeq ($(SYSV),1)
207
UPDEPS+=$(addsuffix -sysv,$(addprefix upload-,$(L)))
208
endif
209
ifeq ($(SYSD),1)
210
UPDEPS+=$(addsuffix -sysd,$(addprefix upload-,$(L)))
211
endif
212
 
213
genhtml: $(HTMLDEPS)
214
genpdf: $(PDFDEPS)
215
genepub: $(EPUBDEPS)
216
gentar: $(TARDEPS)
217
 
218
update: $(PO)
219
 
220
pootle:
221
	pootle sync_stores --project=blfs
222
	$(MAKE) svnup
223
	$(MAKE) update
224
	python3 changelogtranslator.py fr/introduction/welcome/changelog.po
225
	for lang in $(LANGUAGES); do \
226
		python3 templatetranslator.py `find $$lang -name '*.po'` ;\
227
	done
228
	pootle update_stores --project=blfs
229
 
230
ssh-agent:
231
	(ssh-add -l | grep $(PRIVKEY)) || \
232
	ssh-add $(PRIVKEY)
233
 
234
upload: $(UPDEPS)
235
 
236
release: $(SSH_AGENT) genhtml genpdf gentar genepub
237
	for lang in $(L); do \
238
		cd html-$$lang-systemd ;\
239
		rsync --progress --recursive * $(USER)@www.linuxfromscratch.org:/srv/www/www.$$lang.linuxfromscratch.org/view/blfs-$(MILESTONE)-systemd-$$lang/ ;\
240
		cd ../html-$$lang-sysv ;\
241
		rsync --progress --recursive * $(USER)@www.linuxfromscratch.org:/srv/www/www.$$lang.linuxfromscratch.org/view/blfs-$(MILESTONE)-$$lang/ ;\
242
		cd ../pdf-$$lang ;\
243
		rsync --progress LFS-$(MILESTONE)-$$lang.pdf $(USER)@www.linuxfromscratch.org:/srv/www/www.$$lang.linuxfromscratch.org/archives/BLFS-$(MILESTONE)/ ;\
244
		rsync --progress LFS-$(MILESTONE)-$$lang-systemd.pdf $(USER)@www.linuxfromscratch.org:/srv/www/www.$$lang.linuxfromscratch.org/archives/BLFS-$(MILESTONE)-systemd/ ;\
245
		cd .. ;\
246
		rsync --progress LFS-$(MILESTONE)-$$lang-HTML.tar.bz2 $(USER)@www.linuxfromscratch.org:/srv/www/www.$$lang.linuxfromscratch.org/archives/BLFS-$(MILESTONE)/ ;\
247
		rsync --progress LFS-$(MILESTONE)-systemd-$$lang-HTML.tar.bz2 $(USER)@www.linuxfromscratch.org:/srv/www/www.$$lang.linuxfromscratch.org/archives/BLFS-$(MILESTONE)-systemd/ ;\
248
		cd epub-$$lang-sysv;\
249
		rsync --progress lfs-$(MILESTONE)-$$lang.epub $(USER)@www.linuxfromscratch.org:/srv/www/www.$$lang.linuxfromscratch.org/archives/BLFS-$(MILESTONE)/ ;\
250
		cd ../epub-$$lang-systemd ;\
251
		rsync --progress lfs-$(MILESTONE)-systemd-$$lang.epub $(USER)@www.linuxfromscratch.org:/srv/www/www.$$lang.linuxfromscratch.org/archives/BLFS-$(MILESTONE)-systemd/ ;\
252
	done
253
 
254
commit: pootle
255
	svn commit -m 'Automatic BLFS commit based on r$(REVISION)'
256
 
257
blfsgen-%/pdf.mk: pdf.mk
7163 jlepiller 258
	mkdir -p $$(dirname $@)
259
	cp $< $@
7156 jlepiller 260
 
7371 jlepiller 261
blfsgen-%/epub.mk: epub.mk
7163 jlepiller 262
	mkdir -p $$(dirname $@)
7371 jlepiller 263
	sed -e 's|DOCBOOK_LOCATION|$(DOCBOOK_LOCATION)|g' $< > $@
7156 jlepiller 264
 
7371 jlepiller 265
###############################################################################
266
# These files are not translated using po files. We use sed to modify them    #
267
# directly.                                                                   #
268
###############################################################################
269
 
270
##
271
## French translation of non po files
272
##
273
 
274
#blfsgen-fr/index.xml: $(ORIGDIR)/index.xml fr/index.po
275
#	./sed_fr.sh $@.tmp
276
#	LANG=$(LANG_fr) po4a-translate -k 0 -f docbook -m $< -l $@.tmp -p $(word 2,$^)
277
#	sed -i -e 's|<book>|<book lang="fr">|g' \
278
#	       -e 's|encoding="ISO-8859-1"|encoding="UTF-8"|g' $@.tmp > $@
279
#	rm $@.tmp
280
 
281
blfsgen-fr/general.ent: $(ORIGDIR)/general.ent
282
	mkdir -p $$(dirname $@)
7156 jlepiller 283
	cat $< | tr '\n' '\r' | \
284
	sed -e "s|The BLFS Team|L'équipe de BLFS|g" \
285
	    -e "s|The BLFS Development Team|L'équipe de développement de BLFS|g" \
286
	    -e "s|Unknown|Inconnu|g" \
287
	    -e "s|<!ENTITY lfs\([0-9]\)\([0-9]\)_checked [^\r]*\r[^\r]*\">|<!ENTITY lfs\1\2_checked \"<para>Ce paquet est connu pour se construire correctement sur une plateforme LFS-\1.\2.</para>\">|g" \
288
	    -e "s|<!ENTITY lfs\([0-9]\)\([0-9]\)_built [^\r]*\r[^\r]*\">|<!ENTITY lfs\1\2_built \"<para>Ce paquet est connu pour se construire correctement sur une plateforme LFS-\1.\2 mais n'a pas été testé.</para>\">|g" \
7266 jlepiller 289
            -e "s|<!ENTITY gcc7_checked [^\r]*\r[^\r]*\">|<!ENTITY gcc7_checked \"<para>Ce paquet est connu pour se construire correctement avec gcc-7.1.</para>\">|g" \
7156 jlepiller 290
	    -e "s|<!ENTITY lfssvn_checked [^\r]*\r[^\r]*\">|<!ENTITY lfssvn_checked \"Ce paquet est connu pour se construire correctement sur une plateforme LFS-SVN-\">|g" \
291
	    -e "s|<!ENTITY lfssvn_built [^\r]*\">|<!ENTITY lfssvn_checked \"Ce paquet est connu pour se construire correctement sur une plateforme LFS-SVN-\">|g" \
292
	    -e "s|<!ENTITY lfssvn_checked2 [^\r]*\">|<!ENTITY lfssvn_checked2 \" .\">|g" \
293
	    -e "s|<!ENTITY lfssvn_built2 [^\r]*\">|<!ENTITY lfssvn_built2 \" mais n'a pas été testé.\">|g" \
294
	    -e "s|<!ENTITY as_root *\"[^\"]*\">||g" \
295
	    -e "s|<!ENTITY not-katamari *\"[^\"]*\">|<!ENTITY not-katamari \"<para>Ce paquet ne fait pas partie de Xorg Katamari et est seulement fourni comme dépendance d'autres paquets ou pour tester l'installation complète de Xorg.</para>\">|g" \
296
	    -e "s|<!ENTITY parallel_issues *\"[^\"]*\">|<!ENTITY parallel_issues \"<note><para>Ce paquet peut parfois échouer quand il est construit avec plusieurs processeurs. Voir <xref linkend='parallel-builds'/> pour plus d'information.</para></note>\">|g" \
297
	    | tr '\r' '\n' > $@
298
		cat general.ent.as_root >> $@
299
 
7371 jlepiller 300
blfsgen-fr/packages.ent: $(ORIGDIR)/packages.ent
301
	mkdir -p $$(dirname $@)
7156 jlepiller 302
	cp $< $@
303
 
7371 jlepiller 304
blfsgen-fr/gnome.ent: $(ORIGDIR)/gnome.ent
305
	mkdir -p $$(dirname $@)
7156 jlepiller 306
	cp $< $@
307
 
7371 jlepiller 308
blfsgen-fr/tidy.conf: $(ORIGDIR)/tidy.conf
309
	mkdir -p $$(dirname $@)
310
	sed -e "s/latin1/UTF8/g" $< > $@
7156 jlepiller 311
 
7371 jlepiller 312
blfsgen-fr/Makefile: $(ORIGDIR)/Makefile blfsgen-fr/epub.mk blfsgen-fr/pdf.mk
313
	mkdir -p $$(dirname $@)
314
	sed -e 's|^html:|include epub.mk\ninclude pdf.mk\nhtml:|' $< > $@