commit:     36f2e6f505922fc48f1059055c2ab94937880dc7
Author:     xdch47 <xdch47 <AT> posteo <DOT> de>
AuthorDate: Tue Nov 27 09:35:54 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Dec  2 18:20:59 2018 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=36f2e6f5

sys-apps/lshw: patches for various fixes (musl+mem)

  musl compile fixes:
  - include "libgen.h" for basename
  - fix basename parameters (should be char * instead of const char *)

  additional changes
  - fix potential buffer overflows
  - bump to eapi7

Package-Manager: Portage-2.3.51, Repoman-2.3.11
Manifest-Sign-Key: 0DEDF1A904568BAD1FC45C283DCC44782ED07E1C
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 sys-apps/lshw/Manifest                             |  15 ++
 sys-apps/lshw/files/lshw-02.18b-fixes.patch        | 188 +++++++++++++++++++++
 sys-apps/lshw/files/lshw-02.18b-gentoo.patch       | 161 ++++++++++++++++++
 .../lshw/files/lshw-02.18b-gettext-array.patch     |  31 ++++
 sys-apps/lshw/files/lshw-02.18b-sgx.patch          |  32 ++++
 sys-apps/lshw/lshw-02.18b-r2.ebuild                |  72 ++++++++
 sys-apps/lshw/metadata.xml                         |   8 +
 7 files changed, 507 insertions(+)

diff --git a/sys-apps/lshw/Manifest b/sys-apps/lshw/Manifest
new file mode 100644
index 0000000..d64989e
--- /dev/null
+++ b/sys-apps/lshw/Manifest
@@ -0,0 +1,15 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+DIST lshw-B.02.18.tar.gz 2322176 BLAKE2B 
66183895fcdd5b47bfaa044c10f7b561b3310829b53828444a20f078ce63e166a878595c8a8a79e22f1e4ab726e98165a1b31225997785d2bfc3ad5d7b0c5214
 SHA512 
4385db86101178b8bd33a80e991718e14f83277c66b3d63ae97cb4339196873b6e9b31a174024bf43d16fe66e1d7f8cf5cea56076697878087880c8821b11e47
+-----BEGIN PGP SIGNATURE-----
+
+iQEzBAEBCAAdFiEEDe3xqQRWi60fxFwoPcxEeC7QfhwFAlv9D/cACgkQPcxEeC7Q
+fhxSvggAmDoo1vQYKHl3fwhZnFcx7ByB7tIp4Qj0ugNKUp5DEelojTuviwnwT/SV
+nzPi2+o0ExX/SGAmjcukIqIOx7a3TieyHU/qEAxMikTAe/y7hMYmgyydON28i3M2
+50p0xFkuQ2i6xPGS76WojWz/YVBUhrbOrbxzlcVPKRAu2vD/MhSZkWA+0JX+RqS0
+Tp6TzttzD3uwR365J2VxiWw5q9AZroq+tY8IWk8NZnLqTyVXOP7BA0XaR0Zz+nw0
+EDNb9PVCTrraXFzWKIL+NMOghi8q2gP2iCzlfvBPDOuh6y0bGRtXdYAQtB8tqe0z
+JaeR0rCU/dB6hd+WlXwSEIxgd7/GBw==
+=gv1w
+-----END PGP SIGNATURE-----

diff --git a/sys-apps/lshw/files/lshw-02.18b-fixes.patch 
b/sys-apps/lshw/files/lshw-02.18b-fixes.patch
new file mode 100644
index 0000000..ce395e1
--- /dev/null
+++ b/sys-apps/lshw/files/lshw-02.18b-fixes.patch
@@ -0,0 +1,188 @@
+diff --git a/src/core/cpuinfo.cc b/src/core/cpuinfo.cc
+index 5a2b8c0..c5100d8 100644
+--- a/src/core/cpuinfo.cc
++++ b/src/core/cpuinfo.cc
+@@ -16,7 +16,7 @@ static int currentcpu = 0;
+ static hwNode *getcpu(hwNode & node,
+ int n = 0)
+ {
+-  char cpubusinfo[10];
++  char cpubusinfo[16];
+   hwNode *cpu = NULL;
+ 
+   if (n < 0)
+diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc
+index 2823233..3ffd316 100644
+--- a/src/core/device-tree.cc
++++ b/src/core/device-tree.cc
+@@ -420,7 +420,7 @@ static void scan_devtree_memory(hwNode & core)
+ 
+   while (true)
+   {
+-    char buffer[10];
++    char buffer[16];
+     string mcbase;
+     vector < string > slotnames;
+     vector < string > dimmtypes;
+diff --git a/src/core/hw.h b/src/core/hw.h
+index 4211a82..8adaf3f 100644
+--- a/src/core/hw.h
++++ b/src/core/hw.h
+@@ -3,6 +3,7 @@
+ 
+ #include <string>
+ #include <vector>
++#include <libgen.h>
+ 
+ using namespace std;
+ 
+diff --git a/src/core/network.cc b/src/core/network.cc
+index 15a961d..8bdb3fa 100644
+--- a/src/core/network.cc
++++ b/src/core/network.cc
+@@ -396,7 +396,7 @@ bool scan_network(hwNode & n)
+ 
+ // check for wireless extensions
+       memset(buffer, 0, sizeof(buffer));
+-      strncpy(buffer, interfaces[i].c_str(), sizeof(buffer));
++      strncpy(buffer, interfaces[i].c_str(), sizeof(buffer)-1);
+       if (ioctl(fd, SIOCGIWNAME, &buffer) == 0)
+       {
+         interface.addCapability("wireless", _("Wireless-LAN"));
+diff --git a/src/core/partitions.cc b/src/core/partitions.cc
+index 634a8c0..44f69d1 100644
+--- a/src/core/partitions.cc
++++ b/src/core/partitions.cc
+@@ -690,7 +690,7 @@ static bool detect_gpt(source & s, hwNode & n)
+   static uint8_t buffer[BLOCKSIZE];
+   static gpth gpt_header;
+   uint32_t i = 0;
+-  char gpt_version[8];
++  char gpt_version[16];
+   uint8_t *partitions = NULL;
+   uint8_t type;
+ 
+@@ -1108,11 +1108,11 @@ static bool detect_gpt(source & s, hwNode & n)
+       partition.setConfig("name", p.PartitionName);
+       if(p.Attributes && PARTITION_PRECIOUS)
+         partition.addCapability("precious", "This partition is required for 
the platform to function");
+-      if(p.Attributes && PARTITION_READONLY)
++      if(p.Attributes & PARTITION_READONLY)
+         partition.addCapability("readonly", "Read-only partition");
+-      if(p.Attributes && PARTITION_HIDDEN)
++      if(p.Attributes & PARTITION_HIDDEN)
+         partition.addCapability("hidden");
+-      if(p.Attributes && PARTITION_NOMOUNT)
++      if(p.Attributes & PARTITION_NOMOUNT)
+         partition.addCapability("nomount", "No automatic mount");
+ 
+       partition.describeCapability("nofs", "No filesystem");
+diff --git a/src/core/scsi.cc b/src/core/scsi.cc
+index afc582b..dd0699f 100644
+--- a/src/core/scsi.cc
++++ b/src/core/scsi.cc
+@@ -210,7 +210,7 @@ int channel = -1,
+ int id = -1,
+ int lun = -1)
+ {
+-  char buffer[10];
++  char buffer[16];
+   string result = "SCSI:";
+ 
+   snprintf(buffer, sizeof(buffer), "%02d", host);
+diff --git a/src/core/sysfs.cc b/src/core/sysfs.cc
+index acc9d00..24f7152 100644
+--- a/src/core/sysfs.cc
++++ b/src/core/sysfs.cc
+@@ -97,9 +97,11 @@ static string sysfs_getbustype(const string & path)
+ 
+   for (i = 0; i < n; i++)
+   {
++    char *tmp_path = strdup(path.c_str());
+     devname =
+       string(fs.path + "/bus/") + string(namelist[i]->d_name) +
+-      "/devices/" + basename(path.c_str());
++      "/devices/" + basename(tmp_path);
++    free (tmp_path);
+ 
+     if (samefile(devname, path))
+       return string(namelist[i]->d_name);
+@@ -139,7 +141,9 @@ static string sysfstobusinfo(const string & path)
+ 
+   if (bustype == "virtio")
+   {
+-    string name = basename(path.c_str());
++    char *tmp_path = strdup(path.c_str());
++    string name = basename(tmp_path);
++    free(tmp_path);
+     if (name.compare(0, 6, "virtio") == 0)
+       return "virtio@" + name.substr(6);
+     else
+@@ -207,7 +211,10 @@ string entry::driver() const
+   string driverlink = This->devpath + "/driver";
+   if (!exists(driverlink))
+     return "";
+-  return basename(readlink(driverlink).c_str());
++  char *tmp_path = strdup(readlink(driverlink).c_str());
++  driverlink = string(basename(tmp_path));
++  free(tmp_path);
++  return driverlink;
+ }
+ 
+ 
+@@ -288,7 +295,10 @@ string entry::name_in_class(const string & classname) 
const
+ 
+ string entry::name() const
+ {
+-  return basename(This->devpath.c_str());
++  char *tmp_path = strdup(This->devpath.c_str());
++  string name = string(basename(tmp_path));
++  free(tmp_path);
++  return name;
+ }
+ 
+ 
+diff --git a/src/core/volumes.cc b/src/core/volumes.cc
+index b433956..1185e34 100644
+--- a/src/core/volumes.cc
++++ b/src/core/volumes.cc
+@@ -446,7 +446,7 @@ static string dos_serial(unsigned long serial)
+ {
+   char buffer[16];
+ 
+-  snprintf(buffer, sizeof(buffer), "%04lx-%04lx", serial >> 16, serial & 
0xffff);
++  snprintf(buffer, sizeof(buffer), "%04lx-%04lx", (serial >> 16) & 0xffff, 
serial & 0xffff);
+ 
+   return string(buffer);
+ }
+@@ -987,13 +987,13 @@ static bool detect_ntfs(hwNode & n, source & s)
+     else
+       n.setConfig("state", "clean");
+ 
+-    if(vi->flags && VOLUME_MODIFIED_BY_CHKDSK)
++    if(vi->flags & VOLUME_MODIFIED_BY_CHKDSK)
+       n.setConfig("modified_by_chkdsk", "true");
+-    if(vi->flags && VOLUME_MOUNTED_ON_NT4)
++    if(vi->flags & VOLUME_MOUNTED_ON_NT4)
+       n.setConfig("mounted_on_nt4", "true");
+-    if(vi->flags && VOLUME_UPGRADE_ON_MOUNT)
++    if(vi->flags & VOLUME_UPGRADE_ON_MOUNT)
+       n.setConfig("upgrade_on_mount", "true");
+-    if(vi->flags && VOLUME_RESIZE_LOG_FILE)
++    if(vi->flags & VOLUME_RESIZE_LOG_FILE)
+       n.setConfig("resize_log_file", "true");
+   }
+   if(info)
+diff --git a/src/lshw.cc b/src/lshw.cc
+index 77a5932..74643fc 100644
+--- a/src/lshw.cc
++++ b/src/lshw.cc
+@@ -219,7 +219,7 @@ char **argv)
+     exit(1);
+   }
+ 
+-  if(enabled("output:X")) execl(SBINDIR"/gtk-lshw", SBINDIR"/gtk-lshw", NULL);
++  if(enabled("output:X")) execl(SBINDIR"/gtk-lshw", SBINDIR"/gtk-lshw", (char 
*)NULL);
+ 
+   if (geteuid() != 0)
+   {

diff --git a/sys-apps/lshw/files/lshw-02.18b-gentoo.patch 
b/sys-apps/lshw/files/lshw-02.18b-gentoo.patch
new file mode 100644
index 0000000..0a50e9d
--- /dev/null
+++ b/sys-apps/lshw/files/lshw-02.18b-gentoo.patch
@@ -0,0 +1,161 @@
+--- lshw-B.02.18/src/Makefile
++++ lshw-B.02.18/src/Makefile
+@@ -21,11 +21,11 @@
+ CXX?=c++
+ INCLUDES=-I./core/
+ DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" 
-DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\"
+-CXXFLAGS=-g -Wall -g $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
++CXXFLAGS += -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
+ ifeq ($(SQLITE), 1)
+       CXXFLAGS+= -DSQLITE $(shell pkg-config --cflags sqlite3)
+ endif
+-LDFLAGS=-L./core/ -g
++LDFLAGS += -L./core/
+ ifneq ($(shell $(LD) --help 2| grep -- --as-needed), )
+       LDFLAGS+= -Wl,--as-needed
+ endif
+@@ -39,27 +39,25 @@
+ export LIBS
+ export LDFLAGS
+ 
+-DATAFILES = pci.ids usb.ids oui.txt manuf.txt
+-
+-all: $(PACKAGENAME) $(PACKAGENAME).1 $(DATAFILES)
++all: $(PACKAGENAME) $(PACKAGENAME).1
+ 
+ .cc.o:
+       $(CXX) $(CXXFLAGS) -c $< -o $@
+ 
+ .PHONY: core
+ core:
+-      +make -C core all
++      $(MAKE) -C core all
+ 
+ $(PACKAGENAME): core $(PACKAGENAME).o
+       $(CXX) $(LDFLAGS) -o $@ $(PACKAGENAME).o $(LIBS)
+ 
+ .PHONY: po
+ po:
+-      +make -C po all
++      $(MAKE) -C po all
+ 
+ .PHONY: gui
+ gui: core
+-      +make -C gui all
++      $(MAKE) -C gui all
+ 
+ .PHONY: nologo
+ nologo:
+@@ -70,7 +68,6 @@
+ 
+ $(PACKAGENAME)-static: core core/lib$(PACKAGENAME).a $(PACKAGENAME).o
+       $(CXX) $(LDSTATIC) $(LDFLAGS) -o $@ $(PACKAGENAME).o $(LIBS)
+-      $(STRIP) $@
+ 
+ .PHONY: compressed
+ compressed: $(PACKAGENAME)-compressed
+@@ -93,14 +90,13 @@
+ manuf.txt:
+       wget -O $@ http://anonsvn.wireshark.org/wireshark/trunk/manuf
+ 
+-install: all
++install:
+       $(INSTALL) -d -m 0755 $(DESTDIR)/$(SBINDIR)
+       $(INSTALL) -m 0755 $(PACKAGENAME) $(DESTDIR)/$(SBINDIR)
+       $(INSTALL) -d -m 0755 $(DESTDIR)/$(MANDIR)/man1
+       $(INSTALL) -m 0644 $(PACKAGENAME).1 $(DESTDIR)/$(MANDIR)/man1
+       $(INSTALL) -d -m 0755 $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)
+-      $(INSTALL) -m 0644 $(DATAFILES) $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)
+-      make -C po install
++      $(MAKE) -C po install
+ 
+ install-gui: gui
+       $(INSTALL) -d -m 0755 $(DESTDIR)/$(SBINDIR)
+@@ -112,8 +108,8 @@
+ 
+ clean:
+       rm -f $(PACKAGENAME).o $(PACKAGENAME) $(PACKAGENAME)-static 
$(PACKAGENAME)-compressed
+-      make -C core clean
+-      make -C gui clean
++      $(MAKE) -C core clean
++      $(MAKE) -C gui clean
+ 
+ .timestamp:
+       date --utc +%Y%m%d%H%M%S > $@
+--- lshw-B.02.18/src/core/Makefile
++++ lshw-B.02.18/src/core/Makefile
+@@ -1,10 +1,9 @@
+ PACKAGENAME?=lshw
+ 
+-CXX=c++
++CXX?=c++
+ INCLUDES=
+ DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" 
-DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\"
+-CXXFLAGS?=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
+-LDFLAGS=
++CXXFLAGS += -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
+ LDSTATIC=
+ LIBS=
+ 
+--- lshw-B.02.18/src/core/pci.cc
++++ lshw-B.02.18/src/core/pci.cc
+@@ -17,7 +17,7 @@
+ 
+ #define PROC_BUS_PCI "/proc/bus/pci"
+ #define SYS_BUS_PCI "/sys/bus/pci"
+-#define PCIID_PATH 
DATADIR"/pci.ids:/usr/share/lshw/pci.ids:/usr/local/share/pci.ids:/usr/share/pci.ids:/etc/pci.ids:/usr/share/hwdata/pci.ids:/usr/share/misc/pci.ids"
++#define PCIID_PATH "/usr/share/misc/pci.ids"
+ 
+ #define PCI_CLASS_REVISION      0x08              /* High 24 bits are class, 
low 8 revision */
+ #define PCI_VENDOR_ID           0x00    /* 16 bits */
+--- lshw-B.02.18/src/core/usb.cc
++++ lshw-B.02.18/src/core/usb.cc
+@@ -27,7 +27,7 @@
+ 
+ #define PROCBUSUSBDEVICES "/proc/bus/usb/devices"
+ #define SYSKERNELDEBUGUSBDEVICES "/sys/kernel/debug/usb/devices"
+-#define USBID_PATH 
DATADIR"/usb.ids:/usr/share/lshw/usb.ids:/usr/local/share/usb.ids:/usr/share/usb.ids:/etc/usb.ids:/usr/share/hwdata/usb.ids:/usr/share/misc/usb.ids"
++#define USBID_PATH "/usr/share/misc/usb.ids"
+ 
+ #define USB_CLASS_PER_INTERFACE         0         /* for DeviceClass */
+ #define USB_CLASS_AUDIO                 1
+--- lshw-B.02.18/src/gui/Makefile
++++ lshw-B.02.18/src/gui/Makefile
+@@ -1,5 +1,7 @@
+ PACKAGENAME?=lshw
+ 
++SQLITE?=0
++
+ CXX?=c++
+ CC?=cc
+ STRIP?=strip
+@@ -8,14 +10,15 @@
+ DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" 
-DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\"
+ GTKINCLUDES=$(shell pkg-config gtk+-2.0 --cflags)
+ INCLUDES=-I../core $(GTKINCLUDES)
+-CXXFLAGS=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
++CXXFLAGS += -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
+ CFLAGS=$(CXXFLAGS) $(DEFINES)
+ GTKLIBS=$(shell pkg-config gtk+-2.0 gmodule-2.0 --libs)
+-LIBS=-L../core -llshw -lresolv $(GTKLIBS)
+-LDFLAGS=
+-ifneq ($(shell $(LD) --help 2| grep -- --as-needed), )
+-      LDFLAGS+= -Wl,--as-needed
+-endif
++LIBS=-L../core -llshw -lresolv $(GTKLIBS)
++
++ifeq ($(SQLITE), 1)
++      CXXFLAGS+= -DSQLITE $(shell pkg-config --cflags sqlite3)
++      LIBS+= $(shell pkg-config --libs sqlite3)
++endif
+ 
+ OBJS = gtk-lshw.o callbacks.o engine.o print-gui.o stock.o
+ SRCS = $(OBJS:.o=.c)
+@@ -39,7 +42,6 @@
+       $(CXX) $(LDFLAGS) -o $@ $^ $(LIBS)
+ 
+ install: all
+-      $(STRIP) gtk-$(PACKAGENAME)
+       
+ clean:
+       rm -f $(OBJS) gtk-$(PACKAGENAME) gtk-lshw.glade.bak gtk-lshw.gladep.bak 
callbacks.c.bak callbacks.h.bak Makefile.bak

diff --git a/sys-apps/lshw/files/lshw-02.18b-gettext-array.patch 
b/sys-apps/lshw/files/lshw-02.18b-gettext-array.patch
new file mode 100644
index 0000000..4aea642
--- /dev/null
+++ b/sys-apps/lshw/files/lshw-02.18b-gettext-array.patch
@@ -0,0 +1,31 @@
+patch sent upstream
+
+From 1fb7ebed787ec1b73218c1f12cbb71b103433375 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vap...@gentoo.org>
+Date: Tue, 14 Mar 2017 22:25:12 -0700
+Subject: [PATCH] fix array access with string translations
+
+The code forgot to rebase the num to 0 before indexing the string array.
+It also provides 5 strings, but was only allowing 4 to be accessed.
+---
+ src/core/dmi.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/core/dmi.cc b/src/core/dmi.cc
+index 250f48572d54..0db074975f2d 100644
+--- a/src/core/dmi.cc
++++ b/src/core/dmi.cc
+@@ -510,8 +510,8 @@ static const char *dmi_memory_array_location(u8 num)
+   };
+   if (num <= 0x0A)
+     return _(memory_array_location[num]);
+-  if (num >= 0xA0 && num < 0xA4)
+-    return _(jp_memory_array_location[num]);
++  if (num >= 0xA0 && num <= 0xA4)
++    return _(jp_memory_array_location[num - 0xA0]);
+   return "";
+ }
+ 
+-- 
+2.12.0
+

diff --git a/sys-apps/lshw/files/lshw-02.18b-sgx.patch 
b/sys-apps/lshw/files/lshw-02.18b-sgx.patch
new file mode 100644
index 0000000..92bd6c2
--- /dev/null
+++ b/sys-apps/lshw/files/lshw-02.18b-sgx.patch
@@ -0,0 +1,32 @@
+patch from upstream:
+https://ezix.org/src/pkg/lshw/commit/5e5744732b2dcdf83845919256388b3842033183
+
+From 5e5744732b2dcdf83845919256388b3842033183 Mon Sep 17 00:00:00 2001
+From: Wenkai Du <wenkai...@intel.com>
+Date: Fri, 22 Dec 2017 09:57:57 -0800
+Subject: [PATCH] lshw: fix segmentation fault when /dev/sgx is present
+
+When Intel SGX is enabled in kernel, /dev/sgx is created and is
+picked up by "/dev/sg*" glob matching.
+
+Signed-off-by: Wenkai Du <wenkai...@intel.com>
+---
+ src/core/scsi.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/core/scsi.cc b/src/core/scsi.cc
+index b38dda2cd8a8..75061c0fb195 100644
+--- a/src/core/scsi.cc
++++ b/src/core/scsi.cc
+@@ -30,7 +30,7 @@
+ 
+ __ID("@(#) $Id$");
+ 
+-#define SG_X "/dev/sg*"
++#define SG_X "/dev/sg[0-9]*"
+ #define SG_MAJOR 21
+ 
+ #ifndef SCSI_IOCTL_GET_PCI
+-- 
+2.15.1
+

diff --git a/sys-apps/lshw/lshw-02.18b-r2.ebuild 
b/sys-apps/lshw/lshw-02.18b-r2.ebuild
new file mode 100644
index 0000000..e2254b7
--- /dev/null
+++ b/sys-apps/lshw/lshw-02.18b-r2.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+
+PLOCALES='fr'
+
+inherit flag-o-matic toolchain-funcs l10n desktop
+
+MAJ_PV=$(ver_cut 1-2)
+MIN_PV=$(ver_cut 3)
+
+MY_P="$PN-${MIN_PV^^}.$MAJ_PV"
+DESCRIPTION="Hardware Lister"
+HOMEPAGE="https://www.ezix.org/project/wiki/HardwareLiSter";
+SRC_URI="https://www.ezix.org/software/files/${MY_P}.tar.gz";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 arm ~arm64 ~mips ~ppc ~x86"
+IUSE="gtk sqlite static"
+
+REQUIRED_USE="static? ( !gtk )"
+
+RDEPEND="gtk? ( x11-libs/gtk+:2 )
+       sqlite? ( dev-db/sqlite:3 )"
+DEPEND="${RDEPEND}
+       gtk? ( virtual/pkgconfig )
+       sqlite? ( virtual/pkgconfig )"
+RDEPEND="${RDEPEND}
+       sys-apps/hwids"
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-02.18b-gentoo.patch"
+       "${FILESDIR}/${PN}-02.18b-gettext-array.patch"
+       "${FILESDIR}/${PN}-02.18b-sgx.patch"
+       "${FILESDIR}/${PN}-02.18b-fixes.patch"
+)
+
+src_prepare() {
+       default
+       l10n_find_plocales_changes "src/po" "" ".po" || die
+       sed -i \
+               -e "/^LANGUAGES =/ s/=.*/= $(l10n_get_locales)/" \
+               src/po/Makefile || die
+       sed -i \
+               -e 's:\<pkg-config\>:${PKG_CONFIG}:' \
+               src/Makefile src/gui/Makefile || die
+}
+
+src_compile() {
+       tc-export CC CXX AR PKG_CONFIG
+       use static && append-ldflags -static
+
+       # Need two sep make statements to avoid parallel build issues. #588174
+       local sqlite=$(usex sqlite 1 0)
+       emake SQLITE=${sqlite} all
+       use gtk && emake SQLITE=${sqlite} gui
+}
+
+src_install() {
+       emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" install $(usex gtk 
'install-gui' '')
+       dodoc README.md docs/*
+       if use gtk ; then
+               newicon -s scalable src/gui/artwork/logo.svg gtk-lshw.svg
+               make_desktop_entry \
+                       "${EPREFIX}"/usr/sbin/gtk-lshw \
+                       "${DESCRIPTION}"
+       fi
+}

diff --git a/sys-apps/lshw/metadata.xml b/sys-apps/lshw/metadata.xml
new file mode 100644
index 0000000..56c1244
--- /dev/null
+++ b/sys-apps/lshw/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+<maintainer type="project">
+       <email>base-sys...@gentoo.org</email>
+       <name>Gentoo Base System</name>
+</maintainer>
+</pkgmetadata>

Reply via email to