# File vlib

# Making library files for voice from the mgetty distribution.
# This script places files in /usr/local/lib/voice.

# IMPORTANT: 
#   1) Root must run this script.
#   2) Should recompile locks.c first; see note in below in 3.

# References:
#     vgetty-maintainer@alphanet.ch
#     http://alpha.greenie.net/mgetty/index.html
#     http://www.leo.org/~doering/mgetty/index.html
#     File: Nov 2002: mgetty1.1.29-Nov25.tar.gz 983945 (bytes)    

# The six library files this script provides are:
#    libmgetty.a libmgsm.a libpvf.a libutil.a libvgetty.a libvoice.a

# Target:
TO=/usr/local/lib/voice

# Source:
DIRM=/home/dale/mgetty/mgetty-1.1.29 # Path to installed mgetty
DIRV=$DIRM/voice

# 1. Copying vgetty library files:

cp -p $DIRV/libmgsm/libmgsm.a $TO/.; chmod 444 $TO/libmgsm.a
cp -p $DIRV/libpvf/libpvf.a $TO/.; chmod 444 $TO/libpvf.a
cp -p $DIRV/libutil/libutil.a $TO/.; chmod 444 $TO/libutil.a
cp -p $DIRV/libvoice/libvoice.a $TO/.; chmod 444 $TO/libvoice.a

# 2. Creating libvgetty.a, a library of vgetty .o files:
LIBM=libvgetty.a
OP=-crs
cd $DIRV/vgetty
ar $OP $LIBM answer.o  button.o  event.o  message.o  rings.o 
mv $LIBM $TO/$LIBM; chmod 444 $TO/$LIBM

# 3. Creating libmgetty.a, a library of mgetty .o files:
#    NOTE: The following line in DIRM/locks.c can cause seg fault:
#        char  lock[MAXLINE+1]; /* name of the lockfile */
#    Before running this script, change it to read:
#       static  char  lock[MAXLINE+1]; /* name of the lockfile */
#    and rerun 'make' in DIRM to create a new locks.o file.
LIBM=libmgetty.a
OP=-crs
cd $DIRM
ar $OP $LIBM class1lib.o class1.o cnd.o config.o conf_mg.o conf_sf.o \
       do_chat.o do_stat.o faxhng.o faxlib.o faxrec.o faxrecp.o \
       faxsend.o getdisk.o gettydefs.o goodies.o io.o locks.o \
       logfile.o login.o logname.o mg_m_init.o modem.o ring.o \
       tio.o utmp.o
mv $LIBM $TO/$LIBM; chmod 444 $TO/$LIBM
