3 # Copyright (C) 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
5 # This file is free software; as a special exception the author gives
6 # unlimited permission to copy and/or distribute it, with or without
7 # modifications, as long as this notice is preserved.
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 tmp
="`echo $0 | sed 's,.*gnupg-\([^/]*\)/.*,\1,'`"
21 if [ -f "../gnupg-$tmp/README" ]; then
22 srcdir
="../gnupg-$tmp"
23 bindir
="../gnupg-$tmp"
25 elif [ -f ..
/README
]; then
27 elif [ -f ..
/..
/README
]; then
30 elif [ -f ..
/..
/gnupg-stable
/README
]; then
31 srcdir
=..
/..
/gnupg-stable
32 elif [ -f ..
/..
/..
/gnupg-stable
/README
]; then
33 srcdir
=..
/..
/..
/gnupg-stable
35 echo "cannot figure out the source dir" >&2
39 # Windows uses an internal build number. We use the last day of the
40 # year concatenated with the hour. for it. If it happens that a new
41 # release of the same version is to be made in the next year, the
42 # build number must be given manually by adding the appropriate number
44 if [ "$1" = "--build-number" -a -n "$2" ]; then
49 build_number
=$
(date -u '+%j%k' |
sed 's/^0*\(.*\)/\1/')
53 if i586-mingw32msvc-strip
--version >/dev
/null
2>&1 ; then
54 STRIP
=i586-mingw32msvc-strip
59 # If we don't have an installer we don't need to prepare for it.
60 if ! makensis
-version >/dev
/null
2>&1 ; then
65 # A function to return a plain ASCII (or Latin-1) encoded description
66 # text for a language identifier. We need this to display the list of
67 # available languages in the installer. NSIS does not support utf-8
68 # so we need to standardize on one character set. Note that this
69 # script itself is written in utf-8 but the resulting file will get
70 # converted to Latin-1
73 be
) r
="Belarusian"; ;;
79 en|en@
*) r
="English"; ;;
82 et
) r
="Eesti keel"; ;;
87 id
) r
="Indonesian"; ;;
92 pt_BR
) r
="Português (do Brasil)"; ;;
98 zh_CN
) r
="Chinese (simplified)"; ;;
99 zh_TW
) r
="Chinese (traditional)"; ;;
107 # Figure out the version
108 version
=$
(sed -n 's/^#[ ]*define[ ][ ]*VERSION[ ][ ]*\"\([0-9.a-z-]*\)\"/\1/p' $bindir/config.h
)
109 prod_version
=$
(echo "$version"|
awk -F'[^0-9]' '{print $1 "." $2 "." $3 }')
110 prod_version
="${prod_version}.${build_number}"
111 echo "building version $version ($prod_version)"
113 rm * >/dev
/null
2>/dev
/null || true
115 cp ${bindir}/g10
/gpg.exe gpg.exe
117 cp ${bindir}/g10
/gpgv.exe gpgv.exe
119 for name
in hkp curl ldap
finger; do
120 cp ${bindir}/keyserver
/gpgkeys_
$name.exe gpgkeys_
$name.exe
121 $STRIP gpgkeys_
$name.exe
123 cp ${bindir}/tools
/gpgsplit.exe gpgsplit.exe
127 cp ${bindir}/doc
/$i $i.txt
130 man
-Tlatin1 -l ${srcdir}/doc
/gpg
.1 |
sed `printf "s/\b.//g"` >gpg.man
132 man
-Tlatin1 -l ${srcdir}/doc
/gpgv
.1 |
sed `printf "s/\b.//g"` >gpgv.man
134 man
-Tlatin1 -l ${srcdir}/doc
/gnupg
.7 |
sed `printf "s/\b.//g"` >gnupg.man
136 for i
in README COPYING NEWS
; do
137 cp ${srcdir}/$i $i.txt
141 cp ${srcdir}/doc
/README.W32 README-W32.txt
145 for i
in `find "$topdir/patches" -type f -name '*.diff'`; do
147 patches_defs
="-DWITH_PATCHES"
151 # We must distribute the MO files in UTF-8, the conversion is done by
152 # gpg at runtime. To include English at the right position in the list we
153 # need a special case.
156 for i
in `(ls ${srcdir}/po/*.po; echo ${srcdir}/po/en.po) | sort`; do
157 lang
=$
(basename $i .po
)
158 if [ $lang != "en" ]; then
159 grep -s $lang ${srcdir}/po
/LINGUAS
>/dev
/null ||
continue
160 [ -f$lang.mo
-a $lang.mo
-nt $i ] && continue
162 fromset
=`sed -n '/^"Content-Type:/ s/.*charset=\([a-zA-Z0-9_-]*\).*/\1/p' $i`
164 utf8|utf-8|UTF8|UTF-8
)
165 echo "$lang: keeping $fromset" >&2
166 msgfmt
--output-file=$lang.mo
$i
169 echo "$lang: converting from $fromset to utf-8" >&2
170 iconv --silent --from-code=$fromset --to-code=utf-8
< $i | \
171 sed "/^\"Content-Type:/ s/charset=[a-zA-Z0-9_-]*/charset=utf-8/"|\
172 msgfmt
--output-file=$lang.mo
-
176 langlist
="$langlist $lang"
177 langname
="`get_langname $lang`"
178 [ -n "$langdesclist" ] && langdesclist
="${langdesclist}|"
179 langdesclist
="${langdesclist}${lang} - ${langname}"
183 # Create the option file for use with the NSIS installer.
184 cat <<EOF | iconv --silent --from-code=utf-8 --to-code=latin1 >opt.ini
194 ListItems="$langdesclist"
198 # If we have a topdir, assume the full build environment and
199 # prepare the installer
200 if [ -n "$topdir" ]; then
203 buildinfo
="`date -u '+%Y-%m-%d %H:%M UTC'`"
205 # iconv.dll is a hard requirement
206 if [ ! -f "$topdir/iconv/iconv.dll" ]; then
207 echo "iconv.dll not available" >&2
210 ln "$topdir/iconv/iconv.dll" iconv.dll
211 for i
in COPYING.LIB README.
iconv; do
212 cp ${topdir}/iconv
/$i $i.txt
217 if [ -f "$topdir/winpt/WinPT.exe" ]; then
218 ln "$topdir/winpt/WinPT.exe" WinPT.exe
219 ln "$topdir/winpt/PTD.dll" PTD.dll
220 cp "$topdir/winpt/README-0.9.txt" README.winpt.txt
221 cp "$topdir/winpt/NEWS-0.9.txt" NEWS.winpt.txt
222 cp "$topdir/winpt/keyserver.conf" keyserver.conf
223 winpt_defs
="-DWITH_WINPT"
226 # See whether we should include the source and figure out the
227 # version numbers of the source files.
228 if [ -d "$topdir/tarballs" ]; then
232 for i
in `find "$topdir/tarballs" -type f -name '*.tar.gz'`; do
233 fname
=$
(basename "$i" .gz
)
237 tmp
=$
(echo "$fname" | \
238 sed -n 's/^[^-]*-\([0-9.a-z-]*\)\.tar$/\1/p')
239 echo "gnupg source version is $tmp" >&2
240 if [ "$version" != "$tmp" ]; then
241 echo "gnupg source version does not match" >&2
247 tmp
=$
(echo "$fname" | \
248 sed -n 's/^[^-]*-\([0-9.a-z-]*\)\.tar$/\1/p')
249 echo "libiconv source version is $tmp" >&2
250 src_defs
="$src_defs -DLIBICONV_VERSION=$tmp"
251 have_libiconv_src
=yes
254 tmp
=$
(echo "$fname" | \
255 sed -n 's/^[^-]*-\([0-9.a-z-]*\)\.tar$/\1/p')
256 echo "winpt source version is $tmp" >&2
257 src_defs
="$src_defs -DWINPT_VERSION=$tmp"
262 echo "WARNING: unknown source file $fname ignored" >&2
266 if [ -n "$src_defs" ]; then
267 if [ $have_gnupg_src = "no" ]; then
268 echo "gnupg source missing" >&2
271 if [ $have_libiconv_src = "no" ]; then
272 echo "libiconv source missing" >&2
275 if [ -n "$winpt_defs" ]; then
276 if [ $have_winpt_src = "no" ]; then
277 echo "winpt source missing" >&2
282 src_defs
="$src_defs -DWITH_SOURCE"
287 # Now run the installer
288 echo "invoking installer as:"
289 echo makensis
-v0 -nocd -DVERSION="${version}" \
290 -DPROD_VERSION="${prod_version}" \
291 -DGNUPG_SRCDIR="${srcdir}" ${winpt_defs} ${src_defs} \
292 ${patches_defs} ${srcdir}/scripts/w32installer.nsi
293 BUILDINFO=$buildinfo makensis -v0 -nocd -DVERSION="${version}" \
294 -DPROD_VERSION="${prod_version}" \
295 -DGNUPG_SRCDIR="${srcdir}" ${winpt_defs} ${src_defs} \
296 ${patches_defs} ${srcdir}/scripts
/w32installer.nsi
297 echo "Installer created" >&2
299 zip -9 "gnupg-w32cli-${version}.zip" *
300 echo "ZIP archive created" >&2