Learning to create packages (slkbuild)

General talk about packaging procedures and packages.
Post Reply
User avatar
icaroperseo
Donor
Posts: 67
Joined: 19. Nov 2014, 01:12
Contact:

Learning to create packages (slkbuild)

Post by icaroperseo »

Hi guys!!!

I am learning to create my own packages via slkbuild and though I could create one successfully, I do not feel completely satisfied because I guess it will exist a better way of doing.

This is my SLKBUILD:

Code: Select all

#Maintainer: Icaro Perseo <icaro[dot]perseo[at]gmail[dot]com>

pkgname=dianara
pkgver=v1.2.4
pkgrel=rvm
arch=noarch
source=("http://download.savannah.gnu.org/releases/dianara/$pkgname-$pkgver.tar.gz" \
        "dianara.desktop" \
        "dianara-32x32.png" \
        "dianara-64x64.png")
url="http://dianara.nongnu.org/"
docs=('CHANGELOG' 'BUGS' 'LICENSE' 'README' 'TODO' 'INSTALL')

slackdesc=\
(
#|-----handy-ruler---------------------------------------------------|
"Dianara - pump.io client"
"Dianara is a pump.io client, a free (as in freedom) desktop"
"application to manage a user's account on the pump.io distributed"
"social network. It is very usable for daily tasks, and it can even"
"do several things that the web interface can't, like editing posts"
"and comments, or uploading audio and video."
)

build() {
	# how many build jobs?
	JOBS="-j$(($(getconf _NPROCESSORS_ONLN)*2))"
	NUMJOBS="${NUMJOBS:-"${JOBS}"}"

	cd $startdir/src/$pkgname-$pkgver

	mkdir build
	cd build
	qmake ..

	make $NUMJOBS || return 1
	make install
}

doinst() {
  mv -u /usr/src/dianara-v1.2.4/dianara.desktop /usr/share/applications/
  mv -u /usr/src/dianara-v1.2.4/dianara-32x32.png /usr/share/icons/hicolor/32x32/apps/dianara.png
  mv -u /usr/src/dianara-v1.2.4/dianara-64x64.png /usr/share/icons/hicolor/64x64/apps/dianara.png
}
There are several aspects that I would like to understand.

1. Is there any way to remove the *.png and *.desktop files automatically once the application is uninstalled? One reason why I had to add these files is that the application seems not copied once finalized the installation/compilation process automatically and I could not find a better way to do this. :roll:

2. Is there any way to automatically resolve dependencies? In this particular case the dependencies are:

Gslapt:

Code: Select all

qca
qjson
imagemagick
qca-ossl
Sourcery:

Code: Select all

qoauth
3. Without mentioning the following documentation, are there any other resources that could help me improve my skills to package applications? I made use of google but have not found much information about it.

http://guide.salixos.org/31PackageManagement.html
http://guide.salixos.org/325MakingaPack ... l-your-own
http://docs.salixos.org/wiki/New_to_Packaging
http://guide.salixos.org/324spkg.html
http://docs.salixos.org/wiki/Building_p ... h_slkbuild
http://slkbuild.sourceforge.net/

4. Moreover, is there anything else I should to know or to learn?

Thanking you for your help and patience...

Regards!!!
Image

Image
User avatar
gapan
Salix Wizard
Posts: 6241
Joined: 6. Jun 2009, 17:40

Re: Learning to create packages (slkbuild)

Post by gapan »

icaroperseo wrote:1. Is there any way to remove the *.png and *.desktop files automatically once the application is uninstalled? One reason why I had to add these files is that the application seems not copied once finalized the installation/compilation process automatically and I could not find a better way to do this. :roll:
Don't move the icons in the doinst(). Do it in build().

Code: Select all

mkdir -p $startdir/pkg/usr/share/icons/hicolor/32x32/apps
cp $startdir/src/my_icon.png $startdir/pkg/usr/share/icons/hicolor/32x32/apps/
icaroperseo wrote:2. Is there any way to automatically resolve dependencies?
What do you mean? While building the package? Of course not. That is of course true for any distribution, not just salix.

If you're talking about offering the package in some repository and that having dependency information, there are several ways to do it, including the way salix does it. But you shouldn't be interested in this, yet at least.
icaroperseo wrote:3. Without mentioning the following documentation, are there any other resources that could help me improve my skills to package applications? I made use of google but have not found much information about it.
You found most of it. Also run:

Code: Select all

man slkbuild
and

Code: Select all

man SLKBUILD
and make sure you at least take a look inside your /usr/src and also in the source directory of the salix repositories for samples of other SLKBUILD files.
icaroperseo wrote:4. Moreover, is there anything else I should to know or to learn?
A lot! But it mostly comes with experience.
Image
Image
User avatar
icaroperseo
Donor
Posts: 67
Joined: 19. Nov 2014, 01:12
Contact:

Re: Learning to create packages (slkbuild)

Post by icaroperseo »

Many thanks @gapan!!! I will follow your tips (I have rebuilt my package and everything works great).

On the other hand:
gapan wrote: If you're talking about offering the package in some repository and that having dependency information, there are several ways to do it, including the way salix does it. But you shouldn't be interested in this, yet at least.
Yes, that's exactly what I meant to say. When you have a little time, could you tell me how to proceed to do it or where to turn?

I'll leave the thread open in case anyone else is encouraged to contribute (which would appreciate a lot). Personally, I would like to learn enough to help more actively with this great distribution and community.

Thanks again!!!
User avatar
gapan
Salix Wizard
Posts: 6241
Joined: 6. Jun 2009, 17:40

Re: Learning to create packages (slkbuild)

Post by gapan »

You can find almost everything about packaging and submitting packages information in the wiki: http://docs.salixos.org/wiki/Category:D ... umentation
Especially the submission info page: http://docs.salixos.org/wiki/Submitting ... repository

Keep in mind that tricks like the NUMJOBS thing in your SLKBUILD are OK if you're building packages for yourself, but should be avoided if you're building for the repositories. SLKBUILD uses its own built in $numjobs variable anyway.

For finding out dependencies, you should look into depfinder.

Code: Select all

man depfinder
Image
Image
Post Reply