source: trunk/third/pine/buildcyg @ 18834

Revision 18834, 16.5 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18833, which included commits to RCS files with non-trunk default branches.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2#
3# $Id: buildcyg,v 1.1.1.1 2003-02-12 08:01:48 ghudson Exp $
4#
5#            T H E    P I N E    M A I L   S Y S T E M
6#
7#   Laurence Lundblade and Mike Seibel
8#   Networks and Distributed Computing
9#   Computing and Communications
10#   University of Washington
11#   Administration Building, AG-44
12#   Seattle, Washington, 98195, USA
13#   Internet: lgl@CAC.Washington.EDU
14#             mikes@CAC.Washington.EDU
15#
16#   Please address all bugs and comments to "pine-bugs@cac.washington.edu"
17#
18#
19#   Pine and Pico are registered trademarks of the University of Washington.
20#   No commercial use of these trademarks may be made without prior written
21#   permission of the University of Washington.
22#
23#   Pine, Pico, and Pilot software and its included text are Copyright
24#   1989-2002 by the University of Washington.
25#
26#   The full text of our legal notices is contained in the file called
27#   CPYRIGHT, included with this distribution.
28#
29#
30#   Pine is in part based on The Elm Mail System:
31#    ***********************************************************************
32#    *  The Elm Mail System  -  Revision: 2.13                             *
33#    *                                                                     *
34#    *                  Copyright (c) 1986, 1987 Dave Taylor               *
35#    *                  Copyright (c) 1988, 1989 USENET Community Trust    *
36#    ***********************************************************************
37#
38#
39
40
41#
42# This is a modified build script which is for Cygwin. The reason it is
43# separate is because we do not want to deal with the .exe suffixes in
44# the regular build script.
45#
46
47cat > .bld.hlp <<EOF
48Usage: build <make-options> <target-platform>
49
50<target-platform> may be one of the ports listed in doc/pine-ports or
51  clean   Clean up object files and such.
52          Also, a good way to rebuild Pine/Pico from scratch.
53
54See the README file for more information.
55
56EOF
57                 
58
59# If no args, build what was built last time.
60if [ $# -eq 0 ]
61then
62    if [ -f .bld.args ]
63    then
64        set `cat .bld.args`
65    fi
66else
67    rm -f .bld.args
68fi
69
70L1=
71L2=
72K1=
73K2=
74S1=
75S2=
76S3=
77S4=
78CERTSD=
79NOSSL=
80# We will complain if we use "none",
81# but this gets overridden if we find the ssl dir
82SSL=none
83DEFSSLD=/usr/local/ssl
84SSLD=
85NOCC=
86LLIBS=
87LFLAGS=
88NOLDAP=
89GDIR=
90AAFLAGS=
91SAFLAGS=
92
93maketarg="no-target"
94PHOME=`pwd`
95
96for var in "$@"; do
97  case "$var" in
98 
99    help) cat .bld.hlp
100          exit ;;
101
102    clean|???)
103         if [ $maketarg != no-target ]
104         then
105             echo "Can only make one target system at a time"
106             echo Both \""$maketarg"\" and \""$var"\" were given
107             exit
108         else
109             maketarg="$var"
110         fi
111       ;;
112
113    NOSSL) NOSSL=1
114           NSSL=NOSSL
115           SSL="none"
116       ;;
117
118    NOLDAP) NOLDAP=1
119           NLDAP=NOLDAP
120       ;;
121
122    SSLTYPE=*) SAFLAGS=1
123               SSL=`echo "$var" | cut -c9-`
124               if [ "$SSL" = "none" ]
125               then
126                   NOSSL=1
127                   NSSL=NOSSL
128               fi
129           ;;
130
131    *) makeargs="$makeargs '$var'"
132       case "$var" in
133         CC=*)                   NOCC=1    ;;
134         LDAPLIBS=*)             LLIBS=1   ;;
135         LDAPCFLAGS=*)           LFLAGS=1  ;;
136         GSSDIR=*)               GDIR=1
137                                 K1="$var" ;;
138         EXTRAAUTHENTICATORS=*)  AAFLAGS=1 ;;
139         SSLDIR=*)               SSLD=`echo "$var" | cut -c8-`  ;;
140         SSLCERTS=*)             CERTSD=`echo "$var" | cut -c10-`
141                                 S2="$var" ;;
142         SSLINCLUDE=*)           S3="$var" ;;
143         SSLLIB=*)               S4="$var" ;;
144       esac
145       ;;
146
147  esac
148done
149
150
151if [ $# -ne 0 ]
152then
153    case $maketarg in
154
155       ???)
156            echo "$makeargs" "$NSSL" "$NLDAP" $maketarg > .bld.args ;;
157    esac
158fi
159
160# Set up correct compiler
161if [ "$NOCC" != "1" ]
162then
163  case $maketarg in
164     sol)
165 echo "\"Sol\" port no longer exists. Use \"so4\" for Solaris version 2.4 or"
166 echo "lower (SunOS 5.4 or lower) and \"so5\" for Solaris version 2.5 or"
167 echo "higher (SunOS 5.5 or higher)."
168          exit;;
169     gso)
170 echo "\"Gso\" port no longer exists. Use \"gs4\" for Solaris version 2.4 or"
171 echo "lower (SunOS 5.4 or lower) and \"gs5\" for Solaris version 2.5 or"
172 echo "higher (SunOS 5.5 or higher)."
173          exit;;
174     cyg) makeargs="CC=gcc $makeargs" ;;
175     gh9) makeargs="CC=gcc $makeargs" ;;
176     ghp) makeargs="CC=gcc $makeargs" ;;
177     go5) makeargs="CC=gcc $makeargs" ;;
178     gs4) makeargs="CC=gcc $makeargs" ;;
179     gs5) makeargs="CC=gcc $makeargs" ;;
180     gsc) makeargs="CC=gcc $makeargs" ;;
181     gsu) makeargs="CC=gcc $makeargs" ;;
182     gul) makeargs="CC=gcc $makeargs" ;;
183     mnt) makeargs="CC=gcc $makeargs" ;;
184     bs3) makeargs="CC=shlicc $makeargs" ;;
185     nto) makeargs="CC=qcc $makeargs" ;;
186     lyn) [ -f /CYGNUS.bash ] && . /CYGNUS.bash; makeargs="CC=gcc $makeargs" ;;
187       *) makeargs="CC=cc $makeargs" ;;
188  esac
189fi
190
191# Some ports are common for pico (for example) but different for pine.
192# For example, port hxd uses hpp port for pico, hpx port for pine, and a
193# separate hxd port for c-client. Not all of these have been verified to work.
194case $maketarg in
195   aos) ccltarg=$maketarg; picotarg=bsd;       pinetarg=$picotarg ;;
196   bs2) ccltarg=bsi;       picotarg=$maketarg; pinetarg=$maketarg ;;
197   bs3) ccltarg=$maketarg; picotarg=bs2;       pinetarg=bs2 ;;
198   cyg) ccltarg=$maketarg; picotarg=$maketarg; pinetarg=$maketarg ; DEFSSLD=/usr/ssl ;;
199   d41) ccltarg=$maketarg; picotarg=d-g;       pinetarg=$picotarg ;;
200   d54) ccltarg=$maketarg; picotarg=d-g;       pinetarg=$picotarg ;;
201   ghp) ccltarg=$maketarg; picotarg=gh9;       pinetarg=$maketarg ;;
202   go5) ccltarg=$maketarg; picotarg=$maketarg; pinetarg=sc5 ;;
203   gs4) ccltarg=gso;       picotarg=gso;       pinetarg=$maketarg ;;
204   gs5) ccltarg=gso;       picotarg=gso;       pinetarg=$maketarg ;;
205   gsc) ccltarg=$maketarg; picotarg=sco;       pinetarg=sco ;;
206   hpx) ccltarg=$maketarg; picotarg=hpp;       pinetarg=$maketarg ;;
207   hxd) ccltarg=$maketarg; picotarg=hpp;       pinetarg=hpx ;;
208   lnp) ccltarg=$maketarg; picotarg=lnx;       pinetarg=$picotarg ;;
209   lrh) ccltarg=$maketarg; picotarg=lnx;       pinetarg=$picotarg ; DEFSSLD=/usr/share/ssl ;;
210   lsu) ccltarg=$maketarg; picotarg=lnx;       pinetarg=$picotarg ; DEFSSLD=/usr/ssl ;;
211   nx3) ccltarg=$maketarg; picotarg=nxt;       pinetarg=$picotarg ;;
212   osx) ccltarg=$maketarg; picotarg=$maketarg; pinetarg=$picotarg ; DEFSSLD=/System/Library/OpenSSL ;;
213   os4) ccltarg=$maketarg; picotarg=osf;       pinetarg=$picotarg ;;
214   pt1) ccltarg=psx;       picotarg=$maketarg; pinetarg=$maketarg ;;
215   shp) ccltarg=$maketarg; picotarg=hpp;       pinetarg=$picotarg ;;
216   sg6) ccltarg=$maketarg; picotarg=sgi;       pinetarg=$picotarg ;;
217   slx) ccltarg=$maketarg; picotarg=lnx;       pinetarg=$picotarg ;;
218   sl4) ccltarg=$maketarg; picotarg=lnx;       pinetarg=$picotarg ;;
219   sl5) ccltarg=$maketarg; picotarg=lnx;       pinetarg=$picotarg ;;
220   snx) ccltarg=$maketarg; picotarg=sv4;       pinetarg=sv4 ;;
221   so4) ccltarg=sol;       picotarg=sol;       pinetarg=$maketarg ;;
222   so5) ccltarg=sol;       picotarg=sol;       pinetarg=$maketarg ;;
223   sos) ccltarg=$maketarg; picotarg=osf;       pinetarg=$picotarg ;;
224   ssn) ccltarg=$maketarg; picotarg=sun;       pinetarg=$picotarg ;;
225     *) ccltarg=$maketarg; picotarg=$maketarg; pinetarg=$maketarg ;;
226esac
227
228echo "make args are $makeargs" "$maketarg"
229
230case $maketarg in
231
232   ???)
233        echo ''
234        cd "$PHOME"
235
236# Try to automatically include LDAP definitions.
237        if [ "$NOLDAP" != "1" -a -f contrib/ldap-setup -a \
238             \( "$LLIBS" != "1" -o "$LFLAGS" != "1" \) ]
239        then
240          contrib/ldap-setup $pinetarg $maketarg
241# Allow for override of either of these separately.
242          case "$?" in
243            1) if [ "$LLIBS" != "1" ]
244               then
245                 L1="'LDAPLIBS=../ldap/libraries/libldap.a ../ldap/libraries/liblber.a'"
246               fi
247               if [ "$LFLAGS" != "1" ]
248               then
249                 L2="'LDAPCFLAGS=-DENABLE_LDAP -I../ldap/include'"
250               fi
251               echo "Including LDAP functionality"
252               ;;
253
254            11) if [ "$LLIBS" != "1" ]
255               then
256                 L1="'LDAPLIBS=../ldap/libraries/libldap/.libs/libldap.a ../ldap/libraries/liblber/.libs/liblber.a'"
257               fi
258               if [ "$LFLAGS" != "1" ]
259               then
260                 L2="'LDAPCFLAGS=-DENABLE_LDAP -I../ldap/include'"
261               fi
262               echo "Including LDAP functionality"
263               ;;
264
265            2) if [ "$LLIBS" != "1" ]
266               then
267                 L1="'LDAPLIBS=../ldap/libraries/libldap.a'"
268               fi
269               if [ "$LFLAGS" != "1" ]
270               then
271                 L2="'LDAPCFLAGS=-DENABLE_LDAP -I../ldap/include'"
272               fi
273               echo "Including LDAP functionality"
274               ;;
275
276            3) if [ "$LLIBS" != "1" ]
277               then
278                 L1="'LDAPLIBS=-lldap'"
279               fi
280               if [ "$LFLAGS" != "1" ]
281               then
282                 L2="'LDAPCFLAGS=-DENABLE_LDAP'"
283               fi
284               echo "Including LDAP functionality"
285               ;;
286
287            4) ;;
288
289            *) exit 30 ;;
290          esac
291        fi
292
293# Try to automatically include Kerberos5 definitions.
294        if [ -d krb5 -a -f contrib/krb5-setup -a \
295             \( "$GDIR" != "1" -o "$AAFLAGS" != "1" \) ]
296        then
297          contrib/krb5-setup $pinetarg $maketarg
298# Allow for override of either of these separately.
299          case "$?" in
300            0) if [ "$GDIR" != "1" ]
301               then
302                 K1="GSSDIR=\"$PHOME/krb5\""
303               fi
304               if [ "$AAFLAGS" != "1" ]
305               then
306                 K2="'EXTRAAUTHENTICATORS=gss'"
307               fi
308               echo "Including Kerberos5 functionality"
309               ;;
310
311            *) exit 30 ;;
312          esac
313        fi
314
315# Try to automatically include SSL. To prevent SSL from being automatically
316# included use "build NOSSL target".
317# Check for nonempty certs directory from OpenSSL. Also check for 8-hexdigit
318# symlinks.
319        if [ x"$SSLD" = "x" ]
320        then
321          SSLD="$DEFSSLD"
322        fi
323
324        if [ x"$CERTSD" = "x" ]
325        then
326          CERTSD="$SSLD/certs"
327        fi
328
329        if [ \( -d "$SSLD" -o -d "$CERTSD" \) -a "$SAFLAGS" != "1" -a "$NOSSL" != "1" ]
330        then
331          if [ ! -d "$CERTSD" -o ! -f "$CERTSD"/factory.pem ]
332          then
333            if [ ! -d "$CERTSD" ]
334            then
335              echo ""
336              echo "  Directory "$CERTSD" is missing"
337              echo ""
338              SSLWARN=1
339            else
340              echo "  File "$CERTSD"/factory.pem is missing"
341              echo "  This might indicate that CA certs did not get properly"
342              echo "  installed.  If you get certificate validation failures"
343              echo "  in Pine, this might be the reason for them."
344              echo ""
345            fi
346          else
347            /bin/ls "$CERTSD" | grep '[0-9A-Za-z][0-9A-Za-z][0-9A-Za-z][0-9A-Za-z][0-9A-Za-z][0-9A-Za-z][0-9A-Za-z][0-9A-Za-z][0-9A-Za-z]*\.0' > /dev/null 2>&1
348            if [ $? != "0" ]
349            then
350                echo "  No 8-hexdigit symlinks in "$CERTSD""
351                echo "  This might indicate that CA certs did not get properly"
352                echo "  installed.  If you get certificate validation failures"
353                echo "  in Pine, this might be the reason for them."
354                echo ""
355            fi
356          fi
357          case $maketarg in
358            sco|gsc|sc5|go5)   SSL="sco.nopwd"  ;;
359            *)                 SSL="nopwd" ;;
360          esac
361
362          S1="SSLDIR=$SSLD"
363          echo "Including SSL functionality"
364        fi
365
366        if [ -s c-client ] ; then rm -f c-client ; fi
367        ln -s imap/c-client c-client
368        if [ -s mtest    ] ; then rm -f mtest    ; fi
369        ln -s imap/mtest mtest
370        if [ -s mailutil ] ; then rm -f mailutil ; fi
371        ln -s imap/mailutil mailutil
372        if [ -s imapd    ] ; then rm -f imapd    ; fi
373        ln -s imap/imapd imapd
374        if [ -s ipopd    ] ; then rm -f ipopd    ; fi
375        ln -s imap/ipopd ipopd
376        echo "Making c-client library, imapd, and ipopd"
377        echo $S1 $S2 $S3 $S4 $K1 > imap/SPECIALS
378        cd "$PHOME/imap"
379# This "touch" tells the IMAP make not to give any warnings about IESG compliance.
380        if [ "$NOSSL" = "1" -o "$SSL" != "none" ] ; then touch ssl$SSL ; fi
381        if [ "$NOSSL" != "1" -a "$SSL" = "none" -a ! -f sslnone ]
382        then
383           echo "+-----------------------------------------------------------+"
384           echo "| It appears that you do not have OpenSSL or equivalent     |"
385           echo "| installed on this system.                                 |"
386           echo "|                                                           |"
387           echo "| Building PINE without SSL support will possibly introduce |"
388           echo "| problems when communicating with IMAP, POP3, or SMTP      |"
389           echo "| servers that require TLS or SSL authentication.           |"
390           echo "| In addition, your password may be vulnerable to a         |"
391           echo "| snooping attack since it may be sent over the network     |"
392           echo "| unencrypted.                                              |"
393           echo "+-----------------------------------------------------------+"
394           echo ""
395           echo "Do you want to continue this build anyway? Type y or n please:"
396           read ans
397           case "$ans" in
398               y)   echo "Building without SSL ..."
399                    touch sslnone
400                    ;;
401
402               *)   echo "Terminating build"
403                    exit 1
404                    ;;
405           esac
406        fi
407        eval echo eval make "$makeargs" "SSLTYPE=$SSL" "SPECIALS=`cat SPECIALS`" "$K2" $ccltarg
408        eval make "$makeargs" "SSLTYPE=$SSL" "SPECIALS=`cat SPECIALS`" "$K2" $ccltarg
409        rc=$?
410        if [ $rc != "0" ]
411        then
412            echo "+---------------------------------------------+"
413            echo "| Problems building c-client                  |"
414            echo "|                                             |"
415            echo "| Please check the output above for a         |"
416            echo "| possible explanation for this failure       |"
417            echo "+---------------------------------------------+"
418            echo ""
419            exit $rc
420        fi
421        echo ''
422
423        echo "Making Pico and Pilot"
424        cd "$PHOME/pico"
425        eval echo make "$makeargs" -f makefile.$picotarg
426        eval make "$makeargs" -f makefile.$picotarg
427        rc=$?
428        if [ $rc != "0" ] ; then exit $rc ; fi
429        echo ''
430
431        echo "Making Pine and rpload/rpdump".
432        cd "$PHOME/pine"
433        eval echo make "$makeargs" "$L1" "$L2" -f makefile.$pinetarg
434        eval make "$makeargs" "$L1" "$L2" -f makefile.$pinetarg
435        rc=$?
436        if [ $rc != "0" ] ; then exit $rc ; fi
437        cd "$PHOME"
438        if [ ! -d bin ] ;  then    mkdir bin;        fi
439        cd "$PHOME/bin"
440        rm -f pine.exe mtest.exe imapd.exe mailutil.exe pico.exe pilot.exe rpload.exe rpdump.exe ipop2d.exe ipop3d.exe
441        if [ -s ../pine/pine.exe ] ;      then ln ../pine/pine.exe  pine.exe      ; fi
442        if [ -s ../mtest/mtest.exe ] ;    then ln ../mtest/mtest.exe mtest.exe    ; fi
443        if [ -s ../mailutil/mailutil.exe ] ; then ln ../mailutil/mailutil.exe mailutil.exe ; fi
444        if [ -s ../imapd/imapd.exe ] ;    then ln ../imapd/imapd.exe imapd.exe    ; fi
445        if [ -s ../ipopd/ipop2d.exe ] ;   then ln ../ipopd/ipop2d.exe ipop2d.exe  ; fi
446        if [ -s ../ipopd/ipop3d.exe ] ;   then ln ../ipopd/ipop3d.exe ipop3d.exe  ; fi
447        if [ -s ../pico/pico.exe ] ;      then ln ../pico/pico.exe pico.exe       ; fi
448        if [ -s ../pico/pilot.exe ] ;     then ln ../pico/pilot.exe pilot.exe     ; fi
449        if [ -s ../pine/rpload.exe ] ;    then ln ../pine/rpload.exe rpload.exe   ; fi
450        if [ -s ../pine/rpdump.exe ] ;    then ln ../pine/rpdump.exe rpdump.exe   ; fi
451        cd "$PHOME"
452        echo ''
453        echo "Links to executables are in bin directory:"
454        size bin/pine.exe bin/mtest.exe bin/imapd.exe bin/pico.exe bin/pilot.exe bin/rpdump.exe bin/rpload.exe bin/mailutil.exe bin/ipop2d.exe bin/ipop3d.exe
455        case $maketarg in
456            mnt)    echo "Fixing stacksizes ..."
457                    fixstk 64K bin/pine bin/pico bin/imapd bin/mtest bin/pilot
458        esac
459        if [ "$SSLWARN" = "1" ]
460        then
461            echo ""
462            echo " +---------------------------------------------------------+"
463            echo " |                                                         |"
464            echo " |   WARNING. Certificates may not be installed correctly  |"
465            echo " |   in $CERTSD. This may cause Pine SSL/TLS  |"
466            echo " |   connections to fail because Pine may not be able to   |"
467            echo " |   verify the authenticity of the certificates on the    |"
468            echo " |   server. To compile Pine without SSL support use       |"
469            echo " |                                                         |"
470            echo " |             build NOSSL target                          |"
471            echo " |                                                         |"
472            echo " +---------------------------------------------------------+"
473            echo ""
474        fi
475        echo "Done"
476        ;;
477
478
479    clean) # This only sort of works
480        rm -f c-client mtest  mailutil imapd ipopd
481        echo "Cleaning c-client and imapd"
482        cd "$PHOME/imap"
483        make clean
484# this list of ssl* files matches with imap/Makefile
485        rm -f sslnopwd sslunix.nopwd sslsco.nopwd sslunix sslsco sslnone
486        echo "Cleaning Pine"
487        cd "$PHOME/pine"
488        make -f makefile.cyg clean
489        echo "Cleaning pico"
490        cd "$PHOME/pico"
491        make $makeargs -f makefile.cyg clean
492        echo "Done"
493        cd "$PHOME"
494        ;;
495
496    no-target)
497        echo "No target plaform for which to build Pine given."
498        echo 'Give command "build help" for help.'
499        ;;
500
501    *)  echo 'Do not know how to make Pine for target "'$maketarg'".'
502        ;;
503esac
Note: See TracBrowser for help on using the repository browser.