summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2013-02-26 09:53:01 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2013-03-05 18:29:39 +0100
commitd895dc43702717deb4022f0896469ba6ac8646a5 (patch)
tree4d37f0af2a02b0cbc0882389dfac8aa3d1503ee0
parent56eb7986520cae806159a6ada4652b93307a83d3 (diff)
Allow to use system pci.ids/usb.ids files
Most distros already ship copies of pci.ids/usb.ids. This commit allows to make use of these rather than the ones shipped with libosinfo. This is achieved through the use of --with-usb-ids-path and --with-pci-ids-path configure flags.
-rw-r--r--configure.ac21
-rw-r--r--data/Makefile.am37
-rw-r--r--libosinfo.spec.in3
3 files changed, 49 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index 1e255c1..5ad9b6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,6 +7,7 @@ AC_CONFIG_SRCDIR([osinfo/osinfo_db.c])
AC_CONFIG_HEADERS([config.h])
AC_PROG_LIBTOOL
AC_PROG_CC
+AC_PROG_LN_S
LIBOSINFO_COMPILE_WARNINGS
GNOME_MAINTAINER_MODE_DEFINES
@@ -171,6 +172,26 @@ fi
AC_SUBST(COVERAGE_CFLAGS)
AC_SUBST(COVERAGE_LDFLAGS)
+# Path to the usb.ids file -- to know if we use one shipped with another
+# package, or an internal file
+AC_ARG_WITH(usb-ids-path,
+ [AC_HELP_STRING([--with-usb-ids-path],
+ [Specify the path to usb.ids @<:@default=(internal)@:>@])],,
+ [with_usb_ids_path="\${usb_databasedir}/usb.ids"])
+
+AM_CONDITIONAL(USE_INTERNAL_USB_IDS, test "x$with_usb_ids_path" = "x\${usb_databasedir}/usb.ids")
+AC_SUBST([USB_IDS], ["$with_usb_ids_path"])
+
+# Path to the pci.ids file -- to know if we use one shipped with another
+# package, or an internal file
+AC_ARG_WITH(pci-ids-path,
+ [AC_HELP_STRING([--with-pci-ids-path],
+ [Specify the path to pci.ids @<:@default=(internal)@:>@])],,
+ [with_pci_ids_path="\${pci_databasedir}/pci.ids"])
+
+AM_CONDITIONAL(USE_INTERNAL_PCI_IDS, test "x$with_pci_ids_path" = "x\${pci_databasedir}/pci.ids")
+AC_SUBST([PCI_IDS], ["$with_pci_ids_path"])
+
# Setup GLIB_MKENUMS to use glib-mkenums even if GLib is uninstalled.
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
AC_SUBST(GLIB_MKENUMS)
diff --git a/data/Makefile.am b/data/Makefile.am
index 747f0e9..77ad889 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,10 +1,30 @@
+INSTALL_DATA_HOOK_DEPS =
SUBDIRS = datamaps devices oses hypervisors install-scripts schemas
-
EXTRA_DIST = usb.ids pci.ids 95-osinfo.rules.in
+CLEANFILES = usb.ids pci.ids
+
+if USE_INTERNAL_USB_IDS
+usb_database_DATA = usb.ids
+usb_databasedir = $(pkgdatadir)/db/
+usb.ids:
+ -wget -q -O $@ http://www.linux-usb.org/usb.ids
+else
+usb_ids_install:
+ $(LN_S) $(USB_IDS) $(pkgdatadir)/db/usb.ids
+INSTALL_DATA_HOOK_DEPS += usb_ids_install
+endif
-databasedir = $(pkgdatadir)/db/
-database_DATA = usb.ids pci.ids
+if USE_INTERNAL_PCI_IDS
+pci_database_DATA = pci.ids
+pci_databasedir = $(pkgdatadir)/db/
+pci.ids:
+ -wget -q -O $@ http://pciids.sourceforge.net/v2.2/pci.ids
+else
+pci_ids_install:
+ $(LN_S) $(PCI_IDS) $(pkgdatadir)/db/pci.ids
+INSTALL_DATA_HOOK_DEPS += pci_ids_install
+endif
if WITH_UDEV
BUILT_SOURCES = 95-osinfo.rules
@@ -12,16 +32,11 @@ BUILT_SOURCES = 95-osinfo.rules
95-osinfo.rules: 95-osinfo.rules.in
sed 's,\@bindir\@,$(exec_prefix)/bin,' $< > $@
-install-data-hook: 95-osinfo.rules
+95-osinfo.rules-install: 95-osinfo.rules
mkdir -p $(DESTDIR)$(UDEV_RULESDIR)
$(INSTALL) -m 0644 95-osinfo.rules $(DESTDIR)$(UDEV_RULESDIR)
+INSTALL_DATA_HOOK_DEPS += 95-osinfo.rules-install
endif
-CLEANFILES = usb.ids pci.ids
-
-usb.ids:
- -wget -q -O $@ http://www.linux-usb.org/usb.ids
-
-pci.ids:
- -wget -q -O $@ http://pciids.sourceforge.net/v2.2/pci.ids
+install-data-hook: $(INSTALL_DATA_HOOK_DEPS)
diff --git a/libosinfo.spec.in b/libosinfo.spec.in
index 75de896..49ebd52 100644
--- a/libosinfo.spec.in
+++ b/libosinfo.spec.in
@@ -36,6 +36,7 @@ BuildRequires: /usr/bin/pod2man
%if %{with_gir}
BuildRequires: gobject-introspection-devel
%endif
+Requires: hwdata
Requires: udev
%description
@@ -85,7 +86,7 @@ This package provides the Vala bindings for libosinfo library.
%define udev_arg --enable-udev=no
%endif
-%configure %{gir_arg} %{udev_arg} --enable-vala=yes
+%configure %{gir_arg} %{udev_arg} --enable-vala=yes --with-usb-ids-path=/usr/share/hwdata/usb.ids --with-pci-ids-path=/usr/share/hwdata/pci.ids
%__make %{?_smp_mflags} V=1
chmod a-x examples/*.js examples/*.py