You are on page 1of 7

1 herco.

org
07/24/201211:12:22AM hIIp://herco.org/noc/mkpkg.hImI
Creating packages using akepkg
A gude that expan hw t create packages usng makepkg (the package maker).
lntroduction
T bud a package we need t understand 'What s a package?', furthermre the basc r
requred sks n a Unx type system such as : the fe management and manpuatn,
drectres, permssns, the cncept f surce cde, prcess f cmpatn, etc. We w
gnre sme f the mentned sks, assumng that the user s famarzed wth them.
uestions
Then, we w frmuate sme questns and based n the questns: the answers. As we
as expanatns and thngs t keep n mnd fr ater
Source code or binary7
A Surce cde s a set f nstructns gven by the prgrammers thrugh a cmputer
anguage, can be read and wrtten by pepe. The cmputers are capabe t understand
the cde r the nstructns st f bth are "nterpreted", s that them can use t drecty.
The nterpretatn f cde by cmputers s f transate r "cmpe" n a "bnary" the
surce cde, whch they can understand.
What is a package7
It s packaged Sftware pece, dstrbuted and ready fr use. Usuay sftware s
packaged bnary frm, dstrbuted n a specfc frmat by peratng system and/r GNU/
Lnux Dstrbutn.
In Dragra GNU/Lnux the package frmat s n mre that a "tar" fe cmpressed wth
"zp". That s t say, a ne fe packaged and cmpressed n standard way, prtabe
(accrdng t the ts used).
Why used or create a package7
By the smpe reasn f easy dstrbutn. Awng the package management ts:
nsta, remve and update. Aways mantanng a system g
2 herco.org
07/24/201211:12:22AM hIIp://herco.org/noc/mkpkg.hImI
To work
Suppse we have dwnaded the surces f the prgram "f" and we wsh t create
the package (passng by the prcess f cmpatn, f curse). Fr ths, we decmpress
the surce
# lar xvi ioo-1.2.3.lar.z
Enter n the drectry f the unpackaged surce fr ts psterr cnfguratn and
nstaatn
# cd ioo-1.2.3
Is necessary t fx r arrange the fe permssns, grup and drectres fr ur package.
Snce sme surces cme wth dfferent wner*, grup and permssns*.
# choWn -R 0.0 .
# i1nd . \{ -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 400 -o -perm 440 \}
] xars chmod -v 644
# i1nd . \{ -perm 2777 -o -perm 777 -o -perm 775 -o -perm 511 -o -perm 711 -o -perm 555
\} ] xars chmod -v 755
Explanation
The ptn -R f 'chwn' s recursve, that means that the wner and grup d
'0' (tradtnay 'rt') w be apped fr a the fes and drectres f the surce. 'fnd' s
respnsbe f fnd the permssns that are wrng and fx t (644 fr nn-executabe -
755 fr executabes and drectres).
Source configuration
Nw we w use the prgram 'cnfgure' f the surce t fx and cnfgure the surce
package accrdng t ur needs.
We must carfy that 'cnfgure' can have mre ptns that are ut f the purpse f ths
gude. The dea s remark the usua ptns
-prei1x=1usr
Ths ptn says t 'cnfgure' the drectry at whch we w nsta the prgram, usuay
n /usr
3 herco.org
07/24/201211:12:22AM hIIp://herco.org/noc/mkpkg.hImI
-sysconid1r=1elc
Ths ptn says t 'cnfgure' where we want t put the prgram cnfguratn fe,
tradtnay n /etc.
-1niod1r=1usr11nio
Wth ths ptn we cnfgure where t nsta the dcumentatn and nfrmatn.
-mand1r=1usr1man
Wth ths ptn we cnfgure where we want t nsta the manua pages.
Fr a detaed descrptn f the ptns, we wrte:
# .1coni1ure --help
Fnay, we shud get
# .1coni1ure --prei1x=1usr --sysconid1r=1elc --1niod1r=1usr11nio --mand1r=1usr1man
Building the source
The next step s make/cmpe prpery the prgram wth 'make', we type.
# make
The next step s nsta the bnary prgram(s) generated by 'make'.
Tradtnay t s dne wth 'make nsta', but ths, w nsta the prgrams n the system
rt, dsabng the package creatn. Instead, s used a methd f fakng the drectn,
where the prgrams are nstaed n a drectry apart that we w create at next:
Temprary drectry f the package
# mkd1r -p 1lmp1sources1packae-ioo
Nw, we nsta the prgram:
# make 1nslall 0EST0TR=1lmp1sources1packae-ioo
Enter nt the drectry and st t see the structure
# cd 1lmp1sources1packae-ioo
# ls -l
4 herco.org
07/24/201211:12:22AM hIIp://herco.org/noc/mkpkg.hImI
Additional Steps
Reoving debugging inforation of binaries
Remve ths nfrmatn can be usefu because we can get a smaer bnary and better
perfrmance. Identfes the drectres where the bnares are.
The 'strp' cmmand w be usefu fr ths purpse
# slr1p --slr1p-unneeded usr1b1n1* usr1l1b1*.so*
A Matas A. Fnz mpementatn usng the scaabe awk, that cmbnes 'fnd', 'fe', 'cut',
and 'strp', fr scan fes remvng debuggng symbs fr bth, prgrams and brares.
# i1nd . -lype i ] xars i1le ] aWk `1ELI1 && 1execulable1 ]] 1shared obecl1` ] cul -i 1
-d . ] xars slr1p --slr1p-unneeded
Copressing the anuals
Docuents of inforation of GNU
We remve the redundancy
# rm -i usr11nio1d1r
Cmpress usng the better cmpressn eve (-9) - keepng the rgna date and tme f
the fes:
# z1p -9N usr11nio1*
Manual Pages
# z1p -9N usr1man1*1*.?
Infrmatn dcuments and manua pages are |ust a part f the prgram
dcumentatn. It s very mprtant t dentfy and ntrduce the mssng part f
dcumentatn.
Creating the directory for the docuentation copies
# mkd1r -p usr1doc1ioo-1.2.3
Enter nt the drectry where decmpress the surce fr cpy the dcuments t the
drectry f the future package:
# cp -a AuTR0RS C0PYTN0 REA0ME T000 IA 1lmp1sources1packae-ioo1usr1doc1ioo-1.2.3
// The -a option of 'p' keeps the modifiation date and time of the files. //
S herco.org
07/24/201211:12:22AM hIIp://herco.org/noc/mkpkg.hImI
Description File
The next step s creatng the drectry descrptn where the descrptn fe w be
stred:
# cd 1lmp1sources1packae-ioo
# mkd1r descr1pl1on
Usng a text edtr, create n the drectry descrptn that w stre the descrptn fes
f the prgram. Fr mre nfrmatn, g t the Descrptn Fe sectn.
Making the package
In the package's tempra drectry, wrte:
# makepk -l 1lmp1ioo-1.2.3-1686-1.llz
Explanation
The ptn - f 'makepkg' adds t the pst-nstaatn fe (post-install}post-install)
the fund nks may r may nt be present; whch w be recreated when the package s
nstaed.
The drectry }tp s used cnventnay t acate the package "foo-1.2.3-
i486-1.tlz" n the drectry }tp.
// ".tlz" is the extension given to the pakage. From the hanges for Dragora J.J, was
introdued the new feature of using lzip as the default format in the pakage system, lzip
uses the LZMA ompression algorithm with a better ompression level than bzip2. You
an get more information about lzip, at: http://www.nongnu.org/lzip/lzip.html //
Connotation of the packages
Anayzng hw s cmpsed the cmpete name f a package:
* name-version-arhiteture-building.extension
Section Description
name The prgram name.
6 herco.org
07/24/201211:12:22AM hIIp://herco.org/noc/mkpkg.hImI
budng
The budng number. If n the future, the package s mdfed, makng
sme sgnfcant change: The budng number s ncremented.
extensn Extensn supprted by `makepkg'.
* Example: "foo-J.2.3-i486-J.tlz"
* Try the full name *if possible* is in lowerase.
Suary of steps
1. lar xvi ioo-1.2.3.lar.z
2. cd ioo-1.2.3
3. choWn -R 0.0 .
4. i1nd . \{ -perm 666 -o -perm 664 -o -per 600 -o -perm 444 -o -perm 400 -o -perm 440 \}
] xars chmod -v 644
5. i1nd . \{ -perm 2777 -o -perm 777 -o -perm 775 -o -perm 511 -o -perm 711 -o -perm 555
\} ] xars chmod -v 755
6. .1coni1ure --prei1x=1usr --sysconid1r=1elc --1niod1r=1usr11nio --mand1r=1usr1man
7. make
8. mkd1r -p 1lmp1sources1packae-ioo
9. make 1nslall 0EST0TR=1lmp1sources1packae-ioo
10. cd 1lmp1sources1packae-ioo
11. ls -l
12. slr1p --slr1p-unneeded usr1b1n1* usr1l1b1*.so*
13. rm -i usr11nio1d1r
14. z1p -9N usr11nio1*
15. z1p -9N usr1man1*1*.?
16. mkd1r -p usr1doc1ioo-1.2.3
17. cd 1d1reclory-Where-lhe-source-Was-unpacked1ioo-1.2.3
18. cp -a AuTR0RS C0PYTN0 REA0ME T000 IA 1lmp1sources1packae-ioo1usr1doc1ioo-1.2.3
19. cd 1lmp1sources1packae-ioo
20. mkd1r descr1pl1on
21. cd descr1pl1on
22. moe en
23. makepk -l 1lmp1ioo-1.2.3-1486-1.llz
// All the steps are done by the super user (5ystem Administrator). //
Final Notes
7 herco.org
07/24/201211:12:22AM hIIp://herco.org/noc/mkpkg.hImI
It s seen that the ptns and steps made n ths gude are genera, may be present r
nt. Depend n the ma|rty f cases f each surce; sme has n nfrmatn
dcuments, man pages, cnfguratn fes, etc. Leavng such decsns t the user
--Matias A. Fonzo 20JJ/05/J9 J8:25
--Translation 20JJ/07/24 2J:44
Cntent f ths page s censed under the fwng cense:Pubc Dman
Back t herc.rg
Copyleil 2005-2012 Rercules Koroneos..under 0Nu Iree 0ocumenlal1on L1cense..RTML
4.01..1n 0Nu We lrusl!

You might also like