mbrola-voice-package-generate 6.18 KB
Newer Older
1 2 3 4
#!/bin/bash

shopt -s nocaseglob nullglob

5
me="Samuel Thibault <sthibault@debian.org>"
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

debug() {
	:
	echo "$@"
}

if [ "$#" -lt 4 ]
then
	echo "Usage: $0 code version language locale"
	echo "for instance, $0 ca1 0.1 \"Canadian French\" fr_CA"
	exit 1
fi

code="$1"
version="$2"
language="$3"
language="$(echo $language | sed -e 's/^\(.\)/\u\1/')"
locale="$4"
locale_lang="${locale/%_*/}"
locale_territory=
[ -z "${locale/*_*}" ] && locale_territory="${locale/#*_/}"
territory="$(echo $locale_territory | tr 'A-Z' 'a-z')"
a_language="a $language"
case $language in
	A*|E*|I*|O*)
		a_language="an $language"
esac

debug "code=\"$code\""
debug "version=\"$version\""
debug "language=\"$language\""
debug "locale=\"$locale\""
debug "lang=\"$locale_lang\""
debug "territory=\"$territory\""
debug "a language=\"$a_language\""

#
#
debug \# Check the cwd
#
#

license=
[ -r license.txt ] && license=license.txt
[ -r licence.txt ] && license=licence.txt
if [ -z "$license" ]
then
	echo "missing license file, are you within the unzipped archive?"
	exit 1
fi

#
#
debug \# check voice file
#
#

voice=
[ -r "$code" ] && voice="$code"
if [ -z "$voice" ];
then
	echo "Could not find voice"
	exit 1
fi

#
#
debug \# check help file
#
#

help=
[ -r "$code.txt" ] && help="$code.txt"
[ -r "$code.info" ] && help="$code.info"
try=$(echo $code | tr 'a-z' 'A-Z')
[ -r "$try.txt" ] && help="$try.txt"
[ -r "$try.info" ] && help="$try.info"
try=$(echo $code | sed -e 's/^\(.\)/\u\1/')
[ -r "$try.txt" ] && help="$try.txt"
[ -r "$try.info" ] && help="$try.info"
if [ -z "$help" ];
then
	echo "Could not find help file"
	exit 1
fi
debug "help=\"$help\""

#
#
debug \# detect gender
#
#
gender=male
grep -q -i female $help && gender=female
debug "gender=\"$gender\""

#
#
debug \# Look for a test
#
#

testdir=
[ -d "TEST" ] && testdir="TEST"
110
[ -d "TEST1" ] && testdir="TEST1"
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
[ -d "test" ] && testdir="test"
[ -d "Test" ] && testdir="Test"
if [ -z "$testdir" ];
then
	echo "Could not find testdir"
	exit 1
fi
debug "testdir=\"$testdir\""
cd "$testdir"
testpho=$(ls -S *.pho *.Pho *.PHO | head -n 1)
cd - > /dev/null
if [ -z "$testpho" ];
then
	echo "Could not find phoneme test file"
	exit 1
fi
debug "testpho=\"$testpho\""

#
#
debug \# Try it
mbrola -e $voice $testdir/$testpho -.au | play -t .au - &
#
#

#
#
debug \# Ok, go !
#
#

tar czf ../mbrola-${code}_$version.orig.tar.gz --exclude=debian --transform "s/^\./mbrola-$code-$version/" .

mkdir -p debian
cat > debian/changelog << EOF
mbrola-$code ($version-1) UNRELEASED; urgency=low

  * Initial release (Closes: #XXX).

 -- $me  $(date -R)
EOF

cat > debian/compat << EOF
154
7
155 156 157 158 159 160 161 162 163 164
EOF

provides="mbrola-voice-$locale_lang, mbrola-voice"
[ -n "$territory" ] && provides="mbrola-voice-$locale_lang-$territory, $provides"

cat > debian/control << EOF
Source: mbrola-$code
Section: non-free/sound
Priority: optional
Maintainer: $me
165
Build-Depends: debhelper (>= 7)
166
Standards-Version: 3.9.3
167 168 169 170
Homepage: http://tcts.fpms.ac.be/synthesis/

Package: mbrola-$code
Architecture: all
171
Depends: \${misc:Depends}, mbrola
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
Provides: $provides
Description: $language $gender voice for Mbrola
 This package contains $a_language diphone database provided in the context
 of the MBROLA project see: http://tcts.fpms.ac.be/synthesis/
 .
 It provides $a_language $gender voice to be used with the MBROLA program.
EOF

cat > debian/copyright << EOF
This package was debianized by $me
on $(date -R), based on the packageing from the Oralux
distribution (Igor B. Poretsky <master@goga.energo.ru> and Gilles Casse
<gcasse@oralux.org>)

It was downloaded from http://tcts.fpms.ac.be/synthesis/

Upstream Author: Faculte Polytechnique de  Mons  -  mbrola team <mbrola@tcts.fpm
s.ac.be>

Copyright:
Copyright (C) 1996-2008  Faculte Polytechnique de  Mons  -  mbrola team <mbrola@tcts.fpms.ac.be>

$(tr -d '
' < $license | iconv -f latin1 -t utf-8)
EOF

cat > debian/docs << EOF
$help
EOF

[ -r sampa.txt ] && echo sampa.txt >> debian/docs
[ -r label.txt ] && echo label.txt >> debian/docs

cat > debian/examples << EOF
$testdir/*
EOF

cat > debian/README.Debian << EOF
mbrola-$code for Debian
---------------------

212
This package installs the diphone database into /usr/share/mbrola/$code/$code .
213 214 215 216
All examples go to /usr/share/doc/mbrola-$code/examples .

You can test your installation by running:

217
mbrola /usr/share/mbrola/$code/$code /usr/share/doc/mbrola-$code/examples/$testpho ${testpho/.pho}.wav
218 219 220 221 222

which will create ${testpho/.pho}.wav in the current directory.

If you have Sox installed, you can run:

223
mbrola /usr/share/mbrola/$code/$code /usr/share/doc/mbrola-$code/examples/$testpho -.au | play -t .au -
224 225 226 227 228 229 230 231 232 233

to play it on the fly.

 -- $me  $(date -R)
EOF

cat > debian/rules << EOF
#!/usr/bin/make -f

build:
234 235
build-indep:
build-arch:
236 237 238 239 240 241 242

binary-arch:

binary-indep:
	dh_testdir
	dh_testroot
	dh_prep
243
	dh_install $code usr/share/mbrola/$code
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
	dh_installdocs
	dh_installchangelogs
	dh_installexamples
	dh_compress -X.pho
	dh_fixperms
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep

clean:
	dh_testdir
	dh_clean
EOF
259
chmod +x debian/rules
260 261

cat > ../ITP-mbrola-$code << EOF
262 263
From: $me
To: Debian Bug Tracking System <submit@bugs.debian.org>
264
Subject: ITP: mbrola-$code -- $language $gender voice for Mbrola
265 266
X-Debbugs-Cc: debian-devel@lists.debian.org
X-Debbugs-Cc: debian-accessibility@lists.debian.org
267 268 269 270

Package: wnpp
Version: N/A; reported $(date +%Y-%m-%d)
Severity: wishlist
271
Owner: $me
272 273

* Package name    : mbrola-$code
274
  Version         : $version
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
  Upstream Author : Faculte Polytechnique de  Mons  -  mbrola team <mbrola@tcts.fpms.ac.be> 
* URL             : http://tcts.fpms.ac.be/synthesis
* License         : see the file readme.txt in the source zip: non-free as in
                    without source code, and for non-commercial, non-military
                    purposes, with and only with the mbrola package made
                    available by the author.
  Description     : $language $gender voice for Mbrola
 This package contains $a_language diphone database provided in the context
 of the MBROLA project see: http://tcts.fpms.ac.be/synthesis/
 .
 It provides $a_language $gender voice to be used with the MBROLA
 program.
EOF

wait
echo Warning: check that the gender was really $gender, or check on http://tcts.fpms.ac.be/synthesis/mbrola/mbrcopybin.html as the readme is sometimes bogus