Installera källkod

Jag visar med ett exempel, programmet "checkinstall" från http://checkinstall.izto.org/

(Ett liknande, suveränt program för att göra om källkod till *.tgz/*.txz är programmet src2pkg.
Hemsida: http://www.src2pkg.net/ (Domän upphört 2006 /mdkdio) Korrekt URL för nedladdning Nedladdning: Se ovan /mdkdio

Ladda ner
Som vanlig användare laddar du ner programmet i din hemkatalog, jag har skapat katalogen "program" där jag lägger det. ($mkdir /home/hakan/program )

Kontrollera...
hakan@haze:~$ cd program
hakan@haze:~/program$ ls

checkinstall-1.6.0beta3.tgz  parted-1.2.14.tar.gz  swaret/
grub-0.93/                   pysol-4.82/
mplayer/                     splash/

Jag lägger mina program i /usr/local
hakan@haze:~/program$ cd /usr/local

Nu blir jag root
hakan@haze:/usr/local$ su
Password:

Packa upp:OBS! Programmet är ett .tar.gz trots att det bara står .tgz. (Har du ett
tar.bz2 använder du  tar xvfj istället.)
root@haze:/usr/local# tar xvfz /home/hakan/program/checkinstall-1.6.0beta3.tgz

checkinstall-1.6.0beta3/
checkinstall-1.6.0beta3/FAQ
checkinstall-1.6.0beta3/BUGS
checkinstall-1.6.0beta3/TODO
checkinstall-1.6.0beta3/Makefile
checkinstall-1.6.0beta3/doc-pak/
checkinstall-1.6.0beta3/doc-pak/FAQ
checkinstall-1.6.0beta3/doc-pak/BUGS
checkinstall-1.6.0beta3/doc-pak/TODO
checkinstall-1.6.0beta3/doc-pak/README
checkinstall-1.6.0beta3/doc-pak/installwatch-0.7.0beta3/
checkinstall-1.6.0beta3/doc-pak/installwatch-0.7.0beta3/BUGS
checkinstall-1.6.0beta3/doc-pak/installwatch-0.7.0beta3/TODO
checkinstall-1.6.0beta3/doc-pak/installwatch-0.7.0beta3/README
checkinstall-1.6.0beta3/doc-pak/installwatch-0.7.0beta3/CHANGELOG
checkinstall-1.6.0beta3/doc-pak/installwatch-0.7.0beta3/VERSION
checkinstall-1.6.0beta3/doc-pak/installwatch-0.7.0beta3/INSTALL
checkinstall-1.6.0beta3/doc-pak/installwatch-0.7.0beta3/COPYING
checkinstall-1.6.0beta3/doc-pak/NLS_SUPPORT
checkinstall-1.6.0beta3/doc-pak/RELNOTES
checkinstall-1.6.0beta3/doc-pak/INSTALL
checkinstall-1.6.0beta3/doc-pak/Changelog
checkinstall-1.6.0beta3/doc-pak/COPYING
checkinstall-1.6.0beta3/doc-pak/CREDITS
checkinstall-1.6.0beta3/README
checkinstall-1.6.0beta3/makepak
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/er
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/BUGS
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/TODO
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/create-localdecls
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/Makefile
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/README
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/CHANGELOG
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/installwatch
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/test-installwatch.c
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/VERSION
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/installwatch.c
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/INSTALL
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/libctest.c
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/description-pak
checkinstall-1.6.0beta3/installwatch-0.7.0beta3/COPYING
checkinstall-1.6.0beta3/NLS_SUPPORT
checkinstall-1.6.0beta3/locale/
checkinstall-1.6.0beta3/locale/checkinstall-template.po
checkinstall-1.6.0beta3/locale/checkinstall-es.mo
checkinstall-1.6.0beta3/locale/checkinstall-es.po
checkinstall-1.6.0beta3/locale/checkinstall-ru.po
checkinstall-1.6.0beta3/locale/checkinstall-pt_BR.po
checkinstall-1.6.0beta3/locale/checkinstall-zh_CN.po
checkinstall-1.6.0beta3/checkinstall
checkinstall-1.6.0beta3/RELNOTES
checkinstall-1.6.0beta3/checkinstallrc-dist
checkinstall-1.6.0beta3/INSTALL
checkinstall-1.6.0beta3/Changelog
checkinstall-1.6.0beta3/description-pak
checkinstall-1.6.0beta3/COPYING
checkinstall-1.6.0beta3/CREDITS

Detta skapar katalogen "checkinstall-1.6.0beta3" i /usr/local.
root@haze:/usr/local# ls

bin  checkinstall-1.6.0beta3  etc  games  include  info  lib  man  sbin  share  src

Flytta dit...
root@haze:/usr/local# cd checkinstall-1.6.0beta3/
root@haze:/usr/local/checkinstall-1.6.0beta3# ls

BUGS     Changelog  Makefile     RELNOTES      checkinstallrc-dist  installwatch-0.7.0beta3
COPYING  FAQ        NLS_SUPPORT  TODO          description-pak      locale
CREDITS  INSTALL    README       checkinstall  doc-pak              makepak

Nu bör du läsa lite, åtmindstånde README och INSTALL, använd filhanteraren (konqueror)
om du har den, annars "less"
root@haze:/usr/local/checkinstall-1.6.0beta3# less INSTALL

Här ser du hur du fortsätter (make, make install, checkinstall) oftast måste du även köra
./configure, dock inte nu.
root@haze:/usr/local/checkinstall-1.6.0beta3# make

make -C installwatch-0.7.0beta3
make[1]: Entering directory `/usr/local/checkinstall-1.6.0beta3/installwatch-0.7.0beta3'
./create-localdecls
Checking truncate argument type... off_t
Checking libc version... libc.so.6
Checking glibc subversion... Treated as glibc >= 2.1 (finger crossed)
gcc -Wall -c -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT -DVERSION=\"0.7.0beta3\" installwatch.c
ld -shared -o installwatch.so installwatch.o -ldl -lc
make[1]: Leaving directory `/usr/local/checkinstall-1.6.0beta3/installwatch-0.7.0beta3'

root@haze:/usr/local/checkinstall-1.6.0beta3# make install

make -C installwatch-0.7.0beta3
make[1]: Entering directory `/usr/local/checkinstall-1.6.0beta3/installwatch-0.7.0beta3'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/local/checkinstall-1.6.0beta3/installwatch-0.7.0beta3'
cp checkinstall makepak /usr/local/sbin
make -C installwatch-0.7.0beta3 install
make[1]: Entering directory `/usr/local/checkinstall-1.6.0beta3/installwatch-0.7.0beta3'
if [ -r /usr/local/lib/installwatch.so ]; then rm -f  /usr/local/lib/installwatch.so;cp installwatch.so /usr/local/lib; else cp installwatch.so /usr/local/lib; fi
sed -e "s|#PREFIX#|/usr/local|" < installwatch > /usr/local/bin/installwatch
chmod 755 /usr/local/bin/installwatch
make[1]: Leaving directory `/usr/local/checkinstall-1.6.0beta3/installwatch-0.7.0beta3'
mkdir -p /usr/local/lib/checkinstall/locale
mkdir -p /usr/local/lib/checkinstall/locale/es/LC_MESSAGES
cp locale/checkinstall-es.mo /usr/local/lib/checkinstall/locale/es/LC_MESSAGES/checkinstall.mo
cp checkinstallrc-dist /usr/local/lib/checkinstall
if ! [ -f /usr/local/lib/checkinstall/checkinstallrc ]; then cp /usr/local/lib/checkinstall/checkinstallrc-dist /usr/local/lib/checkinstall/checkinstallrc; fi

root@haze:/usr/local/checkinstall-1.6.0beta3# checkinstall

checkinstall 1.6.0beta3, Copyright 2002 Felipe Eduardo Sanchez Diaz Duran
           This software is released under the GNU GPL.


Vi har ju Slackware...
Please choose the packaging method you want to use.
Slackware [S], RPM [R] or Debian [D]? S


This package will be built according to these values:

1 -  Summary: [ CheckInstall installations tracker, version 1.6.0beta3 ]
2 -  Name:    [ checkinstall ]
3 -  Version: [ 1.6.0beta3 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ Applications/System ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ checkinstall-1.6.0beta3 ]
9 -  Alternate source location: [  ]

Enter a number to change any of them or press ENTER to continue:

Installing with make install...

========================= Installation results ===========================
make -C installwatch-0.7.0beta3
make[1]: Entering directory `/usr/local/checkinstall-1.6.0beta3/installwatch-0.7.0beta3'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/local/checkinstall-1.6.0beta3/installwatch-0.7.0beta3'
cp checkinstall makepak /usr/local/sbin
make -C installwatch-0.7.0beta3 install
make[1]: Entering directory `/usr/local/checkinstall-1.6.0beta3/installwatch-0.7.0beta3'
if [ -r /usr/local/lib/installwatch.so ]; then rm -f  /usr/local/lib/installwatch.so;cp installwatch.so /usr/local/lib; else cp installwatch.so /usr/local/lib; fi
sed -e "s|#PREFIX#|/usr/local|" < installwatch > /usr/local/bin/installwatch
chmod 755 /usr/local/bin/installwatch
make[1]: Leaving directory `/usr/local/checkinstall-1.6.0beta3/installwatch-0.7.0beta3'
mkdir -p /usr/local/lib/checkinstall/locale
mkdir -p /usr/local/lib/checkinstall/locale/es/LC_MESSAGES
cp locale/checkinstall-es.mo /usr/local/lib/checkinstall/locale/es/LC_MESSAGES/checkinstall.mo
cp checkinstallrc-dist /usr/local/lib/checkinstall
if ! [ -f /usr/local/lib/checkinstall/checkinstallrc ]; then cp /usr/local/lib/checkinstall/checkinstallrc-dist /usr/local/lib/checkinstall/checkinstallrc; fi

======================== Installation successful ==========================

Copying documentation directory...
./
FAQ
BUGS
TODO
README
installwatch-0.7.0beta3/
installwatch-0.7.0beta3/BUGS
installwatch-0.7.0beta3/TODO
installwatch-0.7.0beta3/README
installwatch-0.7.0beta3/CHANGELOG
installwatch-0.7.0beta3/VERSION
installwatch-0.7.0beta3/INSTALL
installwatch-0.7.0beta3/COPYING
NLS_SUPPORT
RELNOTES
INSTALL
Changelog
COPYING
CREDITS

Copying files to the temporary directory...OK

Striping ELF binaries and libraries...OK

Compressing man pages...OK

Building file list...OK

********************************************
**** Slackware package creation selected ***
********************************************

Preparing Slackware install directory...OK

Writing package description...OK

Writing Slackware install script...OK

Creating package checkinstall-1.6.0beta3-i386-1...OK

NOTE: The package will not be installed.

Erasing temporary files...OK

Writing backup package...OK

Deleting temp dir...OK


**********************************************************************

 Done. The new package has been saved to

 /usr/local/checkinstall-1.6.0beta3/checkinstall-1.6.0beta3-i386-1.tgz
 You can install it in your system anytime using:

      installpkg checkinstall-1.6.0beta3-i386-1.tgz

**********************************************************************

Kontrollera...
root@haze:/usr/local/checkinstall-1.6.0beta3# ls

BUGS       INSTALL      TODO                                                 description-pak
COPYING    Makefile     backup-010120040711-pre-checkinstall-1.6.0beta3.tgz  doc-pak
CREDITS    NLS_SUPPORT  checkinstall                                         installwatch-0.7.0beta3
Changelog  README       checkinstall-1.6.0beta3-i386-1.tgz                   locale
FAQ        RELNOTES     checkinstallrc-dist                                  makepak

Installera..
root@haze:/usr/local/checkinstall-1.6.0beta3# installpkg checkinstall-1.6.0beta3-i386-1.tgz

Installing package checkinstall-1.6.0beta3-i386-1...
PACKAGE DESCRIPTION:
Executing install script for checkinstall-1.6.0beta3-i386-1...

PACKAGE DESCRIPTION:
CheckInstall installations tracker, version 1.6.0beta3

CheckInstall keeps track of all the files created or
modified by your installation script ("make install"
"make install_modules", "setup", etc), builds a
standard binary package and installs it in your
system giving you the ability to uninstall it with your
distribution's standard package management utilities.

Kontrollera...
root@haze:/usr/local/checkinstall-1.6.0beta3# pkgtool

Välj Remove


Jajamän, där satt den..


Förhoppningsvis har du nu fått ett "hum" om hur det går till, på köpet fick du ett program som underlättar för dig när du vill installera/ta bort olika program som du installerar från källkod. Glöm inte bort att komma ihåg att läsa dokumentationen för programmet. ;-)

Valid HTML 4.01!