View previous topic :: View next topic |
Author |
Message |
dg09 n00b

Joined: 24 Apr 2024 Posts: 13
|
Posted: Thu Feb 13, 2025 5:19 pm Post subject: Ebuild & Meson Dilemma |
|
|
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: |
cd /tmp/astal/lib/astal/io
meson setup --prefix /usr build
meson install -C build
|
astal3
Code: |
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: |
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! |
|
Back to top |
|
 |
grknight Retired Dev

Joined: 20 Feb 2015 Posts: 2023
|
Posted: Thu Feb 13, 2025 5:28 pm Post subject: |
|
|
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. |
|
Back to top |
|
 |
wjb l33t


Joined: 10 Jul 2005 Posts: 646 Location: Fife, Scotland
|
Posted: Thu Feb 13, 2025 6:59 pm Post subject: |
|
|
(look for existing ebuilds using the meson & vala eclasses and steal from them) |
|
Back to top |
|
 |
Hu Administrator

Joined: 06 Mar 2007 Posts: 23121
|
Posted: Thu Feb 13, 2025 7:10 pm Post subject: |
|
|
After following grknight's advice, if you still need help, post the revised ebuilds and the output when running them fails. |
|
Back to top |
|
 |
dg09 n00b

Joined: 24 Apr 2024 Posts: 13
|
Posted: Thu Feb 13, 2025 9:27 pm Post subject: |
|
|
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: |
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! |
|
Back to top |
|
 |
grknight Retired Dev

Joined: 20 Feb 2015 Posts: 2023
|
Posted: Fri Feb 14, 2025 12:57 am Post subject: |
|
|
Very good. Here is my take based heavily on your work:
astal-io-9999.ebuild: | # 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
}
|
astal-gtk-9999.ebuild: | # 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
} |
|
|
Back to top |
|
 |
|
|
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
|
|