#!/bin/sh # THINSTALL_1.0.0 ################################################################## # $Id: thinstall.acu,v 1.14 1998/09/05 00:05:01 mark Threshold_Inc mark $ ################################################################## case $PHASE in id) if [ "$SCRIPT_TYPE" = "env" ] then echo "acu:Acucobol" >>$tmp.list fi ;; preprod) : ${ACU_DIR=""} : ${THLIB_DIR=$THUD_DIR} ${THCOBLIB_DIR=$THUD_DIR} : ${THINST_DIR=$THUD_DIR} : ${THUD_EXTRACT_LIST="main.o startup.o conio.o"} echo '**************************************************************' echo '* This script performs the initial steps in preparing new *' echo '* versions of the Acucobol runtime libraries that contain *' echo '* the general thud interface. These updated libraries can *' echo '* then be used to rebuild the Acucobol executable. *' echo '**************************************************************' # Goal: have runcbl.a.orig and a copy of it as runcbl.a, # or have libruncbl.a.orig/libruncbl.a, # libacuterm.a.orig/libacuterm.a, and # libvision.a.orig/libvision.a # lib....a.orig/lib....a # If .orig's already exist use them, else search for unmodified # .a's in the current directory and ACU_DIR. If not found, ask # the user for ACU_DIR. # Sub goal: Copy unmodified lib(s) to .orig's. By default, first # look for the current revision's libraries. if [ -f libruncbl.a.orig ] then if [ -f libfsi.a.orig ] then ACU_LIB_LIST="libruncbl.a libfsi.a libacuterm.a libvision.a" else ACU_LIB_LIST="libruncbl.a libacuterm.a libvision.a" fi if [ -f libclnt.a.orig ] then ACU_LIB_LIST="$ACU_LIB_LIST libclnt.a" fi if [ -f liblib.a.orig ] then ACU_LIB_LIST="$ACU_LIB_LIST liblib.a" fi if [ -f libmessage.a.orig ] then ACU_LIB_LIST="$ACU_LIB_LIST libmessage.a" fi if [ -f libmemory.a.orig ] then ACU_LIB_LIST="$ACU_LIB_LIST libmemory.a" fi if [ -f libstdlib.a.orig ] then ACU_LIB_LIST="$ACU_LIB_LIST libstdlib.a" fi if [ -f libclient.a.orig ] then ACU_LIB_LIST="$ACU_LIB_LIST libclient.a" fi if [ -f libconnectc.a.orig ] then ACU_LIB_LIST="$ACU_LIB_LIST libconnectc.a" fi : ${ACU_DIR:=.} elif [ -f runcbl.a.orig ] then ACU_LIB_LIST=runcbl.a : ${ACU_DIR:=.} else # No .orig file; look for unmodified .a in current directory. if [ -f runcbl.a ] && lib_not_modified runcbl.a then mv runcbl.a runcbl.a.orig || error "Renaming AcuCobol library" ACU_LIB_LIST=runcbl.a : ${ACU_DIR:=.} elif [ -f libruncbl.a ] && lib_not_modified libruncbl.a then mv libruncbl.a libruncbl.a.orig && mv libacuterm.a libacuterm.a.orig && mv libvision.a libvision.a.orig || error "Renaming AcuCobol libraries" ACU_LIB_LIST="libruncbl.a libacuterm.a libvision.a" if [ -f libfsi.a ] then mv libfsi.a libfsi.a.orig || error "Renaming AcuCobol libfsi.a library" ACU_LIB_LIST="libruncbl.a libfsi.a libacuterm.a libvision.a" fi if [ -f libclnt.a ] then mv libclnt.a libclnt.a.orig || error "Renaming AcuCobol libclnt.a library" ACU_LIB_LIST="$ACU_LIB_LIST libclnt.a" fi if [ -f liblib.a ] then mv liblib.a liblib.a.orig || error "Renaming AcuCobol liblib.a library" ACU_LIB_LIST="$ACU_LIB_LIST liblib.a" fi if [ -f libmessage.a ] then mv libmessage.a libmessage.a.orig || error "Renaming AcuCobol libmessage.a library" ACU_LIB_LIST="$ACU_LIB_LIST libmessage.a" fi if [ -f libmemory.a ] then mv libmemory.a libmemory.a.orig || error "Renaming AcuCobol libmemory.a library" ACU_LIB_LIST="$ACU_LIB_LIST libmemory.a" fi if [ -f libstdlib.a ] then mv libstdlib.a libstdlib.a.orig || error "Renaming AcuCobol libstdlib.a library" ACU_LIB_LIST="$ACU_LIB_LIST libstdlib.a" fi if [ -f libclient.a ] then mv libclient.a libclient.a.orig || error "Renaming AcuCobol libclient.a library" ACU_LIB_LIST="$ACU_LIB_LIST libclient.a" fi if [ -f libconnectc.a ] then mv libconnectc.a libconnectc.a.orig || error "Renaming AcuCobol libconnectc.a library" ACU_LIB_LIST="$ACU_LIB_LIST libconnectc.a" fi : ${ACU_DIR:=.} else # No unmodified .a in current directory, check in ACU_DIR # then user supplied directory. until [ -f $ACU_DIR/runcbl.a ] && lib_not_modified $ACU_DIR/runcbl.a || [ -f $ACU_DIR/libruncbl.a ] && lib_not_modified $ACU_DIR/libruncbl.a do mesg="Enter pathname of directory containing AcuCobol libraries" prompt ACU_DIR=$cmd done if [ -f $ACU_DIR/runcbl.a ] then cp $ACU_DIR/runcbl.a runcbl.a.orig || error "Copying AcuCobol library" ACU_LIB_LIST=runcbl.a elif [ -f $ACU_DIR/libruncbl.a ] then cp $ACU_DIR/libruncbl.a libruncbl.a.orig && cp $ACU_DIR/libacuterm.a libacuterm.a.orig && cp $ACU_DIR/libvision.a libvision.a.orig || error "Copying AcuCobol libraries" ACU_LIB_LIST="libruncbl.a libacuterm.a libvision.a" if [ -f $ACU_DIR/libfsi.a ] then cp $ACU_DIR/libfsi.a libfsi.a.orig || error "Copying AcuCobol libfsi.a library" ACU_LIB_LIST="libruncbl.a libfsi.a libacuterm.a libvision.a" fi if [ -f $ACU_DIR/libclnt.a ] then cp $ACU_DIR/libclnt.a libclnt.a.orig || error "Copying AcuCobol libclnt.a library" ACU_LIB_LIST="$ACU_LIB_LIST libclnt.a" fi if [ -f $ACU_DIR/liblib.a ] then cp $ACU_DIR/liblib.a liblib.a.orig || error "Copying AcuCobol liblib.a library" ACU_LIB_LIST="$ACU_LIB_LIST liblib.a" fi if [ -f $ACU_DIR/libmessage.a ] then cp $ACU_DIR/libmessage.a libmessage.a.orig || error "Copying AcuCobol libmessage.a library" ACU_LIB_LIST="$ACU_LIB_LIST libmessage.a" fi if [ -f $ACU_DIR/libmemory.a ] then cp $ACU_DIR/libmemory.a libmemory.a.orig || error "Copying AcuCobol libmemory.a library" ACU_LIB_LIST="$ACU_LIB_LIST libmemory.a" fi if [ -f $ACU_DIR/libstdlib.a ] then cp $ACU_DIR/libstdlib.a libstdlib.a.orig || error "Copying AcuCobol libstdlib.a library" ACU_LIB_LIST="$ACU_LIB_LIST libstdlib.a" fi if [ -f $ACU_DIR/libclient.a ] then cp $ACU_DIR/libclient.a libclient.a.orig || error "Copying AcuCobol libclient.a library" ACU_LIB_LIST="$ACU_LIB_LIST libclient.a" fi if [ -f $ACU_DIR/libconnectc.a ] then cp $ACU_DIR/libconnectc.a libconnectc.a.orig || error "Copying AcuCobol libconnectc.a library" ACU_LIB_LIST="$ACU_LIB_LIST libconnectc.a" fi else error "AcuCobol libraries not available!" fi fi fi # Make a temp directory to hold all of the object modules rm -r -f $tmp mkdir $tmp for lib in $ACU_LIB_LIST do echo "Creating new version of library $lib" cp $lib.orig $lib && chmod u+w $lib || error "Creating new library $lib" # Add entries to the cross-reference file for all of the modules # in this library build_lib_xref $lib done # Extract cd $tmp echo Extracting files extract_module $THUD_EXTRACT_LIST if [ $? -ne $OK ] then echo "Could not extract one or more of the following modules:" echo " $THUD_EXTRACT_LIST" echo "Resolve and try again" cleanup 1 fi if extract_module lowscrn.o then ${THINST_DIR}/thpatch -f lowscrn.o read tred else if extract_module lowterm.o then ${THINST_DIR}/thpatch -f lowterm.o read tred else echo "Could not extract either lowterm.o or lowscrn.o" cleanup 1; fi fi if extract_module osfile.o then ${THINST_DIR}/thpatch -f osfile.o fread frxxx ${THINST_DIR}/thpatch -f osfile.o read tred ${THINST_DIR}/thpatch -f osfile.o frxxx fread fi # On DEC Alpha, libraries all have a zero-permission fake module # placed at the front by ar, probably a symbol table. Since the # permissions are zero, it cannot be extracted twice, killing the # multiple ar below that just wants to extract all modules in the # three "thud" libraries. So, since that fake module isn't wanted # anyway, build a list of the modules that are wanted, and use that # in the extract. THLIB_MODULES=`ar t ${THLIB_DIR}/thlib.a | grep -v '^_'` THCOBLIB_MODULES=`ar t ${THCOBLIB_DIR}/thaculib.a | grep -v '^_'` THUD_MODULES=`ar t ${THUD_DIR}/thclient.a | grep -v '^_'` ar x ${THLIB_DIR}/thlib.a $THLIB_MODULES && ar x ${THCOBLIB_DIR}/thaculib.a $THCOBLIB_MODULES && ar x ${THUD_DIR}/thclient.a $THUD_MODULES || error "Could not extract thud modules" # AIX version seems to have dots on the front of function names if module_contains_sym main.o AShutdown || module_contains_sym main.o .AShutdown then ${THINST_DIR}/thpatch \ -f main.o \ AShutdownAcuConnectClient xShutdownAcuConnectClient \ AShutdownAcuConnectServer xShutdownAcuConnectServer \ Aexam_argsAcuConnectClient Axxam_argsAcuConnectClient \ AStartupAcuConnectClient AxtartupAcuConnectClient \ exam_args txam_args \ AStartup TStartup \ AShutdown TShutdown \ w_accept t_accept \ xShutdownAcuConnectClient AShutdownAcuConnectClient \ xShutdownAcuConnectServer AShutdownAcuConnectServer \ Axxam_argsAcuConnectClient Aexam_argsAcuConnectClient \ AxtartupAcuConnectClient AStartupAcuConnectClient \ -f thacuini.o \ AStartup Axtartup \ AShutdown Axhutdown \ TStartup Txtartup \ TShutdown Txhutdown \ DStartup Dxtartup \ DShutdown Dxhutdown \ ThresholdStartup Thresholdxtartup \ ThresholdShutdown Thresholdxhutdown \ ProductStartup Productxtartup \ ProductShutdown Productxhutdown \ \ Startup Dtartup \ Shutdown Dhutdown \ \ Axtartup AStartup \ Axhutdown AShutdown \ Txtartup TStartup \ Txhutdown TShutdown \ Dxtartup DStartup \ Dxhutdown DShutdown \ Thresholdxtartup ThresholdStartup \ Thresholdxhutdown ThresholdShutdown \ Productxtartup ProductStartup \ Productxhutdown ProductShutdown else ${THINST_DIR}/thpatch \ -f main.o \ AShutdownAcuConnectClient xShutdownAcuConnectClient \ AShutdownAcuConnectServer xShutdownAcuConnectServer \ Aexam_argsAcuConnectClient Axxam_argsAcuConnectClient \ AStartupAcuConnectClient AxtartupAcuConnectClient \ exam_args txam_args \ Startup Ttartup \ Shutdown Thutdown \ w_accept t_accept \ xShutdownAcuConnectClient AShutdownAcuConnectClient \ xShutdownAcuConnectServer AShutdownAcuConnectServer \ Axxam_argsAcuConnectClient Aexam_argsAcuConnectClient \ AxtartupAcuConnectClient AStartupAcuConnectClient \ -f thacuini.o \ AStartup DStartup \ AShutdown DShutdown fi ${THINST_DIR}/thpatch \ -f startup.o \ Aexam_argsAcuConnectClient Axxam_argsAcuConnectClient \ AStartupAcuConnectClient AxtartupAcuConnectClient \ LIBTABLE TIBTABLE \ AStartup TStartup \ exam_args txam_args \ Axxam_argsAcuConnectClient Aexam_argsAcuConnectClient \ AxtartupAcuConnectClient AStartupAcuConnectClient \ -f conio.o \ w_accept t_accept xaccept="unused" if module_contains_sym thacuacc.o t_xaccept then xaccept="needed" ${THINST_DIR}/thpatch \ -f conio.o \ w_xaccept t_xaccept if extract_module newacpt.o then if module_contains_sym newacpt.o w_xaccept then xaccept="exists" echo "newacpt.o contains w_xaccept" fi fi fi if [ "$xaccept" = "needed" ] then echo "Including dummy w_xaccept routine" echo "int w_xaccept() { return 0; }" >thxaccept.c make thxaccept.o || error "Cannot build w_xaccept dummy module" fi process_input="unused" if module_contains_sym thacuacc.o t_process_input then process_input="needed" ${THINST_DIR}/thpatch \ -f conio.o \ w_process_input t_process_input if extract_module newacpt.o then ${THINST_DIR}/thpatch \ -f newacpt.o \ w_process_input t_process_input fi if extract_module control.o then ${THINST_DIR}/thpatch \ -f control.o \ w_process_input t_process_input fi if extract_module newwin.o then if module_contains_sym newwin.o w_process_input then process_input="exists" echo "newwin.o contains w_process_input" fi fi fi if [ "$process_input" = "needed" ] then echo "Including dummy w_process_input routine" echo "int w_process_input() { return 0; }" >thprocess_input.c make thprocess_input.o || error "Cannot build w_process_input dummy module" fi # Don't need the Base Window Routines emulator module if this version # of Acucobol is one that really has these routines. The versions # with multiple library files definitely have them; the older single # library versions need to be inspected to determine this. if [ "$ACU_LIB_LIST" != "runcbl.a" ] then rm -f thacuwb.o elif module_contains_sym $INSTALL_DIR/runcbl.a wb_get_map then rm -f thacuwb.o else echo "Base Window Routines do not exist in this version of Acucobol." echo "Threshold emulator module substituted." fi # Don't need the Window_H emulator module if this version of Acucobol # is one that really has these routines. The older single library # versions definitely don't have them; the newer multiple library # versions must be inspected to check this. if [ "$ACU_LIB_LIST" != "runcbl.a" ] then if module_contains_sym $INSTALL_DIR/libacuterm.a w_window_h then rm -f thacuwinh.o fi fi if [ -f thacuwinh.o ] then echo "Window_H routines do not exist in this version of Acucobol." echo "Threshold emulator module substituted." fi cd $INSTALL_DIR ;; postprod) # All modules extracted into the temp directory need to be put back into their # parent libraries. Any modules that were not originally in the ACUCOBOL # libraries (such as the ones obtained from the Threshold libraries) should # be added to the main ACUCOBOL library, defined as the first one in the # ACU_LIB_LIST built earlier. # Special handling is needed for the Screen Demon call emulation # module. Both the real and dummy versions were extracted from # the "thaculib.a" library. If that package was selected, then # the thinstall.sd script removed the dummy version. Otherwise, # both versions are still present in the $tmp directory, and the # real one needs to be removed before building new libraries. if [ -f $tmp/thacusd_dummy.o ] then rm -f $tmp/thacusd.o echo "Using dummy Screen Demon call emulation module" fi echo "\nConstructing new libraries with updated modules" construct_library $ACU_LIB_LIST echo "\nNew Acucobol runtime libraries are ready for use" ;; esac