Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Compiling uTox & ebuild
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Marcih
Apprentice
Apprentice


Joined: 19 Feb 2018
Posts: 213

PostPosted: Sat Feb 23, 2019 5:18 pm    Post subject: [SOLVED] Compiling uTox & ebuild Reply with quote

Does anyone have any experience with compiling uTox? I tried the precompiled binaries provided but calling doesn't work without DBus installed and the file picker used is the GTK+3 one so I wanted to try to compile.
I followed the build instructions but I can't even get past the
Code:
cmake ..
part (what exactly is happening in that step?), CMake complains about missing libraries. What's odd is that I have all the dependencies installed, or at least all the required ones. First it was complaining about DBus, after that it's about filter_audio.

I quite frankly don't understand what's happening when you compile from source, what CMake does here, all I've ever done was
Code:
./configure
make
make install
Could anyone give me a hand, even if it's only general advice about compiling?
_________________
Bones McCracker wrote:
It wouldn't be so bad, if it didn't suck.

NeddySeagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.


Last edited by Marcih on Fri Sep 06, 2019 2:33 pm; edited 3 times in total
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sat Feb 23, 2019 6:10 pm    Post subject: Reply with quote

There used to be an ebuild in the main tree, maybe you can dig it up. I switched to qtox because this was causing OOMs during build with 2GB RAM.
Back to top
View user's profile Send private message
Marcih
Apprentice
Apprentice


Joined: 19 Feb 2018
Posts: 213

PostPosted: Sat Feb 23, 2019 8:00 pm    Post subject: Reply with quote

Ant P. wrote:
There used to be an ebuild in the main tree, maybe you can dig it up. I switched to qtox because this was causing OOMs during build with 2GB RAM.

Thanks for the tip, there's an ebuild in someone's overlay, turns out the CMake flags were -DENABLE_DBUS/FILTERAUDIO/TESTS=ON/OFF. Why was uTox dropped from the official repos? I suppose chances of getting it back are slim since not even the qTox ebuilds are actively maintained anymore.
It still seems to require GTK+3 file picker but I'll have to inquire the devs directly about that one. I'll mark this one solved.

Won't bump an already-solved thread so I'll just edit this in:
Found a solution for the GTK+ file picker change on the Web, just edit the src/xlib/gtk.c file like the patch says.
Unfortunately the file picker still wouldn't launch, I guess it was because it was trying to load "widget_set_margin_left" and "widget_set_margin_right" from the GTK+ lib, commenting out the lines mentioning it and recompiling did the trick.
The final patch is as follows:
Code:
--- src/xlib/gtk.c.old  2019-02-24 17:23:38.702737879 +0100
+++ src/xlib/gtk.c      2019-02-24 17:15:52.507700317 +0100
@@ -24,8 +24,8 @@
 #include <stdlib.h>
 #include <string.h>

-#define LIBGTK_FILENAME "libgtk-3.so"
-#define LIBGTK_FILENAME_FALLBACK "libgtk-3.so.0"
+#define LIBGTK_FILENAME "libgtk-x11-2.0.so"
+#define LIBGTK_FILENAME_FALLBACK "libgtk-x11-2.0.so.0"

 #define GTK_FILE_CHOOSER_ACTION_OPEN 0
 #define GTK_FILE_CHOOSER_ACTION_SAVE 1
@@ -49,8 +49,8 @@
 void (*utoxGTK_init)(int *, char ***);
 bool (*utoxGTK_events_pending)(void);
 bool (*utoxGTK_main_iteration)(void);
-void (*utoxGTK_widget_set_margin_left)(void *, int);
-void (*utoxGTK_widget_set_margin_right)(void *, int);
+/*void (*utoxGTK_widget_set_margin_left)(void *, int);
+void (*utoxGTK_widget_set_margin_right)(void *, int);*/
 void (*utoxGTK_widget_destroy)(void *);
 void *(*utoxGTK_message_dialog_new)(void *, int, int, int, const char *, ...);
 int (*utoxGTK_dialog_run)(void *);
@@ -107,10 +107,10 @@
         return;
     }

-    // pad to MAX_PREVIEW_SIZE + 3px margins
+/*    // pad to MAX_PREVIEW_SIZE + 3px margins
     int margin = (MAX_PREVIEW_SIZE + 6 - utoxGDK_pixbuf_get_width(pixbuf)) / 2;
     utoxGTK_widget_set_margin_left(image, margin);
-    utoxGTK_widget_set_margin_right(image, margin);
+    utoxGTK_widget_set_margin_right(image, margin);*/

     // set preview
     utoxGTK_image_set_from_pixbuf(image, pixbuf);
@@ -517,8 +517,8 @@
         U_DLLOAD(gtk, file_chooser_set_preview_widget);
         U_DLLOAD(gtk, image_new);
         U_DLLOAD(gtk, image_set_from_pixbuf);
-        U_DLLOAD(gtk, widget_set_margin_left);
-        U_DLLOAD(gtk, widget_set_margin_right);
+/*      U_DLLOAD(gtk, widget_set_margin_left);
+        U_DLLOAD(gtk, widget_set_margin_right);*/

         U_DLLOAD(g, slist_free);
         U_DLLOAD(g, free);

_________________
Bones McCracker wrote:
It wouldn't be so bad, if it didn't suck.

NeddySeagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.
Back to top
View user's profile Send private message
Marcih
Apprentice
Apprentice


Joined: 19 Feb 2018
Posts: 213

PostPosted: Fri Sep 06, 2019 9:56 am    Post subject: Reply with quote

OK, am I dumb or am I dumb? I've been trying to make myself an ebuild of uTox with no success.

The build instructions say you need to create directory "build" and that's where you run cmake & make, while I also need to apply a patch to a file in the root(?) unpacked directory (see above post with the patch). Needless to say I've no clue what I'm doing, the official ebuild docs haven't been much help to me and I would like some help, please and thank you. :)
Code:
# Copyright 1999-2019 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit xdg-utils gnome2-utils cmake-utils

DESCRIPTION="Lightweight Tox client"
HOMEPAGE="https://utox.io"
SRC_URI="https://github.com/uTox/uTox/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-3"
SLOT="0"
IUSE="+dbus filter_audio gtk2 +gtk3 test"
REQUIRED_USE="|| ( gtk2 gtk3 )"
KEYWORDS="~amd64"

RDEPEND="dev-libs/libsodium
        media-libs/freetype
        media-libs/fontconfig
        filter_audio? ( media-libs/libfilteraudio )
        media-libs/libv4l
        media-libs/libvpx
        media-libs/openal
        media-libs/opus
        net-libs/tox[av]
        dbus? ( sys-apps/dbus )
        gtk2? ( x11-libs/gtk+:2 )
        gtk3? ( x11-libs/gtk+:3 )
        x11-libs/libX11
        x11-libs/libXext
        x11-libs/libXrender"
DEPEND="${RDEPEND}
        test? ( dev-libs/check )
        >=dev-util/cmake-3.2.0
        virtual/pkgconfig"


src_unpack() {
        default
        mkdir ${WORKDIR}/uTox-${PV}/build
        ${S} = ${WORKDIR}/uTox-${PV}/build
}

src_prepare() {
        # Strip GTK+3-only functions in order to be able to use the (perfectly adequate) GTK+2 file picker
        if ! use gtk3; then
                eapply "${FILESDIR}"/${PN}-0.17.0.allow-gtk2.patch
        fi

        epatch_user
        cmake-utils_src_prepare
}

src_configure() {
        local mycmakeargs=(
                -DENABLE_FILTERAUDIO=$(usex filter_audio ON OFF)
                -DENABLE_DBUS=$(usex dbus ON OFF)
                -DENABLE_TESTS=$(usex test ON OFF)
        )
        cmake-utils_src_configure
}

pkg_postinst() {
        xdg_desktop_database_update
        gnome2_icon_cache_update
}

pkg_postrm() {
        xdg_desktop_database_update
        gnome2_icon_cache_update
}
Build output:
Code:
>>> Unpacking source...
>>> Unpacking utox-0.17.0.tar.gz to /tmp/portage/net-im/utox-0.17.0/work
/tmp/portage/net-im/utox-0.17.0/temp/environment: line 2279: /tmp/portage/net-im/utox-0.17.0/work/utox-0.17.0: No such file or directory
>>> Source unpacked in /tmp/portage/net-im/utox-0.17.0/work
 * ERROR: net-im/utox-0.17.0::local_overlay failed (prepare phase):
 *   The source directory '/tmp/portage/net-im/utox-0.17.0/work/utox-0.17.0' doesn't exist
 *
 * Call stack:
 *            ebuild.sh, line  781:  Called __ebuild_main 'prepare'
 *   phase-functions.sh, line 1072:  Called __dyn_prepare
 *   phase-functions.sh, line  384:  Called die
 * The specific snippet of code:
 *              die "The source directory '${S}' doesn't exist"
 *
 * If you need support, post the output of `emerge --info '=net-im/utox-0.17.0::local_overlay'`,
 * the complete build log and the output of `emerge -pqv '=net-im/utox-0.17.0::local_overlay'`.
 * The complete build log is located at '/tmp/portage/net-im/utox-0.17.0/temp/build.log'.
 * The ebuild environment file is located at '/tmp/portage/net-im/utox-0.17.0/temp/environment'.
 * Working directory: '/tmp/portage/net-im/utox-0.17.0/homedir'
 * S: '/tmp/portage/net-im/utox-0.17.0/work/utox-0.17.0'

It's complaining about missing the source directory, which is true since the distfile extracts into "/tmp/portage/net-im/utox-0.17.0/work/uTox-0.17.0/" (note the capitalisation). How do I set the source dir to the correct one? Also, am I handling the whole "build" dir shenanigans correctly?
Thanks for all your feedback.
_________________
Bones McCracker wrote:
It wouldn't be so bad, if it didn't suck.

NeddySeagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30904
Location: here

PostPosted: Fri Sep 06, 2019 10:37 am    Post subject: Reply with quote

Code:
 *   The source directory '/tmp/portage/net-im/utox-0.17.0/work/utox-0.17.0' doesn't exist

This because when you untar archive directory is named uTox-0.17.0, the overwrite S variable with
Code:
S="${WORKDIR}/uTox-${PV}"

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


Joined: 19 Feb 2018
Posts: 213

PostPosted: Fri Sep 06, 2019 12:40 pm    Post subject: Reply with quote

fedeliallalinea wrote:
Code:
 *   The source directory '/tmp/portage/net-im/utox-0.17.0/work/utox-0.17.0' doesn't exist

This because when you untar archive directory is named uTox-0.17.0, the overwrite S variable with
Code:
S="${WORKDIR}/uTox-${PV}"
That's what I was trying to do in the unpack phase using hilariously wrong syntax :D Thanks for the correction.
Now onto the patch and building:
Code:
>>> Unpacking source...
>>> Unpacking utox-0.17.0.tar.gz to /tmp/portage/net-im/utox-0.17.0/work
>>> Source unpacked in /tmp/portage/net-im/utox-0.17.0/work
>>> Preparing source in /tmp/portage/net-im/utox-0.17.0/work/uTox-0.17.0 ...
 * Applying utox-0.17.0.allow-gtk2.patch ...
The text leading up to this was:
--------------------------
|--- src/xlib/gtk.c     2019-02-24 17:23:38.702737879 +0100
|+++ src/xlib/gtk.c     2019-02-24 17:15:52.507700317 +0100
--------------------------
No file to patch.  Skipping patch.
4 out of 4 hunks ignored                                                                                                                                                                                                             [ !! ]
 * ERROR: net-im/utox-0.17.0::local_overlay failed (prepare phase):
 *   patch -p1  failed with /tmp/portage/net-im/utox-0.17.0/files/utox-0.17.0.allow-gtk2.patch
 *
 * Call stack:
 *               ebuild.sh, line  125:  Called src_prepare
 *             environment, line 2270:  Called eapply '/tmp/portage/net-im/utox-0.17.0/files/utox-0.17.0.allow-gtk2.patch'
 *             environment, line 1076:  Called _eapply_patch '/tmp/portage/net-im/utox-0.17.0/files/utox-0.17.0.allow-gtk2.patch'
 *             environment, line 1014:  Called __helpers_die 'patch -p1  failed with /tmp/portage/net-im/utox-0.17.0/files/utox-0.17.0.allow-gtk2.patch'
 *   isolated-functions.sh, line  119:  Called die
 * The specific snippet of code:
 *              die "$@"
The file I'm trying to patch is "/tmp/portage/net-im/utox-0.17.0/work/uTox-0.17.0/src/xlib/gtk.c" and it does exist after unpacking. The only thing I can think of is I'm using relative paths and I'm in the wrong directory but I assumed I would be in the source directory, therefore the path "src/xlib/gtk.c" should work. Thoughts?
_________________
Bones McCracker wrote:
It wouldn't be so bad, if it didn't suck.

NeddySeagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6098
Location: Dallas area

PostPosted: Fri Sep 06, 2019 1:16 pm    Post subject: Reply with quote

Try

Code:
--- 1/src/xlib/gtk.c     2019-02-24 17:23:38.702737879 +0100
+++ 2/src/xlib/gtk.c     2019-02-24 17:15:52.507700317 +0100


IINM the first path gets stripped off.

Looking at the difference between gtk2 and gtk3 set_left_margin, there shouldn't be any.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
Marcih
Apprentice
Apprentice


Joined: 19 Feb 2018
Posts: 213

PostPosted: Fri Sep 06, 2019 2:33 pm    Post subject: Reply with quote

Anon-E-moose wrote:
Try

Code:
--- 1/src/xlib/gtk.c     2019-02-24 17:23:38.702737879 +0100
+++ 2/src/xlib/gtk.c     2019-02-24 17:15:52.507700317 +0100


IINM the first path gets stripped off.
Cheers, that worked.
Anon-E-moose wrote:
Looking at the difference between gtk2 and gtk3 set_left_margin, there shouldn't be any.
I commented out the lines I did because of build failures saying something along the lines of the function not existing so I just assumed it was a new feature in GTK+3. It works like this but if you discover something new then do let me know.

I also realised that the uTox project doesn't actually provide usable release tarballs so I had to settle with their git repo (like they say in the compile instructions).
Here's my final working ebuild - it looks like it's nightly builds so i named it "utox-9999.ebuild":
Code:
# Copyright 1999-2019 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit xdg-utils cmake-utils git-r3

DESCRIPTION="µTox the lightest and fluffiest Tox client"
HOMEPAGE="https://utox.io/"
EGIT_REPO_URI="https://github.com/uTox/uTox.git"

LICENSE="MIT"
SLOT="0"
IUSE="+dbus filter_audio gtk2 +gtk3 test"
REQUIRED_USE="|| ( gtk2 gtk3 )"
KEYWORDS="~amd64"

RDEPEND="dev-libs/libsodium
        media-libs/freetype
        media-libs/fontconfig
        filter_audio? ( media-libs/libfilteraudio )
        media-libs/libv4l
        media-libs/libvpx
        media-libs/openal
        media-libs/opus
        net-libs/tox[av]
        dbus? ( sys-apps/dbus )
        gtk2? ( x11-libs/gtk+:2 )
        gtk3? ( x11-libs/gtk+:3 )
        x11-libs/libX11
        x11-libs/libXext
        x11-libs/libXrender"
DEPEND="${RDEPEND}
        test? ( dev-libs/check )
        >=dev-util/cmake-3.2.0
        virtual/pkgconfig"

src_prepare() {
        # Strip GTK+3-only functions in order to be able to use the (perfectly adequate) GTK+2 file picker
        if ! use gtk3; then
                eapply "${FILESDIR}"/${PN}.allow-gtk2.patch
        fi

        cmake-utils_src_prepare
}

src_configure() {
        local mycmakeargs=(
                -DENABLE_FILTERAUDIO=$(usex filter_audio ON OFF)
                -DENABLE_DBUS=$(usex dbus ON OFF)
                -DENABLE_TESTS=$(usex test ON OFF)
        )
        cmake-utils_src_configure
}

pkg_postinst() {
        xdg_desktop_database_update
        xdg_icon_cache_update
}

pkg_postrm() {
        xdg_desktop_database_update
        xdg_icon_cache_update
}
If you're intrerested in testing it, feel free and let me know the results, preferably also on x86 if you can. Also keep in mind that filter_audio is not in the Gentoo repos so trying to turn the USE flag on is not going to work; I might try to put together an ebuild for that too at some point.

And here's "utox.allow-gtk2.patch" again:
Code:
--- 1/src/xlib/gtk.c    2019-02-24 17:23:38.702737879 +0100
+++ 2/src/xlib/gtk.c    2019-02-24 17:15:52.507700317 +0100
@@ -24,8 +24,8 @@
 #include <stdlib.h>
 #include <string.h>

-#define LIBGTK_FILENAME "libgtk-3.so"
-#define LIBGTK_FILENAME_FALLBACK "libgtk-3.so.0"
+#define LIBGTK_FILENAME "libgtk-x11-2.0.so"
+#define LIBGTK_FILENAME_FALLBACK "libgtk-x11-2.0.so.0"

 #define GTK_FILE_CHOOSER_ACTION_OPEN 0
 #define GTK_FILE_CHOOSER_ACTION_SAVE 1
@@ -49,8 +49,8 @@
 void (*utoxGTK_init)(int *, char ***);
 bool (*utoxGTK_events_pending)(void);
 bool (*utoxGTK_main_iteration)(void);
-void (*utoxGTK_widget_set_margin_left)(void *, int);
-void (*utoxGTK_widget_set_margin_right)(void *, int);
+/*void (*utoxGTK_widget_set_margin_left)(void *, int);
+void (*utoxGTK_widget_set_margin_right)(void *, int);*/
 void (*utoxGTK_widget_destroy)(void *);
 void *(*utoxGTK_message_dialog_new)(void *, int, int, int, const char *, ...);
 int (*utoxGTK_dialog_run)(void *);
@@ -107,10 +107,10 @@
         return;
     }

-    // pad to MAX_PREVIEW_SIZE + 3px margins
+/*    // pad to MAX_PREVIEW_SIZE + 3px margins
     int margin = (MAX_PREVIEW_SIZE + 6 - utoxGDK_pixbuf_get_width(pixbuf)) / 2;
     utoxGTK_widget_set_margin_left(image, margin);
-    utoxGTK_widget_set_margin_right(image, margin);
+    utoxGTK_widget_set_margin_right(image, margin);*/

     // set preview
     utoxGTK_image_set_from_pixbuf(image, pixbuf);
@@ -517,8 +517,8 @@
         U_DLLOAD(gtk, file_chooser_set_preview_widget);
         U_DLLOAD(gtk, image_new);
         U_DLLOAD(gtk, image_set_from_pixbuf);
-        U_DLLOAD(gtk, widget_set_margin_left);
-        U_DLLOAD(gtk, widget_set_margin_right);
+/*      U_DLLOAD(gtk, widget_set_margin_left);
+        U_DLLOAD(gtk, widget_set_margin_right);*/

         U_DLLOAD(g, slist_free);
         U_DLLOAD(g, free);

_________________
Bones McCracker wrote:
It wouldn't be so bad, if it didn't suck.

NeddySeagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6098
Location: Dallas area

PostPosted: Fri Sep 06, 2019 4:07 pm    Post subject: Reply with quote

Marcih wrote:
Anon-E-moose wrote:
Looking at the difference between gtk2 and gtk3 set_left_margin, there shouldn't be any.
I commented out the lines I did because of build failures saying something along the lines of the function not existing so I just assumed it was a new feature in GTK+3. It works like this but if you discover something new then do let me know.


Yeah, on looking at it again, they changed things for widget spacing, names, etc. I don't have a good handle on converting gtk3 to gtk2 for the spacing.

But with your commenting them out, it should still work, it just doesn't pad the widget, ie. it might look a little funny.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software 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