Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] games-emulation/ares ebuild need help
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
sdauth
l33t
l33t


Joined: 19 Sep 2018
Posts: 656
Location: Ásgarðr

PostPosted: Tue May 21, 2024 1:19 am    Post subject: [SOLVED] games-emulation/ares ebuild need help Reply with quote

Hello,
I created the following ebuild for games-emulation/ares : https://github.com/ares-emulator/ares
I'm having an issue with the librashader USE flag I added to enable/disable librashader.
Otherwise, it builds fine. clang is enabled by default as it is recommended by ares project.

The ares doc says :

Quote:
Librashader Support

If you do not want to include librashader support, you can pass the following option to the make command to skip these requirements using: librashader=false

Librashader requires rust in order to build. You can install it with the following command:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env
rustup toolchain install nightly

In order to build librashader, change into the ares/thirdparty/librashader directory and run the script build-librashader.sh Note that once the build completes, it will instruct you to run three copy commands to install the library on your system. These paths may be different depending on Linux distribution.


I don't think I want to do that : "run the script build-librashader.sh" ; what's the correct way to do it ?

Thanks.

ares-138.ebuild

Code:
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit desktop toolchain-funcs

ARES_COMMIT="57c01b8e17746151a58af822d1db4aa59f21f673"

DESCRIPTION="ares is a cross-platform, open source, multi-system emulator, focusing on accuracy and preservation."
HOMEPAGE="https://ares-emu.net https://github.com/ares-emulator/ares"
SRC_URI="https://github.com/ares-emulator/ares/archive/${ARES_COMMIT}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-${ARES_COMMIT}"

LICENSE="GPL-3+ ISC"
SLOT="0"
KEYWORDS="~amd64"
IUSE="alsa ao +clang +gtk librashader openal +opengl oss +pulseaudio +sdl udev xv"

RDEPEND="
  x11-libs/libX11
  x11-libs/libXext
  x11-libs/libXrandr
  alsa? ( media-libs/alsa-lib )
  ao? ( media-libs/libao )
  openal? ( media-libs/openal )
  opengl? ( media-libs/libglvnd[X] )
  pulseaudio? ( media-libs/libpulse )
  sdl? ( media-libs/libsdl2[joystick] )
  udev? ( virtual/libudev:= )
  xv? ( x11-libs/libXv )
  librashader? ( games-misc/librashader )
  gtk? (
    dev-libs/glib:2
    x11-libs/cairo
    x11-libs/gdk-pixbuf:2
    x11-libs/gtk+:3[X]
    x11-libs/gtksourceview:3.0=
    x11-libs/pango
  )
  !gtk? (
    dev-qt/qtcore:5
    dev-qt/qtgui:5
    dev-qt/qtwidgets:5
  )
"
DEPEND="
  ${RDEPEND}
  x11-base/xorg-proto"
BDEPEND="
  virtual/pkgconfig
  !clang? (
    >sys-devel/gcc-11.4.0
  )
  clang? (
    sys-devel/lld
    sys-devel/clang
  )
"

src_prepare() {
  default
}

src_compile() {
  if use clang ; then
    compiler="clang++"
  else
    compiler="$(tc-getCXX)"
  fi

  # Librashader requires rust in order to build.
  if use librashader ; then
    librashader=true
  else
    librashader=false
  fi

  local makeopts=(
    platform=linux
    compiler="${compiler}"
    hiro=$(usex gtk gtk3 qt5)
    librashader="${librashader}"
  )

  local drivers=(
    video.xshm
    input.xlib
    $(usev alsa audio.alsa)
    $(usev ao audio.ao)
    $(usev openal audio.openal)
    $(usev opengl "video.glx video.glx2")
    $(usev oss audio.oss)
    $(usev pulseaudio "audio.pulseaudio audio.pulseaudiosimple")
    $(usev sdl input.sdl)
    $(usev udev input.udev)
    $(usev xv video.xvideo)
  )

  local coreopts=(
    cores="a26 fc sfc n64 sg ms md ps1 pce ng msx cv myvision gb gba ws ngp spec"
    ruby="${drivers[*]}"
  )

  emake "${makeopts[@]}" "${coreopts[@]}" -C desktop-ui
}

src_install() {
  dobin desktop-ui/out/ares
  domenu desktop-ui/resource/ares.desktop
  doicon desktop-ui/resource/ares.png

  use opengl && insinto /usr/share/ares/Shaders && doins -r thirdparty/slang-shaders/*
  insinto /usr/share/ares/Database && doins -r mia/Database/*
}


Last edited by sdauth on Thu May 23, 2024 3:12 pm; edited 5 times in total
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22705

PostPosted: Tue May 21, 2024 2:06 am    Post subject: Reply with quote

That curlpipesh doesn't bode well (even if it is parroted from the Rust project, where it was a bad idea from the beginning). However, delegating part of the build to the upstream project's shell script is not inherently wrong. We routinely delegate to upstream's Makefile or equivalent. Is there something in this particular shell script that makes you want to avoid invoking it from the ebuild?
Back to top
View user's profile Send private message
sdauth
l33t
l33t


Joined: 19 Sep 2018
Posts: 656
Location: Ásgarðr

PostPosted: Tue May 21, 2024 5:09 am    Post subject: Reply with quote

The idea was to skip downloading rust nightly (although maybe it is really needed ?) and use the rust version I have on my system.
But after looking at : thirdparty/librashader/librashader-build-script/Cargo.toml

Code:
[dependencies]
cbindgen = "0.26.0"
clap = { version = "=4.1.0", features = ["derive"] }


It needs clap dependency, which is not available as a gentoo ebuild.
I suppose I need to add that instead (with maybe cbindgen too) to CRATES variable and also (maybe) add a cargo eclass.
Also, I don't know how to call the build script in the src_compile(), any tips would be appreciated ! :)
I'm not even sure my GPU can handle those shaders but if I can learn one thing or two..
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22705

PostPosted: Tue May 21, 2024 2:20 pm    Post subject: Reply with quote

Does this not work?
Code:
src_compile() {
    (cd ares/thirdparty/librashader && ./build-librashader.sh)
}
If not, what does it display?
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1715
Location: South America

PostPosted: Tue May 21, 2024 2:58 pm    Post subject: Reply with quote

The build-librashader.sh script is just a wrapper around a cargo run command. The ebuild could probably skip the check with rustup and the check for MacOS, and just call whatever Gentoo eclasses offer for doing cargo run. Probably without the +nightly option for trying the installed dev-lang/rust.
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
sdauth
l33t
l33t


Joined: 19 Sep 2018
Posts: 656
Location: Ásgarðr

PostPosted: Tue May 21, 2024 3:30 pm    Post subject: Reply with quote

Hu wrote:
Does this not work?
Code:
src_compile() {
    (cd ares/thirdparty/librashader && ./build-librashader.sh)
}
If not, what does it display?


Thanks. It checks if rustup is installed and exit.

Code:
>>> Source configured.
>>> Compiling source in /var/tmp/portage/games-emulation/ares-138/work/ares-57c01b8e17746151a58af822d1db4aa59f21f673 ...
++ uname
+ '[' Linux '!=' Darwin ']'
++ uname
+ '[' Linux '!=' Windows_NT ']'
+ pkg-config --exists librashader
+ command -v rustup
+ echo 'rustup not found. Please install rustup from https://rustup.rs/. If prompted, please install the nightly toolchain.'
rustup not found. Please install rustup from https://rustup.rs/. If prompted, please install the nightly toolchain.
+ exit 1


GDH-gentoo wrote:
The build-librashader.sh script is just a wrapper around a cargo run command. The ebuild could probably skip the check with rustup and the check for MacOS, and just call whatever Gentoo eclasses offer for doing cargo run. Probably without the +nightly option for trying the installed dev-lang/rust.


How to skip the check for MacOS, rustup and +nightly ? Do I have to "patch" the buildscript ?

I also tried to add cargo eclass with CRATES variable + ${CARGO_CRATE_URIS} in SRC_URI.
Added in src_compile() just above emake :
cd thirdparty/librashader/librashader-build-script || die
cargo_src_compile

Code:
>>> Unpacking source...
>>> Unpacking ares-138.tar.gz to /var/tmp/portage/games-emulation/ares-138/work
 * Unpacking crates ...
tar -x -C /var/tmp/portage/games-emulation/ares-138/work/cargo_home/gentoo -f ash-0.37.3+1.3.251.crate
tar -x -C /var/tmp/portage/games-emulation/ares-138/work/cargo_home/gentoo -f cbindgen-0.26.0.crate
tar -x -C /var/tmp/portage/games-emulation/ares-138/work/cargo_home/gentoo -f clap-4.1.0.crate
tar -x -C /var/tmp/portage/games-emulation/ares-138/work/cargo_home/gentoo -f halfbrown-0.2.4.crate                            [ ok ]
>>> Source unpacked in /var/tmp/portage/games-emulation/ares-138/work
>>> Preparing source in /var/tmp/portage/games-emulation/ares-138/work/ares-57c01b8e17746151a58af822d1db4aa59f21f673 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/games-emulation/ares-138/work/ares-57c01b8e17746151a58af822d1db4aa59f21f673 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/games-emulation/ares-138/work/ares-57c01b8e17746151a58af822d1db4aa59f21f673 ...
 * cargo build --release
error: no matching package found
searched package name: `glob`
perhaps you meant:      clap
location searched: registry `crates-io`
required by package `librashader v0.2.7 (/var/tmp/portage/games-emulation/ares-138/work/ares-57c01b8e17746151a58af822d1db4aa59f21f673/thirdparty/librashader/librashader)`
As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag.


Apparently some dependency is missing but I don't know why it is searching for "glob" :roll:
The cargo stuff is confusing and it is the first time I deal with it...
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1715
Location: South America

PostPosted: Tue May 21, 2024 4:07 pm    Post subject: Reply with quote

sdauth wrote:
How to skip the check for MacOS, rustup and +nightly ? Do I have to "patch" the buildscript ?

I'd just ignore the script and call an eclass function in the ebuild. I haven't reviewed the Rust / Cargo-related eclasses yet to be able to make a suggestion at the moment.

sdauth wrote:
The cargo stuff is confusing and it is the first time I deal with it...

F@#$&&g Rust and every language that wants to reinvent package managent :P
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
sdauth
l33t
l33t


Joined: 19 Sep 2018
Posts: 656
Location: Ásgarðr

PostPosted: Tue May 21, 2024 5:55 pm    Post subject: Reply with quote

I created an ebuild for librashader instead.
Compilation failed, it doesn't seem to like stable channel.

Code:
error[E0554]: `#![feature]` may not be used on the stable release channel
  --> librashader-reflect/src/lib.rs:49:1
   |
49 | #![feature(impl_trait_in_assoc_type)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
  --> librashader-reflect/src/lib.rs:50:1
   |
50 | #![feature(let_chains)]
   | ^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0554`.
error: could not compile `librashader-reflect` (lib) due to 2 previous errors


This is latest tagged version: 0.2.7

Maybe the stable version (0.2.4) works, I'm going to try that.
EDIT : nope
Code:
error[E0554]: `#![feature]` may not be used on the stable release channel
  --> librashader-reflect/src/lib.rs:49:1
   |
49 | #![feature(impl_trait_in_assoc_type)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
  --> librashader-reflect/src/lib.rs:50:1
   |
50 | #![feature(let_chains)]
   | ^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0554`.
error: could not compile `librashader-reflect` (lib) due to 2 previous errors


----
By the way, this is the ebuild for 0.2.7 (insane stuff.. look at the number of crates :lol: maybe some are not needed, the windows stuff etc.. Haven't investigated yet)

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

# Autogenerated by pycargoebuild 0.13.2

EAPI=8

CRATES="
   ab_glyph@0.2.23
   ab_glyph_rasterizer@0.1.8
   adler@1.0.2
   ahash@0.7.8
   ahash@0.8.10
   aho-corasick@1.1.2
   allocator-api2@0.2.16
   android-activity@0.5.2
   android-properties@0.2.2
   android_system_properties@0.1.5
   array-concat@0.5.2
   array-init@2.1.0
   arrayref@0.3.7
   arrayvec@0.7.4
   as-raw-xcb-connection@1.0.1
   ash-window@0.12.0
   ash@0.37.3+1.3.251
   async-trait@0.1.77
   atomic-waker@1.1.2
   atty@0.2.14
   auto_ops@0.3.0
   autocfg@1.1.0
   base64@0.13.1
   bincode@2.0.0-rc.3
   bincode_derive@2.0.0-rc.3
   bit-set@0.5.3
   bit-vec@0.6.3
   bit_field@0.10.2
   bitflags@1.3.2
   bitflags@2.4.2
   bitvec@1.0.1
   blake3@1.5.0
   block-buffer@0.10.4
   block-sys@0.2.1
   block2@0.3.0
   block2@0.4.0
   block@0.1.6
   build-target@0.4.0
   bumpalo@3.15.3
   bytecount@0.6.7
   bytemuck@1.14.3
   bytemuck_derive@1.5.0
   byteorder@1.5.0
   bytes@1.5.0
   calloop-wayland-source@0.2.0
   calloop@0.12.4
   cbindgen@0.26.0
   cc@1.0.88
   cesu8@1.1.0
   cfg-if@1.0.0
   cfg_aliases@0.1.1
   clap@3.2.25
   clap@4.1.0
   clap_derive@4.1.0
   clap_lex@0.2.4
   clap_lex@0.3.3
   cmake@0.1.50
   cocoa-foundation@0.1.2
   cocoa@0.25.0
   codespan-reporting@0.11.1
   color_quant@1.1.0
   com@0.6.0
   com_macros@0.6.0
   com_macros_support@0.6.0
   combine@4.6.6
   concurrent-queue@2.4.0
   config@0.13.4
   constant_time_eq@0.3.0
   core-foundation-sys@0.8.6
   core-foundation@0.9.4
   core-graphics-types@0.1.3
   core-graphics@0.23.1
   cpufeatures@0.2.12
   crc-catalog@2.4.0
   crc32fast@1.4.0
   crc@3.0.1
   crossbeam-deque@0.8.5
   crossbeam-epoch@0.9.18
   crossbeam-utils@0.8.19
   crunchy@0.2.2
   crypto-common@0.1.6
   cty@0.2.2
   cursor-icon@1.1.0
   d3d12@0.19.0
   data-encoding@2.5.0
   digest@0.10.7
   dirs-next@1.0.2
   dirs-sys-next@0.1.2
   dispatch@0.2.0
   dlib@0.5.2
   dlv-list@0.3.0
   document-features@0.2.8
   downcast-rs@1.2.0
   either@1.10.0
   encoding_rs@0.8.33
   env_logger@0.10.2
   equivalent@1.0.1
   errno@0.3.8
   exr@1.72.0
   fastrand@2.0.1
   fdeflate@0.3.4
   fixedbitset@0.4.2
   flate2@1.0.28
   flume@0.11.0
   foreign-types-macros@0.2.3
   foreign-types-shared@0.3.1
   foreign-types@0.5.0
   fs2@0.4.3
   funty@2.0.0
   generic-array@0.14.7
   gethostname@0.4.3
   getrandom@0.2.12
   gfx-maths@0.2.9
   gif@0.13.1
   gl@0.14.0
   gl_generator@0.14.0
   glfw-sys@4.0.0+3.3.5
   glfw@0.47.0
   glfw@0.49.1
   glob@0.3.1
   glow@0.13.1
   glslang-sys@0.3.2
   glslang@0.3.2
   glutin_wgl_sys@0.5.0
   gpu-alloc-types@0.3.0
   gpu-alloc@0.6.0
   gpu-allocator@0.25.0
   gpu-descriptor-types@0.1.2
   gpu-descriptor@0.2.4
   half@2.4.0
   halfbrown@0.2.4
   hashbrown@0.12.3
   hashbrown@0.13.2
   hashbrown@0.14.3
   hassle-rs@0.11.0
   heck@0.4.1
   hermit-abi@0.1.19
   hermit-abi@0.3.9
   hexf-parse@0.2.1
   humantime@2.1.0
   icrate@0.0.4
   icrate@0.1.0
   image@0.24.9
   indexmap@1.9.3
   indexmap@2.2.3
   is-terminal@0.4.12
   itoa@1.0.10
   jni-sys@0.3.0
   jni@0.21.1
   jpeg-decoder@0.3.1
   js-sys@0.3.68
   json5@0.4.1
   khronos-egl@6.0.0
   khronos_api@3.1.0
   lazy_static@1.4.0
   lebe@0.5.2
   libc@0.2.153
   libloading@0.7.4
   libloading@0.8.1
   librashader-spirv-cross@0.25.1
   libredox@0.0.1
   libredox@0.0.2
   linked-hash-map@0.5.6
   linux-raw-sys@0.4.13
   litrs@0.4.1
   lock_api@0.4.11
   log@0.4.21
   mach-siegbert-vogt-dxcsa@0.1.3
   malloc_buf@0.0.6
   matches@0.1.10
   memchr@2.7.1
   memmap2@0.9.4
   metal@0.27.0
   minimal-lexical@0.2.1
   miniz_oxide@0.7.2
   naga@0.19.0
   ndk-context@0.1.1
   ndk-sys@0.5.0+25.2.9519653
   ndk@0.8.0
   nom@7.1.3
   nom_locate@4.2.0
   num-bigint@0.4.4
   num-complex@0.4.5
   num-integer@0.1.46
   num-iter@0.1.44
   num-rational@0.4.1
   num-traits@0.2.18
   num@0.4.1
   num_enum@0.7.2
   num_enum_derive@0.7.2
   objc_exception@0.1.2
   objc-sys@0.3.2
   objc2-encode@3.0.0
   objc2-encode@4.0.0
   objc2@0.4.1
   objc2@0.5.0
   objc@0.2.7
   once_cell@1.19.0
   orbclient@0.3.47
   ordered-multimap@0.4.3
   os_str_bytes@6.6.1
   owned_ttf_parser@0.20.0
   parking_lot@0.12.1
   parking_lot_core@0.9.9
   paste@1.0.14
   pathdiff@0.2.1
   percent-encoding@2.3.1
   persy@1.4.7
   pest@2.7.7
   pest_derive@2.7.7
   pest_generator@2.7.7
   pest_meta@2.7.7
   petgraph@0.6.4
   pin-project-lite@0.2.13
   pkg-config@0.3.30
   platform-dirs@0.3.0
   png@0.17.13
   polling@3.5.0
   pollster@0.3.0
   ppv-lite86@0.2.17
   presser@0.3.1
   proc-macro-crate@3.1.0
   proc-macro-error-attr@1.0.4
   proc-macro-error@1.0.4
   proc-macro2@1.0.78
   profiling@1.0.15
   qoi@0.4.1
   quick-xml@0.31.0
   quote@1.0.35
   radium@0.7.0
   rand@0.8.5
   rand_chacha@0.3.1
   rand_core@0.6.4
   range-alloc@0.1.3
   raw-window-handle@0.4.3
   raw-window-handle@0.5.2
   raw-window-handle@0.6.0
   raw-window-metal@0.3.2
   rayon-core@1.12.1
   rayon@1.9.0
   redox_syscall@0.3.5
   redox_syscall@0.4.1
   redox_users@0.4.4
   regex-automata@0.4.5
   regex-syntax@0.8.2
   regex@1.10.3
   renderdoc-sys@1.0.0
   ron@0.7.1
   rspirv@0.12.0+sdk-1.3.268.0
   rust-ini@0.18.0
   rustc-hash@1.1.0
   rustix@0.38.31
   rustversion@1.0.14
   ryu@1.0.17
   same-file@1.0.6
   scoped-tls@1.0.1
   scopeguard@1.2.0
   sctk-adwaita@0.8.1
   serde@1.0.197
   serde_derive@1.0.197
   serde_json@1.0.114
   sha2@0.10.8
   simd-adler32@0.3.7
   slab@0.4.9
   slotmap@1.0.7
   smallvec@1.13.1
   smithay-client-toolkit@0.18.1
   smol_str@0.2.1
   spin@0.9.8
   spirv-to-dxil-sys@0.4.7
   spirv-to-dxil@0.4.7
   spirv@0.3.0+sdk-1.3.268.0
   sptr@0.3.2
   static_assertions@1.1.0
   strict-num@0.1.1
   strsim@0.10.0
   syn@1.0.109
   syn@2.0.52
   tap@1.0.1
   tempfile@3.10.1
   termcolor@1.4.1
   textwrap@0.16.1
   thiserror-impl@1.0.57
   thiserror@1.0.57
   tiff@0.9.1
   tiny-skia-path@0.11.4
   tiny-skia@0.11.4
   tinymap@0.4.0
   tinyvec@1.6.0
   toml@0.5.11
   toml_datetime@0.6.5
   toml_edit@0.21.1
   tracing-core@0.1.32
   tracing@0.1.40
   ttf-parser@0.20.0
   typenum@1.17.0
   ucd-trie@0.1.6
   unicode-ident@1.0.12
   unicode-segmentation@1.11.0
   unicode-width@0.1.11
   unicode-xid@0.2.4
   unsigned-varint@0.7.2
   version_check@0.9.4
   virtue@0.0.13
   walkdir@2.4.0
   wasi@0.11.0+wasi-snapshot-preview1
   wasm-bindgen-backend@0.2.91
   wasm-bindgen-futures@0.4.41
   wasm-bindgen-macro-support@0.2.91
   wasm-bindgen-macro@0.2.91
   wasm-bindgen-shared@0.2.91
   wasm-bindgen@0.2.91
   wayland-backend@0.3.3
   wayland-client@0.31.2
   wayland-csd-frame@0.3.0
   wayland-cursor@0.31.1
   wayland-protocols-plasma@0.2.0
   wayland-protocols-wlr@0.2.0
   wayland-protocols@0.31.2
   wayland-scanner@0.31.1
   wayland-sys@0.31.1
   web-sys@0.3.68
   web-time@0.2.4
   weezl@0.1.8
   wgpu-core@0.19.0
   wgpu-hal@0.19.1
   wgpu-types@0.19.2
   wgpu@0.19.3
   widestring@1.0.2
   winapi-i686-pc-windows-gnu@0.4.0
   winapi-util@0.1.6
   winapi-x86_64-pc-windows-gnu@0.4.0
   winapi@0.3.9
   windows-core@0.52.0
   windows-sys@0.45.0
   windows-sys@0.48.0
   windows-sys@0.52.0
   windows-targets@0.42.2
   windows-targets@0.48.5
   windows-targets@0.52.4
   windows@0.52.0
   windows_aarch64_gnullvm@0.42.2
   windows_aarch64_gnullvm@0.48.5
   windows_aarch64_gnullvm@0.52.4
   windows_aarch64_msvc@0.42.2
   windows_aarch64_msvc@0.48.5
   windows_aarch64_msvc@0.52.4
   windows_i686_gnu@0.42.2
   windows_i686_gnu@0.48.5
   windows_i686_gnu@0.52.4
   windows_i686_msvc@0.42.2
   windows_i686_msvc@0.48.5
   windows_i686_msvc@0.52.4
   windows_x86_64_gnu@0.42.2
   windows_x86_64_gnu@0.48.5
   windows_x86_64_gnu@0.52.4
   windows_x86_64_gnullvm@0.42.2
   windows_x86_64_gnullvm@0.48.5
   windows_x86_64_gnullvm@0.52.4
   windows_x86_64_msvc@0.42.2
   windows_x86_64_msvc@0.48.5
   windows_x86_64_msvc@0.52.4
   winit@0.29.11
   winnow@0.5.40
   wyz@0.5.1
   x11-dl@2.21.0
   x11rb-protocol@0.13.0
   x11rb@0.13.0
   xcursor@0.3.5
   xkbcommon-dl@0.4.2
   xkeysym@0.2.0
   xml-rs@0.8.19
   yaml-rust@0.4.5
   zerocopy-derive@0.7.32
   zerocopy@0.7.32
   zigzag@0.1.0
   zune-inflate@0.2.54
"

inherit cargo

DESCRIPTION="RetroArch shaders for all."
HOMEPAGE="https://github.com/SnowflakePowered/librashader"
SRC_URI="
   ${CARGO_CRATE_URIS}
  https://github.com/SnowflakePowered/librashader/archive/librashader-v${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-${PN}-v${PV}"

LICENSE="|| ( GPL-3 MPL-2.0 )"
# Dependent crate licenses
LICENSE+="
   Apache-2.0 BSD-2 BSD CC0-1.0 ISC MIT MPL-2.0 Unicode-DFS-2016 ZLIB
"
SLOT="0"
KEYWORDS="~amd64"
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1715
Location: South America

PostPosted: Tue May 21, 2024 8:22 pm    Post subject: Reply with quote

sdauth wrote:
Code:
error[E0554]: `#![feature]` may not be used on the stable release channel
  --> librashader-reflect/src/lib.rs:49:1
   |
49 | #![feature(impl_trait_in_assoc_type)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
  --> librashader-reflect/src/lib.rs:50:1
   |
50 | #![feature(let_chains)]
   | ^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0554`.
error: could not compile `librashader-reflect` (lib) due to 2 previous errors

Looks like this project really wants nightly... Try again after (re)installing dev-lang/rust with the nightly USE flag set. No available dev-lang/rust-bin alternative for this unfortunately.

sdauth wrote:
(insane stuff.. look at the number of crates :lol: [...])

Typical of packages written in Rust...
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
sdauth
l33t
l33t


Joined: 19 Sep 2018
Posts: 656
Location: Ásgarðr

PostPosted: Wed May 22, 2024 3:14 am    Post subject: Reply with quote

So I've rebuilt rust with nightly USE and this time, librashader compiled without issue.
Except a QA warning during installation about missing SONAME :

Code:
* QA Notice: The following shared libraries lack a SONAME
 * /usr/lib64/librashader.so.1


Also, the prefix is wrong here :
/usr/lib64/pkgconfig/librashader.pc

Code:
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${exec_prefix}/include
 
Name: librashader
Description: RetroArch shaders for all
Version: 0.2.0
Libs: -L${libdir} -lrashader
Cflags: -I${includedir}


For some reason, cargo_src_compile worked but produced a "release" build instead of "optimized" and "librashader.so" was missing in the target dir (there was only "librashader_capi.so")
So I ran the cargo run command instead. This is probably not the right way to do it but at least there is some progress...
When running ares from terminal, it doesn't complain anymore about missing librashader libs.

Here is what I modified :
Code:
src_compile() {
#cargo_src_compile
PREFIX="${EPREFIX}/usr" LIBDIR="${PREFIX}"/$(get_libdir) cargo run -p librashader-build-script -- --profile optimized
}

src_install() {
  newlib.so target/optimized/librashader.so librashader.so.1
  dosym librashader.so.1 /usr/$(get_libdir)/librashader.so

  insinto /usr/$(get_libdir)/pkgconfig
  doins pkg/librashader.pc
}
Back to top
View user's profile Send private message
sdauth
l33t
l33t


Joined: 19 Sep 2018
Posts: 656
Location: Ásgarðr

PostPosted: Thu May 23, 2024 2:35 am    Post subject: Reply with quote

I found an other issue, when I compile ares in my gentoo chroot (for core2duo laptop) on my main machine
and install the binpkg then ares crashes with "Illegal instruction" (traps: ares[16230] trap invalid opcode)
By default, the package is built with clang but the same issue happens when I use gcc instead.

Looking at the GNUmakefile :
Code:
ifneq ($(filter $(arch),x86 amd64),)
  ifeq ($(filter cl,$(compiler)),)
    ifeq ($(local),true)
      flags += -march=native
    else
      # For official builds, default to x86-64-v2 (Intel Nehalem, AMD Bulldozer) which supports up to SSE 4.2.
      flags += -march=x86-64-v2
    endif
  endif
endif


In the ebuild I have :
Code:
  if use clang ; then
    compiler="clang++"
  else
    compiler="$(tc-getCXX)"
  fi


and local is set to true by default so -march=native is used but it seems that when ares is compiled in the gentoo chroot with the following make.conf :
Code:
COMMON_FLAGS="-march=core2 -O2 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 sse4_1 ssse3"


it somehow includes instructions not available on my laptop... How to make it respect CFLAGS & CPU_FLAGS_X86 so it uses -march=core2 ?
On the other hand, If I compile ares directly on my core2duo laptop then -march=native works as expected and ares runs fine.
Also, I can't set local=false to use march=x86-64-v2 because it enables sse4_2 (not available on core2duo)

Is it something I can fix in the ebuild ?

EDIT :

Solved with :
Code:
src_prepare() {
  default
  myarch=$(get-flag march)
  sed -i "s|-march=native|-march=$myarch|g" desktop-ui/GNUmakefile || die
}
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22705

PostPosted: Thu May 23, 2024 11:58 am    Post subject: Reply with quote

That solution looks plausible, but I wonder if you could instead just replace upstream's -march=native with an empty string, and allow the user's CFLAGS to provide the required -march, without the need for your ebuild to extract it from CFLAGS.
Back to top
View user's profile Send private message
sdauth
l33t
l33t


Joined: 19 Sep 2018
Posts: 656
Location: Ásgarðr

PostPosted: Thu May 23, 2024 12:11 pm    Post subject: Reply with quote

@Hu:
In fact, I tried it just before the simple sed edit.

I added CFLAGS variable in makeopts and set local=false (in GNUmakefile) so it doesn't use -march=native.

Code:
  local makeopts=(
    verbose
    local=false
    compiler="${compiler}"
    CFLAGS="${CFLAGS} ${LDFLAGS}"
    platform=linux
    hiro=$(usex gtk gtk3 qt5)
    librashader="${librashader}
    vulkan=false
  )


Then used sed to remove reference to "-march=x86-64-v2" and let it empty :

Code:
src_prepare() {
  default

  sed -i 's:-march=x86-64-v2::' desktop-ui/GNUmakefile || die
}


The compilation command was (in the ares log)

Code:
make -j5 compiler=clang++ 'CFLAGS=-march=core2 -O2 -pipe -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs' verbose local=false platform=linux hiro=gtk3 librashader=false vulkan=false 'cores=a26 fc sfc n64 sg ms md ps1 pce ng msx cv myvision gb gba ws ngp spec' 'ruby=video.xshm input.xlib audio.alsa video.glx video.glx2 input.sdl input.udev video.xvideo' -C desktop-ui


looked good, compiled just fine but for some reason, I was still receiving an "illegal instruction" when executing it on the core2 laptop :?
Anyway, all of that was for nothing because I found out ares requires opengl 3.x as a minimum, even without the shader thing. (the gui starts fine but when launching a game, it complains about old opengl) And this old laptop is stuck on opengl 2.x so... I'll keep using mednafen or retroarch on that.. :lol:

----
EDIT :

Working ebuild for ares & librashader (requires rust with nightly USE set for now, see: https://github.com/SnowflakePowered/librashader/issues/55)
Not perfect so if someone wants to improve them...
A nice thing would be to improve librashader ebuild and add some USE flags to be able to enable/disable d3d11, metal, vulkan etc.. so it can be compiled a little bit faster.
I'm a noob with cargo eclass and haven't looked on how to do that.

ares-138.ebuild
librashader-0.2.7
Back to top
View user's profile Send private message
Amon2501
Tux's lil' helper
Tux's lil' helper


Joined: 12 Dec 2018
Posts: 141

PostPosted: Sat Nov 23, 2024 8:40 pm    Post subject: Reply with quote

Sorry for necrobump but im using that emulator too. Found a solution to make librashader work.

Code:
cargo run -p librashader-build-script -- --profile optimized --stable


Did the trick and it builds using the stable rust without errors. Then just copy librashader.so to /usr/local/lib(64)

That should be re-done after any upgrade of the rust itself.
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