File: rules

package info (click to toggle)
doc-linux-fr 2013.01-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 21,580 kB
  • ctags: 123
  • sloc: xml: 139,071; sh: 361; makefile: 182; lisp: 27
file content (163 lines) | stat: -rwxr-xr-x 6,406 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/usr/bin/make -f
#
# Invoke each target with `./debian/rules <target>'.  All targets should be
# invoked with the package root as the current directory.
# 
# Marco Budde (Budde@tu-harburg.de)
# Colin Watson (cjwatson@debian.org)
# Pierre Machard (pmachard@debian.org)
# 
# The name of the package

R = debian/doc-linux-fr-html
R2 = debian/doc-linux-fr-text
R3 = debian/doc-linux-fr-ps
R4 = debian/doc-linux-fr-pdf

HTML_BUILD = $(R)/usr/share/doc/HOWTO/fr-html
TEXT_BUILD = $(R2)/usr/share/doc/HOWTO/fr-txt
PS_BUILD = $(R3)/usr/share/doc/HOWTO/fr-ps
PDF_BUILD = $(R4)/usr/share/doc/HOWTO/fr-pdf

source = $(shell dpkg-parsechangelog | grep '^Source:' | sed 's/^Source: //')
upstream = $(shell dpkg-parsechangelog | grep '^Version:' | \
                   sed -e 's/^Version: //' -e 's/-.*//')

# Override this if you want to use a mirror closer to home.
TRADUC = ftp://traduc.org/pub/traduc.org/doc-vf
LFO = ftp://ftp.linux-france.org/pub

SUPP = fcol-faq fhs-fr info-sheet intro meta-faq ProductionGuidesPratiques

FILE_fhs_fr = fhs-2.0.fr-nroff.tar.gz
FILE_fcol_faq = faq-fcol.tar.gz
FILE_info_sheet = info-sheet.fr-html.tar.gz
FILE_intro = intro-html.tar.gz
FILE_meta_faq = meta-faq.fr-html.tar.gz
FILE_ProductionGuidesPratiques = master.tar.gz

URL_fhs_fr = $(LFO)/article/sys/$(FILE_fhs_fr)
URL_fcol_faq = $(LFO)/article/fcol-faq/$(FILE_fcol_faq)
URL_info_sheet = $(TRADUC)/documents/info-sheet.fr/$(FILE_info_sheet)
URL_intro = $(TRADUC)/documents/intro/$(FILE_intro)
URL_meta_faq = $(TRADUC)/documents/meta-faq.fr/$(FILE_meta_faq)
URL_ProductionGuidesPratiques = https://github.com/fevrier/ProductionGuidesPratiques/archive/$(FILE_ProductionGuidesPratiques)

OPTION_fcol_faq = --strip-components=1
OPTION_fhs_fr = --strip-components=1
OPTION_ProductionGuidesPratiques = --strip-components=1

IGNORE = ATA-RAID-HOWTO.sgml IRC.sgml Linux\+WinNT.sgml MP3-CD-Burning.sgml \
	 $(NONFREE)
NONFREE = Adv-Routing-HOWTO.sgml Astronomy-HOWTO.sgml \
	  C-C\+\+Beautifier-HOWTO.sgml CD-Distributions-EN-HOWTO.sgml \
	  DHCP.sgml FTP.xml HOWTO-HOWTO-sgml.tar.gz Installation-HOWTO.sgml \
	  IPMasquerading\+Napster.sgml Jaz-Drive-HOWTO.sgml \
	  KDE-GUI-Login-Configuration-HOWTO.xml lartc.xml Mail2News.sgml \
	  Online-Troubleshooting-HOWTO.sgml Plug-and-Play-HOWTO.xml \
	  Process-Accounting.sgml Quota.sgml Reading-List-HOWTO.sgml \
	  RPM-HOWTO.sgml SMB-HOWTO.sgml SquashFS-HOWTO-xml.tar.gz \
	  StarOffice.sgml Text-Terminal-HOWTO.sgml TransparentProxy.xml \
	  UPS-HOWTO.sgml User-Authentication-HOWTO.xml Vim-HOWTO.sgml \
	  Wacom-USB-mini-HOWTO.xml XFree86-HOWTO.sgml \
	  XFree86-Video-Timings-HOWTO.xml

SUBVERSION_images = HP-HOWTO/images/HP-HOWTO images/TimePrecision-HOWTO

WIKI_URL = http://traduc.org/Guides_pratiques/Suivi/
WIKI = EVMSUG

get-orig-source: howto $(SUBVERSION_images) $(SUPP) $(WIKI)

$(SUBVERSION_images):
	dh_testdir
	[ -d howto/images ] || mkdir howto/images
	cd howto/images && svn export svn://svn.traduc.org/guides_pratiques/trunk/$@

$(WIKI):
	dh_testdir
	[ -d howto ] || mkdir howto
	w3m "$(WIKI_URL)$@/Source?action=raw" > howto/$@.source
	for i in $$(sed -n -e '/\[\[\/.*|/p' howto/$@.source | \
		sed 's,^.*\[\[/\(.*\)|.*$$,\1,') ; do \
		w3m "$(WIKI_URL)$@/Source/$$i?action=raw" | \
		sed -e '1d' > howto/$$i && sleep 5 ; done
	[ -d howto/images/$@ ] || mkdir howto/images/$@
	for i in $$(sed -n -e '/\[\[attachment:.*\]\]/p' howto/$@.source | \
		sed 's,^.*\[\[attachment:\(.*\)\]\].*$$,\1,') ; do \
		wget -O howto/images/$@/$$i \
		"$(WIKI_URL)$@/Source?action=AttachFile&do=get&target=$$i" ; done
	rm howto/$@.source

howto:
	dh_testdir
	# Update sources of the HOWTOs.
	[ -d $@ ] || mkdir -p $@
	lftp -c 'mirror -nev $(patsubst %,--exclude %,$(IGNORE)) \
		$(TRADUC)/HOWTO/telechargement/source $@'
	# Fetch index and stylesheet
	wget -O index.html \
		"http://guidespratiques.traduc.org/nouvel_index.php?howto.1"
	lftp -c 'get -ce $(TRADUC)/HOWTO/telechargement/html-1page/style.css'

$(SUPP):
	dh_testdir
	# Download upstream tarball, preserving its timestamp
	lftp -c 'get $(URL_$(subst -,_,$@))'
	# Rename upstream tarball as proper supplementary one
	mv $(FILE_$(subst -,_,$@)) ../$(source)_$(upstream).orig-$@.tar$(suffix $(FILE_$(subst -,_,$@)))
	# Unpack upstream tarball
	[ -d $@ ] || mkdir $@
	tar -a $(OPTION_$(subst -,_,$@)) -C $@ -xf ../$(source)_$(upstream).orig-$@.tar$(suffix $(FILE_$(subst -,_,$@)))

# Build a new .orig.tar.gz.
orig: clean
	tar --xz -C .. --exclude debian --exclude .git --exclude .pc \
		$(patsubst %,--exclude %,$(SUPP)) -cvf \
	 	../$(source)_$(upstream).orig.tar.xz $(source)

override_dh_auto_build:
	cd fcol-faq && make
	cd fhs-fr && make
	cd howto && for i in *.tar.gz; do tar xaf $$i; done; \
		sed -i 's%docbook.org%oasis-open.org/docbook%' \
		CSPM-HOWTO.xml Linux-Complete-Backup-and-Recovery-HOWTO.xml Mobile-IPv6-HOWTO.xml; \
		fig2eps images/Home-Network/*.fig; \
		for i in images/Home-Network/*.eps; do convert $$i $${i%eps}png; done; \
		./preparation-des-scripts.sh; \
		for i in *xml *.sgml; do \
		HOME=/tmp LC_ALL=fr_FR.UTF-8 ../ProductionGuidesPratiques/production-traduc.org.sh $$i; done

override_dh_install:
	dh_install
	# Clean the index and remove reference to the RedHat-CD-HOWTO
	debian/index-cleaner $(HTML_BUILD)/index.html	
	rm -rf $(HTML_BUILD)/RedHat-CD-HOWTO*
	rm -rf $(HTML_BUILD)/outils/RedHat*
	rm -f $(PDF_BUILD)/RedHat-CD-HOWTO.pdf
	rm -f $(PS_BUILD)/RedHat-CD-HOWTO.ps
	rm -f $(TEXT_BUILD)/RedHat-CD-HOWTO.txt
	find $(HTML_BUILD)/images -type f -name *.eps -o -name *.fig | xargs rm -f
	gzip -n $(TEXT_BUILD)/* $(R2)/usr/share/doc/LANG/fr/linux/fhs-fr/fhs.txt
override_dh_installdocs:
	dh_installdocs
	# Workaround over #525821
	sed -i -e "s/\(^Document: .*\)-\(html\|pdf\|ps\|text\)$$/\1/g" \
	$(CURDIR)/debian/$(source)-*/usr/share/doc-base/*
override_dh_compress:
	dh_compress -X.fdisk -X.metadata
override_dh_clean:
	cd fcol-faq && make clean
	cd fhs-fr && make clean
	cd howto && rm -f *.css *.fo *.html *.pdf *.ps *.sh *.txt \
		Authentication-Gateway-HOWTO.sgml Debian-and-Windows-Shared-Printing.xml \
		Home-Network.xml Howto-HOWTO.sgml SquashFS-HOWTO.xml chapter*.xml; \
		find . -mindepth 1 -maxdepth 1 -type d ! -name images | xargs rm -rf; \
		find images -mindepth 1 -maxdepth 1 ! -name HP-HOWTO ! -name TimePrecision-HOWTO \
		$(patsubst %,! -name %,$(WIKI)) | xargs rm -rf
	dh_clean

%:
	dh $@

.PHONY: get-orig-source howto $(SUBVERSION_images) $(SUPP) $(WIKI) orig