View previous topic :: View next topic |
Author |
Message |
rihteri n00b
Joined: 01 Jun 2003 Posts: 36 Location: Seinäjoki, Finland
|
Posted: Sat Jul 12, 2003 4:46 pm Post subject: ebuild and ${D} |
|
|
I'm trying to make my first ebuild, and I have basically modified an old one to support a new(and renamed) version of a program.
My ebuild works, if it is installed into root directory. In the end there is however a line that I imagine would break things if someone tried to install this elsewhere. If I change the line(see comment below), the ebuild program tries to link a file in the temporary sandbox dir, and not the final destdir.
Code: | DESCRIPTION="mount bin/cue cd images"
HOMEPAGE="http://outertech.com/robert/virtualcd/"
SRC_URI="http://outertech.com/robert/virtualcd/cdemu_0.5.0_alpha.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86 ppc"
DEPEND="virtual/kernel
python? ( >=dev-lang/python-2.2.3-r1 )"
S=${WORKDIR}/${P/-/_}
src_compile() {
${CC:-gcc} cdemu.c -o cdemu.o -c \
${CFLAGS} -D__KERNEL__ -DMODULE -Wall \
-I/usr/src/linux/include \
|| die "could not make kernel module"
}
src_install() {
mkdir -p ${D}/lib/modules/`uname -r`/kernel/fs/cdemu \
|| die "could not create module directory"
cp ${S}/cdemu.o ${D}/lib/modules/`uname -r`/kernel/fs/cdemu/ \
|| die "could not copy module into destination"
mkdir -p ${D}/opt/cdemu \
|| die "failed to create binary directory"
cp ${S}/cdemu ${D}/opt/cdemu/ || die "failed to install binary"
cp ${S}/libcdemu.py ${D}/opt/cdemu/ || die "failed to install library"
mkdir -p ${D}/usr/bin || die "failed to create executable link directory"
###I wonder if this is inacceptable, as there is no ${D} on the link source... ?
ln -s /opt/cdemu/cdemu ${D}/usr/bin/cdemu || die "failed to symlink executable"
dodoc AUTHORS ChangeLog README TODO
einfo "Remember to load the cdemu kernel module before using!"
} |
My question: how can I resolve this to work in every case, or is it good as it is? |
|
Back to top |
|
|
Pythonhead Developer
Joined: 16 Dec 2002 Posts: 1801 Location: Redondo Beach, Republic of Calif.
|
Posted: Sat Jul 12, 2003 6:01 pm Post subject: |
|
|
Is the problem that your link will get erased if the /var/tmp/portage/cdemu* gets cleaned, right?
If so, how about this:
Code: |
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: $
MY_P="${PN}_${PV}_alpha"
DESCRIPTION="mount bin/cue cd images"
HOMEPAGE="http://outertech.com/robert/virtualcd/"
SRC_URI="http://outertech.com/robert/virtualcd/${MY_P}.tar.bz2"
IUSE=""
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86 ppc"
DEPEND="virtual/kernel
python? ( >=dev-lang/python-2.2.3-r1 )"
S=${WORKDIR}/${MY_P}
src_compile() {
${CC:-gcc} cdemu.c -o cdemu.o -c \
${CFLAGS} -D__KERNEL__ -DMODULE -Wall \
-I/usr/src/linux/include \
|| die "could not make kernel module"
}
src_install() {
mkdir -p ${D}/lib/modules/`uname -r`/kernel/fs/cdemu \
|| die "could not create module directory"
cp ${S}/cdemu.o ${D}/lib/modules/`uname -r`/kernel/fs/cdemu/ \
|| die "could not copy module into destination"
mkdir -p ${D}/opt/cdemu \
|| die "failed to create binary directory"
cp ${S}/cdemu ${D}/opt/cdemu/ || die "failed to install binary"
cp ${S}/libcdemu.py ${D}/opt/cdemu/ || die "failed to install library"
#mkdir -p ${D}/usr/bin || die "failed to create executable link directory"
###I wonder if this is inacceptable, as there is no ${D} on the link source... ?
#ln -s /opt/cdemu/cdemu ${D}/usr/bin/cdemu || die "failed to symlink executable"
into /opt/cdemu/
dobin cdemu
dodoc AUTHORS ChangeLog README TODO
einfo "Remember to load the cdemu kernel module before using!"
} |
|
|
Back to top |
|
|
rihteri n00b
Joined: 01 Jun 2003 Posts: 36 Location: Seinäjoki, Finland
|
Posted: Sat Jul 12, 2003 7:18 pm Post subject: |
|
|
Thanks for the help, and the nicely cleaned SRC_URI
Quote: | Is the problem that your link will get erased if the /var/tmp/portage/cdemu* gets cleaned, right? |
Yes.
However, I propably wasn't specific enough.
Code: |
into /opt/cdemu/
dobin cdemu
|
If I understand right this will copy the executable(cdemu) to /opt/cdemu/bin. What I wanted to do was get cdemu and libcdemu.py(who need to be in the same directory to work AFAIK) to some directory(/opt/cdemu/) and only link the executable(cdemu) to a directory in the PATH(/usr/bin/).
Of course it would be optimal if someone could figure out how to separate the cdemu and libcdemu.py into two separate directories. |
|
Back to top |
|
|
Pythonhead Developer
Joined: 16 Dec 2002 Posts: 1801 Location: Redondo Beach, Republic of Calif.
|
Posted: Sat Jul 12, 2003 7:51 pm Post subject: |
|
|
Is there a reason you're putting it in /opt? The reason I ask is because Gentoo only wants binary-only packages there.
If its just going to be a personal ebuild thats fine, but if you're submitting it to Gentoo I think it might make sense to put libcdemu.py in /usr/lib/python-n.n.n/site-packages/ and cdemu in /usr/bin
Would that work? That way cdemu would find libcdemu, no symlinks needed. |
|
Back to top |
|
|
rihteri n00b
Joined: 01 Jun 2003 Posts: 36 Location: Seinäjoki, Finland
|
Posted: Sat Jul 12, 2003 8:19 pm Post subject: |
|
|
Quote: | Is there a reason you're putting it in /opt? |
No. I wasn't aware of the gentoo policy on /opt.
Quote: | it might make sense to put libcdemu.py in /usr/lib/python-n.n.n/site-packages/ and cdemu in /usr/bin
Would that work? That way cdemu would find libcdemu, no symlinks needed. |
Works!
But then, how can I determine the python-n.n.n directory on a specific users machine?
This one is most likely going to be just a private ebuild, but I want to do it well, so maybe one day I can make submittable ones |
|
Back to top |
|
|
Pythonhead Developer
Joined: 16 Dec 2002 Posts: 1801 Location: Redondo Beach, Republic of Calif.
|
Posted: Sat Jul 12, 2003 8:51 pm Post subject: |
|
|
There may be a better way, but you could use something like:
Code: | PY_PRE=`python -c 'import sys;print sys.path[1]'` |
This would give:
/usr/lib/python-2.2 |
|
Back to top |
|
|
|