chadmed / asahi-overlay

Gentoo overlay for Apple Silicon support
GNU General Public License v2.0
43 stars 10 forks source link

sys-apps/speakersafetyd: use cargo_src_install and emake install-data #103

Closed n3ph closed 1 month ago

n3ph commented 1 month ago
>>> Install sys-apps/speakersafetyd-1.0.0 into /var/tmp/portage/sys-apps/speakersafetyd-1.0.0/image
make -j10 DESTDIR=/var/tmp/portage/sys-apps/speakersafetyd-1.0.0/image install 
install -dDm0755 /var/tmp/portage/sys-apps/speakersafetyd-1.0.0/image//lib/systemd/system
install -pm0644 speakersafetyd.service /var/tmp/portage/sys-apps/speakersafetyd-1.0.0/image//lib/systemd/system/speakersafetyd.service
install -dDm0755 /var/tmp/portage/sys-apps/speakersafetyd-1.0.0/image//lib/udev/rules.d
install -pm0644 95-speakersafetyd.rules /var/tmp/portage/sys-apps/speakersafetyd-1.0.0/image//lib/udev/rules.d/95-speakersafetyd.rules
install -dDm0755 /var/tmp/portage/sys-apps/speakersafetyd-1.0.0/image//usr/share//speakersafetyd/apple
install -pm0644 -t /var/tmp/portage/sys-apps/speakersafetyd-1.0.0/image//usr/share//speakersafetyd/apple conf/apple/j180.conf conf/apple/j274.conf conf/apple/j293.conf conf/apple/j313.conf conf/apple/j314.conf conf/apple/j316.conf conf/apple/j375.conf conf/apple/j413.conf conf/apple/j414.conf conf/apple/j415.conf conf/apple/j416.conf conf/apple/j456.conf conf/apple/j457.conf conf/apple/j473.conf conf/apple/j474.conf conf/apple/j475.conf conf/apple/j493.conf
install -dDm0755 /var/tmp/portage/sys-apps/speakersafetyd-1.0.0/image//var//lib/speakersafetyd/blackbox
install -dDm0755 /var/tmp/portage/sys-apps/speakersafetyd-1.0.0/image//usr/lib/tmpfiles.d
install -pm0644 speakersafetyd.tmpfiles /var/tmp/portage/sys-apps/speakersafetyd-1.0.0/image//usr/lib/tmpfiles.d/speakersafetyd.conf
install -dDm0755 /var/tmp/portage/sys-apps/speakersafetyd-1.0.0/image//usr/bin
install -pm0755 target/release/speakersafetyd /var/tmp/portage/sys-apps/speakersafetyd-1.0.0/image//usr/bin/speakersafetyd
/usr/bin/install: cannot stat 'target/release/speakersafetyd': No such file or directory
install-xattr: failed to stat /var/tmp/portage/sys-apps/speakersafetyd-1.0.0/image//usr/bin/speakersafetyd: No such file or directory
make: *** [Makefile:16: install] Error 1

Thx to parona, I've stumbled across https://bugs.gentoo.org/937782 and saw Gentoo builds target specific releases now. But there is cargo_src_install.

chadmed commented 1 month ago

If you have a look at the Makefile, you will see that using cargo to install the binary alone is not going to work here. We install a bunch of extra stuff that cargo has no conception of.

Please see 5b8f27f19e24d19c418a5be21d77f92b2b549157 in ::gentoo, which closes the bug you linked. We need to sed the Makefile in-place to use $(cargo_target_dir). Using cargo_src_install() will result in our udev rules and config files not being installed.

n3ph commented 1 month ago

Oh right, I've missed that. I guess emake DESTDIR=${D} install-data could do it as well?

n3ph commented 1 month ago

Looks good so far...

>>> Installing (1 of 1) sys-apps/speakersafetyd-1.0.0-r1::local
 * checking 22 files for package collisions
>>> Merging sys-apps/speakersafetyd-1.0.0-r1 to /
--- /etc/
--- /etc/init.d/
=== /etc/init.d/speakersafetyd
--- /lib/
--- /lib/udev/
--- /lib/udev/rules.d/
>>> /lib/udev/rules.d/95-speakersafetyd.rules
--- /lib/systemd/
--- /lib/systemd/system/
>>> /lib/systemd/system/speakersafetyd.service
--- /usr/
--- /usr/lib/
--- /usr/lib/tmpfiles.d/
>>> /usr/lib/tmpfiles.d/speakersafetyd.conf
--- /usr/share/
>>> /usr/share/speakersafetyd/
>>> /usr/share/speakersafetyd/apple/
>>> /usr/share/speakersafetyd/apple/j493.conf
>>> /usr/share/speakersafetyd/apple/j475.conf
>>> /usr/share/speakersafetyd/apple/j474.conf
>>> /usr/share/speakersafetyd/apple/j473.conf
>>> /usr/share/speakersafetyd/apple/j457.conf
>>> /usr/share/speakersafetyd/apple/j456.conf
>>> /usr/share/speakersafetyd/apple/j416.conf
>>> /usr/share/speakersafetyd/apple/j415.conf
>>> /usr/share/speakersafetyd/apple/j414.conf
>>> /usr/share/speakersafetyd/apple/j413.conf
>>> /usr/share/speakersafetyd/apple/j375.conf
>>> /usr/share/speakersafetyd/apple/j316.conf
>>> /usr/share/speakersafetyd/apple/j314.conf
>>> /usr/share/speakersafetyd/apple/j313.conf
>>> /usr/share/speakersafetyd/apple/j293.conf
>>> /usr/share/speakersafetyd/apple/j274.conf
>>> /usr/share/speakersafetyd/apple/j180.conf
--- /usr/bin/
=== /usr/bin/speakersafetyd
>>> Safely unmerging already-installed instance...
--- replaced obj /usr/bin/speakersafetyd
--- replaced dir /usr/bin
--- replaced dir /usr
--- replaced obj /etc/init.d/speakersafetyd
--- replaced dir /etc/init.d
--- replaced dir /etc
>>> Original instance of package unmerged safely.
>>> sys-apps/speakersafetyd-1.0.0-r1 merged.

>>> Recording sys-apps/speakersafetyd::local in "world" favorites file...
chadmed commented 1 month ago

lmfao I completely forgot we had that target in the Makefile

Happy to merge this once you squash your commits and fix them to use the proper format (use pkgdev commit --signoff to make this easier). Probably also doesn't need a revbump since nothing about what is merged into the rootfs is being changed, so just edit the existing speakersafetyd-1.0.0.ebuild.

n3ph commented 1 month ago

@chadmed Done. I fat-fingered an additional NL into it, so I had to force-push again.

Is pkgdev commit --signoff doing something special? I always have that signoff in my commit messages, but maybe I am missing something?

chadmed commented 1 month ago

pkgdev commit --signoff will automatically detect what package you have changed and even automatically write your commit message for certain things (revbump, keywording, etc). if youve set git up properly according to the gentoo dev guide, it will also sign your commits with your GPG key (required for anything going into ::gentoo)

chadmed commented 1 month ago

also sorry to be a bother again, could you drop the metadata caches from the commit? theyre just noise

n3ph commented 1 month ago

pkgdev commit --signoff will automatically detect what package you have changed and even automatically write your commit message for certain things (revbump, keywording, etc). if youve set git up properly according to the gentoo dev guide, it will also sign your commits with your GPG key (required for anything going into ::gentoo)

I have all of that manually set up with my .gitconfig. But I'll have an eye on pkgdev commit --signoff, seems like it brings various nice2have Gentoo commit features. Thx for the explanation! 🙇🏼

also sorry to be a bother again, could you drop the metadata caches from the commit? theyre just noise

Done and Thx again. I am not very familiar with these processes yet. Please let me know whenever I am missing something, so I can adopt quickly.