Skip to contentSkip to conversation

alsa-utils: fix udev build with pkgconf 1.5.3

PATCH New Fabrice Fontaine 2 participants 4 messages Dec 14, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 alsa-utils: fix udev build with pkgconf 1.5.3

Since the bump to 1.5.3, pkgconf prepends the sysroot to all absolute paths found in the .pc file. This is correct when the paths refer to something in STAGING_DIR (e.g. libdir, includedir), but not when it refers to something used for the target.

alsa-utils uses the udevdir variable from udev.pc to decide where to install things. Since DESTDIR is prepended to the install destination, this will end up in the wrong location.

Until a better solution is found in pkgconf, pass the udevrulesdir to use explicitly instead of relying on udev.pc.

Fixes:
- http://autobuild.buildroot.org/results/d8ad140ae52b4fe8e153de3835f3f17e92b58e53

---
Changes v1 -> v2 (after review of Baruch Siach):
- remove udev build-time dependency

 package/alsa-utils/alsa-utils.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/alsa-utils/alsa-utils.mk +4 -0
index 0bf2b432bd..8b2d335be4 100644
@@ -28,6 +28,10 @@ ALSA_UTILS_CONF_OPTS = \
 	--disable-rst2man \
 	--with-curses=$(if $(BR2_PACKAGE_NCURSES_WCHAR),ncursesw,ncurses)
 
+ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
+ALSA_UTILS_CONF_OPTS += --with-udev-rules-dir=/usr/lib/udev/rules.d
+endif
+
 ifeq ($(BR2_PACKAGE_ALSA_UTILS_ALSALOOP),y)
 ALSA_UTILS_CONF_OPTS += --enable-alsaloop
 else
Signature · 1 line
2.14.1
#1 lore raw

PATCH v2 2/2 alsa-utils: fix systemd build with pkgconf 1.5.3

Since the bump to 1.5.3, pkgconf prepends the sysroot to all absolute paths found in the .pc file. This is correct when the paths refer to something in STAGING_DIR (e.g. libdir, includedir), but not when it refers to something used for the target.

alsa-utils uses the systemdsystemunitdir variable from systemd.pc to decide where to install things. Since DESTDIR is prepended to the install destination, this will end up in the wrong location.

Until a better solution is found in pkgconf, pass the systemdsystemunitdir to use explicitly instead of relying on systemd.pc.

Fixes:
- http://autobuild.buildroot.org/results/d8ad140ae52b4fe8e153de3835f3f17e92b58e53

---
 package/alsa-utils/alsa-utils.mk | 1 +
 1 file changed, 1 insertion(+)
package/alsa-utils/alsa-utils.mk +1 -0
index 8b2d335be4..4983283328 100644
@@ -88,6 +88,7 @@ endef
 
 ifeq ($(BR2_PACKAGE_ALSA_UTILS_ALSACTL)$(BR2_INIT_SYSTEMD),yy)
 ALSA_UTILS_DEPENDENCIES += systemd
+ALSA_UTILS_CONF_OPTS += --with-systemdsystemunitdir=/usr/lib/systemd/system
 define ALSA_UTILS_INSTALL_INIT_SYSTEMD
 	$(INSTALL) -D -m 0644 $(@D)/alsactl/alsa-restore.service \
 		$(TARGET_DIR)/usr/lib/systemd/system/alsa-restore.service
Signature · 1 line
2.14.1
#2 lore raw

PATCH v2 2/2 alsa-utils: fix systemd build with pkgconf 1.5.3

Hello,

Quoted 12 lines · Fabrice Fontaine

Since the bump to 1.5.3, pkgconf prepends the sysroot to all absolute paths found in the .pc file. This is correct when the paths refer to something in STAGING_DIR (e.g. libdir, includedir), but not when it refers to something used for the target.

alsa-utils uses the systemdsystemunitdir variable from systemd.pc to decide where to install things. Since DESTDIR is prepended to the install destination, this will end up in the wrong location.

Until a better solution is found in pkgconf, pass the systemdsystemunitdir to use explicitly instead of relying on systemd.pc.

Quoted 7 lines

Fixes:
- http://autobuild.buildroot.org/results/d8ad140ae52b4fe8e153de3835f3f17e92b58e53

---
 package/alsa-utils/alsa-utils.mk | 1 +
 1 file changed, 1 insertion(+)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH v2 1/2 alsa-utils: fix udev build with pkgconf 1.5.3

In reply to Fabrice Fontaine

Hello Fabrice,

package/alsa-utils/alsa-utils.mk ALSA_UTILS_CONF_OPTS = \ · line 33

Quoted 3 lines · Fabrice Fontaine
package/alsa-utils/alsa-utils.mk +3 -0
+ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
+ALSA_UTILS_CONF_OPTS += --with-udev-rules-dir=/usr/lib/udev/rules.d
+endif

I think this is still wrong: we should pass the --with-udev-rules-dir option unconditionally.

Indeed, the udev files are installed unconditionally by alsa-utils, regardless of whether udev is present or not.

Currently what happens is that if udev is not installed, the rules are installed in /lib/udev/rules.d/. If udev is installed, then the udev.pc file is found, and this is where the issue happens with pkg-config 1.5.3, and which you work-around here.

See:

$ find output/staging/ | grep udev
output/staging/lib/udev
output/staging/lib/udev/rules.d
output/staging/lib/udev/rules.d/89-alsa-ucm.rules
output/staging/lib/udev/rules.d/90-alsa-restore.rules
$ grep UDEV .config
# BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV is not set
# BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV is not set
# BR2_PACKAGE_UDEV is not set
# BR2_PACKAGE_UDEV_RULES_GEN is not set
# BR2_PACKAGE_UDEV_ALL_EXTRAS is not set

Note: the rule files are not installed to TARGET_DIR, because we don't run "make install" for alsa-utils, but only manually install things to the target (which is a bit crappy, but that's a separate issue).

Also, I'm not convinced /usr/lib/udev/rules.d is the right place, /lib/udev/rules.d seems common. But Buildroot is not very consistent on this:

$ git grep "/lib/udev" | cat
package/bcache-tools/bcache-tools.mk:# expects the /lib/udev/rules.d directory to exist.
package/bcache-tools/bcache-tools.mk:	$(INSTALL) -m 0755 -d $(TARGET_DIR)/lib/udev/rules.d
package/gpsd/gpsd.mk:	chmod u+w $(TARGET_DIR)/lib/udev/rules.d/25-gpsd.rules
package/libgphoto2/libgphoto2.mk:LIBGPHOTO2_CONF_ENV = udevscriptdir=/lib/udev
package/libv4l/libv4l.mk:LIBV4L_CONF_OPTS += --with-udevdir=/usr/lib/udev
package/systemd/Config.in:	  Enables hardware database installation to /usr/lib/udev/hwdb.d
package/tpm2-abrmd/tpm2-abrmd.mk:	--with-udevrulesdir=$(if $(BR2_PACKAGE_HAS_UDEV),/usr/lib/udev/rules.d,no)
package/triggerhappy/triggerhappy.mk:		$(TARGET_DIR)/lib/udev/rules.d/triggerhappy.rules
package/usbmount/usbmount.mk:	$(INSTALL) -m 0644 -D $(@D)/usbmount.rules $(TARGET_DIR)/lib/udev/rules.d/usbmount.rules

Some packages install them in /lib/udev, some in /usr/lib/udev. Not good. So, for the alsa-utils patch, just unconditionally do:

	--with-udev-rules-dir=/lib/udev/rules.d

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com