7cf8ccdd9bbf643d3999a788c5f8851ebddfbb3b
[chise/xemacs-chise.git.1] / build-msw-release.sh
1 #!/bin/sh
2
3 # This file builds the release kits for both cygwin and win32. You
4 # must have both environments configured for it to work properly. In
5 # particular you must provide a suitable value for NATIVE_ZLIB_DIR.
6
7 # configuration
8 NATIVE_ZLIB_DIR=/usr/local/mingw/lib
9 PROGRAM_FILES='c:/Program Files/XEmacs'
10 # no configuration past this point
11
12 INSTALL=
13 FILES=
14 BUILD=1
15
16 for OPT in $*
17 do
18     case $OPT in
19     --install) INSTALL=1;;
20     --installonly) INSTALL=1; BUILD='';;
21     --help) echo "usage: build-msw-release.sh [--install]" && exit;;
22     --*) ;;
23     *) FILES="$FILES $OPT";;
24     esac
25 done
26
27 # pick up version info
28 . version.sh
29
30 # decide on names
31 emacs_ver=${emacs_major_version}.${emacs_minor_version}.${emacs_beta_version}
32 cygwin_tarball=xemacs-i686-pc-cygwin-${emacs_ver}.tar.gz
33 win32_tarball=xemacs-i586-pc-win32-${emacs_ver}.tar.gz
34
35 # create a dist directory 
36 mkdir -p windows/cygwin32
37 mkdir -p windows/win32
38 mkdir -p /usr/local
39 DISTDIR=`pwd`/windows
40
41 # check to see if we should build
42 if test "$BUILD" = "1"
43 then
44
45 echo "Building the mswindows ${emacs_ver} release"
46
47 # cleanup everything first
48 if [ -f Makefile ] ; then
49     make distclean
50 fi
51
52 # first build win32
53 (cd nt;
54   nmake -f xemacs.mak)
55 (cd "${PROGRAM_FILES}";
56     rm -rf ./XEmacs-${emacs_ver})
57 (cd nt;
58   nmake -f xemacs.mak install;
59   nmake -f xemacs.mak clean)
60
61 # now build cygwin
62 ./configure --with-dragndrop --with-postgresql=no --with-x=no \
63     --bindir=/usr/local/bin/i686-pc-cygwin --with-site-lisp=yes \
64     --with-ipv6-cname=no --with-netinstall
65 make CFLAGS=-O3 MINGW_ZLIB_DIR=${NATIVE_ZLIB_DIR} beta
66
67 # deal with the netinstaller
68 (cd netinstall;
69     strip setup.exe)
70 cp netinstall/setup.exe windows
71
72 # the win32 tar ball needs setup.exe
73 cp netinstall/setup.exe \
74     "${PROGRAM_FILES}"/XEmacs-${emacs_ver}/i586-pc-win32
75
76 # make the win32 tarball
77 (cd "${PROGRAM_FILES}";
78     tar czvf ${DISTDIR}/win32/${win32_tarball} \
79         ./XEmacs-${emacs_ver})
80
81 # make the tarball
82 make install
83 (cd /usr/local;
84     tar czvf ${DISTDIR}/cygwin32/${cygwin_tarball} \
85     ./bin/i686-pc-cygwin \
86     ./lib/xemacs-${emacs_ver} \
87     ./lib/xemacs/lock \
88     ./man/man1/ctags.1 \
89     ./man/man1/etags.1 \
90     ./man/man1/gnuattach.1 \
91     ./man/man1/gnuclient.1 \
92     ./man/man1/gnudoit.1 \
93     ./man/man1/gnuserv.1 \
94     ./man/man1/xemacs.1)
95
96 # figure out the ini file.
97 cygwin_tarball_size=`ls -l windows/cygwin32/${cygwin_tarball} | awk '{ print $5; }'`
98 win32_tarball_size=`ls -l windows/win32/${win32_tarball} | awk '{ print $5; }'`
99
100 (cd netinstall;
101     make CYGWIN_SIZE=${cygwin_tarball_size} \
102         WIN32_SIZE=${win32_tarball_size} setup-bin.ini )
103 cp netinstall/setup-bin.ini windows
104
105 # tidy up
106 make distclean
107
108 fi
109 # end of build
110
111 # optionally install to the ftp site
112 if test "$INSTALL" != ""
113 then
114     echo "Installing the mswindows ${emacs_ver} release"
115     scp -r -oUser=slb -oProtocol=1 windows/* \
116         ftp.xemacs.org:/pub/xemacs/windows
117     # update setup.ini
118     ssh -1 -l slb ftp.xemacs.org 'cd /pub/xemacs/windows; sh makeini.sh'
119 fi
120