Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
help with writing an ebuild
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
littletux
n00b
n00b


Joined: 08 Dec 2003
Posts: 73

PostPosted: Sat Nov 04, 2017 11:11 am    Post subject: help with writing an ebuild Reply with quote

This is the content of my ebuild
Code:
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=6
DESCRIPTION="yapc = Yet Another Pacman Clone"
EGIT_REPO_URI="https://github.com/ebuc99/pacman.git"
inherit git-r3
HOMEPAGE="https://github.com/ebuc99"
SLOT="0"
LICENSE="GPL3"
KEYWORDS="~x86 ~amd64"
DEPEND="media-libs/libsdl2
        media-libs/sdl2-image
        media-libs/sdl2-mixer
        media-libs/sdl2-ttf"
RDEPEND="${DEPEND}"

src_configure() {
        CPPFLAGS="-I/usr/include/SDL2" econf
}

So now if I emerge it, I receive this Message
Code:
 * --------------------------- ACCESS VIOLATION SUMMARY ---------------------------
 * LOG FILE: "/var/log/sandbox/sandbox-15216.log"
 *
VERSION 1.0
FORMAT: F - Function called
FORMAT: S - Access Status
FORMAT: P - Path as passed to function
FORMAT: A - Absolute Path (not canonical)
FORMAT: R - Canonical Path
FORMAT: C - Command Line

F: open_wr
S: deny
P: /usr/local/share/applications/.mimeinfo.cache.VR528Y
A: /usr/local/share/applications/.mimeinfo.cache.VR528Y
R: /usr/local/share/applications/.mimeinfo.cache.VR528Y
C: update-desktop-database -q

F: open_wr
S: deny
P: /usr/share/applications/.mimeinfo.cache.LY318Y
A: /usr/share/applications/.mimeinfo.cache.LY318Y
R: /usr/share/applications/.mimeinfo.cache.LY318Y
C: update-desktop-database -q
 * --------------------------------------------------------------------------------


What I have to change/add to my ebuild so it will work?

[Moderator edit: changed [quote] tags to [code] tags to preserve output layout. -Hu]
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 22659
Location: here

PostPosted: Sat Nov 04, 2017 12:02 pm    Post subject: Reply with quote

Add this function in ebuild
Code:
src_prepare() {
        default
        # Do not run update-desktop-database (sandbox violation)
        sed -e '/^UPDATE_DESKTOP/s:=.*:=true:' \
                -i Makefile.am Makefile.in || die
}


For line CPPFLAGS="-I/usr/include/SDL2" econf you can use flag-o-matic eclass with append-cppflags -I/usr/include/SDL2
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
littletux
n00b
n00b


Joined: 08 Dec 2003
Posts: 73

PostPosted: Sat Nov 04, 2017 1:29 pm    Post subject: Reply with quote

Thanks a lot, the new ebuild now looks like that

Code:

# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=6
DESCRIPTION="yapc = Yet Another Pacman Clone"
EGIT_REPO_URI="https://github.com/ebuc99/pacman.git"
inherit flag-o-matic git-r3
HOMEPAGE="https://github.com/ebuc99"
SLOT="0"
LICENSE="GPL3"
KEYWORDS="~x86 ~amd64"
DEPEND="media-libs/libsdl2
        media-libs/sdl2-image
        media-libs/sdl2-mixer
        media-libs/sdl2-ttf"
RDEPEND="${DEPEND}"

src_prepare() {
        default
        # Do not run update-desktop-database (sandbox violation)
        sed -e '/^UPDATE_DESKTOP/s:=.*:=true:' \
                -i Makefile.am Makefile.in || die
}

src_configure() {
        append-cppflags -I/usr/include/SDL2
        econf
}


The ebuild now do all that's needed, but, the build process goes wrong. Normaly emerge changes automagic the mostly used path prefix from /usr/local to /usr. It does it also here, but the resulting binary has still /usr/local as the search path, and so if I start the program it says
Quote:
Unable to load image: Couldn't open /usr/local/share/pacman/gfx/pacman_desktop.png

I have played around EPREFIX and ED with emake and emake install but haven't found a solution
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 22659
Location: here

PostPosted: Sat Nov 04, 2017 2:11 pm    Post subject: Reply with quote

littletux wrote:
The ebuild now do all that's needed, but, the build process goes wrong. Normaly emerge changes automagic the mostly used path prefix from /usr/local to /usr.

Usually yes, but in this case developer load has hard binded images path in code (see src/platform.cpp). You can use sed in src_prepare for patch this problem
Code:
src_prepare() {
        default
        # Do not run update-desktop-database (sandbox violation)
        sed -e '/^UPDATE_DESKTOP/s:=.*:=true:' \
                -i Makefile.am Makefile.in || die

        # Change path of image
        sed -e '/^Icon/s:/local::' -i pacman.desktop || die
        sed -e '/strcpy/s:/local::' -i src/platform.cpp || die
}

_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2799

PostPosted: Sat Nov 04, 2017 3:45 pm    Post subject: Re: help with writing an ebuild Reply with quote

littletux wrote:
This is the content of my ebuild
Code:
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=6
DESCRIPTION="yapc = Yet Another Pacman Clone"
EGIT_REPO_URI="https://github.com/ebuc99/pacman.git"
inherit git-r3

See https://devmanual.gentoo.org/ebuild-writing/using-eclasses/#the-inherit-function
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