%% $Header: /cvsroot/lcdp/lpic/general-linux-2/slides/gl2.102.3.slides.tex,v 1.3 2003/05/30 06:03:32 waratah Exp $

\input{gl2.slide-header.tex}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----10->|-----20->|-----30->|-----40->|-----50->|-----60->|-----70->|-----80->
\begin{slide} %================================================================
\begin{center} \LARGE \textsf{-- General Linux 2 -- \\
Make and install programs from source }
\LARGE \textsf{[5] } \\[2mm]
\large  \textsf{(Linux Professional Institute Certification)}\\[1mm]

\normalsize\end{center}

\footnote{Copyright \copyright\ 2002 Geoffrey Robertson. Permission is granted to make and distribute verbatim copies or modified versions of this document provided that this copyright notice and this permission notice are preserved on all copies under the terms of the GNU General Public License as published by the Free Software Foundation---either version 2 of the License or (at your option) any later version.}
 
\scriptsize
\begin{verbatim} 
   .~.    
   /V\     by: geoffrey robertson        
  // \\        geoffrey@zip.com.au
  @._.@ 
\end{verbatim} 
\tiny
\begin{verbatim}
$Id: gl2.102.3.slides.tex,v 1.3 2003/05/30 06:03:32 waratah Exp $ 
\end{verbatim} 
\normalsize  
\vfill \end{slide} %-----------------------------------------------------------
%----10->|-----20->|-----30->|-----40->|-----50->|-----60->|-----70->|-----80->

%==============================================================================
\begin{slide} %ghr
  \listofslides
\vfill \end{slide}
%------------------------------------------------------------------------------

%==============================================================================
\begin{slide}{} %ghr
\Slidecontents
\vfill \end{slide} %-----------------------------------------------------------
 
%==============================================================================
%==============================================================================
\begin{slide} %ghr
\slideheading{(2.2) 102 Installation \& Package Mgt. [24]}
\begin{description}
  \item[2.102.1] Design hard disk layout [2]
  \item[2.102.2] Install a boot manager [3]
  \item[2.102.3] {\bf \underline{Make and install programs from source [5]}}
  \item[2.102.4] Manage shared libraries [3]
  \item[2.102.5] Use Debian package management [5]
  \item[2.102.6] Use Red Hat Package Manager (RPM) [6] 
\end{description}
\vfill \end{slide} %-----------------------------------------------------------
 
%==============================================================================
\begin{slide}{} %ghr
\Slidecontents
\vfill \end{slide} %-----------------------------------------------------------
 
%==============================================================================
%==============================================================================
\begin{slide} %ghr
\slideheading{Make and install programs from source [5]}
\slidesubheading{Objective} 

Candidates should be able to build and install an executable program
from source. This objective includes being able to unpack a file of
sources. Candidates should be able to make simple customisations to
the Makefile, for example changing paths or adding extra include
directories.

\vfill \end{slide} %-----------------------------------------------------------
 
%==============================================================================
\begin{slide} %ghr
\Slideheading{Make and install programs from source [5]}
\slidesubheading{Key files, terms, and utilities}
\begin{alltt}
gunzip
gzip
bzip2 
tar 
configure 
make
\end{alltt}
\vfill \end{slide} %-----------------------------------------------------------
 
%==============================================================================
\begin{slide} %ghr
\Slideheading{Make and install programs from source [5]}
\slidesubheading{Resources of interest}
 
LPI Linux Certification in a Nutshell \\
\texttt{by Jeffrey Dean}\\
\textsf{O'Reilly}

LPIC 1 Certification Bible\\
\textit{Angie Nash and Jason Nash}\\
\textsf{Hungry Minds}


\vfill \end{slide} %-----------------------------------------------------------
 
%==============================================================================
\begin{slide}{} %ghr
\Slidecontents
\vfill \end{slide} %-----------------------------------------------------------

%==============================================================================
%==============================================================================
\begin{slide}{}
\slideheading{Source Code Distribution}
\slidesubheading{}

To distribute software in the form of source code a \textsf{source tree} is archived into one file using the tar command and then compressed. The resulting file is called a \textsf{tarball}.

Source code may also be distributed using the package management tools of a particular distribution.
\begin{description}
\item[Debian] apt-get install kernel-source-2.2.27
\item[Redhat] rpm -Uhv at-3.1.8-23.src.rpm
\item[Tarball] tdb-1.0.6.tar.gz
\end{description}

\vfill \end{slide} %-----------------------------------------------------------


%==============================================================================
\begin{slide}{} %ghr
\Slidecontents
\vfill \end{slide} %-----------------------------------------------------------


%==============================================================================
%==============================================================================
\begin{slide}{}
\slideheading{Installing the trivial database \texttt{tdb}}
\slidesubheading{Download}

Locate and download the \texttt{tarball}
\begin{itemize}
\item \textsf{googling} for it: \texttt{http://google.com}
\item search on \textsf{freshmeat}: \texttt{http://freshmeat.net}
\item see if it lives on \textsf{sourceforge}: \texttt{http://www.sf.net}
\end{itemize}
Download the tarball to a suitable directory such as \texttt{/tmp}.

\vfill \end{slide} %-----------------------------------------------------------


%==============================================================================
\begin{slide}{}
\Slideheading{Installing the trivial database \texttt{tdb}}
\slidesubheading{Unpack}
 
The \textsf{tarball} file is a compressed archived source tree.

Most commonly the file will be compressed using either \texttt{gzip}
or \texttt{bzip2}

\textsf{GNU} \texttt{tar} can uncompress and unpack the archive:
\begin{alltt}
\cmd{tar zxvf tdb-1.0.6.tar.gz}  
\end{alltt}
or
\begin{alltt}
\cmd{tar jxvf tdb-1.0.6.tar.bz2}  
\end{alltt}

\vfill \end{slide} %-----------------------------------------------------------
 
%==============================================================================
\begin{slide}{}
\Slideheading{Installing the trivial database \texttt{tdb}}
\slidesubheading{\texttt{cd} into the tree}

The unpacked \textsf{tarball} creates a source tree. The base of which is the name of the program
\begin{alltt}
\cmd{ls}
tdb-1.0.6  tdb-1.0.6.tar.gz

\cmd{cd tdb-1.0.6}

\cmd{ls}
configure  tdb.c  tdb.h   README  INSTALL  COPYING
...
\end{alltt}

\vfill \end{slide} %-----------------------------------------------------------
%==============================================================================
\begin{slide}{}
\Slideheading{Installing the trivial database \texttt{tdb}}
\Slidesubheading{\texttt{cd} into the tree}

\scriptsize
\begin{alltt}
\cmd{ls -w 70}
acconfig.h    install-sh     stamp-h.in       tdb.h
aclocal.m4    ltconfig       tdb.3            tdbiterate.c
AUTHORS       ltmain.sh      tdb.c            tdb_open.3
ChangeLog     Makefile.am    tdb_chainlock.3  tdb.spec
config.guess  Makefile.in    tdb_close.3      tdbspeed.c
config.h.in   missing        tdb_delete.3     tdb_store.3
config.sub    mkinstalldirs  tdbdump.c        tdbtest.c
configure     NEWS           tdb_error.3      tdbtool.c
configure.in  README         tdb_exists.3     tdbtorture.c
COPYING       spinlock.c     tdb_fetch.3      tdb_traverse.3
INSTALL       spinlock.h     tdb_firstkey.3   TODO
\end{alltt}

\vfill \end{slide} %-----------------------------------------------------------

%==============================================================================
\begin{slide}{}
\Slideheading{Installing the trivial database \texttt{tdb}}
\slidesubheading{\texttt{./configure}}
\small
\begin{alltt}
\cmd{file configure}
configure: Bourne shell script text executable

\cmd{head -5 configure}
#! /bin/sh

# Guess values for system-dependent variables 
# Create Makefiles.
# Generated automatically using autoconf version 2.13

\end{alltt}

\vfill \end{slide} %-----------------------------------------------------------

%==============================================================================
\begin{slide}{}
\Slideheading{Installing the trivial database \texttt{tdb}}
\Slidesubheading{\texttt{./configure}}
\small
\begin{alltt}
\cmd{./configure}
 creating cache ./config.cache
checking for a BSD compat install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal... found
...
creating ./config.status
creating Makefile
creating config.h
\end{alltt}

\vfill \end{slide} %-----------------------------------------------------------

%==============================================================================
%==============================================================================
\begin{slide}{}
\Slideheading{Installing the trivial database \texttt{tdb}}
\slidesubheading{The \texttt{Makefile}}
\small
\begin{alltt}
SHELL = /bin/sh
CC = gcc
CFLAGS = -g -O2
prefix = /usr/local
includedir = ${prefix}/include
...
tdbtool: $(tdbtool_OBJECTS) $(tdbtool_DEPENDENCIES)
        @rm -f tdbtool
        $(LINK) $(tdbtool_LDFLAGS) $(tdbtool_OBJECTS) \
                             $(tdbtool_LDADD) $(LIBS)
...
distclean: distclean-am
        -rm -f config.status
\end{alltt}

\vfill \end{slide} %-----------------------------------------------------------

%==============================================================================
\begin{slide}{}
\Slideheading{Installing the trivial database \texttt{tdb}}
\slidesubheading{\texttt{make}}
\small
\begin{alltt}
\cmd{make}
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. 
-I. -I.     -g -O2  -c tdb.c
mkdir .libs
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c  -fPIC -DPIC 
tdb.c -o .libs/tdb.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c tdb.c -o tdb.o
>/dev/null 2>&1
mv -f .libs/tdb.lo tdb.lo
/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. 
-I. -I.     -g -O2  -c spinlock.c  
...
\end{alltt}

\vfill \end{slide} %-----------------------------------------------------------

%==============================================================================
\begin{slide}{}
\Slideheading{Installing the trivial database \texttt{tdb}}
\slidesubheading{\texttt{make install}}
\small
\begin{alltt}
su -c 'make install'
Password:
make[1]: Entering directory `/tmp/tdb-1.0.6'
/bin/sh ./mkinstalldirs /usr/local/lib
/bin/sh ./libtool  --mode=install /usr/bin/install -c 
libtdb.la /usr/local/lib/libtdb.la
...
chmod 644 /usr/local/lib/libtdb.a
PATH="$PATH:/sbin" ldconfig -n /usr/local/lib
\end{alltt}

\vfill \end{slide} %-----------------------------------------------------------

%==============================================================================
%==============================================================================
\begin{slide}{}
\slideheading{Using \texttt{tdb}}
\scriptsize
\begin{alltt}
\cmd{tdbtool}
tdb> ?

tdbtool:
  create    dbname     : create a database
  open      dbname     : open an existing database
  erase                : erase the database
  dump      dumpname   : dump the database as strings
  insert    key  data  : insert a record
  store     key  data  : store a record (replace)
  show      key        : show a record by key
  delete    key        : delete a record by key
  list                 : print the database hash table and freelist
  free                 : print the database freelist
  1 | first            : print the first record
  n | next             : print the next record
  q | quit             : terminate
  \(\setminus\)n                   : repeat 'next' command
tdb>
\end{alltt}

\vfill \end{slide} %-----------------------------------------------------------


%==============================================================================
%==============================================================================
\begin{slide}{}
\Slideheading{Using \texttt{tdb}}
\small
\begin{alltt}
\cmd{tdbtool}
tdb>  create test.tdb
tdb> insert 1 thing
tdb> insert 2 foo
tdb> insert 3 bar
tdb> insert 55 whizz
tdb> show 3

key 2 bytes
3
data 4 bytes
[000] 62 61 72 00      bar
\end{alltt}

\vfill \end{slide} %-----------------------------------------------------------


%==============================================================================
%==============================================================================
\begin{slide}{}
\slideheading{Summary}
\begin{itemize}
\item \cmd{tar zxvf my-progy.tar.gz}
\overlay{1}
\item \cmd{cd my-progy}
\overlay{2}
\item \cmd{less README INSTALL}
\overlay{3}
\item \cmd{./configure}
\overlay{4}
\item \cmd{make}
\overlay{5}
\item \cmd{su -c 'make install'}
\overlay{6}
\item \cmd{my-progy}
\end{itemize}

\vfill \end{slide} %-----------------------------------------------------------

%==============================================================================
\begin{slide}{} %ghr
\heading{The End}
 \Slidecontents
\vfill \end{slide} %-----------------------------------------------------------


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%==============================================================================
%==============================================================================
\begin{slide}{}
\slideheading{}


\vfill \end{slide} %-----------------------------------------------------------

=============================================================================
\begin{slide}{}

\end{slide} %------------------------------------------------------------------

