chiark / gitweb /
Install libgudev-1.0.so in prefix / instead of prefix /usr
authorDavid Zeuthen <davidz@redhat.com>
Mon, 11 Oct 2010 16:01:04 +0000 (12:01 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Mon, 11 Oct 2010 16:10:02 +0000 (12:10 -0400)
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 <davidz@redhat.com>
Makefile.am

index 3d9773b658094eba2a321343fe99c587e20554a4..093a10e058f565d1a3a12e62ccdfe3f759ea1042 100644 (file)
@@ -433,6 +433,22 @@ typelibs_DATA = extras/gudev/GUdev-1.0.typelib
 CLEANFILES += $(gir_DATA) $(typelibs_DATA)
 endif # ENABLE_INTROSPECTION
 
 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
 # ------------------------------------------------------------------------------
 # ------------------------------------------------------------------------------
 # Bluetooth HID devices with special magic to switch the device
 # ------------------------------------------------------------------------------