kornelski / cargo-deb

Make Debian packages directly from Rust/Cargo projects
https://lib.rs/cargo-deb
MIT License
408 stars 48 forks source link

[HELP] src/config.rs.ini vs src/config.rs #49

Open Baraccc opened 1 year ago

Baraccc commented 1 year ago

Hi, I need some help, I'm trying to create .deb files for the apps on circle.gnome.com. A particularity of those apps is that they use src/config.rs.ini instead of src/config.rs and the cargo-deb program fails to create .deb files despite all compiling going flawlessly.

For instant I'll post the error on Amberol app, but the same happens for Fragments and Podcast apps.

Compiling amberol v0.1.0 (/home/hamza/Downloads/amberol-0.9.1) error[E0432]: unresolved importscrate::config::APPLICATION_ID,crate::config::VERSION` --> src/application.rs:14:14 14 config::{APPLICATION_ID, VERSION}, ^^^^^^^^^^^^^^ ^^^^^^^ no VERSION in config
no APPLICATION_ID in config

error[E0432]: unresolved import crate::config::APPLICATION_ID --> src/audio/mpris_controller.rs:14:5 | 14 | config::APPLICATION_ID, | ^^^^^^^^^^^^^^^^^^^^^^ no APPLICATION_ID in config

error[E0432]: unresolved import crate::config::APPLICATION_ID --> src/utils.rs:11:5 | 11 | use crate::config::APPLICATION_ID; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no APPLICATION_ID in config

error[E0432]: unresolved import crate::config::APPLICATION_ID --> src/window.rs:20:5 | 20 | config::APPLICATION_ID, | ^^^^^^^^^^^^^^^^^^^^^^ no APPLICATION_ID in config

error[E0432]: unresolved imports config::APPLICATION_ID, config::GETTEXT_PACKAGE, config::LOCALEDIR, config::PKGDATADIR, config::PROFILE --> src/main.rs:23:14 23 use config::{APPLICATION_ID, GETTEXT_PACKAGE, LOCALEDIR, PKGDATADIR, PROFILE}; ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^ no PROFILE in config
no PKGDATADIR in config
no LOCALEDIR in config
no GETTEXT_PACKAGE in config
no APPLICATION_ID in config

For more information about this error, try rustc --explain E0432. error: could not compile amberol due to 5 previous errors cargo-deb: build failed hamza@surface:~/Downloads/amberol-0.9.1$ `

the content of src/config.rs.ini is: `// SPDX-FileCopyrightText: 2022 Emmanuele Bassi // SPDX-License-Identifier: GPL-3.0-or-later

pub static VERSION: &str = @VERSION@; pub static GETTEXT_PACKAGE: &str = @GETTEXT_PACKAGE@; pub static LOCALEDIR: &str = @LOCALEDIR@; pub static PKGDATADIR: &str = @PKGDATADIR@; pub static APPLICATION_ID: &str = @APPLICATION_ID@; pub static PROFILE: &str = @PROFILE@;

`

So I guess is pointing to somewhere, I just don't know.

I tried to create a empty src/config.rs there ended up with that error.

I tried to create a src/config.rs file with some contents trying to match those on src/config.rs.ini in fact it created the .deb file on the target, installed but the apps refused to start.

So first I think I should figure out is the best way to pass the first error i.e the app not being compiled with just it's original config.rs.ini.

So please help me on this.

I'm doing all this on Debian Testing.

ximon18 commented 1 year ago

I'm not familiar with those gnome projects but looking at the source code of Amberol I see that it has some meson files.

I suspect that the project cannot be built using just a standard cargo invocation and instead requires that it be built using Meson. Cargo-deb has no way of knowing how to handle non-standard build systems.

What you could do is build it as it is supposed to built, then disable compilation via --no-build when invoking cargo-deb so that cargo-deb only packages already built artifacts.

Baraccc commented 1 year ago

It worked, not necessarily with amberol but with Fragments, whose instruction is in the project readme in gitlab.

Cargo-deb has no way of knowing how to handle non-standard build systems.

So no plan to support meson build system right?

ximon18 commented 1 year ago

My brief, limited, impression of Meson is that it is intended to own the build process and so using --no-build with Cargo-deb is the right thing to do.

Though I have contributed to Cargo-deb in the past, I'm not the maintainer of Cargo-deb so I can only give you my opinion: the most likely way in my experience to extend Cargo-deb is to submit a pull request yourself with arguments explaining why it is a good proposal.