1#! /bin/sh
2#
3# This script has to be built by configure.
4#
5# This is a script to install MPE Profiling Environment. It can be invoked with
6#
7#    make install  ( if you used -prefix at configure time )
8#
9#    or,
10#
11#    make install PREFIX=Path_to_the_installation_of_MPE
12#
13# in the top-level MPE __build__ directory which could be the same
14# or different from the source directory
15#
16
17# Location of sources
18# top_srcdir=@top_srcdir@
19top_srcdir=@top_srcdir_abs@       # in absolute path
20
21# Build locations
22includebuild_dir=@includebuild_dir@
23libbuild_dir=@libbuild_dir@
24binbuild_dir=@binbuild_dir@
25sbinbuild_dir=@sbinbuild_dir@
26etcbuild_dir=@etcbuild_dir@
27
28# Installation directories: Default paths (set at configure time)
29prefix=@prefix@
30exec_prefix=@exec_prefix@
31includedir=@includedir@
32libdir=@libdir@
33bindir=@bindir@
34sbindir=@sbindir@
35sysconfdir=@sysconfdir@
36datarootdir=@datarootdir@
37datadir=@datadir@
38docdir=@docdir@
39htmldir=@htmldir@
40mandir=@mandir@
41# Since autoconf < 2.60 does not set @docdir@ and @htmldir@,
42# If not set, docdir=@docdir@ remains, set them accordingly.
43if [ "$docdir" = "@docdir@" ] ; then
44    docdir=${datadir}/doc/${PACKAGE}
45fi
46if [ "$htmldir" = "@htmldir@" ] ; then
47    htmldir=${docdir}
48fi
49
50# Assume PROF_LIBNAME=MPE_LIBNAME.
51PROF_LIBNAME=@MPE_LIBNAME@
52MPI_IMPL=@MPI_IMPL@
53MPE_BUILD_FORTRAN2C=@MPE_BUILD_FORTRAN2C@
54
55# Determine this package's name
56tmpname="`echo $top_srcdir | sed -e 's%\(.*\)/\([^/]*\)%\2%'`"
57pkgname="`echo $tmpname | sed -e 'y%abcdefghijklmnopqrstuvwxyz/%ABCDEFGHIJKLMNOPQRSTUVWXYZ_%'`"
58if [ "x$pkgname" = "x" ] ; then
59    pkgname="MPE2"
60fi
61
62MAKE="@MAKE@"
63INSTALL="@INSTALL@"
64RM="@RM@"
65LN_S="@LN_S@"
66
67# File access mode
68MODE=0644
69XMODE=0755
70DMODE=0755
71replace=1
72# set failmode to soft to let failures accumulate
73failmode="hard"
74# chmod can fail for various reasons.  Let it?
75chmodfailmode="hard"
76Show=eval
77# set verbose to 0 to suppress success output
78verbose=0
79just_testing=0
80prefix_override=0
81package_override=0
82
83# filelist records files that have been installed
84filelist=""
85# dirlist records directories created
86dirlist=""
87# cmdlist records commands to be carried out during uninstall
88cmdlist=""
89# initialize the error code return counter
90errs=0
91
92# The variable, appendUninstall, is to signal this script to allow uninstall
93# information to append to an existing uninstall file.  Default is NO.
94appendUninstall=0
95
96# Set uninstall file
97# Should replace basename which is NOT available on all machine ?
98# Is ok for now. Popular Unix boxes, AIX, solaris, Linux, all have basename
99if [ -z "$UNINSTALLFILE" ] ; then
100    INSTALL_base=`basename $0`
101    UNINSTALL_base=`echo $INSTALL_base | sed -e 's/install/uninstall/'`
102    UNINSTALLFILE=$DESTDIR${sbindir}/${UNINSTALL_base}
103fi
104
105for arg in "$@" ; do
106    case "$arg" in
107        -prefix=*)
108            prefix=`echo $arg | sed -e 's/-prefix=//g'`
109            if [ "$prefix" != "@prefix@" ] ; then
110                prefix_override=1
111            fi
112            ;;
113        -package=*)
114            PACKAGE=`echo $arg | sed -e 's/-package=//g'`
115            package_override=1
116            ;;
117        -uninstall=*)
118            UNINSTALLFILE=`echo A$arg | sed -e 's/A-uninstall=//g'`
119            appendUninstall=1
120            ;;
121        -mode=*)
122            MODE=`echo $arg | sed -e 's/-mode=//g'`
123            ;;
124        -xmode=*)
125            XMODE=`echo $arg | sed -e 's/-xmode=//g'`
126            ;;
127        -dmode=*)
128            DMODE=`echo $arg | sed -e 's/-dmode=//g'`
129            ;;
130        -t)
131            Show=echo ; just_testing=1 ; failmode="soft"
132            ;;
133        -noman)                   noman=1 ;;
134        -echo)                    set -x ;;
135        -noreplace|-no_replace)   replace=0 ;;
136        -replace)                 replace=1 ;;
137        -no_verbose|-noverbose)   verbose=0 ;;
138        -verbose)                 verbose=1 ;;
139        -soft)                    failmode="soft" ; chmodfailmode="soft" ;;
140        -hard)                    failmode="hard" ; chmodfailmode="hard" ;;
141        -softchmod)               chmodfailmode="soft" ;;
142        -help|-u|-usage|-h)
143cat <<EOF
144Install $pkgname into $prefix.
145-prefix=path     - Destination directory.
146-package=name    - Set the package name for docdir and sharedir(examplesdir).
147-uninstall=file  - File to append uninstall information to
148-mode=nnnn       - mode for regular files.  Default is $MODE .
149-xmode=nnnn      - mode for execuables.  Default is $XMODE .
150-dmode=nnnn      - mode for directories.  Default is $DMODE .
151-t               - Try only; do no installation.
152-manpath=path    - Set an alternate path for the man pages
153-noman           - Do not install the man pages.
154-noreplace       - Do not replace files found in the installation directory
155-soft            - Do not abort on failure
156-softchmod       - Do not abort on failure of chmod
157EOF
158            exit 1
159            ;;
160        *)
161            # Silently skip empty arguments (these can occur on
162            # some systems and within some scripts; they are
163            # harmless)
164            if [ -n "$arg" ] ; then
165                echo "mpeinstall: Unrecognized argument $arg ."
166                exit 1
167            fi
168            ;;
169    esac
170done
171
172
173
174if [ "$SHELL_ECHO" = "on" ] ; then
175    set -x
176fi
177
178##############################################################################
179#
180# Start of Routines
181#
182##############################################################################
183
184INSTALLER="$INSTALL"
185#
186InstallFile() {
187if [ -z "$3" ] ; then
188    mode=$MODE
189else
190    mode=$3
191fi
192if [ -d $DESTDIR$2 ] ; then
193    dest=$DESTDIR$2/`basename $1`
194    destfile=$2/`basename $1`
195else
196    dest=$DESTDIR$2
197    destfile=$2
198fi
199if [ $replace = 0 -a -f $dest ] ; then
200    if [ $verbose = 1 ] ; then echo "$dest exists; not changed" ; fi
201elif [ -d $1 ] ; then
202    echo ">>> $1 is a directory; not installed <<<"
203    errs=`expr $errs + 1`
204    if [ $failmode = "hard" ] ; then exit 1 ; fi
205elif [ ! -f $1 ] ; then
206    echo "*** File $1 does not exist (or is not a regular file)! ***"
207    errs=`expr $errs + 1`
208    if [ $failmode = "hard" ] ; then exit 1 ; fi
209elif [ "$1" = "$dest" ] ; then
210    echo "*** File $1 is being installed to itself! ***"
211    errs=`expr $errs + 1`
212    if [ $failmode = "hard" ] ; then exit 1 ; fi
213else
214    if [ $verbose = 1 ] ; then echo "Installing $1 to $dest" ; fi
215    if [ -f $dest ] ; then
216        echo "Replacing existing file $dest..."
217        $Show $RM -f $dest
218    fi
219    if [ "X$mode" != "X" ] ; then
220        $Show $INSTALLER -m $mode $1 $dest
221    else
222        $Show $INSTALLER $1 $dest
223    fi
224    rc=$?
225    if [ $rc != 0 ] ; then
226        echo "*** Error installing file $1 to $dest with mode $mode. ***"
227        errs=`expr $errs + 1`
228        if [ $failmode = "hard" ] ; then exit $rc ; fi
229    else
230        # store the destination installed filename
231        filelist="$filelist $destfile"
232    fi
233fi
234}
235
236
237
238#
239# Recursive directory install that installs or replaces files
240# (file replacement of replace=1) but excluding directories,
241# .svn/, old/ and tex/.
242# $1 is the src directory, $2 is dest directory, $3 is $MODE or $XMODE
243InstallDirRecur() {
244if [ -n "$1" -a -n "$2" ] ; then
245    if [ -d $1 ] ; then
246        MkDir $2
247        # use $4 as a local variable
248        # & set it as the original PWD before "cd $1"
249        set $1 $2 ${3:-"$MODE"} `pwd`
250        cd $1
251        # Install everything but *.in file(that includes mpecc.in/Makefile.in)
252        for file in * ; do
253            case "$file" in
254                *.in)
255                    ;;
256                *)
257                    if [ -f $file ] ; then
258                        InstallFile $file $2/$file $3
259                    fi
260                    ;;
261            esac
262        done
263        for dir in * ; do
264            if [ -d $dir \
265                 -a "$dir" != ".svn" -a "$dir" != "old" \
266                 -a "$dir" != "tex" \
267               ] ; then
268                InstallDirRecur $dir $2/$dir $3
269            fi
270        done
271        # cd back where it comes from
272        # counter the effect of "cd $1" above,
273        # so "for" loop still works
274        cd $4
275    fi
276fi
277}
278
279
280
281#
282# Make the given directory.  This handles building intermediate directories
283# as required, and maintains a list of created directories in dirlist.
284MkDir() {
285dest=$1
286if [ ! -d $DESTDIR$dest ] ; then
287    dir=`echo $dest | sed 's%/% /%g'`
288    path_to_date=''
289    for path in $dir ; do
290        path_to_date="$path_to_date$path"
291        if [ ! -d $DESTDIR$path_to_date ] ; then
292            if [ $verbose = 1 ] ; then
293                echo "Creating directory $DESTDIR$path_to_date"
294            fi
295            $Show "mkdir $DESTDIR$path_to_date"
296            rc=$?
297            if [ $rc != 0 ] ; then
298                echo "*** Error making directory $DESTDIR$path_to_date. ***"
299                errs=`expr $errs + 1`
300                if [ $failmode = "hard" ] ; then exit $rc ; fi
301                echo "Failed to create directory $DESTDIR$path_to_date"
302                exit 1
303            else
304                # Note that we store in inverse order
305                dirlist="$path_to_date $dirlist"
306            fi
307            if [ "X$DMODE" != "X" ] ; then
308                $Show chmod $DMODE $DESTDIR$path_to_date
309                rc=$?
310                if [ $rc != 0 ] ; then
311                    echo "*** Error setting mode to $DMODE on directory $DESTDIR$path_to_date. ***"
312                    errs=`expr $errs + 1`
313                    if [ $chmodfailmode = "hard" ] ; then exit $rc ; fi
314                fi
315            fi
316        fi
317    done
318fi
319}
320
321
322
323#
324# Fixup files with various xxxxbuild_dir to xxxxdir, install directory.
325#
326#   The MPE_CLINKER/MPE_FLINKER need to sync with mpe2/configure.ac
327#
328FixInstallFile() {
329if [ -d $DESTDIR$2 ] ; then
330    dest=$DESTDIR$2/`basename $1`
331    destfile=$2/`basename $1`
332else
333    dest=$DESTDIR$2
334    destfile=$2
335fi
336if [ $replace = 0 -a -f $dest ] ; then
337    if [ $verbose = 1 ] ; then echo "$dest exists; not changed" ; fi
338elif [ -d $1 ] ; then
339    echo "$1 is a directory; not fixed"
340else
341    if [ -f $dest ] ; then $Show $RM -f $dest ; fi
342    if [ $just_testing = 0 ] ; then \
343        if [ "$MPI_IMPL" = "MPICH" -o "$MPI_IMPL" = "MPICH2" ] ; then
344            sed \
345            -e "s%^MPI_CC\([ ]*\)=\([ ]*\).*\$%MPI_CC\1=\2$bindir/mpicc%g" \
346            -e "s%^MPI_F77\([ ]*\)=\([ ]*\).*\$%MPI_F77\1=\2$bindir/mpif77%g" \
347            -e "s%^MPE_CLINKER\([ ]*\)=\([ ]*\).*\$%MPE_CLINKER\1=\2$bindir/mpicc -mpe=%g" \
348            -e "s%^MPE_FLINKER\([ ]*\)=\([ ]*\).*\$%MPE_FLINKER\1=\2$bindir/mpif77 -mpe=%g" \
349            -e "s%^MPE_INCDIR\([ ]*\)=\([ ]*\).*\$%MPE_INCDIR\1=\2$includedir%g" \
350            -e "s%^MPE_LIBDIR\([ ]*\)=\([ ]*\).*\$%MPE_LIBDIR\1=\2$libdir%g" \
351            -e "s%^MPE_BINDIR\([ ]*\)=\([ ]*\).*\$%MPE_BINDIR\1=\2$bindir%g" \
352            -e "s%^MPE_ETCDIR\([ ]*\)=\([ ]*\).*\$%MPE_ETCDIR\1=\2$sysconfdir%g" \
353            -e "s%^MPE_SBINDIR\([ ]*\)=\([ ]*\).*\$%MPE_SBINDIR\1=\2$sbindir%g" \
354            $1 > $dest
355        else
356            sed \
357            -e "s%^MPE_CLINKER\([ ]*\)=\([ ]*\).*\$%MPE_CLINKER\1=\2$bindir/mpecc -%g" \
358            -e "s%^MPE_FLINKER\([ ]*\)=\([ ]*\).*\$%MPE_FLINKER\1=\2$bindir/mpefc -%g" \
359            -e "s%^MPE_INCDIR\([ ]*\)=\([ ]*\).*\$%MPE_INCDIR\1=\2$includedir%g" \
360            -e "s%^MPE_LIBDIR\([ ]*\)=\([ ]*\).*\$%MPE_LIBDIR\1=\2$libdir%g" \
361            -e "s%^MPE_BINDIR\([ ]*\)=\([ ]*\).*\$%MPE_BINDIR\1=\2$bindir%g" \
362            -e "s%^MPE_ETCDIR\([ ]*\)=\([ ]*\).*\$%MPE_ETCDIR\1=\2$sysconfdir%g" \
363            -e "s%^MPE_SBINDIR\([ ]*\)=\([ ]*\).*\$%MPE_SBINDIR\1=\2$sbindir%g" \
364            $1 > $dest
365        fi
366        rc=$?
367        if [ $rc != 0 ] ; then
368            echo "*** Error fixing up file $dest. ***"
369            errs=`expr $errs + 1`
370            if [ $failmode = "hard" ] ; then exit $rc ; fi
371        else
372            # store the destination fixed filename
373            filelist="$filelist $destfile"
374        fi
375    else
376        if [ $verbose = 1 ] ; then echo "Fixup $1 and install to $dest" ; fi
377    fi
378fi
379if [ -z "$3" ] ; then
380    mode=$MODE
381else
382    mode=$3
383fi
384if [ "X$mode" != "X" ] ; then
385    $Show chmod $mode $dest
386    rc=$?
387    if [ $rc != 0 ] ; then
388        echo "*** Error setting mode $mode on file $dest. ***"
389        errs=`expr $errs + 1`
390        if [ $failmode = "hard" ] ; then exit $rc ; fi
391    fi
392fi
393}
394
395
396##############################################################################
397#
398# End of routines
399#
400##############################################################################
401if [ ! -s $libbuild_dir/lib${PROF_LIBNAME}.a ] ; then
402    echo "You must make $pkgname before installing it!"
403    echo "Could not find $libbuild_dir/lib${PROF_LIBNAME}.a !"
404    exit 1
405fi
406
407if [ ! -n "$prefix" ] ; then
408    echo "Set an installation location with -prefix=<location> ."
409    exit 1
410fi
411if [ $verbose = 1 ] ; then
412    echo "Install into $DESTDIR$prefix"
413fi
414
415if [ -d $DESTDIR$prefix ] ; then
416    if [ $verbose = 1 ] ; then
417        echo "using existing directory $DESTDIR$prefix"
418    fi
419else
420    MkDir $prefix
421fi
422
423# echo "prefix = $prefix"
424# echo "exec_prefix = $exec_prefix"
425# echo "includedir = $includedir"
426# echo "libdir = $libdir"
427# echo "bindir = $bindir"
428# echo "sbindir = $sbindir"
429# echo "sysconfdir = $sysconfdir"
430# echo "datarootdir = $datarootdir"
431# echo "datadir = $datadir"
432# echo "docdir = $docdir"
433# echo "mandir = $mandir"
434# echo "htmldir = $htmldir"
435
436# If the prefix was set, we want to override these choices
437# use autoconf variables, @...@, here, as they are set w.r.t. $prefix.
438if [ "$prefix_override" = 1 -o "$package_override" = 1 ] ; then
439    exec_prefix=@exec_prefix@
440    includedir=@includedir@
441    libdir=@libdir@
442    bindir=@bindir@
443    sbindir=@sbindir@
444    sysconfdir=@sysconfdir@
445    datarootdir=@datarootdir@
446    datadir=@datadir@
447    docdir=@docdir@
448    htmldir=@htmldir@
449    mandir=@mandir@
450    # Since autoconf < 2.60 does not set @docdir@ and @htmldir@,
451    # If not set, docdir=@docdir@ remains, set them accordingly.
452    if [ "$docdir" = "@docdir@" ] ; then
453        docdir=${datadir}/doc/${PACKAGE}
454    fi
455    if [ "$htmldir" = "@htmldir@" ] ; then
456        htmldir=${docdir}
457    fi
458    if [ $appendUninstall = 0 ] ; then
459        UNINSTALLFILE=$DESTDIR${sbindir}/${UNINSTALL_base}
460    fi
461fi
462
463# Install end-user include Files, i.e. mpe*h
464if [ -n "$includebuild_dir" ] ; then
465    if [ -d $includebuild_dir ] ; then
466        echo "Installing $pkgname include files to $DESTDIR$includedir"
467        MkDir $includedir
468        cd $includebuild_dir
469        for file in clog*.h mpe*.h ; do
470            if [ -f $includebuild_dir/$file ] ; then
471                InstallFile $includebuild_dir/$file $includedir/$file $MODE
472            fi
473        done
474    fi
475fi
476
477# Install libraries
478if [ -n "$libbuild_dir" ] ; then
479    if [ -d $libbuild_dir ] ; then
480        echo "Installing $pkgname libraries to $DESTDIR$libdir"
481        InstallDirRecur $libbuild_dir $libdir $MODE
482    fi
483fi
484
485# Install utility programs
486if [ -n "$binbuild_dir" ] ; then
487    if [ -d $binbuild_dir ] ; then
488        echo "Installing $pkgname utility programs to $DESTDIR$bindir"
489        InstallDirRecur $binbuild_dir $bindir $XMODE
490        if [ -s $binbuild_dir/mpecc -a -x $binbuild_dir/mpecc ] ; then
491            FixInstallFile $binbuild_dir/mpecc $bindir/mpecc $XMODE
492        fi
493        if [ -s $binbuild_dir/mpefc -a -x $binbuild_dir/mpefc ] ; then
494            FixInstallFile $binbuild_dir/mpefc $bindir/mpefc $XMODE
495        fi
496    fi
497fi
498
499# Install compiler configuration files
500if [ -n "$etcbuild_dir" ] ; then
501    if [ -d $etcbuild_dir ] ; then
502        echo "Installing $pkgname configuration files to $DESTDIR$sysconfdir"
503        MkDir $sysconfdir
504        cd $etcbuild_dir && \
505        for file in *.conf ; do \
506            FixInstallFile $file $sysconfdir/$file ; \
507        done
508    fi
509fi
510
511# Create $sbindir outside of nested IF blocks because $sbindir is needed
512# even if $sbinbuild_dir/* do not exist.
513MkDir $sbindir
514
515# Install system-admin related utilies
516if [ -n "$sbinbuild_dir" ] ; then
517    if [ -d $sbinbuild_dir ] ; then
518         echo "Installing $pkgname system utility programs to $DESTDIR$sbindir"
519         InstallFile    $sbinbuild_dir/mpecheckinstall  $sbindir $XMODE
520         FixInstallFile $sbinbuild_dir/mpetestlink      $sbindir $XMODE
521         FixInstallFile $sbinbuild_dir/mpetestexec      $sbindir $XMODE
522         FixInstallFile $sbinbuild_dir/mpetestexeclog   $sbindir $XMODE
523    fi
524fi
525
526# Append sharedir and docdir With NULL PACKAGE to dirlist for removal
527if [ -n "${PACKAGE}" ] ; then
528    # Added MkDir $datadir, so $datadir is appended to dirlist for removal.
529    MkDir $datadir
530    # Added MkDir $docdir with NULL PACKAGE,
531    # so $docdir (with NULL PACKAGE) is appended to dirlist for removal.
532    savedPACKAGE=$PACKAGE
533    PACKAGE=""
534%%PORTDOCS%%    MkDir @docdir@
535    PACKAGE=$savedPACKAGE
536fi
537
538sharedir=$datadir
539if [ -n "${PACKAGE}" ] ; then
540    sharedir=$datadir/$PACKAGE
541fi
542MkDir $sharedir
543
544# Set up Examples directory for the MPE Logging programs
545logging_dirname="src/wrappers/test"
546graphics_dirname="src/graphics/contrib/test"
547collchk_dirname="src/collchk/test"
548for pkg in logging graphics collchk ; do
549    dirname=${pkg}_dirname
550    eval dirvalue=\$"$dirname"
551    if [ -f $libbuild_dir/../$dirvalue/Makefile ] ; then
552        examplesdir=$sharedir/examples/${pkg}
553        MkDir $examplesdir
554#       Install example C and Fortran programs
555        InstallDirRecur $top_srcdir/$dirvalue $examplesdir
556
557#       Create examples Makefile
558        cd $DESTDIR$examplesdir && \
559        FixInstallFile $libbuild_dir/../$dirvalue/Makefile \
560                       $examplesdir/Makefile
561
562#        MPICH2 1.0.2 mpd does not sypport symbolic link to mpiexec
563#        if [ -x $bindir/mpiexec -o -x $DESTDIR$bindir/mpiexec ] ; then
564#            $Show "( cd $DESTDIR$examplesdir && \
565#                     $RM -f mpiexec && \
566#                     $LN_S $bindir/mpiexec mpiexec )"
567#            filelist="$filelist $examplesdir/mpiexec"
568#        elif [ -x $bindir/mpirun -o -x $DESTDIR$bindir/mpirun ] ; then
569#            $Show "( cd $DESTDIR$examplesdir && \
570#                     $RM -f mpirun && \
571#                     $LN_S $bindir/mpirun mpirun )"
572#            filelist="$filelist $examplesdir/mpirun"
573#        fi
574    fi
575done
576
577
578# Install documentation related files if they exist,
579# ie INSTALL $top_srcdir/doc  $docdir
580#    INSTALL $top_srcdir/man  $mandir
581#    INSTALL $top_srcdir/html $htmldir
582%%PORTDOCS%%for type in doc man html ; do
583%%PORTDOCS%%    typename=${type}dir
584%%PORTDOCS%%    eval typevalue=\$"$typename"
585%%PORTDOCS%%    if [ -d $top_srcdir/$type ] ; then
586%%PORTDOCS%%        MkDir $typevalue
587%%PORTDOCS%%        echo "Installing $pkgname $type to $DESTDIR$typevalue"
588%%PORTDOCS%%        InstallDirRecur $top_srcdir/$type $typevalue $MODE
589%%PORTDOCS%%    fi
590%%PORTDOCS%%done
591
592# Remove old uninstall file
593if [ "$appendUninstall" = 0 -a -f $UNINSTALLFILE ] ; then
594    $RM -f $UNINSTALLFILE
595fi
596#
597# Open an uninstall file and force strong echo if one does NOT exist
598if [ ! -f $UNINSTALLFILE ] ; then
599    cat > $UNINSTALLFILE <<EOF
600#! /bin/sh
601set -x
602EOF
603fi
604
605chmod u+x $UNINSTALLFILE
606
607# Install the SLOG-2 tools if they exist
608# Don't set the prefix if the default is chosen.
609if [ -x $libbuild_dir/../src/slog2sdk/sbin/install-package ] ; then
610    install_opts="-mode=$MODE -xmode=$XMODE -dmode=$DMODE -copymode=core"
611    install_opts="-uninstall=$UNINSTALLFILE $install_opts"
612    if [ "$prefix_override" = 1 ] ; then
613        install_opts="-prefix=$prefix $install_opts"
614    fi
615    if [ "$package_override" = 1 ] ; then
616        install_opts="-package=$PACKAGE $install_opts"
617    fi
618    ( cd $libbuild_dir/../src/slog2sdk && ./sbin/install-package $install_opts )
619fi
620
621#  Clean up the example directories
622for pkg in logging graphics ; do
623    dirname=${pkg}_dirname
624    examplesdir=$sharedir/examples/${pkg}
625    if [ -s $DESTDIR$examplesdir/Makefile ] ; then
626       echo "( cd \${DESTDIR}$examplesdir && $MAKE clean )" >> $UNINSTALLFILE
627    fi
628done
629
630# Add the files to be removed to the UNINSTALLFILE
631for file in $filelist ; do
632    echo "$RM -f \${DESTDIR}$file" >> $UNINSTALLFILE
633done
634
635if [ "$appendUninstall" = 0 ] ; then
636    if [ -n "${DESTDIR}" ] ; then
637        uninstallfilename=`echo $UNINSTALLFILE| sed -e "s|^${DESTDIR}||g"`
638        echo "$RM -f \${DESTDIR}$uninstallfilename" >> $UNINSTALLFILE
639    else
640        echo "$RM -f \${DESTDIR}$UNINSTALLFILE" >> $UNINSTALLFILE
641    fi
642fi
643
644# Add the directory removes to the UNINSTALL file
645for dir in $dirlist ; do
646    echo "if [ -d \${DESTDIR}$dir ] ; then rmdir \${DESTDIR}$dir || true ; fi" >> $UNINSTALLFILE
647done
648
649if [ "$appendUninstall" = 0 ] ; then
650    cp $UNINSTALLFILE $sbinbuild_dir/mpeuninstall
651#
652    echo "Installed $pkgname in $prefix"
653    echo "${sbindir}/${UNINSTALL_base} may be used to remove the installation"
654fi
655
656if [ $errs -gt 0 ] ; then
657    rc=1
658else
659    rc=0
660fi
661exit $rc
662