From 18f5c802dfd958d9ac52924454eefba182d9ddfb Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Mon, 11 Oct 2010 12:01:04 -0400 Subject: [PATCH] Install libgudev-1.0.so in prefix / instead of prefix /usr This is to match where libudev.so is installed and it works because all dependent libraries are already installed in / instead of /usr on most distros: $ ldd /usr/lib64/libgudev-1.0.so linux-vdso.so.1 => (0x00007fff44dff000) libudev.so.0 => /lib64/libudev.so.0 (0x0000003bf2600000) libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x0000003fb5200000) libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x0000003fb4e00000) libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003d5b000000) librt.so.1 => /lib64/librt.so.1 (0x0000003d5b800000) libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x0000003fb4a00000) libc.so.6 => /lib64/libc.so.6 (0x0000003d5ac00000) /lib64/ld-linux-x86-64.so.2 (0x0000003d5a800000) With this change it is possible to write libgudev applications that can be installed in /bin or /sbin and can run without /usr being mounted. This is needed for e.g. udisks, NetworkManager and other subsystem-specific daemons. Signed-off-by: David Zeuthen --- Makefile.am | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Makefile.am b/Makefile.am index 3d9773b65..093a10e05 100644 --- a/Makefile.am +++ b/Makefile.am @@ -433,6 +433,22 @@ typelibs_DATA = extras/gudev/GUdev-1.0.typelib CLEANFILES += $(gir_DATA) $(typelibs_DATA) endif # ENABLE_INTROSPECTION +# move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed +libgudev-install-move-hook: + if test "$(libdir)" != "$(rootlib_execdir)"; then \ + mkdir -p $(DESTDIR)$(rootlib_execdir) && \ + so_img_name=$$(readlink $(DESTDIR)$(libdir)/libgudev-1.0.so) && \ + so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ + ln -sf $$so_img_rel_target_prefix$(rootlib_execdir)/$$so_img_name $(DESTDIR)$(libdir)/libgudev-1.0.so && \ + mv $(DESTDIR)$(libdir)/libgudev-1.0.so.* $(DESTDIR)$(rootlib_execdir); \ + fi + +libgudev-uninstall-move-hook: + rm -f $(DESTDIR)$(rootlib_execdir)/libgudev-1.0.so* + +INSTALL_EXEC_HOOKS += libgudev-install-move-hook +UNINSTALL_EXEC_HOOKS += libgudev-uninstall-move-hook + # ------------------------------------------------------------------------------ # Bluetooth HID devices with special magic to switch the device # ------------------------------------------------------------------------------ -- 2.30.2