Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Ebuild building
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
cs02rm0
Tux's lil' helper
Tux's lil' helper


Joined: 12 Oct 2004
Posts: 91

PostPosted: Sun Oct 31, 2004 9:43 pm    Post subject: Ebuild building Reply with quote

Is there any documentation on this which is fairly extensive for creating ebuilds?

I've been able to create a (dodgy, hacked to pieces) ebuild for a program in python which comes with an install script to move stuff into relevant directories.

The problem is that I get permission denied on a lot of it. Before I go pulling that install script apart too I'd like to know where I'm supposed to be putting the installed files.

If I were to submit this ebuild to Gentoo, would it be breaking etiquette to have the ebuild execute another install script? Thinking about it, a lot of my confusion lies in that most of the other ebuilds I've looked at compile C/C++ programs and I guess that's just calling other programs/scripts.

Any advice appreciated :)
_________________
Rich
Back to top
View user's profile Send private message
Voltago
Advocate
Advocate


Joined: 02 Sep 2003
Posts: 2593
Location: userland

PostPosted: Sun Oct 31, 2004 9:45 pm    Post subject: Reply with quote

http://www.gentoo.org/proj/en/devrel/handbook/handbook.xml
'nuff said.
Back to top
View user's profile Send private message
Pythonhead
Developer
Developer


Joined: 16 Dec 2002
Posts: 1801
Location: Redondo Beach, Republic of Calif.

PostPosted: Sun Oct 31, 2004 10:06 pm    Post subject: Re: Ebuild building Reply with quote

cs02rm0 wrote:

The problem is that I get permission denied on a lot of it. Before I go pulling that install script apart too I'd like to know where I'm supposed to be putting the installed files.


In your src_install make sure everything goes into the ${D} directory. So if its trying to install something in /usr/lib make sure it goes in ${D}/usr/lib

Quote:

If I were to submit this ebuild to Gentoo, would it be breaking etiquette to have the ebuild execute another install script? Thinking about it, a lot of my confusion lies in that most of the other ebuilds I've looked at compile C/C++ programs and I guess that's just calling other programs/scripts.


Theres no problem with executing another install script, but you'll probably have to use sed on it so many times or patch it to change everything to install in ${D}, it might not be worth it. With C/C++ programs its easy to overide the variables in Makefiles that tell it where to install files.

Post the file if you want advice.
Back to top
View user's profile Send private message
cs02rm0
Tux's lil' helper
Tux's lil' helper


Joined: 12 Oct 2004
Posts: 91

PostPosted: Tue Nov 02, 2004 12:23 pm    Post subject: Reply with quote

Thanks - the ${D} bit solved most of my issues.

Now it seems to at least work (not a bad place to start from) - I took the install script out of the install script and put it into the ebuild, so I could use the ebuild variables without having to pass them to the install script.

However, heh... although it seems to install, the program doesn't work, even if I remove all trace of it and install it from the original tarball. So I don't know if this would kill anyone's python install every time or if it'd work and I've done something elsewhere to mess it up. It's a Yahoo! chat client in python, called zinc.

Code:

# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-im/zinc/zinc-1.1_pre6.ebuild,v 1.5 2004/09/2$

inherit eutils

DESCRIPTION="Zinc is a Yahoo! chat client written in Python"
HOMEPAGE="http://larvalstage.org/"
SRC_URI="http://larvalstage.org/zinc/files/zinc-1.1pre6.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86"
IUSE=""

DEPEND=">=dev-lang/python-2.1
        >=sys-libs/ncurses-5.2"

src_unpack() {
        unpack ${A}
}

src_install () {
        #${WORKDIR}/zinc-1.1pre6/install.sh
        PYTHON=`which python 2>&1`

        if [ $? -eq 1 ]; then
        echo "Cannot find installed Python interpreter"
        exit 2
        fi

        PARAM="-l 'prefix=' \"$*\""

        set -- `${WORKDIR}/zinc-1.1pre6/scripts/pygetopt $PARAM`

        PREFIX=${D}/usr
        OS=`uname -s`
        if [ $OS = FreeBSD ] || [ $OS = OpenBSD ]; then
        PREFIX=${D}/usr/local
        fi

        for i in $*
        do
        case $i in
        --prefix)       PREFIX=$2; shift 2;;
        esac
        done

        if [ ! -d $PREFIX/lib/zinc ]; then
        # create path
        mkdir -p $PREFIX/lib/zinc
        chmod 755 $PREFIX/lib/zinc
        fi

        if [ ! -d $PREFIX/bin ]; then
        # create path
        mkdir -p $PREFIX/bin
        fi

        rm -f $PREFIX/lib/zinc/*
        rm -f $PREFIX/bin/zinc

        cp ${WORKDIR}/zinc-1.1pre6/src/* $PREFIX/lib/zinc/

        ln -sf $PREFIX/lib/zinc/zinc $PREFIX/bin/zinc

        $PYTHON $PREFIX/lib/zinc/zinc --install
        $PYTHON -O $PREFIX/lib/zinc/zinc --install
}


Oh. Another point. As best I could figure out, the way the package should be named for this release is zinc-1.1_pre6 - which makes the script a bit messier because it's not the same as the source package name. Is that the right convention for naming? Obviously it would make life easier for producing ebuilds with other version numbers if the source package was on a server where the name of it followed the portage naming conventions.

I know the header line's probably a mess too, I haven't paid much attention to that yet.
_________________
Rich
Back to top
View user's profile Send private message
mholtz
Tux's lil' helper
Tux's lil' helper


Joined: 04 Feb 2004
Posts: 110
Location: Ohio, USA

PostPosted: Sat Dec 25, 2004 8:22 pm    Post subject: Reply with quote

Ok, here's a question. I'm writing an ebuild for mudmagic. The installation follows the standard ./configure; make; make install. This is my current ebuild:

Code:

# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

#inherit some_eclass another_eclass
       DESCRIPTION="MudMagic gtk mud client"
       HOMEPAGE="http://www.mudmagic.com/mud-client/"
       SRC_URI="mirror://sourceforge/kyndig/${P}.tar.gz"
       
       LICENSE="GPL"
       SLOT="0"
       KEYWORDS="x86"
       IUSE=""

       DEPEND="virtual/libc
              dev-libs/libpcre
              x11-libs/gtk+
              dev-lang/python
              dev-db/sqlite
              >=gnome-base/libglade-2.0.1"

       src_compile() {
            econf || die "could not configure"
            emake || die "emake failed"
       }

       src_install() {
            # into ${D}
            #dodir /usr/lib/mudmagic
            make DESTDIR=${D} install || die
       }


The ebuild downloads, configures, and compiles fine. The problem is on src_install(). I get errors like this when running the ebuild (don't worry about the odd error messages -- my locale is Japanese):

Code:

>>> Install mudmagic-1.0.3 into /var/tmp/portage/mudmagic-1.0.3/image/ category games-mud
Making install in src
make[1]: Entering directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3/src'
Making install in main
make[2]: Entering directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3/src/main'
make[3]: Entering directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3/src/main'
/bin/sh ../../mkinstalldirs /var/tmp/portage/mudmagic-1.0.3/image//usr/bin
mkdir -p -- /var/tmp/portage/mudmagic-1.0.3/image//usr/bin
  /bin/install -c mudmagic /var/tmp/portage/mudmagic-1.0.3/image//usr/bin/mudmagic
make[3]: `install-data-am' に対して行うべき事はありません。
make[3]: Leaving directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3/src/main'
make[2]: Leaving directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3/src/main'
make[2]: Entering directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3/src'
make[3]: Entering directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3/src'
make[3]: `install-exec-am' に対して行うべき事はありません。
make[3]: `install-data-am' に対して行うべき事はありません。
make[3]: Leaving directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3/src'
make[2]: Leaving directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3/src'
make[1]: Leaving directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3/src'
Making install in plugins-extra
make[1]: Entering directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3/plugins-extra'
make[1]: `install' に対して行うべき事はありません。
make[1]: Leaving directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3/plugins-extra'
make[1]: Entering directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3'
make[2]: Entering directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3'
make[2]: `install-exec-am' に対して行うべき事はありません。
/bin/sh ./mkinstalldirs /usr/share/mudmagic/ui; ¥
/bin/sh ./mkinstalldirs /usr/share/mudmagic/doc; ¥
/bin/sh ./mkinstalldirs /usr/lib/mudmagic/plugins-1.0; ¥
/bin/sh ./mkinstalldirs ‾/.mudmagic
mkdir -p -- /usr/share/mudmagic/ui
ACCESS DENIED  mkdir:     /usr/share/mudmagic
mkdir: ディレクトリ `/usr/share/mudmagic' を作成できません: 許可がありません
mkdir -p -- /usr/share/mudmagic/doc
ACCESS DENIED  mkdir:     /usr/share/mudmagic
mkdir: ディレクトリ `/usr/share/mudmagic' を作成できません: 許可がありません
mkdir -p -- /usr/lib/mudmagic/plugins-1.0
ACCESS DENIED  mkdir:     /usr/lib/mudmagic
mkdir: ディレクトリ `/usr/lib/mudmagic' を作成できません: 許可がありません
for file in ./ui/*; do ¥
        if test -f $file; then ¥
                /bin/install -c -m 644 $file /usr/share/mudmagic/ui; ¥
        fi ¥
done ;¥
for file in ./doc/*; do ¥
        if test -f $file; then ¥
                /bin/install -c -m 644 $file /usr/share/mudmagic/doc; ¥
        fi ¥
done
ACCESS DENIED  open_wr:   /usr/share/mudmagic/ui
/bin/install: cannot create regular file `/usr/share/mudmagic/ui': 許可がありません
ACCESS DENIED  open_wr:   /usr/share/mudmagic/ui
/bin/install: cannot create regular file `/usr/share/mudmagic/ui': 許可がありません
ACCESS DENIED  open_wr:   /usr/share/mudmagic/ui
/bin/install: cannot create regular file `/usr/share/mudmagic/ui': 許可がありません
ACCESS DENIED  open_wr:   /usr/share/mudmagic/ui
/bin/install: cannot create regular file `/usr/share/mudmagic/ui': 許可がありません
ACCESS DENIED  open_wr:   /usr/share/mudmagic/ui
/bin/install: cannot create regular file `/usr/share/mudmagic/ui': 許可がありません
ACCESS DENIED  open_wr:   /usr/share/mudmagic/ui
/bin/install: cannot create regular file `/usr/share/mudmagic/ui': 許可がありません
ACCESS DENIED  open_wr:   /usr/share/mudmagic/ui
/bin/install: cannot create regular file `/usr/share/mudmagic/ui': 許可がありません
ACCESS DENIED  open_wr:   /usr/share/mudmagic/doc
/bin/install: cannot create regular file `/usr/share/mudmagic/doc': 許可がありません
ACCESS DENIED  open_wr:   /usr/share/mudmagic/doc
/bin/install: cannot create regular file `/usr/share/mudmagic/doc': 許可がありません
ACCESS DENIED  open_wr:   /usr/share/mudmagic/doc
/bin/install: cannot create regular file `/usr/share/mudmagic/doc': 許可がありません
make[2]: *** [install-data-local] エラー 1
make[2]: Leaving directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3'
make[1]: *** [install-am] エラー 2
make[1]: Leaving directory `/var/tmp/portage/mudmagic-1.0.3/work/mudmagic-1.0.3'
make: *** [install-recursive] エラー 1

!!! ERROR: games-mud/mudmagic-1.0.3 failed.
!!! Function src_install, Line 31, Exitcode 2
!!! (no error message)
!!! If you need support, post the topmost build error, NOT this status message.

--------------------------- ACCESS VIOLATION SUMMARY ---------------------------
LOG FILE = "/tmp/sandbox-games-mud_-_mudmagic-1.0.3-27192.log"

mkdir:     /usr/share/mudmagic
mkdir:     /usr/share/mudmagic
mkdir:     /usr/lib/mudmagic
open_wr:   /usr/share/mudmagic/ui
open_wr:   /usr/share/mudmagic/ui
open_wr:   /usr/share/mudmagic/ui
open_wr:   /usr/share/mudmagic/ui
open_wr:   /usr/share/mudmagic/ui
open_wr:   /usr/share/mudmagic/ui
open_wr:   /usr/share/mudmagic/ui
open_wr:   /usr/share/mudmagic/doc
open_wr:   /usr/share/mudmagic/doc
open_wr:   /usr/share/mudmagic/doc
--------------------------------------------------------------------------------


My question: How do I tell the installation script to install to its sandboxed directory, so that it has write access, and then merge the files into the filesystem correctly?
Back to top
View user's profile Send private message
Carlo
Developer
Developer


Joined: 12 Aug 2002
Posts: 3356

PostPosted: Sat Dec 25, 2004 8:37 pm    Post subject: Reply with quote

mholtz: If the scripts do not take $DESTDIR into account, there's the small chance another variable name is used. Otherwise the scripts need to be patched.
_________________
Please make sure that you have searched for an answer to a question after reading all the relevant docs.
Back to top
View user's profile Send private message
mholtz
Tux's lil' helper
Tux's lil' helper


Joined: 04 Feb 2004
Posts: 110
Location: Ohio, USA

PostPosted: Sat Dec 25, 2004 8:49 pm    Post subject: Reply with quote

Hrmm...I am not quite sure what you mean. The Makefile does use /bin/install for its install program. I guess I am confused as to what exactly DESTDIR, D, and all these other directories are.
Back to top
View user's profile Send private message
Pythonhead
Developer
Developer


Joined: 16 Dec 2002
Posts: 1801
Location: Redondo Beach, Republic of Calif.

PostPosted: Sat Dec 25, 2004 10:28 pm    Post subject: Reply with quote

This ebuild works, as far as running mudmagic it starts up anyways:
Code:

# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

DESCRIPTION=""
HOMEPAGE=""
SRC_URI="mirror://sourceforge/kyndig/${P}.tar.gz"
LICENSE="GPL"
SLOT="0"
KEYWORDS="x86"
IUSE=""
DEPEND="virtual/libc
   dev-libs/libpcre
   x11-libs/gtk+
   =dev-lang/python-2.3*
   dev-db/sqlite
   >=gnome-base/libglade-2.0.1"

src_compile() {
   export pythonpath=/usr/bin/python2.3
   ./reconf
   econf || die "could not configure"
   emake || die "emake failed"
}

src_install() {
   einstall || die "einstall failed"
}


The program expects python 2.3, so notice the change I made in DEPEND and also the pythonpath variable I exported. The instructions said to run reconf before configure, so I added that.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum