tar.gz, .bz, .bz2 Opening a tarball – Has two step: Open file tarball.tar.gz • The -d option to gzip indicates "decompress mode.“ – However we do:... 4.4 Compiling Open Source Software
Trang 13.2 Tar format
What's a tarball?
– Is a compress format
– A tarball is usually indicated by the use of the multiple extensions: tar, gz, tar.gz, bz, bz2
Opening a tarball
– Has two step: Open file tarball.tar.gz
• The -d option to gzip indicates "decompress mode.“ – However we do:
Trang 23.3 Uncompressed bz or bz2 format
Files compressed with bzip2 can be opened with exactly the same options that gzip uses
Recent versions of GNU tar also support the j option to run bzip2 directly.
Trang 34.4 Compiling Open Source Software
After extract the source code we will make and install
System require: gcc or gcc-c++
Install from source code with three steps:
• configure
• make
• make install
Configure
– Most larger source code packages include a configure script – Configure examines your system to verify the existence of a compiler, libraries, utilities, and other items necessary
– It fails will somethings is missing
– When configure succeeds in most cases, it will creates script to make
Trang 44.5 Compiling Open Source Software
– make is a utility for controlling and scripting software compilation – make works by defining targets and their dependencies as
specified in the Makefile
– Typical usage for make is:
Make install
– Install files to system
Trang 54.6 Example:Compiling bash
Untar:
# tar zxvf bash-2.03.tar.gz
bash-2.03/
bash-2.03/CWRU/
bash-2.03/CWRU/misc/
bash-2.03/CWRU/misc/open-files.c
bash-2.03/CWRU/misc/sigs.c
bash-2.03/CWRU/misc/pid.c
(extraction continues)
Trang 64.7 Example:Compiling bash
#cd bash-2.03
# ls AUTHORS NEWS CHANGES NOTES COMPAT README COPYING Y2K
CWRU aclocal.m4 INSTALL alias.c MANIFEST alias.h Makefile.in ansi_stdlib.h (listing continues)
# less README
Trang 74.8 Example:Compiling bash
# /configure
creating cache /config.cache
checking host system type i686-pc-linux-gnu
Beginning configuration for bash-2.03 for i686-pc-linux-gnu checking for gcc gcc
checking whether the C compiler (gcc ) works yes
checking whether the C compiler (gcc ) is a
cross-compiler no
checking whether we are using GNU C yes
checking whether gcc accepts -g yes
checking whether large file support needs explicit
enabling yes
checking for POSIXized ISC no
checking how to run the C preprocessor gcc -E # make (configure continues)
Trang 84.9 Example:Compiling bash
# make /bin/sh /support/mkversion.sh -b -s release -d 2.03 \ -p 0 -o newversion.h && mv newversion.h version.h
***********************************************************
* Making Bash-2.03.0-release for a i686 running linux-gnu
***********************************************************
rm -f shell.o gcc -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"i686"' \ -DCONF_OSTYPE='"linux-gnu"' -DCONF_MACHTYPE='"i686 -pc-linux-gnu"' -DCONF_VENDOR='"pc"' -DSHELL \
-DHAVE_CONFIG_H -D_FILE_OFFSET_BITS=64 -I -I -I./ lib -I/usr/local/include -g -O2 -c shell.c
rm -f eval.o (compile continues)
Trang 94.10 Example:Compiling bash
# make install /usr/bin/install -c -m 0755 bash /usr/local/bin/bash /usr/bin/install -c -m 0755 bashbug /usr/local/bin/bashbug ( cd /doc ; make \
man1dir=/usr/local/man/man1 man1ext=1 \ man3dir=/usr/local/man/man3 man3ext=3 \ (……… -…………)
/usr/local/info/bash.info
if /bin/sh -c 'install-info version' >/dev/null 2>&1; then \
install-info dir-file=/usr/local/info/dir /usr/local/info/bash.info; \
else true; fi make[1]: Leaving directory '/home/ftp/bash-2.03/doc'
Trang 104.11 Test the install
Test with which command:
Trang 114.1 Manage Shared Libraries