Subversion Repositories svn LFS-FR

Rev

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

Rev Author Line No. Line
7138 jlepiller 1
#!/usr/bin/make -f
2
 
7270 jlepiller 3
# Use make L=... to build only a subset of the languages.
7138 jlepiller 4
 
7270 jlepiller 5
LANGUAGES := fr
6
LANG_fr := fr_FR.UTF-8
7
L = all
7155 jlepiller 8
 
7312 jlepiller 9
# Use config.mk to configure username and password for download and upload
10
include config.mk
11
 
7138 jlepiller 12
ORIGDIR := lfs-en
7270 jlepiller 13
 
7306 jlepiller 14
FR_REPO:=svn://svn.linuxfromscratch.org/fr-lfs
15
EN_REPO:=svn://svn.linuxfromscratch.org/LFS
7272 jlepiller 16
 
7306 jlepiller 17
 
7272 jlepiller 18
# Note for releasing a new stable version:
19
# ----------------------------------------
20
#
21
# When a new stable version is released upstream, this Makefile will automatically
22
# track it, so translate it as usual. Once the stable version is translated,
23
# create a new branch that keeps tracking this release:
24
#
25
#   svn cp http://svn.linuxfromscratch.org/fr-lfs/trunk/lfs \
26
#          http://svn.linuxfromscratch.org/fr-lfs/branches/lfs-$(MILESTONE)
27
#
28
# Once this is done, you can publish the new version by running:
29
#
30
#   make upload
31
#
32
# Then, update the MILESTONE to the next (unreleased) version of LFS in the
33
# development branch and commit.
34
 
7270 jlepiller 35
# What we follow from upstream.
7311 jlepiller 36
MILESTONE := 8.2
7272 jlepiller 37
 
7306 jlepiller 38
# Select the current version we are tracking from master
39
EN_CURR_VER := $(shell svn info $(ORIGDIR) | grep ^URL | sed 's|^[^s]*||')
40
 
7272 jlepiller 41
# What this does is that it selects either the development version (if our milestone
42
# is the same as upstream) or the stable version (if it does not match, meaning
43
# that the stable version is released).
7306 jlepiller 44
ifeq ($(EN_CURR_VER), $(EN_REPO)/tags/$(MILESTONE))
45
TAG := $(MILESTONE)
46
else
7270 jlepiller 47
TAG := trunk
7306 jlepiller 48
endif
7311 jlepiller 49
 
50
ifneq ($(MILESTONE), $(shell ((grep milestone $(ORIGDIR)/general.ent || echo $(MILESTONE)) | sed 's|.*"\(.*\)".*|\1|')))
7272 jlepiller 51
TAG := $(MILESTONE)
52
endif
7270 jlepiller 53
 
7272 jlepiller 54
# Depending on what we track, we choose the correct branch from upstream.
7270 jlepiller 55
ifeq ($(TAG), trunk)
7148 jlepiller 56
EN_VER := trunk/BOOK
7270 jlepiller 57
else
58
EN_VER := tags/$(TAG)
59
endif
7138 jlepiller 60
 
7274 jlepiller 61
# Some version of echo (for instance the one shipped in dash) doesn't understand -e
62
# but acts as if it was passed by default.
63
ifeq ($(shell echo -n -e),-e)
64
ECHO:=echo
65
else
66
ECHO:=echo -e
67
endif
68
 
7270 jlepiller 69
# Files that are needed for the build process once translations are generated.
70
filestocopy := INSTALL README process-scripts.sh obfuscate.sh pdf-fixups.sh \
71
               bootscripts udev-lfs aux-file-data.sh make-aux-files.sh
72
# Additional files that may require some changes.
7138 jlepiller 73
filestoget := $(filestocopy) packages.ent tidy.conf patches.ent general.ent Makefile
74
 
7270 jlepiller 75
# Use REV=sysv or REV=systemd to only build that version.
76
REV=all
77
 
78
ifeq ($(REV), all)
79
SYSV=1
80
SYSD=1
81
else
7138 jlepiller 82
ifeq ($(REV), systemd)
7270 jlepiller 83
SYSV=
84
SYSD=1
85
else
86
SYSV=1
87
SYSD=
7138 jlepiller 88
endif
7270 jlepiller 89
endif
7138 jlepiller 90
 
7272 jlepiller 91
# The complete upstream URI we follow.
7138 jlepiller 92
SVN_en := "$(EN_REPO)/$(EN_VER)"
93
 
7270 jlepiller 94
.PHONY: svnup
7272 jlepiller 95
 
96
# Don't delete intermediates (.po files).
7270 jlepiller 97
.SECONDARY:
7138 jlepiller 98
 
7270 jlepiller 99
default:
100
	@echo 'Hi!'
101
	@echo 'To build the HTML documentation, please run `make genhtml`. For'
102
	@echo 'the PDF version, run `make genpdf`. For both run `make all`.'
103
	@echo 'Restrict to a subset of the available language with L=... and'
104
	@echo 'to a subset of the versions with REV=<sysv or systemd>.'
105
	@echo 'Good luck!'
7138 jlepiller 106
 
7141 jlepiller 107
all: genhtml genpdf
7138 jlepiller 108
	@echo DONE
109
 
7270 jlepiller 110
include include.mk
7138 jlepiller 111
 
7312 jlepiller 112
config.mk:
113
	@echo 'Hi!'
114
	@echo 'To use this Makefile, you will need a config.mk file, with your username'
115
	@echo 'and password in it. That is required for uploading to the lfs website.'
116
	@echo 'An example config.mk is simply:'
117
	@echo ''
118
	@echo 'USER:=my-user'
119
	@echo 'PRIVKEY:=~/.ssh/id_rsa'
120
	@echo 'USE_SSH_AGENT:=yes'
121
	@false
122
 
123
# So, if USE_SSH_AGENT = yes ...
124
ifeq ($(USE_SSH_AGENT), yes)
125
SSH_AGENT:=ssh-agent
126
else
127
SSH_AGENT:=
128
endif
129
 
7270 jlepiller 130
init: $(ORIGDIR)
7138 jlepiller 131
 
7270 jlepiller 132
$(ORIGDIR):
133
	[ -d $@ ] || svn co $(SVN_en) $(ORIGDIR)/
7138 jlepiller 134
 
7272 jlepiller 135
# When updating, check that we still want to follow the checked-out branch.
136
# If not, remove it and check out the new branch.
7270 jlepiller 137
svnup: init
7273 jlepiller 138
	v=$$(svn info $(ORIGDIR) | grep ^URL | sed 's|^[^s]*||') ;\
7272 jlepiller 139
	if [ "$$v" != "$(SVN_en)" ]; then \
140
		echo $$v ;\
141
		rm -rf $(ORIGDIR);\
142
		svn co $(SVN_en) $(ORIGDIR)/ >/dev/null;\
143
	else \
144
		if [ "$$(svn status -u $(ORIGDIR) | wc -l)" != "1" ]; then \
145
			LANG=en_US.UTF-8 svn update $(ORIGDIR);\
146
		fi ;\
7270 jlepiller 147
	fi
7138 jlepiller 148
 
7312 jlepiller 149
clean: clean-gen clean-product
7270 jlepiller 150
	rm -rf $(ORIGDIR) include.mk
7138 jlepiller 151
 
7270 jlepiller 152
# include.mk contains most of the logic of the Makefile.
153
# We generate lists of XML files to translated, PO files that contain translations,
154
# images and stylesheet files, and the list of files to copy from the english repo.
155
#
156
# It also contains targets to build different html versions, to refresh the PO
157
# files and to generate the translated XML files. We need to use this target
158
# because the language in the name of the target and the file name are both
159
# wildcards, which cannot be used.
160
include.mk: $(ORIGDIR) Makefile
161
	echo -n 'XML := ' > $@.tmp
162
	for lang in $(LANGUAGES); do \
163
		find $(ORIGDIR) -name '*.xml' -o -name '*stylesheets*' -prune -a -type f |\
164
			sed "s|$(ORIGDIR)/|lfsgen-$$lang/|g" | \
165
			tr '\n' ' ' >> $@.tmp; \
166
	done
167
	echo >> $@.tmp
168
	echo -n 'PO := ' >> $@.tmp
169
	for lang in $(LANGUAGES); do \
170
		find $(ORIGDIR) -name '*.xml' -o -name '*stylesheets*' -prune -a -type f |\
171
			sed "s|$(ORIGDIR)/|$$lang/|g" | \
172
			sed 's|.xml$$|.po|' | tr '\n' ' ' >> $@.tmp; \
173
	done
174
	echo >> $@.tmp
175
	echo -n 'IMAGES := ' >> $@.tmp
176
	for lang in $(LANGUAGES); do \
177
		find images -type f | sed "s|^|lfsgen-$$lang/|g" | tr '\n' ' ' >> $@.tmp; \
178
	done
179
	echo >> $@.tmp
180
	echo -n 'STYLESHEETS := ' >> $@.tmp
181
	for lang in $(LANGUAGES); do \
182
		find stylesheets -type f | sed "s|^|lfsgen-$$lang/|g" | tr '\n' ' ' >> $@.tmp;\
183
	done
184
	echo >> $@.tmp
185
	echo -n 'COPY = ' >> $@.tmp
186
	for lang in $(LANGUAGES); do \
187
		echo -n ' $$(addprefix lfsgen-'"$$lang"'/,$$(filestoget))' >> $@.tmp ;\
188
	done
189
	echo >> $@.tmp
190
	echo >> $@.tmp
191
	for lang in $(LANGUAGES); do \
192
		echo "lfsgen-$$lang/images/%: images/%" >> $@.tmp ;\
7274 jlepiller 193
		$(ECHO) '\t@mkdir -p $$$$(dirname $$@)' >> $@.tmp ;\
194
		$(ECHO) '\t@rm -f $$@' >> $@.tmp ;\
195
		$(ECHO) '\tcp $$< $$@' >> $@.tmp ;\
7270 jlepiller 196
	done
197
	echo >> $@.tmp
198
	for lang in $(LANGUAGES); do \
199
		echo "lfsgen-$$lang/stylesheets/%: stylesheets/%" >> $@.tmp ;\
7274 jlepiller 200
		$(ECHO) '\t@mkdir -p $$$$(dirname $$@)' >> $@.tmp ;\
201
		$(ECHO) '\t@rm -f $$@' >> $@.tmp ;\
202
		$(ECHO) '\tcp $$< $$@' >> $@.tmp ;\
7270 jlepiller 203
	done
204
	echo >> $@.tmp
205
	for lang in $(LANGUAGES); do \
206
		echo "lfsgen-$$lang/%.xml: $(ORIGDIR)/%.xml $$lang/%.po sed-$$lang" \
207
			>> $@.tmp ;\
7274 jlepiller 208
		$(ECHO) '\t@mkdir -p $$$$(dirname $$@)' >> $@.tmp ;\
209
		$(ECHO) '\tLANG=$$(LANG_'"$$lang"') po4a-translate -k 0 -f docbook' \
7270 jlepiller 210
			'-m $$< -l $$@.tmp -p $$(word 2,$$^)' >> $@.tmp ;\
7274 jlepiller 211
		$(ECHO) '\t./$$(word 3,$$^) $$@' >> $@.tmp ;\
212
		$(ECHO) '\trm $$@.tmp' >> $@.tmp ;\
7270 jlepiller 213
	done
214
	echo >> $@.tmp
215
	for lang in $(LANGUAGES); do \
216
		echo "$$lang/%.po: $(ORIGDIR)/%.xml" \
217
			>> $@.tmp ;\
7274 jlepiller 218
		$(ECHO) '\t@mkdir -p $$$$(dirname $$@)' >> $@.tmp ;\
219
		$(ECHO) '\tLANG=$$(LANG_'"$$lang"') po4a-updatepo -f docbook' \
7270 jlepiller 220
			'-m $$< -p $$@' >> $@.tmp ;\
7274 jlepiller 221
		$(ECHO) '\t@touch $$@' >> $@.tmp ;\
7270 jlepiller 222
	done
223
	echo >> $@.tmp
224
	echo 'clean-gen:' >> $@.tmp
225
	for lang in $(LANGUAGES); do \
7274 jlepiller 226
		$(ECHO) "\trm -rf lfsgen-$$lang" >> $@.tmp ;\
7270 jlepiller 227
	done
228
	echo >> $@.tmp
7312 jlepiller 229
	echo 'clean-product:' >> $@.tmp
230
	for lang in $(LANGUAGES); do \
231
		$(ECHO) "\trm -rf LFS-*-$$lang-HTML.tar.bz2" >> $@.tmp ;\
232
		$(ECHO) "\trm -rf LFS-systemd-*-$$lang-HTML.tar.bz2" >> $@.tmp ;\
233
		$(ECHO) "\trm -rf html-$$lang-systemd" >> $@.tmp ;\
234
		$(ECHO) "\trm -rf html-$$lang-sysv" >> $@.tmp ;\
235
		$(ECHO) "\trm -rf pdf-$$lang" >> $@.tmp ;\
236
	done
237
	echo >> $@.tmp
7270 jlepiller 238
	echo .SECONDEXPANSION: >> $@.tmp
239
	for lang in $(LANGUAGES); do \
240
		echo '$$(addprefix lfsgen-'"$$lang"'/,$$(filestocopy)):' \
241
			'INPUT=$$(ORIGDIR)$$(subst lfsgen-'"$$lang"',,$$@)' >> $@.tmp ;\
242
		echo '$$(addprefix lfsgen-'"$$lang"'/,$$(filestocopy)):' \
243
			'$$$$(INPUT)' >> $@.tmp ;\
7274 jlepiller 244
		$(ECHO) '\t@mkdir -p $$$$(dirname $$@)' >> $@.tmp ;\
245
		$(ECHO) '\tcp -r $$< $$@' >> $@.tmp ;\
7270 jlepiller 246
	done
247
	echo >> $@.tmp
248
	for lang in $(LANGUAGES); do \
7271 jlepiller 249
		xml='$$(filter lfsgen-'"$$lang"'/%,$$(XML))' ;\
250
		copy='$$(filter lfsgen-'"$$lang"'/%,$$(COPY))' ;\
251
		echo 'genhtml-'"$$lang"'-sysv: '"$$copy $$xml"' $$(IMAGES) $$(STYLESHEETS)' >> $@.tmp ;\
7274 jlepiller 252
		$(ECHO) '\tLANG=$$(LANG_'"$$lang"') make -C lfsgen-'"$$lang"' -j1 REV=sysv BASEDIR=../html-'"$$lang"'-sysv' >> $@.tmp ;\
7271 jlepiller 253
		echo 'genhtml-'"$$lang"'-systemd: '"$$copy $$xml"' $$(IMAGES) $$(STYLESHEETS)' >> $@.tmp ;\
7274 jlepiller 254
		$(ECHO) '\tLANG=$$(LANG_'"$$lang"') make -C lfsgen-'"$$lang"' -j1 REV=systemd BASEDIR=../html-'"$$lang"'-systemd' >> $@.tmp ;\
7271 jlepiller 255
		echo 'genpdf-'"$$lang"'-sysv: '"$$copy $$xml"' $$(IMAGES) $$(STYLESHEETS)' >> $@.tmp ;\
7274 jlepiller 256
		$(ECHO) '\tLANG=$$(LANG_'"$$lang"') make -C lfsgen-'"$$lang"' -j1 REV=sysv BASEDIR=../pdf-'"$$lang"' pdf' >> $@.tmp ;\
7271 jlepiller 257
		echo 'genpdf-'"$$lang"'-systemd: '"$$copy $$xml"'$$(IMAGES) $$(STYLESHEETS)' >> $@.tmp ;\
7274 jlepiller 258
		$(ECHO) '\tLANG=$$(LANG_'"$$lang"') make -C lfsgen-'"$$lang"' -j1 REV=systemd BASEDIR=../pdf-'"$$lang"' pdf' >> $@.tmp ;\
7270 jlepiller 259
	done
260
	echo >> $@.tmp
261
	mv $@.tmp $@
7138 jlepiller 262
 
7270 jlepiller 263
ifeq ($(L),all)
264
L=$(LANGUAGES)
265
endif
7141 jlepiller 266
 
7270 jlepiller 267
HTMLDEPS=
268
ifeq ($(SYSV),1)
269
HTMLDEPS+=$(addsuffix -sysv,$(addprefix genhtml-,$(L)))
270
endif
271
ifeq ($(SYSD),1)
272
HTMLDEPS+=$(addsuffix -systemd,$(addprefix genhtml-,$(L)))
273
endif
7138 jlepiller 274
 
7270 jlepiller 275
PDFDEPS=
276
ifeq ($(SYSV),1)
277
PDFDEPS+=$(addsuffix -sysv,$(addprefix genpdf-,$(L)))
278
endif
279
ifeq ($(SYSD),1)
280
PDFDEPS+=$(addsuffix -systemd,$(addprefix genpdf-,$(L)))
281
endif
7138 jlepiller 282
 
7270 jlepiller 283
genhtml: $(HTMLDEPS)
284
genpdf: $(PDFDEPS)
7272 jlepiller 285
gentar: genhtml
286
	for lang in $(L); do \
287
		tar cf LFS-$(MILESTONE)-$$lang-HTML.tar html-$$lang-sysv ;\
288
		tar cf LFS-systemd-$(MILESTONE)-$$lang-HTML.tar html-$$lang-systemd ;\
289
		bzip2 LFS-$(MILESTONE)-$$lang-HTML.tar ;\
290
		bzip2 LFS-systemd-$(MILESTONE)-$$lang-HTML.tar ;\
291
	done
7138 jlepiller 292
 
7270 jlepiller 293
update: $(PO)
7138 jlepiller 294
 
7273 jlepiller 295
pootle:
296
	pootle sync_stores --project=lfs
297
	$(MAKE) svnup
298
	$(MAKE) update
299
	python3 changelogtranslator.py $(L)
300
	pootle update_stores --project=lfs
301
 
7312 jlepiller 302
ssh-agent:
303
	(ssh-add -l | grep $(PRIVKEY)) || \
304
	ssh-add $(PRIVKEY)
305
 
306
upload: $(SSH_AGENT)
7271 jlepiller 307
	for lang in $(L); do \
7270 jlepiller 308
		cd html-$$lang-systemd;\
7271 jlepiller 309
		rsync --progress --recursive * $(USER)@www.linuxfromscratch.org:/srv/www/www.$$lang.linuxfromscratch.org/view/lfs-systemd-svn/ ;\
7272 jlepiller 310
		cd ../html-$$lang-sysv;\
7270 jlepiller 311
		rsync --progress --recursive * $(USER)@www.linuxfromscratch.org:/srv/www/www.$$lang.linuxfromscratch.org/view/lfs-svn/ ;\
7271 jlepiller 312
		cd .. ;\
7270 jlepiller 313
	done
314
 
7312 jlepiller 315
release: $(SSH_AGENT) genhtml genpdf gentar
316
	for lang in $(L); do \
317
		cd html-$$lang-systemd ;\
318
		rsync --progress --recursive * $(USER)@www.linuxfromscratch.org:/src/www/www.$$lang.linuxfromscratch.org/view/lfs-$(MILESTONE)-systemd-$$lang/ ;\
319
		cd ../html-$$lang-sysv ;\
320
		rsync --progress --recursive * $(USER)@www.linuxfromscratch.org:/src/www/www.$$lang.linuxfromscratch.org/view/lfs-$(MILESTONE)-$$lang/ ;\
321
		cd ../pdf-$$lang ;\
322
		rsync --progress * $(USER)@www.linuxfromscratch.org:/src/www/www.$$lang.linuxfromscratch.org/archive/LFS-$(MILESTONE)-$$lang/ ;\
323
		cd ..
324
		rsync --progress LFS-$(MILESTONE)-$$lang-HTML.tar.bz2 LFS-systemd-$(MILESTONE)-$$lang-HTML.tar.bz2 $(USER)@www.linuxfromscratch.org:/src/www/www.$$lang.linuxfromscratch.org/archive/LFS-$(MILESTONE)-$$lang/ ;\
325
	done
326
 
7270 jlepiller 327
###############################################################################
328
# These files are not translated using po files. We use sed to modify them    #
329
# directly.                                                                   #
330
###############################################################################
331
 
332
##
333
## French translation of non po files
334
##
335
 
336
lfsgen-fr/general.ent: $(ORIGDIR)/general.ent
337
	@mkdir -p lfsgen-fr
338
	sysv_date=$$(grep " version " $< | sed 's/.*"\([^"]\+\)".*/\1/');\
339
	sysd_date=$$(grep " versiond " $< | sed 's/.*"\([^"]\+\)".*/\1/');\
340
	date=$$(grep "releasedate" $< | sed 's/.*"\([^"]\+\)".*/\1/');\
341
	sed -e "s/$$date/$$(LANG=$(LANG_fr) date -d "$${date}" "+%d %B %Y")/g"\
7138 jlepiller 342
	    -e "s/Approximate build time/Temps de construction approximatif/g"\
343
	    -e "s/Required disk space/Espace disque requis/g"\
344
	    -e "s/Installation depends on/L'installation dépend de/g"\
345
	    -e "s/Test suite depends on/La suite de tests dépend de/g"\
346
	    -e "s/Must be installed before/Doit être installé avant/g"\
347
	    -e "s/Optional dependencies/Dépendances facultatives/g"\
7270 jlepiller 348
	    -e "s|&lfs-root;blfs/|http://fr.linuxfromscratch.org/blfs|g"\
349
	    -e "s|&blfs-root;view/&short-version;|\&blfs-root;\&short-version;|g"\
350
	    -e "s|&lfs-root;hints/downloads/files/|http://fr.linuxfromscratch.org/view/astuces/|g"\
7138 jlepiller 351
	    $< > $@
352
 
7270 jlepiller 353
lfsgen-fr/packages.ent: $(ORIGDIR)/packages.ent
354
	@mkdir -p lfsgen-fr
7138 jlepiller 355
	sed -e "s/KB/Ko/g" -e "s/MB/Mo/g" -e "s/GB/Go/g"\
356
	    -e "s/less than/moins de/g"\
357
	    -e "s/typically about/en général environ/g"\
358
	    -e "s/about/environ/g"\
359
	    -e "s/with tests/avec les tests/g"\
360
	    $< > $@
361
 
7270 jlepiller 362
lfsgen-fr/patches.ent: $(ORIGDIR)/patches.ent
363
	@mkdir -p lfsgen-fr
7138 jlepiller 364
	sed -e "s/KB/Ko/g" \
365
	    $< > $@
366
 
7270 jlepiller 367
lfsgen-fr/tidy.conf: $(ORIGDIR)/tidy.conf
368
	@mkdir -p lfsgen-fr
7138 jlepiller 369
	sed -e "s/latin1/UTF8/g" \
370
	    $< > $@
371
 
7270 jlepiller 372
lfsgen-fr/Makefile: $(ORIGDIR)/Makefile
373
	@mkdir -p lfsgen-fr
7138 jlepiller 374
	sed '/&copy;/d' $< > $@