Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[beginners] Collected bits and pieces from PKGBUILD
01-12-2012, 02:06 PM
Post: #1
[beginners] Collected bits and pieces from PKGBUILD
The PKGBUILD is a collection of hints and tips about 'how to make a PKGBUILD'. Al lot of information is found on several pages. I thought it would be handy to collect most of them and put them in a .txt file. It's not a complete 'how to' but a kind of a reminder with hints and tips.
Oh and I assume that 'binutils' is installed otherwise this is useless :]

Code:
PKGBUILD help:
--------------

How to make packages in 'i386' modus.
Replace './configure' by:

./configure --prefix=/usr --host=$CHOST --build=$CHOST

In case that doesn't work, try this:

./configure --prefix=/usr --host=i386-pc-linux-gnu --build=i386-pc-linux-gnu

If there isn't a 'configure' and it's just 'make', the following WORKAROUND might or might
not work since every piece of software has a different Makefile (put this before the 'make'
sentence):

sed -i "s/CC=gcc/CC=gcc -march=i386/g" Makefile

or

sed -i "s/CFLAGS =/CFLAGS = -march=i386/g" Makefile

Just check the Makefile and see what's needed (the above 'sed-solutions' are just examples).
Sometimes altering is not needed (mostly older software) because they are 386 packages
But be carefull and very sure with this!

---------------------------------------------------------------------------------------

In case of packagename.install files be sure that they ended this way.

op=$1
shift
$op $*

This is only for packages who doesn't need a menu-entry.
Those with a menu entry are explained later.

---------------------------------------------------------------------------------------

Libtool needs to be cleaned, put this in the end of your build (if it's not present).

# Remove the libtool stuff
find ${pkgdir} -depth | grep "\.la" | while read libtool_file ;do
rm -f $libtool_file
done
}

------------------------------------------------------

Be carefull with static libs! If there is no other way install it and remove (rm) it afterwards.
My advice: look further for a replacement, perhaps there is another piece of software
which can do the same without the use of them. It's the most safe way...

-----------------------------------------------------------------------------

Menu-generator:

For an entry in the menu a few files more are needed:
    pkgname.desktop
    pkgname.install
    pkgname_32x32.xpm
    pkgname_16x16.xpm

    pkgname.png (optional, not need yet. But perhaps in the future)


INFO for the PKGBUILD:

Be sure that the following sentences are in the PKGBUILD:
    install=$pkgname.install

Add this behind the url in the source line:
    $pkgname.desktop
    $pkgname.png
    ${pkgname}_16x16.xpm
    ${pkgname}_32x32.xpm)

Don't forget to add the extra MD5SUMs (not for the .install file)

Obviously the extra files need to be installed, you can do this with:

  install -Dm 644 $srcdir/$pkgname.desktop $pkgdir/usr/share/applications/$pkgname.desktop
  install -Dm 644 $srcdir/$pkgname.png $pkgdir/usr/share/pixmaps/$pkgname.png
  install -Dm 644 $srcdir/${pkgname}_32x32.xpm $pkgdir/usr/share/pixmaps/${pkgname}_32x32.xpm
  install -Dm 644 $srcdir/${pkgname}_16x16.xpm $pkgdir/usr/share/pixmaps/${pkgname}_16x16.xpm

Put this right after the 'make .... install'.


----------------------------------------------------------------------------

INFO for the package.install

A typical file looks like this:

post_install() {
  [ -x /usr/bin/menu-generator-trigger ] && /usr/bin/menu-generator-trigger
}

post_upgrade() {
  [ -x /usr/bin/menu-generator-trigger ] && /usr/bin/menu-generator-trigger
}

post_remove() {
  [ -x /usr/bin/menu-generator-trigger ] && /usr/bin/menu-generator-trigger
}

op=$1
shift
$op $*

If a package has already an .install file then just include the stuff from above in it.

---------------------------------------------------------------------------------------

INFO for the package.desktop.

Sometimes a packages has already a .desktop file and sometimes it doesn't.
Check if the .desktop has the one of the following entries:

  Menu-header
  Office
  Tools
  Network
  Graphics
  AudioVideo
  Console-game
  Game
  Settings
  Menu-footer-shutdown


If there isn't a .desktop file create one with ofcourse the right category included.
An example is this:

[Desktop Entry]
Name=packagename
Exec=xterm -geometry 80x25 -fg white -bg black -e packagename
Icon=packagename
Categories=Console-game;

In this case it's a console-game which start with xterm, normally a packagename will do.
There are more options, but this is the bare minimum (look in the source repository for more
examples).

--------------------------------------------------------------------------------------------

package_32x32.xpm package_16x16.xpm and package.png

If your lucky enough a package already contains an icon (mostly .png), in this case convert
it with MTpaint to the xpm format and adjust them to the obvious size.
If the package doesn't have icons, look on the internet for non-copyrighted material or
be creative. The menu-generator only supports .xpm files at this moment but no one can look in
the future so a .png file would be nice to include.

---------------------------------------------------------------------------------------------

Other bits and pieces:

Generating MD5SUMs:

makepkg -g
-OR-
makepkg -g >> PKGBUILD

!!!WARNING!!!:
1.) be very careful when using the second variant ....
    if You type just one > sign, then Your PKGBUILD is lost !
2.) use it only when all the sources are already downloaded, otherwise You would
    generate a junk into Your PKGBUILD.

---

Hints and highly recommended for those who look in the AUR or the official Archlinux
repositories:

1.) Always look at the official site, sometimes you don't need all the dependencies
what's included in the Arch PKGBUILD. A good example is 'supertux', which works perfectly
with just the SDL libraries.

2.) Use AUR only if the original Archlinux doesn't contains the package you're looking for.

3.) In case if the original package doesn't contains information about dependencies, compare
the Arch PKGBUILD with http://packages.debian.org/stable/ ... it won't hurt.

4.) The most common Arch dependency that Delicate doesn't have is 'glibc', Delicate is using
'uclibc' instead which is smaller. Most of the times you can replace the packagename and
it will work, sometimes it doesn't.

5.) If you find a package with an almost similair name, compare them (In Delicate you can do it
with 'pacman -Si packagename' (example: libX11 or libx11).

6.) Be nice, put a 'thank you' in the PKGBUILD when you're using a slighly changed Arch PKGBUILD.
Don't use his or her name as the Maintainer, because they made it for Arch and not for Delicate.
An example:

# Maintainer: Ifor Delicate
#
# Thanks to: Theo Nefromarch

7.) If the building doesn't succeed because you received an error 'blablabla needs a newer version',
then check the site from the package. Sometimes they have an archive with older versions, they
might work.

8.) If the original site is down, and the source cannot be downloaded. I use the following trick.
I'll go to the debian-packages and check if the package is available. Somewhere on the right side
of the screen there is a link to the sourcecode. I'll put that link in the PKGBUILD.
But that's the last option...

Hardware in use: Compaq PIII- 1GHZ, Geforce 4000, 256mb, 80gb HD
Dutch Delicate Linux information: http://www.delicatelinux.nl.ae
Visit this user's website Find all posts by this user
Quote this message in a reply
01-12-2012, 11:00 PM
Post: #2
RE: [beginners] Collected bits and pieces from PKGBUILD
(01-12-2012 08:28 PM)Compact Wrote:  Hay nl2stk
I'll never forget that I did build my first PKGBUILD with your information.
Very handsome textfile. Thank you.

You're welcome :]
Helping eachother is where this forum is about :]
B.t.w nice list, perhaps we can add a debian (and other distros?) section too.

Hardware in use: Compaq PIII- 1GHZ, Geforce 4000, 256mb, 80gb HD
Dutch Delicate Linux information: http://www.delicatelinux.nl.ae
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | DeLi(cate) Linux | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication