| 1 | ############################ -*- Mode: Makefile -*- ########################### |
| 2 | ## debconf.mk --- |
| 3 | ## Author : Manoj Srivastava ( [email protected] ) |
| 4 | ## Created On : Fri Mar 12 11:11:31 2004 |
| 5 | ## Created On Node : glaurung.internal.golden-gryphon.com |
| 6 | ## Last Modified By : Manoj Srivastava |
| 7 | ## Last Modified On : Mon Apr 11 13:19:10 2005 |
| 8 | ## Last Machine Used: glaurung.internal.golden-gryphon.com |
| 9 | ## Update Count : 20 |
| 10 | ## Status : Unknown, Use with caution! |
| 11 | ## HISTORY : |
| 12 | ## Description : helps with using debconf |
| 13 | ## |
| 14 | ## arch-tag: 32b933a9-05ad-4c03-97a8-8644745b832a |
| 15 | ## |
| 16 | ############################################################################### |
| 17 | |
| 18 | # The idea behind this scheme is that the maintainer (or whoever's |
| 19 | # building the package for upload to unstable) has to build on a |
| 20 | # machine with po-debconf installed, but nobody else does. |
| 21 | |
| 22 | # When building with po-debconf, a format 1 (no encoding specifications, |
| 23 | # woody-compatible) debian/templates file is generated in the clean target |
| 24 | # and shipped in the source package, but a format 2 (UTF8-encoded, |
| 25 | # woody-incompatible) debian/templates file is generated in binary-arch |
| 26 | # for the binary package only. |
| 27 | |
| 28 | # When building without po-debconf, the binary package simply reuses the |
| 29 | # woody-compatible debian/templates file that was produced by the clean |
| 30 | # target of the maintainer's build. |
| 31 | |
| 32 | # Also, make sure that debian/control has ${debconf-depends} in the |
| 33 | # appropriate Depends: line., and use the following in the binary |
| 34 | # target: |
| 35 | # dpkg-gencontrol -V'debconf-depends=debconf (>= $(MINDEBCONFVER))' |
| 36 | # |
| 37 | |
| 38 | # WARNING!! You need to create the templates.master file before this all works. |
| 39 | |
| 40 | ifeq (,$(wildcard /usr/bin/po2debconf)) |
| 41 | PO2DEBCONF := no |
| 42 | MINDEBCONFVER := 0.5 |
| 43 | else |
| 44 | PO2DEBCONF := yes |
| 45 | MINDEBCONFVER := 1.2.0 |
| 46 | endif |
| 47 | |
| 48 | |
| 49 | # Hack for woody compatibility. This makes sure that the |
| 50 | # debian/templates file shipped in the source package doesn't specify |
| 51 | # encodings, which woody's debconf can't handle. If building on a |
| 52 | # system with po-debconf installed the binary-arch target will |
| 53 | # generate a better version for sarge. Only do this if there is a |
| 54 | # templates.master, or else the debian/templates file can get |
| 55 | # damamged. |
| 56 | ifeq ($(PO2DEBCONF),yes) |
| 57 | ifeq (,$(wildcard debian/templates.master)) |
| 58 | define CREATE_COMPATIBLE_TEMPLATE |
| 59 | echo Not modifying templates |
| 60 | endef |
| 61 | else |
| 62 | define CREATE_COMPATIBLE_TEMPLATE |
| 63 | echo 1 > debian/po/output |
| 64 | po2debconf debian/templates.master > debian/templates |
| 65 | rm -f debian/po/output |
| 66 | endef |
| 67 | endif |
| 68 | else |
| 69 | define CREATE_COMPATIBLE_TEMPLATE |
| 70 | echo Not modifying templates |
| 71 | endef |
| 72 | endif |
| 73 | |
| 74 | |
| 75 | ifeq ($(PO2DEBCONF),yes) |
| 76 | ifeq (,$(wildcard debian/templates.master)) |
| 77 | define INSTALL_TEMPLATE |
| 78 | echo using old template |
| 79 | endef |
| 80 | else |
| 81 | define INSTALL_TEMPLATE |
| 82 | po2debconf debian/templates.master > debian/templates |
| 83 | endef |
| 84 | endif |
| 85 | else |
| 86 | define INSTALL_TEMPLATE |
| 87 | echo using old template |
| 88 | endef |
| 89 | endif |
| 90 | |
| 91 | # the tool podebconf-report-po is also a great friend to have in such |
| 92 | # circumstances |
| 93 | define CHECKPO |
| 94 | @for i in debian/po/*.po; do \ |
| 95 | if [ -f $$i ]; then \ |
| 96 | echo \"Checking: $$i\"; \ |
| 97 | msgmerge -U $$i debian/po/templates.pot; \ |
| 98 | msgfmt -o /dev/null -c --statistics $$i; \ |
| 99 | fi; \ |
| 100 | done |
| 101 | endef |