Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Help needed with writing ebuild for Renoise DAW
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
defer-
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2007
Posts: 118
Location: Finland

PostPosted: Wed Jul 03, 2013 9:58 pm    Post subject: Help needed with writing ebuild for Renoise DAW Reply with quote

Im writing ebuild for Renoise digital audio workstation. Its distributed as tar.gz package containing binary and resources. I dont have much experience with ebuilds and have never worked with binary ebuilds so i could use little help.

The src_install block is in pure bash to demonstrate what should be done. I got the install instructions from install.sh script coming with the rns_2_8_1_reg_x86_64.tar.gz. The x86 version has x86.tar.gz ending and demo version has Demo_x86.tar.gz ending. It would be nice to add support for x86 and demo versions, but i dont know how?

renoise-2.8.1.ebuild
Code:

EAPI=2
inherit eutils

DESCRIPTION="Complete DAW using a tracker-based approach"
HOMEPAGE="http://www.renoise.com/"

MY_PN="Renoise"
SRC_URI="rns_2_8_1_reg_x86_64.tar.gz"

LICENSE="renoise-EULA"
SLOT="0"
KEYWORDS="amd64"
IUSE=""
RESTRICT="fetch strip"

RDEPEND=""
DEPEND=""

S=${WORKDIR}/${MY_PN}
dir=${GAMES_PREFIX_OPT}/${PN}

pkg_nofetch() {
   elog "Download ${a} from ${homepage} and place it in ${DISTDIR}"
}

src_install() {
tar zxvf rns_2_8_1_reg_x86_64.tar.gz
cd rns_2_8_1_reg_x86_64
xdg-mime install --novendor Installer/renoise.xml
xdg-icon-resource install --novendor --size 48 --context apps Installer/renoise.png
xdg-icon-resource install --novendor --size 48 --context mimetypes Installer/renoise.png application-x-renoise-module
xdg-icon-resource install --novendor --size 48 --context mimetypes Installer/renoise.png application-x-renoise-rns-module
xdg-desktop-menu install --novendor Installer/renoise.desktop
install -D -m644 Installer/renoise.1.gz /usr/share/man/man1/
install -D -m644 Installer/renoise-pattern-effects.5.gz /usr/share/man/man5/
cp renoise /usr/local/bin/
ln -sf /usr/local/bin/renoise-2.8.1 /usr/local/bin/renoise
cp -r Resources/* /usr/local/share/renoise-2.8.1
}

_________________
koti.kapsi.fi/deferi
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8592

PostPosted: Wed Jul 03, 2013 11:22 pm    Post subject: Re: Help needed with writing ebuild for Renoise DAW Reply with quote

defer- wrote:
The src_install block is in pure bash to demonstrate what should be done. I got the install instructions from install.sh script coming with the rns_2_8_1_reg_x86_64.tar.gz. The x86 version has x86.tar.gz ending and demo version has Demo_x86.tar.gz ending. It would be nice to add support for x86 and demo versions, but i dont know how?
The best way to support x86 and other architectures is to rebuild from source. Upstream binary packages are a convenience in some cases, but the only reasons to use them on Gentoo is if the build is extremely expensive (LibreOffice) or upstream refuses to release the source.
defer- wrote:
Code:

SRC_URI="rns_2_8_1_reg_x86_64.tar.gz"
Change to:
Code:
SRC_URI="x86? ( rns_2_8_1_reg_x86.tar.gz )
   amd64? ( rns_2_8_1_reg_x86_64.tar.gz )"

defer- wrote:
Code:

RDEPEND=""
Even binary packages usually have dependencies. You should identify what libraries are required and list their packages in RDEPEND.
defer- wrote:
Code:

dir=${GAMES_PREFIX_OPT}/${PN}
This is unused. Delete it.
defer- wrote:
Code:

pkg_nofetch() {
   elog "Download ${a} from ${homepage} and place it in ${DISTDIR}"
}
Bash variable names are case sensitive. You may not need this function at all, though.
defer- wrote:
Code:

src_install() {
tar zxvf rns_2_8_1_reg_x86_64.tar.gz
cd rns_2_8_1_reg_x86_64
xdg-mime install --novendor Installer/renoise.xml
xdg-icon-resource install --novendor --size 48 --context apps Installer/renoise.png
xdg-icon-resource install --novendor --size 48 --context mimetypes Installer/renoise.png application-x-renoise-module
xdg-icon-resource install --novendor --size 48 --context mimetypes Installer/renoise.png application-x-renoise-rns-module
xdg-desktop-menu install --novendor Installer/renoise.desktop
install -D -m644 Installer/renoise.1.gz /usr/share/man/man1/
install -D -m644 Installer/renoise-pattern-effects.5.gz /usr/share/man/man5/
cp renoise /usr/local/bin/
ln -sf /usr/local/bin/renoise-2.8.1 /usr/local/bin/renoise
cp -r Resources/* /usr/local/share/renoise-2.8.1
}
Unpacking is handled for you by the automatic function src_unpack. You should never install any files to the live filesystem. Put everything under $D.
Back to top
View user's profile Send private message
defer-
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2007
Posts: 118
Location: Finland

PostPosted: Fri Aug 16, 2013 4:02 pm    Post subject: Reply with quote

Thanks for help! I managed to get the ebuild to work :). I would like to hear if there is anything done incorrectly or something to improve? Can i make the same ebuild to support demo version or should i create another ebuild for demo version?

Code:
EAPI=5
inherit eutils

DESCRIPTION="Complete DAW using a tracker-based approach"
HOMEPAGE="http://www.renoise.com/"

MY_ARCH=${ARCH/amd64/x86_64}
SRC_URI="rns_2_8_1_reg_${MY_ARCH}.tar.gz"
S="${WORKDIR}/rns_2_8_1_reg_${MY_ARCH}"

LICENSE="renoise-EULA"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE="-icons"
RESTRICT="fetch strip"

RDEPEND="
        x11-base/xorg-server
        media-libs/alsa-lib
        icons? (
                x11-misc/xdg-utils
        )
"

pkg_nofetch() {
        elog "Download ${A} from ${HOMEPAGE} and place it in ${DISTDIR}"
}

src_install() {
        mkdir -p ${D}/usr/share/renoise-${PV}
        mkdir -p ${D}/usr/bin
        cp -r Resources/* ${D}/usr/share/renoise-${PV}
        cp renoise ${D}/usr/bin/renoise-${PV}
        ln -sf ${D}/usr/bin/renoise-${PV} ${D}/usr/bin/renoise
        install -D -m644 Installer/renoise.1.gz ${D}/usr/share/man/man1/
        install -D -m644 Installer/renoise-pattern-effects.5.gz ${D}/usr/share/man/man5/

        if use icons ; then
                xdg-mime install --novendor ${D}/usr/share/renoise-2.8.1/Installer/renoise.xml
                xdg-icon-resource install --novendor --size 48 --context apps ${D}/usr/share/renoise-2.8.1/Installer/renoise.png
                xdg-icon-resource install --novendor --size 48 --context mimetypes ${D}/usr/share/renoise-2.8.1/Installer/renoise.png application-x-renoise-module
                xdg-icon-resource install --novendor --size 48 --context mimetypes ${D}/usr/share/renoise-2.8.1/Installer/renoise.png application-x-renoise-rns-module
                xdg-desktop-menu install --novendor ${D}/usr/share/renoise-2.8.1/Installer/renoise.desktop
        fi
}

_________________
koti.kapsi.fi/deferi
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8592

PostPosted: Fri Aug 16, 2013 8:52 pm    Post subject: Reply with quote

defer- wrote:
I would like to hear if there is anything done incorrectly or something to improve? Can i make the same ebuild to support demo version or should i create another ebuild for demo version?
You can do either. The correct choice depends on various factors, such as whether a user may want to have both versions installed at once and how much code can be shared between the two ebuilds.
defer- wrote:
Code:

RDEPEND="
        x11-base/xorg-server
Is this right? Can the program be run on one machine and rendered on another via X11 forwarding? Did you list xorg-server as a shortcut to the shared objects that Renoise requires?
defer- wrote:
Code:
        icons? (
                x11-misc/xdg-utils
        )
This should be in DEPEND, not RDEPEND. As written, the ebuild would permit me to emerge --buildpkgonly renoise, but would fail in the install phase when the xdg tools were used.
defer- wrote:
Code:

        mkdir -p ${D}/usr/share/renoise-${PV}
        mkdir -p ${D}/usr/bin
        cp -r Resources/* ${D}/usr/share/renoise-${PV}
        cp renoise ${D}/usr/bin/renoise-${PV}
        ln -sf ${D}/usr/bin/renoise-${PV} ${D}/usr/bin/renoise
${D} should be quoted wherever it is used. Some users stage the build area in a path with spaces.

Why do you copy the file to renoise-${PV}, but then always install a symlink under the basic name? If you want users to access it without a version, then you can install it directly to the basic name.
defer- wrote:
Code:

                xdg-mime install --novendor ${D}/usr/share/renoise-2.8.1/Installer/renoise.xml
                xdg-icon-resource install --novendor --size 48 --context apps ${D}/usr/share/renoise-2.8.1/Installer/renoise.png
                xdg-icon-resource install --novendor --size 48 --context mimetypes ${D}/usr/share/renoise-2.8.1/Installer/renoise.png application-x-renoise-module
                xdg-icon-resource install --novendor --size 48 --context mimetypes ${D}/usr/share/renoise-2.8.1/Installer/renoise.png application-x-renoise-rns-module
                xdg-desktop-menu install --novendor ${D}/usr/share/renoise-2.8.1/Installer/renoise.desktop
These paths include a fixed version number, which is probably not what you want.
Back to top
View user's profile Send private message
defer-
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2007
Posts: 118
Location: Finland

PostPosted: Sat Aug 17, 2013 1:24 am    Post subject: Reply with quote

Hu wrote:
Why do you copy the file to renoise-${PV}, but then always install a symlink under the basic name? If you want users to access it without a version, then you can install it directly to the basic name.

I just wanted to make the ebuild to install it exactly same way as the install.sh script supplied with the package.

I managed to get the ebuild to well working state. its now good enough for me. Thanks for help :)

(Only thing i couldnt find was ebuild function for xdg-mime)

Code:
# Distributed under the terms of the GNU General Public License v2

EAPI=5
inherit eutils

DESCRIPTION="Complete DAW using a tracker-based approach"
HOMEPAGE="http://www.renoise.com/"

MY_ARCH=${ARCH/amd64/x86_64}
SRC_URI="rns_2_8_1_reg_${MY_ARCH}.tar.gz"
S="${WORKDIR}/rns_2_8_1_reg_${MY_ARCH}"

LICENSE="renoise-EULA"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE="-icons"
RESTRICT="fetch strip"

DEPEND="
        icons? (
                x11-misc/xdg-utils
        )
"

RDEPEND="
        media-libs/alsa-lib
"

pkg_nofetch() {
        elog "Download ${A} from ${HOMEPAGE} and place it in ${DISTDIR}"
}

src_install() {
        mkdir -p ${D}/usr/share/renoise-${PV}
        cp -r Resources/* ${D}/usr/share/renoise-${PV}
        mkdir -p ${D}/usr/bin
        cp renoise ${D}/usr/bin/renoise-${PV}
        dosym /usr/bin/renoise-${PV} /usr/bin/renoise
        doman Installer/renoise.1.gz
        doman Installer/renoise-pattern-effects.5.gz

        if use icons ; then
                xdg-mime install --novendor Installer/renoise.xml
                doicon -s 48 -c apps Installer/renoise.png
                doicon -s 48 -c mimetypes Installer/renoise.png application-x-renoise-module
                doicon -s 48 -c mimetypes Installer/renoise.png application-x-renoise-rns-module
                domenu Installer/renoise.desktop
        fi
}

_________________
koti.kapsi.fi/deferi
Back to top
View user's profile Send private message
TomWij
Developer
Developer


Joined: 04 Jul 2012
Posts: 1345

PostPosted: Sat Aug 17, 2013 7:49 am    Post subject: Reply with quote

Quote:
# Distributed under the terms of the GNU General Public License v2


If submitting to the Portage tree is intended, you will want to include the full header from ${PORTDIR}/header.txt

Quote:
MY_ARCH=${ARCH/amd64/x86_64}
SRC_URI="rns_2_8_1_reg_${MY_ARCH}.tar.gz"


ARCH in SRC_URI will cause caching and manifesting problems.

You can do SRC_URI="amd64? ( rns_2_8_1_reg_x86_64.tar.gz ) x86? ( rns_2_8_1_reg_x86.tar.gz )" instead.

Also, you will want to include ${PV} in there and substitute the "." by "_".

Quote:
S="${WORKDIR}/rns_2_8_1_reg_${MY_ARCH}"


Instead do if use amd64 ; then S="..." ; fi if use x86 ; then S="..." ; fi. Alternatively, just set S="${WORKDIR}" and move everything up in unpack or use cd from the phases.

Quote:
KEYWORDS="~x86 ~amd64"


Sort variables when you can.

Quote:
DEPEND="
icons? (
x11-misc/xdg-utils
)
"

RDEPEND="
media-libs/alsa-lib
"


Slot variables when you can, eg. x11-misc/xdg-utils:0 and media-libs/alsa-lib:0. This prevents new major versions from breaking it.

Quote:
mkdir -p ${D}/usr/share/renoise-${PV}


You can use insinto instead. And if you do use something like mkdir, you will want to use || die to catch failures.

Quote:
cp -r Resources/* ${D}/usr/share/renoise-${PV}
cp renoise ${D}/usr/bin/renoise-${PV}


You can use doins -r and doins instead.
Back to top
View user's profile Send private message
defer-
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2007
Posts: 118
Location: Finland

PostPosted: Sat Aug 17, 2013 10:23 am    Post subject: Reply with quote

TomWij wrote:
Quote:
cp -r Resources/* ${D}/usr/share/renoise-${PV}
cp renoise ${D}/usr/bin/renoise-${PV}


You can use doins -r and doins instead.


How can i do this:
cp renoise ${D}/usr/bin/renoise-${PV}
with doins?
_________________
koti.kapsi.fi/deferi
Back to top
View user's profile Send private message
TomWij
Developer
Developer


Joined: 04 Jul 2012
Posts: 1345

PostPosted: Sat Aug 17, 2013 11:05 am    Post subject: Reply with quote

defer- wrote:
How can i do this:
cp renoise ${D}/usr/bin/renoise-${PV}
with doins?


Sorry, haven't looked at the number of parameters or its content, I was focused on the occurrence of the copy command.

You can do that with newins which installs a miscellaneous file using the second argument as the name. Actually, you might even want to use newbin.

Please see http://devmanual.gentoo.org/function-reference/install-functions/index.html for a full list.
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