2002-06-29 15:46:34 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2005-01-26 18:44:48 +01:00
|
|
|
# Copyright (C) 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
|
2002-06-29 15:46:34 +02:00
|
|
|
#
|
|
|
|
# This file is free software; as a special exception the author gives
|
|
|
|
# unlimited permission to copy and/or distribute it, with or without
|
|
|
|
# modifications, as long as this notice is preserved.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful, but
|
|
|
|
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
cd dist-w32
|
|
|
|
|
2005-01-26 18:44:48 +01:00
|
|
|
tmp="`echo $0 | sed 's,.*gnupg-\([^/]*\)/.*,\1,'`"
|
|
|
|
|
|
|
|
topdir=
|
2002-06-30 09:39:53 +02:00
|
|
|
bindir=..
|
|
|
|
|
2005-01-26 18:44:48 +01:00
|
|
|
if [ -f "../gnupg-$tmp/README" ]; then
|
|
|
|
srcdir="../gnupg-$tmp"
|
|
|
|
bindir="../gnupg-$tmp"
|
|
|
|
topdir=".."
|
|
|
|
elif [ -f ../README ]; then
|
2002-06-29 15:46:34 +02:00
|
|
|
srcdir=..
|
2002-06-30 09:39:53 +02:00
|
|
|
elif [ -f ../../README ]; then
|
|
|
|
srcdir=../..
|
|
|
|
bindir=..
|
2002-06-29 15:46:34 +02:00
|
|
|
elif [ -f ../../gnupg-stable/README ]; then
|
|
|
|
srcdir=../../gnupg-stable
|
|
|
|
elif [ -f ../../../gnupg-stable/README ]; then
|
|
|
|
srcdir=../../../gnupg-stable
|
|
|
|
else
|
|
|
|
echo "cannot figure out the source dir" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2005-03-30 16:23:01 +02:00
|
|
|
# Windows uses an internal build number. We use the last day of the
|
|
|
|
# year concatenated with the hour. for it. If it happens that a new
|
|
|
|
# release of the same version is to be made in the next year, the
|
|
|
|
# build number must be given manually by adding the appropriate number
|
|
|
|
# of days.
|
|
|
|
if [ "$1" = "--build-number" -a -n "$2" ]; then
|
|
|
|
build_number="$2"
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
else
|
|
|
|
build_number=$(date -u '+%j%k' | sed 's/^0*\(.*\)/\1/')
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2004-10-27 18:32:51 +02:00
|
|
|
if i586-mingw32msvc-strip --version >/dev/null 2>&1 ; then
|
|
|
|
STRIP=i586-mingw32msvc-strip
|
|
|
|
else
|
|
|
|
STRIP="mingw32 strip"
|
|
|
|
fi
|
|
|
|
|
2005-01-26 18:44:48 +01:00
|
|
|
# If we don't have an installer we don't need to prepare for it.
|
|
|
|
if ! makensis -version >/dev/null 2>&1 ; then
|
|
|
|
topdir=
|
|
|
|
fi
|
2004-10-27 18:32:51 +02:00
|
|
|
|
2005-02-16 14:27:57 +01:00
|
|
|
|
|
|
|
# A function to return a plain ASCII (or Latin-1) encoded description
|
|
|
|
# text for a language identifier. We need this to display the list of
|
|
|
|
# available languages in the installer. NSIS does not support utf-8
|
|
|
|
# so we need to standardize on one character set. Note that this
|
|
|
|
# script itself is written in utf-8 but the resulting file will get
|
|
|
|
# converted to Latin-1
|
|
|
|
get_langname () {
|
|
|
|
case "$1" in
|
|
|
|
be) r="Belarusian"; ;;
|
|
|
|
ca) r="Català"; ;;
|
|
|
|
cs) r="Cesky"; ;;
|
|
|
|
da) r="Danish"; ;;
|
|
|
|
de) r="Deutsch"; ;;
|
|
|
|
el) r="Greek"; ;;
|
|
|
|
en|en@*) r="English"; ;;
|
|
|
|
eo) r="Esperanto"; ;;
|
|
|
|
es) r="Español"; ;;
|
|
|
|
et) r="Eesti keel"; ;;
|
|
|
|
fi) r="Suomi"; ;;
|
|
|
|
fr) r="Français"; ;;
|
|
|
|
gl) r="Galician"; ;;
|
|
|
|
hu) r="Magyar"; ;;
|
|
|
|
id) r="Indonesian"; ;;
|
|
|
|
it) r="Italiano"; ;;
|
|
|
|
ja) r="Japanese"; ;;
|
|
|
|
pl) r="Polski"; ;;
|
|
|
|
pt) r="Português"; ;;
|
|
|
|
pt_BR) r="Português (do Brasil)"; ;;
|
|
|
|
ro) r="Romana"; ;;
|
|
|
|
ru) r="Russian"; ;;
|
|
|
|
sk) r="Slovensky"; ;;
|
|
|
|
sv) r="Svenska"; ;;
|
|
|
|
tr) r="Türkçe"; ;;
|
|
|
|
zh_CN) r="Chinese (simplified)"; ;;
|
|
|
|
zh_TW) r="Chinese (traditional)"; ;;
|
|
|
|
|
|
|
|
*) r="" ;;
|
|
|
|
esac
|
|
|
|
echo "$r"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-26 18:44:48 +01:00
|
|
|
# Figure out the version
|
2004-10-27 18:32:51 +02:00
|
|
|
version=$(sed -n 's/^#[ ]*define[ ][ ]*VERSION[ ][ ]*\"\([0-9.a-z-]*\)\"/\1/p' $bindir/config.h)
|
2005-03-30 16:23:01 +02:00
|
|
|
prod_version=$(echo "$version"|awk -F'[^0-9]' '{print $1 "." $2 "." $3 }')
|
|
|
|
prod_version="${prod_version}.${build_number}"
|
2005-01-17 11:19:57 +01:00
|
|
|
echo "building version $version ($prod_version)"
|
2002-06-30 09:39:53 +02:00
|
|
|
|
2005-01-11 13:03:22 +01:00
|
|
|
rm * >/dev/null 2>/dev/null || true
|
2002-09-02 15:44:29 +02:00
|
|
|
|
|
|
|
cp ${bindir}/g10/gpg.exe gpg.exe
|
2004-10-27 18:32:51 +02:00
|
|
|
$STRIP gpg.exe
|
2002-09-02 15:44:29 +02:00
|
|
|
cp ${bindir}/g10/gpgv.exe gpgv.exe
|
2004-10-27 18:32:51 +02:00
|
|
|
$STRIP gpgv.exe
|
2004-10-28 11:06:50 +02:00
|
|
|
for name in hkp http ldap finger; do
|
2004-10-27 18:32:51 +02:00
|
|
|
cp ${bindir}/keyserver/gpgkeys_$name.exe gpgkeys_$name.exe
|
|
|
|
$STRIP gpgkeys_$name.exe
|
|
|
|
done
|
2002-09-02 15:44:29 +02:00
|
|
|
cp ${bindir}/tools/gpgsplit.exe gpgsplit.exe
|
2004-10-27 18:32:51 +02:00
|
|
|
$STRIP gpgsplit.exe
|
2002-09-02 15:44:29 +02:00
|
|
|
|
|
|
|
for i in FAQ; do
|
2005-01-11 13:03:22 +01:00
|
|
|
cp ${bindir}/doc/$i $i.txt
|
|
|
|
todos $i.txt
|
2002-09-02 15:44:29 +02:00
|
|
|
done
|
|
|
|
man -Tlatin1 -l ${srcdir}/doc/gpg.1 | sed `printf "s/\b.//g"` >gpg.man
|
2002-06-29 15:46:34 +02:00
|
|
|
todos gpg.man
|
2002-09-02 15:44:29 +02:00
|
|
|
man -Tlatin1 -l ${srcdir}/doc/gpgv.1 | sed `printf "s/\b.//g"` >gpgv.man
|
|
|
|
todos gpgv.man
|
|
|
|
man -Tlatin1 -l ${srcdir}/doc/gnupg.7 | sed `printf "s/\b.//g"` >gnupg.man
|
|
|
|
todos gnupg.man
|
2005-01-11 13:03:22 +01:00
|
|
|
for i in README COPYING NEWS; do
|
|
|
|
cp ${srcdir}/$i $i.txt
|
|
|
|
todos $i.txt
|
2002-09-02 15:44:29 +02:00
|
|
|
done
|
2005-03-14 20:19:21 +01:00
|
|
|
|
|
|
|
cp ${srcdir}/doc/README.W32 README-W32.txt
|
|
|
|
todos README-W32.txt
|
|
|
|
|
|
|
|
patches_defs=
|
|
|
|
for i in `find "$topdir/patches" -type f -name '*.diff'`; do
|
|
|
|
cp $i .
|
|
|
|
patches_defs="-DWITH_PATCHES"
|
2002-09-02 15:44:29 +02:00
|
|
|
done
|
|
|
|
|
2005-03-14 20:19:21 +01:00
|
|
|
|
2005-01-11 13:03:22 +01:00
|
|
|
# We must distribute the MO files in UTF-8, the conversion is done by
|
2005-02-16 14:27:57 +01:00
|
|
|
# gpg at runtime. To include English at the right position in the list we
|
|
|
|
# need a special case.
|
|
|
|
langlist=""
|
|
|
|
langdesclist=""
|
|
|
|
for i in `(ls ${srcdir}/po/*.po; echo ${srcdir}/po/en.po) | sort`; do
|
2002-09-11 14:56:56 +02:00
|
|
|
lang=$(basename $i .po)
|
2005-02-16 14:27:57 +01:00
|
|
|
if [ $lang != "en" ]; then
|
|
|
|
grep -s $lang ${srcdir}/po/LINGUAS >/dev/null || continue
|
|
|
|
[ -f$lang.mo -a $lang.mo -nt $i ] && continue
|
|
|
|
|
|
|
|
fromset=`sed -n '/^"Content-Type:/ s/.*charset=\([a-zA-Z0-9_-]*\).*/\1/p' $i`
|
|
|
|
case "$fromset" in
|
|
|
|
utf8|utf-8|UTF8|UTF-8)
|
|
|
|
echo "$lang: keeping $fromset" >&2
|
|
|
|
msgfmt --output-file=$lang.mo $i
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "$lang: converting from $fromset to utf-8" >&2
|
|
|
|
iconv --silent --from-code=$fromset --to-code=utf-8 < $i | \
|
|
|
|
sed "/^\"Content-Type:/ s/charset=[a-zA-Z0-9_-]*/charset=utf-8/"|\
|
|
|
|
msgfmt --output-file=$lang.mo -
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
langlist="$langlist $lang"
|
|
|
|
langname="`get_langname $lang`"
|
|
|
|
[ -n "$langdesclist" ] && langdesclist="${langdesclist}|"
|
|
|
|
langdesclist="${langdesclist}${lang} - ${langname}"
|
2002-09-11 14:56:56 +02:00
|
|
|
done
|
2005-01-17 11:19:57 +01:00
|
|
|
|
2005-02-16 14:27:57 +01:00
|
|
|
|
|
|
|
# Create the option file for use with the NSIS installer.
|
|
|
|
cat <<EOF | iconv --silent --from-code=utf-8 --to-code=latin1 >opt.ini
|
|
|
|
[Settings]
|
|
|
|
NumFields=1
|
|
|
|
|
|
|
|
[Field 1]
|
|
|
|
Type=DropList
|
|
|
|
Left=0
|
|
|
|
Right=130
|
|
|
|
Top=20
|
|
|
|
Bottom=100
|
|
|
|
ListItems="$langdesclist"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
2005-01-26 18:44:48 +01:00
|
|
|
# If we have a topdir, assume the full build environment and
|
|
|
|
# prepare the installer
|
|
|
|
if [ -n "$topdir" ]; then
|
|
|
|
winpt_defs=
|
|
|
|
src_defs=
|
|
|
|
buildinfo="`date -u '+%Y-%m-%d %H:%M UTC'`"
|
|
|
|
|
|
|
|
# iconv.dll is a hard requirement
|
|
|
|
if [ ! -f "$topdir/iconv/iconv.dll" ]; then
|
2005-03-30 16:23:01 +02:00
|
|
|
echo "iconv.dll not available" >&2
|
2005-01-26 18:44:48 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
ln "$topdir/iconv/iconv.dll" iconv.dll
|
|
|
|
for i in COPYING.LIB README.iconv; do
|
|
|
|
cp ${topdir}/iconv/$i $i.txt
|
|
|
|
todos $i.txt
|
|
|
|
done
|
|
|
|
|
|
|
|
# WinPT is optional
|
|
|
|
if [ -f "$topdir/winpt/WinPT.exe" ]; then
|
|
|
|
ln "$topdir/winpt/WinPT.exe" WinPT.exe
|
|
|
|
ln "$topdir/winpt/PTD.dll" PTD.dll
|
|
|
|
cp "$topdir/winpt/README-0.9.txt" README.winpt.txt
|
|
|
|
cp "$topdir/winpt/NEWS-0.9.txt" NEWS.winpt.txt
|
|
|
|
cp "$topdir/winpt/keyserver.conf" keyserver.conf
|
|
|
|
winpt_defs="-DWITH_WINPT"
|
|
|
|
fi
|
|
|
|
|
2005-03-30 16:23:01 +02:00
|
|
|
# See whether we should include the source and figure out the
|
|
|
|
# version numbers of the source files.
|
|
|
|
if [ -d "$topdir/tarballs" ]; then
|
|
|
|
have_gnupg_src=no
|
|
|
|
have_libiconv_src=no
|
|
|
|
have_winpt_src=no
|
|
|
|
for i in `find "$topdir/tarballs" -type f -name '*.tar.gz'`; do
|
|
|
|
fname=$(basename "$i" .gz)
|
|
|
|
zcat "$i" > "$fname"
|
|
|
|
case "$fname" in
|
|
|
|
gnupg-*)
|
|
|
|
tmp=$(echo "$fname" | \
|
|
|
|
sed -n 's/^[^-]*-\([0-9.a-z-]*\)\.tar$/\1/p')
|
|
|
|
echo "gnupg source version is $tmp" >&2
|
|
|
|
if [ "$version" != "$tmp" ]; then
|
|
|
|
echo "gnupg source version does not match" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
have_gnupg_src=yes
|
|
|
|
;;
|
|
|
|
libiconv-*)
|
|
|
|
tmp=$(echo "$fname" | \
|
|
|
|
sed -n 's/^[^-]*-\([0-9.a-z-]*\)\.tar$/\1/p')
|
|
|
|
echo "libiconv source version is $tmp" >&2
|
|
|
|
src_defs="$src_defs -DLIBICONV_VERSION=$tmp"
|
|
|
|
have_libiconv_src=yes
|
|
|
|
;;
|
|
|
|
winpt-*)
|
|
|
|
tmp=$(echo "$fname" | \
|
|
|
|
sed -n 's/^[^-]*-\([0-9.a-z-]*\)\.tar$/\1/p')
|
|
|
|
echo "winpt source version is $tmp" >&2
|
|
|
|
src_defs="$src_defs -DWINPT_VERSION=$tmp"
|
|
|
|
have_winpt_src=yes
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "WARNING: unknown source file $fname ignored" >&2
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
if [ -n "$src_defs" ]; then
|
|
|
|
if [ $have_gnupg_src = "no" ]; then
|
|
|
|
echo "gnupg source missing" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ $have_libiconv_src = "no" ]; then
|
|
|
|
echo "libiconv source missing" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -n "$winpt_defs" ]; then
|
|
|
|
if [ $have_winpt_src = "no" ]; then
|
|
|
|
echo "winpt source missing" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
src_defs="$src_defs -DWITH_SOURCE"
|
|
|
|
fi
|
|
|
|
|
2005-01-26 18:44:48 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Now run the installer
|
|
|
|
echo "invoking installer as:"
|
2005-04-05 19:10:28 +02:00
|
|
|
echo makensis -v0 -nocd -DVERSION="${version}" \
|
2005-01-20 12:42:03 +01:00
|
|
|
-DPROD_VERSION="${prod_version}" \
|
2005-01-26 18:44:48 +01:00
|
|
|
-DGNUPG_SRCDIR="${srcdir}" ${winpt_defs} ${src_defs} \
|
2005-03-14 20:19:21 +01:00
|
|
|
${patches_defs} ${srcdir}/scripts/w32installer.nsi
|
2005-04-05 19:10:28 +02:00
|
|
|
BUILDINFO=$buildinfo makensis -v0 -nocd -DVERSION="${version}" \
|
2005-01-20 12:42:03 +01:00
|
|
|
-DPROD_VERSION="${prod_version}" \
|
2005-01-26 18:44:48 +01:00
|
|
|
-DGNUPG_SRCDIR="${srcdir}" ${winpt_defs} ${src_defs} \
|
2005-03-14 20:19:21 +01:00
|
|
|
${patches_defs} ${srcdir}/scripts/w32installer.nsi
|
2005-01-17 11:19:57 +01:00
|
|
|
echo "Installer created" >&2
|
|
|
|
else
|
|
|
|
zip -9 "gnupg-w32cli-${version}.zip" *
|
|
|
|
echo "ZIP archive created" >&2
|
2005-01-11 13:03:22 +01:00
|
|
|
fi
|