gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] [PATCH] Put udev rules in libdir and not always in /lib


From: Maciej Grela
Subject: Re: [gpsd-dev] [PATCH] Put udev rules in libdir and not always in /lib
Date: Sun, 16 Dec 2012 23:28:01 +0000

2012/12/16 Mike Frysinger <address@hidden>:
> On Thursday 13 December 2012 19:31:59 Maciej Grela wrote:
>> I've developed a patch for gpsd which improves the way that udev rules
>> are installed - they are put in libdir and not always in /lib. This
>> fixes build errors of gpsd on source-based distributions like Exherbo
>> which don't allow a package to install a plain /lib directory if /lib
>> is a symlink to /lib64. By using libdir this issue is resolved - if
>> the build script tells scons to use lib64 as the library destination,
>> the udev rules also end up there.
>
> err, no, that is incorrect.  the correct way is to query udev's .pc file:
>         pkg-config --variable=udevdir udev
>
> although in the case of this SConstruct, it should use env['PKG_CONFIG']

Hi,

thanks for pointing that out. Is this way acceptable? My knowledge of
SCons is limited:

diff -urp gpsd-3.7.orig/SConstruct gpsd-3.7/SConstruct
--- gpsd-3.7.orig/SConstruct    2012-07-02 22:48:16.000000000 +0000
+++ gpsd-3.7/SConstruct 2012-12-16 23:19:19.094799497 +0000
@@ -1630,16 +1630,24 @@ if env['python']:
 # GPS ad libitum.  All is well when you get fix reports each time a GPS
 # is plugged in.

+def set_udevdir(env, result):
+    env['udevdir'] = result.rstrip("\r\n");
+    if not env['udevdir']:
+        env['udevdir'] = "/lib/udev";
+
+env.ParseConfig("%s --variable=udevdir udev" % (env['PKG_CONFIG']),
function=set_udevdir)
+
 Utility('udev-install', 'install', [
-    'mkdir -p ' + DESTDIR + '/lib/udev/rules.d',
-    'cp $SRCDIR/gpsd.rules ' + DESTDIR + '/lib/udev/rules.d/25-gpsd.rules',
-    'cp $SRCDIR/gpsd.hotplug ' + DESTDIR + '/lib/udev/',
-    'chmod a+x ' + DESTDIR + '/lib/udev/gpsd.hotplug',
+    'mkdir -p ' + installdir('udevdir', True),
+    'mkdir -p ' + installdir('udevdir', True) + '/rules.d',
+    'cp $SRCDIR/gpsd.rules ' + installdir('udevdir', True) +
'/rules.d/25-gpsd.rules',
+    'cp $SRCDIR/gpsd.hotplug ' + installdir('udevdir', True),
+    'chmod a+x ' + installdir('udevdir', True) + '/gpsd.hotplug',
         ])

 Utility('udev-uninstall', '', [
-    'rm -f /lib/udev/gpsd.hotplug',
-    'rm -f /lib/udev/rules.d/25-gpsd.rules',
+    'rm -f ' + installdir('udevdir', True) + '/gpsd.hotplug',
+    'rm -f ' + installdir('udevdir', True) + '/rules.d/25-gpsd.rules',
         ])

 Utility('udev-test', '', [


I also considered the path inside gpsd.rules, which will not be
correct if gpsd.hotplug will be installed outside /lib/udev. This
fixes it:

diff -urp gpsd-3.7.orig/gpsd.rules gpsd-3.7/gpsd.rules
--- gpsd-3.7.orig/gpsd.rules    2012-06-01 13:18:21.000000000 +0000
+++ gpsd-3.7/gpsd.rules 2012-12-16 23:22:36.907326501 +0000
@@ -22,28 +22,28 @@
 SUBSYSTEM!="tty", GOTO="gpsd_rules_end"

 # Prolific Technology, Inc. PL2303 Serial Port [linux module: pl2303]
-ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="gps%n",
RUN+="/lib/udev/gpsd.hotplug"
+ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="gps%n",
RUN+="gpsd.hotplug"
 # ATEN International Co., Ltd UC-232A Serial Port [linux module: pl2303]
-ATTRS{idVendor}=="0557", ATTRS{idProduct}=="2008", SYMLINK+="gps%n",
RUN+="/lib/udev/gpsd.hotplug"
+ATTRS{idVendor}=="0557", ATTRS{idProduct}=="2008", SYMLINK+="gps%n",
RUN+="gpsd.hotplug"
 # PS-360 OEM (GPS sold with MS Street and Trips 2005) [linux module: pl2303]
-ATTRS{idVendor}=="067b", ATTRS{idProduct}=="aaa0", SYMLINK+="gps%n",
RUN+="/lib/udev/gpsd.hotplug"
+ATTRS{idVendor}=="067b", ATTRS{idProduct}=="aaa0", SYMLINK+="gps%n",
RUN+="gpsd.hotplug"
 # FTDI 8U232AM / FT232 [linux module: ftdi_sio]
-ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="gps%n",
RUN+="/lib/udev/gpsd.hotplug"
+ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="gps%n",
RUN+="gpsd.hotplug"
 # Cypress M8/CY7C64013 (Delorme uses these) [linux module: cypress_m8]
-ATTRS{idVendor}=="1163", ATTRS{idProduct}=="0100", SYMLINK+="gps%n",
RUN+="/lib/udev/gpsd.hotplug"
+ATTRS{idVendor}=="1163", ATTRS{idProduct}=="0100", SYMLINK+="gps%n",
RUN+="gpsd.hotplug"
 # Cypress M8/CY7C64013 (DeLorme LT-40)
-ATTRS{idVendor}=="1163", ATTRS{idProduct}=="0200", SYMLINK+="gps%n",
RUN+="/lib/udev/gpsd.hotplug"
+ATTRS{idVendor}=="1163", ATTRS{idProduct}=="0200", SYMLINK+="gps%n",
RUN+="gpsd.hotplug"
 # Garmin International GPSmap, various models (tested with Garmin GPS
18 USB)  [linux module: garmin_gps]
-ATTRS{idVendor}=="091e", ATTRS{idProduct}=="0003", SYMLINK+="gps%n",
RUN+="/lib/udev/gpsd.hotplug"
+ATTRS{idVendor}=="091e", ATTRS{idProduct}=="0003", SYMLINK+="gps%n",
RUN+="gpsd.hotplug"
 # Cygnal Integrated Products, Inc. CP210x Composite Device (Used by
Holux m241 and Wintec grays2 wbt-201) [linux module: cp210x]
-ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="gps%n",
RUN+="/lib/udev/gpsd.hotplug"
+ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="gps%n",
RUN+="gpsd.hotplug"
 # Cygnal Integrated Products, Inc. [linux module: cp210x]
-ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea71", SYMLINK="gps%n",
RUN+="/lib/udev/gpsd.hotplug"
+ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea71", SYMLINK="gps%n",
RUN+="gpsd.hotplug"
 # u-blox AG, u-blox 5 (tested with Navilock NL-402U) [linux module: cdc_acm]
-ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a5", SYMLINK="gps%n",
RUN+="/lib/udev/gpsd.hotplug"
+ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a5", SYMLINK="gps%n",
RUN+="gpsd.hotplug"
 # u-blox AG, u-blox 6 (tested with GNSS Evaluation Kit TCXO) [linux
module: cdc_acm]
-ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a6", SYMLINK="gps%n",
RUN+="/lib/udev/gpsd.hotplug"
+ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a6", SYMLINK="gps%n",
RUN+="gpsd.hotplug"

-ACTION=="remove", RUN+="/lib/udev/gpsd.hotplug"
+ACTION=="remove", RUN+="gpsd.hotplug"

 LABEL="gpsd_rules_end"

With both changes applied gpsd now runs correctly when udevdir=/usr/lib64/udev
What do you think?

Best regards,
Maciej Grela



reply via email to

[Prev in Thread] Current Thread [Next in Thread]