Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Ebuild & Meson Dilemma

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
6 posts • Page 1 of 1
Author
Message
dg09
n00b
n00b
Posts: 13
Joined: Wed Apr 24, 2024 6:03 am

Ebuild & Meson Dilemma

  • Quote

Post by dg09 » Thu Feb 13, 2025 5:19 pm

Greetings folks,

I am having a dilemma creating an ebuild for the following software: Astal.

The instructions for building and installing this software are rather simple and clear. After cloning the repository, one must simply do the following:

astal-io

Code: Select all

cd /tmp/astal/lib/astal/io
meson setup --prefix /usr build
meson install -C build
astal3

Code: Select all

cd /tmp/astal/lib/astal/gtk3
meson setup --prefix /usr build
meson install -C build
The above works just fine when installing locally and it is simple enough to follow, so I attempted to replicate the build and install process through an ebuild:

Code: Select all

EAPI=8

inherit git-r3 

DESCRIPTION="Astal Gtk Shell"
HOMEPAGE="https://aylur.github.io/astal"
EGIT_REPO_URI="https://github.com/aylur/astal.git"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"

IUSE=""


DEPEND="
	dev-build/meson
	dev-lang/vala
	x11-libs/gtk+:3
	gui-libs/gtk-layer-shell
	dev-libs/gobject-introspection
"

src_unpack() {
	einfo "Fetching distfiles..."
	git-r3_src_unpack
}

src_compile() {
	einfo "Compiling..."
	export VALAC=/usr/bin/valac-0.56
	export VALADOC=/usr/bin/valadoc-0.56

	cd "${WORKDIR}/astal-1.0/lib/astal/io" || die
	meson setup --prefix="/usr" build || die "Meson setup failed Astal IO module"
	meson compile -C build || die "Meson setup failed Astal IO module"

	cd "${WORKDIR}/astal-1.0/lib/astal/gtk" || die
	meson setup --prefix="/usr" build || die "Meson setup failed for Astal GTK3 module"
	meson compile -C build || die "Meson setup failed for Astal GTK3 module"

}

src_install() {
    cd "${WORKDIR}/astal-1.0/lib/astal/io" || die "Failed to cd into IO module"
    meson install -C build --prefix=/usr || die "Meson install for IO module failed"

    cd "${WORKDIR}/astal-1.0/lib/astal/gtk3" || die "Failed to cd into GTK3 module"
    meson install -C build --prefix=/usr || die "Meson install for GTK3 module failed"
}



I have been testing this ebuild with "ebuild astal-01.ebuild {unpack,compile,install}" with no success. The main issue is that the GTK3 module depends on the IO module being installed in the relevant directories system-wide(it looks for astal-io as a dependency in /usr/bin). This conflicts in the ebuild because the src_install function is called after src_compile, resulting in the GTK module not compiling properly. That said, I tried using "meson install -C build" inside the src_compile function, but was met with the sandbox Portage uses for compiling and installing packages, for which I have yet to learn a lot about it seems.

Given that, I then tried playing around with meson settings but also had no success, mostly due to my ignorance with both the meson build system and ebuild writing. Additionally I attempted a separate ebuild approach, with one ebuild for the IO module and another for the GTK module, and make the GTK module ebuild dependant on the IO module ebuild. I did not have any luck on that for mostly the same reasons, although I was able to successfully compile the IO module on its own, but not install it also due to permission.

Another idea I am considering is to modify the meson build files with a .patch file so that the compile succeeds, but I would like to ask if anyone here has a better approach for resolving this. I would like to learn how to write good ebuilds, so hopefully someone here can shed some light or perhaps some tips and tricks I could use to improve this one.

Thanks in advance!
Top
grknight
Retired Dev
Retired Dev
Posts: 2556
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Thu Feb 13, 2025 5:28 pm

First, split the build into 2 ebuilds since one depends on the other.

Second, use the meson eclass instead of calling it directly. Also, use the vala eclass for vala support.
Top
wjb
l33t
l33t
User avatar
Posts: 681
Joined: Sun Jul 10, 2005 9:40 am
Location: Fife, Scotland

  • Quote

Post by wjb » Thu Feb 13, 2025 6:59 pm

(look for existing ebuilds using the meson & vala eclasses and steal from them)
Top
Hu
Administrator
Administrator
Posts: 24385
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Thu Feb 13, 2025 7:10 pm

After following grknight's advice, if you still need help, post the revised ebuilds and the output when running them fails.
Top
dg09
n00b
n00b
Posts: 13
Joined: Wed Apr 24, 2024 6:03 am

  • Quote

Post by dg09 » Thu Feb 13, 2025 9:27 pm

Thanks everyone for your responses. After following the advice provided, I have managed to split the ebuilds and use the vala eclass on the ebuilds and got the installation somewhat working since the emerge compiles and installs successfully.


However, I am not convinced this correct; the resulting astal binary is sent to /usr/sbin, as opposed to /usr/bin where it should go(I guess I'm having a hard time wrapping my head around the build process and the correct directories/build options).

I have tried to use the meson eclass and src_prepare function as such:

Code: Select all

src_prepare() {
	default
	vala_src_prepare
}

src_configure() {
	local mesonargs=(
		-Dprefix=/usr
		-Dlibdir=lib64
		-Ddatadir=/usr/share
		-Dbindir=/usr/bin
	)

	meson_src_configure
}

src_compile() {
	meson_src_compile
}

src_install() {
	meson_src_install
}

The above was tried in the hopes of fixing the resulting install location of /usr/sbin, but instead I was met with an issue regarding the meson.build file being absent, as shown in this emerge output.

The only way I have managed to get these to work is through explicitly doing "cd ${S}/lib/asta/{io,gtk}" on each ebuild, such that the working directory is able to find the meson.build file and be able to compile. I believe this is where the meson eclass would come in handy, but I cannot get that to work yet.

Additionally, the valadoc binary is not being found during compile without the export statement in the ebuilds; not sure if the vala eclass can handle this properly.

I will keep digging for these, but in the meantime, here's the current *working* ebuilds in case anyone is willing to bounce some ideas:


astal-io-1.0.ebuild

astal-gtk-1.0.ebuild


Thanks again, much appreciated!
Top
grknight
Retired Dev
Retired Dev
Posts: 2556
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Fri Feb 14, 2025 12:57 am

Very good. Here is my take based heavily on your work:

Code: Select all

# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

VALA_USE_DEPEND="valadoc"
inherit git-r3 meson vala

DESCRIPTION="Astal IO Module"
HOMEPAGE="https://aylur.github.io/astal"
EGIT_REPO_URI="https://github.com/aylur/astal.git"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS=""

IUSE=""

DEPEND="
        dev-libs/glib[introspection]
        dev-libs/gobject-introspection
"
RDEPEND="${DEPEND}"
BDEPEND="$(vala_depend)"

S="${S}/lib/astal/io"

src_prepare() {
        default
        vala_setup
}

Code: Select all

# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

VALA_USE_DEPEND="valadoc"
inherit git-r3 meson vala

DESCRIPTION="Astal GTK Module"
HOMEPAGE="https://aylur.github.io/astal"
EGIT_REPO_URI="https://github.com/aylur/astal.git"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS=""

IUSE=""

DEPEND="
        dev-libs/astal-io
        dev-libs/glib[introspection]
        dev-libs/gobject-introspection
        dev-libs/wayland
        dev-libs/wayland-protocols
        x11-libs/gdk-pixbuf[introspection]
        x11-libs/gtk+:3[introspection]
        gui-libs/gtk-layer-shell[introspection,vala]
"
RDEPEND="${DEPEND}"
BDEPEND="
        dev-util/wayland-scanner
        $(vala_depend)
"

S="${S}/lib/astal/gtk3"

src_prepare() {
        default
        vala_setup
}
Top
Post Reply

6 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy