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 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
|
#!/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)
SOURCE := $(shell dpkg-parsechangelog | awk '$$1 == "Source:" { print $$2 }')
R = debian/$(SOURCE)-html
R2 = debian/$(SOURCE)-text
HTML_BUILD = $(R)/usr/share/doc/HOWTO/en-html
TEXT_BUILD = $(R2)/usr/share/doc/HOWTO/en-txt
ifeq ($(SOURCE),doc-linux)
DHELPOUT := $(HTML_BUILD)/.dhelp
else
DHELPOUT := /dev/null
endif
BZTAR = tar --bzip2
source = $(shell dpkg-parsechangelog | grep '^Source:' | sed 's/^Source: //')
upstream = $(shell dpkg-parsechangelog | grep '^Version:' | \
sed -e 's/^Version: //' -e 's/-.*//')
export DH_OPTIONS
$(DIRECTORIES):
install -d -g root -o root -m 755 $@
chmod g-s $@
# Override this if you want to use a mirror closer to home.
LDP_MIRROR = ftp://www.ibiblio.org/pub/Linux/docs
# This should only need to be overridden if the database host moves.
LDP_OMF = http://www.lampadas.org/omf
refresh: refresh-howto-html refresh-howto-text refresh-faq
# refresh-xml
refresh-howto-docbook:
dh_testdir
# Update DocBook versions of the HOWTOs.
[ -d HOWTO ] || mkdir HOWTO
wget --recursive --timestamping --level 1 \
--no-directories --directory-prefix HOWTO --passive \
$(LDP_MIRROR)/HOWTO/other-formats/docbook/
refresh-howto-html:
dh_testdir
# Update HTML versions of the HOWTOs.
[ -d HOWTO ] || mkdir HOWTO
wget --timestamping --passive \
--no-directories --directory-prefix HOWTO \
$(LDP_MIRROR)/HOWTO/other-formats/html/Linux-html-HOWTOs\*.bz2
refresh-howto-text:
dh_testdir
# Update text versions of the HOWTOs.
[ -d HOWTO ] || mkdir HOWTO
wget --timestamping --passive \
--no-directories --directory-prefix HOWTO \
$(LDP_MIRROR)/HOWTO/Linux-HOWTOs\*.bz2
refresh-faq:
dh_testdir
# Update the Linux FAQ.
[ -d FAQ ] || mkdir FAQ
wget --timestamping --no-directories --directory-prefix FAQ --passive \
$(LDP_MIRROR)/faqs/linux-faq/Linux-FAQ.html.tar.gz \
$(LDP_MIRROR)/faqs/linux-faq/Linux-FAQ
# Eventually this XML description (or the related one at ldp.xml) might
# become more intricately involved with this package's build process. It
# probably should. I'm not going to mess around with that during the freeze,
# though.
refresh-xml:
dh_testdir
# Update the OMF document index.
[ -d xml ] || mkdir xml
wget --timestamping --output-document xml/ldp-omf.xml --passive \
$(LDP_OMF)
build: build-stamp
build-stamp:
@if expr "$$DH_ALWAYS_EXCLUDE" : CVS >/dev/null; then \
echo "DH_ALWAYS_EXCLUDE must not include 'CVS'!" >&2; \
exit 1; \
fi
dh_testdir
# $(BZTAR) -tf HOWTO/Linux-html-HOWTOs.tar.bz2 > xml/$(SOURCE).list
# chmod +x debian/make-omf # diffs don't preserve permissions
# debian/make-omf /usr/share/doc/HOWTO/en-html xml/$(SOURCE).list \
# xml/ldp-omf.xml > xml/$(SOURCE).omf
touch $@
# Undoes the effect of `make -f rules build'.
clean:
dh_testdir
dh_testroot
rm -rf $(R) $(R2)
# rm -f xml/$(SOURCE).list xml/$(SOURCE).omf
dh_clean build-stamp debian/$(SOURCE)-html.menu
# Build a new .orig.tar.gz.
orig: clean
tar -C .. --exclude debian --exclude .svn -czvf \
../$(source)_$(upstream).orig.tar.gz $(source)-$(upstream)
# Construct the binary packages.
binary-$(SOURCE)-html: DH_OPTIONS=-p$(SOURCE)-html
binary-$(SOURCE)-html: build
dh_testdir
dh_testroot
dh_clean -d
dh_installdirs
$(BZTAR) -C $(HTML_BUILD) -xf HOWTO/Linux-html-HOWTOs.tar.bz2
ifeq ($(SOURCE),doc-linux)
# Replace some relative links with links to the LDP web site.
patch -d $(HTML_BUILD) -p0 < debian/redirect.patch
perl -pi -e 's,^HREF="../../,HREF="http://www.tldp.org/,' \
$(HTML_BUILD)/HOWTO-INDEX/*.html
# The HTML version of this HOWTO contains sample i386-only binaries.
# Removed for now.
rm -rf $(HTML_BUILD)/RedHat-CD-HOWTO*
endif
chmod +x debian/html2docs # diffs don't preserve permissions
debian/html2docs $(SOURCE)-html HOWTO HOWTO \
$(DHELPOUT) debian/$(SOURCE)-html.menu \
$(HTML_BUILD) \
$(HTML_BUILD)/HOWTO-INDEX/howtos.html
ifeq ($(SOURCE),doc-linux-nonfree)
rm -rf $(HTML_BUILD)/HOWTO-INDEX*
endif
# install -m 644 xml/$(SOURCE).omf \
# $(R)/usr/share/omf/$(SOURCE)-html/HOWTOs.omf
ifeq ($(SOURCE),doc-linux)
cp -a HOWTO/extra $(HTML_BUILD)
find $(HTML_BUILD)/extra -name \*.txt | xargs rm -f
tar -C $(R)/usr/share/doc/FAQ -xzvf FAQ/Linux-FAQ.html.tar.gz
ln -s ../FAQ $(R)/usr/share/doc/$(SOURCE)-html/FAQ
install -m 644 debian/doc-linux-html.doc-base.faq \
$(R)/usr/share/doc-base/linux-faq
install -m 644 debian/doc-linux-html.doc-base.howtos \
$(R)/usr/share/doc-base/linux-howtos
endif
dh_installdocs
dh_installchangelogs
gzip -9 $(R)/usr/share/doc/$(SOURCE)-html/changelog.Debian
ln -s ../HOWTO/en-html $(R)/usr/share/doc/$(SOURCE)-html/HOWTO
dh_installmenu
if test -f debian/$(SOURCE)-html.overrides; then \
install -m644 debian/$(SOURCE)-html.overrides \
$(R)/usr/share/lintian/overrides/$(SOURCE)-html; \
fi
binary-$(SOURCE)-text: DH_OPTIONS=-p$(SOURCE)-text
binary-$(SOURCE)-text: build
dh_testdir
dh_testroot
dh_clean -d
dh_installdirs
$(BZTAR) -C $(TEXT_BUILD) -xf HOWTO/Linux-HOWTOs.tar.bz2
ifeq ($(SOURCE),doc-linux)
rm -f $(TEXT_BUILD)/COPYRIGHT
mkdir $(TEXT_BUILD)/extra
set -e; for x in `find HOWTO/extra -name \*.txt -printf '%P\n'`; do \
name=`dirname $$x`; \
if [ -e $(TEXT_BUILD)/extra/$$name ]; then \
echo "WARNING: Multiple text documents for $$name!"; \
fi; \
install -m 644 HOWTO/extra/$$x $(TEXT_BUILD)/extra/$$name; \
done
install -m 644 FAQ/Linux-FAQ $(R2)/usr/share/doc/FAQ
ln -s ../FAQ $(R2)/usr/share/doc/$(SOURCE)-text/FAQ
else
rm -f $(TEXT_BUILD)/HOWTO-INDEX
endif
# removes escape sequences from HOWTOs. While they may enhance the display
# for some users they also cause problems for others (Bug#324453)
find $(TEXT_BUILD) -type f | xargs grep -l "\[[0-9]\+m" | xargs -r sed -i -e 's/\[[0-9]\+m//g'
ifeq ($(SOURCE),doc-linux)
find $(TEXT_BUILD) $(R2)/usr/share/doc/FAQ -type f | xargs gzip -9
else
find $(TEXT_BUILD) -type f | xargs gzip -9
endif
dh_installdocs
dh_installchangelogs
gzip -9 $(R2)/usr/share/doc/$(SOURCE)-text/changelog.Debian
ln -s ../HOWTO/en-txt $(R2)/usr/share/doc/$(SOURCE)-text/HOWTO
binary-arch:
# Makes a binary package.
binary-indep: DH_OPTIONS=-i
binary-indep: binary-$(SOURCE)-html binary-$(SOURCE)-text
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: refresh refresh-howto-docbook refresh-howto-html refresh-howto-text
.PHONY: refresh-faq refresh-xml clean orig
.PHONY: binary-$(SOURCE)-html binary-$(SOURCE)-text
.PHONY: binary-arch binary-indep binary
|