[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Package builds when depending a specific locale



On Sat, Apr 26, 2008 at 02:24:03PM +0300, Murat Demirten wrote:
> I've a problem with manpages-tr package build process. It is binary
> independent package, basically contains man pages.
> 
> But package author uses a different aproach to build man pages from xml
> sources. There is an xml2man.c which used on build process
> to obtain man pages. And this utility can not be run properly if tr_TR.UTF-8
> locale does not exist at build system. This breaks our automatic
> rebuild systems, so how can we address this problem? Any ideas..

You can do the following:
1. build-depend on "locales"
2. put the "locale-gen" script I attached into debian/locale-gen
   (changing en_US.UTF-8 to tr_TR.UTF-8 in your case)
3. in debian/rules:

manpages:
	sh debian/locale-gen
	LOCPATH=$(CURDIR)/locales $(MAKE) manpages

The idea is not mine, but I don't remember whose anymore :(.  But hey, it
works for me.

-- 
1KB		// Microsoft corollary to Hanlon's razor:
		//	Never attribute to stupidity what can be
		//	adequately explained by malice.
#!/bin/sh

LOCPATH=`pwd`/locales
export LOCPATH

[ -d $LOCPATH ] || mkdir -p $LOCPATH

umask 022

echo "Generating locales..."
while read locale charset; do
	case $locale in \#*) continue;; esac
	[ -n "$locale" -a -n "$charset" ] || continue
	echo -n "  `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"
	echo -n ".$charset"
	echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`
	echo -n '...'
	if [ -f $LOCPATH/$locale ]; then
	    input=$locale
	else
	    input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`
	fi
	localedef -i $input -c -f $charset $LOCPATH/$locale #-A /etc/locale.alias
	echo ' done'; \
done <<EOF
# Put the list of locales you need here:
en_US.UTF-8		UTF-8
EOF

echo "Generation complete."

Reply to: