Contribute ebuilds

From ProAudioOverlay

Revision as of 16:19, 1 June 2008 by (Talk)
Jump to: navigation, search

Writing ebuilds

So you want to contribute ebuilds. If you've no idea how to create proper ebuilds have a look at this gentoo guides:

Instead of creating ebuilds from scratch you can first search here if there is already one:

Hints to fix common sandbox errors

If the FEATURE=sandbox is enabled in make.conf portage won't allow any operations outside it's sandbox
--> your system/usersfiles are protected from being destroyed/whatever

I'll show this on a example:

  • error message
 /bin/sh ../admin/mkinstalldirs /usr/share/texmf/tex/generic/kgtabs
 mkdir -p -- /usr/share/texmf/tex/generic/kgtabs
 ACCESS DENIED  mkdir:     /usr/share/texmf/tex/generic/kgtabs
 mkdir: cannot create directory `/usr/share/texmf/tex/generic/kgtabs': Permission denied
 make[2]: *** [install-kgtabs] error 1
 make[2]: Leaving directory `/var/tmp/portage/kguitar-0.5/work/kguitar-0.5/kguitar_shell'
 make[1]: *** [install-am] error 2
 make[1]: Leaving directory `/var/tmp/portage/kguitar-0.5/work/kguitar-0.5/kguitar_shell'
 make: *** [install-recursive] error 1

 !!! ERROR: media-sound/kguitar-0.5 failed.
 !!! Function kde_src_install, Line 301, Exitcode 2

the problem above is, that portage's sandbox only allow to write into

Most packages provide a variable (often called DESTDIR or destdir). So you can point make/scons there

 src_install() {
 	make DESTDIR="${D}" install || die "install failed"

But above this won't solve the issue because either the variable DESTDIR is not defined in the Makefiles or not consistent.

When I've such a package I try to find the cause of the problem in a Makefile[.in]
For above error I found a missing DESTDIR in the Makefile[.in]
in /var/tmp/portage/kguitar-0.5/work/kguitar-0.5/kguitar_shell
(--> this is the location the error above points to).
I removed this error with sed

  • patching with sed
 sed -i -e 's:\(\$(mkinstalldirs)\)\(.*\)\($(TEXMF)/tex/generic/kgtabs\):\1 $(DESTDIR)\3:' \
          -e 's:\(\$(INSTALL_DATA).*$(srcdir)/kgtabs.tex\ *\):\1 $(DESTDIR):' \
  • Description how sed works

The first line tells sed to find a line which is described between the first : and second :
\(...\) describes a regexp to which I refer with \1 in between the second : and third :
(--> The second line is just the same but for another regexp)

  • changes the above sed-oneliner did
 -$(mkinstalldirs) $(TEXMF)/tex/generic/kgtabs
 -$(INSTALL_DATA) $(srcdir)/kgtabs.tex $(TEXMF)/tex/generic/kgtabs/kgtabs.tex
 +$(mkinstalldirs) $(DESTDIR)$(TEXMF)/tex/generic/kgtabs
 +$(INSTALL_DATA) $(srcdir)/kgtabs.tex $(DESTDIR)$(TEXMF)/tex/generic/kgtabs/kgtabs.tex

So either you can use sed to adjust the Makefile or create a patch and ship it with the ebuild.
Patching files should happen if possible inside:

 src_unpack() {
 	unpack "${A}"
 	cd "${S}"
 	sed -i 's:foo:bar:g' file_to_patch
 	epatch "${FILESDIR}"/yourpatch

Always try to patch (or if it exists.
--> a Makefile is mostly generated from

  • alternative way

a easier way if no DESTDIR variable exist is just to change the prefix
prefix points per gentoo default to /usr this we change here:

 	econf --prefix="${D}"/usr || die "econf failed"
 	emake || die "emake failed"

But sometimes this can give trouble if paths are hardcoded into binaries
So use with care.

Contributing ebuilds

The preferred way to get ebuilds or fixes included into the overlay is:

  • via the proaudio-mailing list Mailing_List
  • via email [evermind att tuxfamily dot org]
Personal tools