summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWenkai Du <wenkai.du@intel.com>2018-01-04 02:13:02 -0500
committerMike Frysinger <vapier@gentoo.org>2018-01-04 02:13:27 -0500
commit1cb1b9ca5d372c83314d9f7b02c80eb7c10cc0bc (patch)
tree123777ced1e278e6b39938b53e4d662f0c2204ee /sys-apps/lshw
parentdev-perl/Module-Runtime: stable 0.16.0 for sparc, bug #643282 (diff)
downloadgentoo-1cb1b9ca5d372c83314d9f7b02c80eb7c10cc0bc.tar.gz
gentoo-1cb1b9ca5d372c83314d9f7b02c80eb7c10cc0bc.tar.bz2
gentoo-1cb1b9ca5d372c83314d9f7b02c80eb7c10cc0bc.zip
sys-apps/lshw: add upstream fix for crashes w/Intel SGX
Diffstat (limited to 'sys-apps/lshw')
-rw-r--r--sys-apps/lshw/files/lshw-02.18b-sgx.patch32
-rw-r--r--sys-apps/lshw/lshw-02.18b-r1.ebuild73
2 files changed, 105 insertions, 0 deletions
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 000000000000..92bd6c23e2f3
--- /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.du@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.du@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-r1.ebuild b/sys-apps/lshw/lshw-02.18b-r1.ebuild
new file mode 100644
index 000000000000..c22eab427571
--- /dev/null
+++ b/sys-apps/lshw/lshw-02.18b-r1.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+PLOCALES='fr'
+
+inherit flag-o-matic eutils toolchain-funcs l10n
+
+MAJ_PV=${PV:0:${#PV}-1}
+MIN_PVE=${PV:0-1}
+MIN_PV=${MIN_PVE/b/B}
+
+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="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux"
+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
+)
+
+src_prepare() {
+ epatch "${PATCHES[@]}"
+
+ 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
+}