home *** CD-ROM | disk | FTP | other *** search
/ ftp.uv.es / 2014.11.ftp.uv.es.tar / ftp.uv.es / pub / unix / pine4.10.tar.gz / pine4.10.tar / pine4.10 / build next >
Text File  |  1998-12-15  |  11KB  |  339 lines

  1. #!/bin/sh
  2. #
  3. # $Id: build,v 4.50 1998/12/15 23:53:24 hubert 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-1998 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. #  General build script for Pine
  42. #
  43.  
  44. cat > .bld.hlp <<EOF
  45. Usage: build <make-options> <target-platform>
  46.  
  47. <target-platform> may be one of the ports listed in doc/pine-ports or
  48.   clean   Clean up object files and such.
  49.           Also, a good way to rebuild Pine/Pico from scratch.
  50.  
  51. <make-options> are generally not needed. They are passed to make.
  52. "-n" is probably the most useful, as it tells make to just print out
  53. what it is going to do and not actually do it.
  54.  
  55. "Build" by itself with no arguments is the same as typing in the previous
  56. build command with the arguments used then.
  57.  
  58. To build Pine and Pico the command "build xxx" should work where xxx
  59. is one of the targets. For example "build ult" to build Pine for Ultrix.
  60.  
  61. If you are attempting to compile in the LDAP functionality in pine, you
  62. should get the Univ. of Michigan ldap-3.3 source and put it in a directory
  63. called "ldap" in this top-level pine directory. Or you could put a symlink
  64. pointing from here to the actual location. The include files should show
  65. up in ldap/include and the libraries in ldap/libraries.
  66. Alternatively, you can try using the Netscape Directory SDK 1.0 (or probably
  67. 3.0 when it is ready) by putting the include files in ldap/include and
  68. libldap.a in ldap/libraries. This build script will attempt to notice that
  69. you are not using ldap-3.3 and leave out liblber.a, which is required when
  70. using ldap-3.3.
  71.  
  72. If you are attempting to compile in Kerberos5 functionality, put a symlink
  73. called krb5 pointing from here to the location of the includes and libraries.
  74. The expected files should be in krb5/include and krb5/lib.
  75.  
  76.  
  77. The executables built by this are:
  78.  
  79.  pine   The Pine mailer. Once compiled this should work just fine on
  80.         your system with no other files than this binary, and no
  81.         modifications to your system. Optionally you may create two
  82.         configuration files, /usr/local/lib/pine.conf and 
  83.         /usr/local/lib/pine.info. See the documentation for details.
  84.  
  85.  pico   The standalone editor similar to the Pine message composer.
  86.         This is a very simple straight forward text editor.
  87.  
  88.  pilot  The standalone file system navigator.
  89.  
  90.  imapd  The IMAP daemon. If you want to run Pine in client/server mode,
  91.         this is the daemon to run on the server. Installing this
  92.         requires system privileges and modifications to /etc/services.
  93.         See doc/tech-notes for more details.
  94.  
  95.  mtest  The test IMAP client, an absolutely minimal mail client, useful
  96.         for debugging.
  97.  
  98. In general you should be able to just copy the Pine and Pico binaries
  99. to the place you keep your other local binaries. /usr/local/bin is a
  100. likely place.
  101.   
  102. EOF
  103.                  
  104.  
  105. # If no args, build what was built last time.
  106. if [ $# -eq 0 ]
  107. then
  108.     if [ -f .bld.args ]
  109.     then
  110.     set `cat .bld.args`
  111.     fi
  112. else
  113.     rm -f .bld.args
  114. fi
  115.  
  116. maketarg="no-target"
  117. PHOME=`pwd`
  118.  
  119. for var in "$@"; do
  120.   case "$var" in
  121.  
  122.     help) cat .bld.hlp
  123.           exit ;;
  124.  
  125.     clean|???)
  126.          if [ $maketarg != no-target ]
  127.          then
  128.              echo "Can only make one target system at a time"
  129.              echo Both \""$maketarg"\" and \""$var"\" were given
  130.              exit
  131.          else
  132.              maketarg="$var"
  133.          fi
  134.        ;;
  135.  
  136.     *) makeargs="$makeargs '$var'"
  137.        case "$var" in
  138.      CC=*)                   NOCC=1    ;;
  139.      LDAPLIBS=*)             LLIBS=1   ;;
  140.      LDAPCFLAGS=*)           LFLAGS=1  ;;
  141.      GSSDIR=*)               GDIR=1    ;;
  142.      EXTRAAUTHENTICATORS=*)  AAFLAGS=1 ;;
  143.        esac
  144.        ;;
  145.  
  146.   esac
  147. done
  148.  
  149. if [ $# -ne 0 ]
  150. then
  151.     case $maketarg in
  152.  
  153.        ???) 
  154.         echo "$makeargs" $maketarg > .bld.args ;;
  155.     esac
  156. fi
  157.  
  158. # Set up correct compiler
  159. if [ "$NOCC" != "1" ]
  160. then
  161.   case $maketarg in
  162.      sol)
  163.  echo "\"Sol\" port no longer exists. Use \"so4\" for Solaris version 2.4 or"
  164.  echo "lower (SunOS 5.4 or lower) and \"so5\" for Solaris version 2.5 or"
  165.  echo "higher (SunOS 5.5 or higher)."
  166.       exit;;
  167.      gso)
  168.  echo "\"Gso\" port no longer exists. Use \"gs4\" for Solaris version 2.4 or"
  169.  echo "lower (SunOS 5.4 or lower) and \"gs5\" for Solaris version 2.5 or"
  170.  echo "higher (SunOS 5.5 or higher)."
  171.       exit;;
  172.      gas) makeargs="CC=gcc $makeargs" ;;
  173.      gh9) makeargs="CC=gcc $makeargs" ;;
  174.      ghp) makeargs="CC=gcc $makeargs" ;;
  175.      gs4) makeargs="CC=gcc $makeargs" ;;
  176.      gs5) makeargs="CC=gcc $makeargs" ;;
  177.      gsu) makeargs="CC=gcc $makeargs" ;;
  178.      gul) makeargs="CC=gcc $makeargs" ;;
  179.      bs3) makeargs="CC=shlicc $makeargs" ;;
  180.      lyn) [ -f /CYGNUS.bash ] && . /CYGNUS.bash; makeargs="CC=gcc $makeargs" ;;
  181.        *) makeargs="CC=cc $makeargs" ;;
  182.   esac
  183. fi
  184.  
  185. # Some ports are common for pico (for example) but different for pine.
  186. # For example, port hxd uses hpp port for pico, hpx port for pine, and a
  187. # separate hxd port for c-client. Not all of these have been verified to work.
  188. case $maketarg in
  189.    aos) ccltarg=$maketarg; picotarg=bsd;       pinetarg=$picotarg ;;
  190.    bs2) ccltarg=bsi;       picotarg=$maketarg; pinetarg=$maketarg ;;
  191.    bs3) ccltarg=$maketarg; picotarg=bs2;       pinetarg=bs2 ;;
  192.    d41) ccltarg=$maketarg; picotarg=d-g;       pinetarg=$picotarg ;;
  193.    d54) ccltarg=$maketarg; picotarg=d-g;       pinetarg=$picotarg ;;
  194.    ghp) ccltarg=$maketarg; picotarg=gh9;       pinetarg=$maketarg ;;
  195.    gs4) ccltarg=gso;       picotarg=gso;       pinetarg=$maketarg ;;
  196.    gs5) ccltarg=gso;       picotarg=gso;       pinetarg=$maketarg ;;
  197.    hpx) ccltarg=$maketarg; picotarg=hpp;       pinetarg=$maketarg ;;
  198.    hxd) ccltarg=$maketarg; picotarg=hpp;       pinetarg=hpx ;;
  199.    lnp) ccltarg=$maketarg; picotarg=lnx;       pinetarg=$picotarg ;;
  200.    nx3) ccltarg=$maketarg; picotarg=nxt;       pinetarg=$picotarg ;;
  201.    os4) ccltarg=$maketarg; picotarg=osf;       pinetarg=$picotarg ;;
  202.    pt1) ccltarg=psx;       picotarg=$maketarg; pinetarg=$maketarg ;;
  203.    shp) ccltarg=$maketarg; picotarg=hpp;       pinetarg=$picotarg ;;
  204.    slx) ccltarg=$maketarg; picotarg=lnx;       pinetarg=$picotarg ;;
  205.    sl4) ccltarg=$maketarg; picotarg=lnx;       pinetarg=$picotarg ;;
  206.    sl5) ccltarg=$maketarg; picotarg=lnx;       pinetarg=$picotarg ;;
  207.    so4) ccltarg=sol;       picotarg=sol;       pinetarg=$maketarg ;;
  208.    so5) ccltarg=sol;       picotarg=sol;       pinetarg=$maketarg ;;
  209.    sos) ccltarg=$maketarg; picotarg=osf;       pinetarg=$picotarg ;;
  210.    ssn) ccltarg=$maketarg; picotarg=sun;       pinetarg=$picotarg ;;
  211.      *) ccltarg=$maketarg; picotarg=$maketarg; pinetarg=$maketarg ;;
  212. esac
  213.  
  214. echo "make args are $makeargs"
  215.  
  216. case $maketarg in
  217.  
  218.    ???) 
  219.         echo ''
  220.         cd $PHOME
  221.  
  222. # Try to automatically include LDAP definitions.
  223.         if [ -d ldap -a -f contrib/ldap-setup -a \
  224.          \( "$LLIBS" != "1" -o "$LFLAGS" != "1" \) ]
  225.     then
  226.       contrib/ldap-setup $pinetarg $maketarg
  227. # Allow for override of either of these separately.
  228.       case "$?" in
  229.         1) if [ "$LLIBS" != "1" ]
  230.            then
  231.          L1="'LDAPLIBS=../ldap/libraries/libldap.a ../ldap/libraries/liblber.a'"
  232.            fi
  233.            if [ "$LFLAGS" != "1" ]
  234.            then
  235.          L2="'LDAPCFLAGS=-DENABLE_LDAP -I../ldap/include'"
  236.            fi
  237.            echo "Including LDAP functionality"
  238.            ;;
  239.  
  240.         2) if [ "$LLIBS" != "1" ]
  241.            then
  242.          L1="'LDAPLIBS=../ldap/libraries/libldap.a'"
  243.            fi
  244.            if [ "$LFLAGS" != "1" ]
  245.            then
  246.          L2="'LDAPCFLAGS=-DENABLE_LDAP -I../ldap/include'"
  247.            fi
  248.            echo "Including LDAP functionality"
  249.            ;;
  250.  
  251.         *) exit 30 ;;
  252.       esac
  253.     fi
  254.  
  255. # Try to automatically include Kerberos5 definitions.
  256.         if [ -d krb5 -a -f contrib/krb5-setup -a \
  257.              \( "$GDIR" != "1" -o "$AAFLAGS" != "1" \) ]
  258.     then
  259.       contrib/krb5-setup $pinetarg $maketarg
  260. # Allow for override of either of these separately.
  261.       case "$?" in
  262.         0) if [ "$GDIR" != "1" ]
  263.            then
  264.              K1="'GSSDIR=$PHOME/krb5'"
  265.            fi
  266.            if [ "$AAFLAGS" != "1" ]
  267.            then
  268.              K2="'EXTRAAUTHENTICATORS=gss'"
  269.            fi
  270.            echo "Including Kerberos5 functionality"
  271.            ;;
  272.  
  273.         *) exit 30 ;;
  274.       esac
  275.     fi
  276.  
  277.         if [ -s c-client ] ; then rm -f c-client ; fi
  278.         ln -s imap/c-client c-client
  279.         if [ -s mtest    ] ; then rm -f mtest    ; fi
  280.         ln -s imap/mtest mtest
  281.         if [ -s imapd    ] ; then rm -f imapd    ; fi
  282.         ln -s imap/imapd imapd
  283.         echo "Making c-client library, mtest and imapd"
  284.         eval echo make "$makeargs" "$K1" "$K2" $ccltarg
  285.         cd $PHOME/imap
  286.         eval make "$makeargs" "$K1" "$K2" $ccltarg
  287.         echo ''
  288.  
  289.         echo "Making Pico and Pilot"
  290.         cd $PHOME/pico
  291.         eval echo make "$makeargs" -f makefile.$picotarg
  292.         eval make "$makeargs" -f makefile.$picotarg
  293.         echo ''
  294.  
  295.         echo "Making Pine".
  296.         cd $PHOME/pine
  297.         eval echo make "$makeargs" "$L1" "$L2" -f makefile.$pinetarg
  298.         eval make "$makeargs" "$L1" "$L2" -f makefile.$pinetarg
  299.         cd $PHOME
  300.         if [ ! -d bin ] ;  then    mkdir bin;        fi
  301.         cd $PHOME/bin
  302.         rm -f pine mtest imapd pico pilot
  303.         if [ -s ../pine/pine ] ;      then ln ../pine/pine  pine      ; fi
  304.         if [ -s ../mtest/mtest ] ;    then ln ../mtest/mtest mtest ; fi
  305.         if [ -s ../imapd/imapd ] ;    then ln ../imapd/imapd imapd    ; fi
  306.         if [ -s ../pico/pico ] ;      then ln ../pico/pico pico ; fi
  307.         if [ -s ../pico/pilot ] ;     then ln ../pico/pilot pilot ; fi
  308.         cd $PHOME
  309.         echo ''
  310.         echo "Links to executables are in bin directory:"
  311.         size bin/pine bin/mtest bin/imapd bin/pico bin/pilot
  312.         echo "Done"
  313.         ;;
  314.  
  315.  
  316.     clean) # This only sort of works 
  317.         echo "Cleaning c-client and imapd"
  318.     cd $PHOME/imap
  319.     make clean
  320.         echo "Cleaning Pine"
  321.         cd $PHOME/pine
  322.         make -f makefile.ult clean
  323.         echo "Cleaning pico"
  324.         cd $PHOME/pico
  325.         make $makeargs -f makefile.ult clean
  326.         echo "Done"
  327.         cd $PHOME
  328.         ;;
  329.  
  330.     no-target)
  331.         echo "No target plaform for which to build Pine given."
  332.         echo 'Give command "build help" for help.'
  333.         ;;
  334.  
  335.     *)  echo 'Do not know how to make Pine for target "'$maketarg'".'
  336.         ;;
  337. esac
  338.