From 54900d99f52e6efaa19cafbbbc9032a812dccfd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Buchm=C3=BCller?= Date: Sat, 7 May 2016 05:40:35 +0200 Subject: [PATCH] lshw: unbreak musl --- srcpkgs/lshw/patches/fix-array-bounds.patch | 13 ++++++++ srcpkgs/lshw/patches/musl-basename.patch | 37 +++++++++++++-------- srcpkgs/lshw/template | 2 +- 3 files changed, 37 insertions(+), 15 deletions(-) create mode 100644 srcpkgs/lshw/patches/fix-array-bounds.patch diff --git a/srcpkgs/lshw/patches/fix-array-bounds.patch b/srcpkgs/lshw/patches/fix-array-bounds.patch new file mode 100644 index 00000000000..7e6d66eed27 --- /dev/null +++ b/srcpkgs/lshw/patches/fix-array-bounds.patch @@ -0,0 +1,13 @@ +Fix GCC warning "array subscript is above array bounds [-Warray-bounds]" + +--- src/core/dmi.cc 2016-05-06 22:17:33.416045355 +0200 ++++ src/core/dmi.cc 2016-05-06 22:21:31.694032471 +0200 +@@ -511,7 +511,7 @@ + if (num <= 0x0A) + return _(memory_array_location[num]); + if (num >= 0xA0 && num < 0xA4) +- return _(jp_memory_array_location[num]); ++ return _(jp_memory_array_location[num - 0xA0]); + return ""; + } + diff --git a/srcpkgs/lshw/patches/musl-basename.patch b/srcpkgs/lshw/patches/musl-basename.patch index feaeb3dbe51..613e9edfd1b 100644 --- a/srcpkgs/lshw/patches/musl-basename.patch +++ b/srcpkgs/lshw/patches/musl-basename.patch @@ -1,19 +1,28 @@ -For musl libc declare a simple, local version of basename(3) -which expects a const char* parameter. +For musl libc declare a macro version of basename(3). ---- src/core/pci.cc 2015-10-14 10:00:49.449367706 +0200 -+++ src/core/pci.cc 2015-10-14 10:02:18.567360753 +0200 -@@ -12,6 +12,13 @@ - #include - #include - #include +--- src/core/dasd.cc 2016-05-07 05:33:49.580629923 +0200 ++++ src/core/dasd.cc 2016-05-07 05:35:10.000625574 +0200 +@@ -10,6 +10,10 @@ + #include + #include + +#if !defined(__GLIBC__) -+static const char * basename(const char * src) -+{ -+ char* slash = strrchr(src, '/'); -+ return slash ? slash+1 : src; -+} ++#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src) +#endif ++ + using namespace std; - __ID("@(#) $Id: pci.cc 2496 2012-05-15 08:00:13Z lyonel $"); + /*Read only block devices, not partitions*/ +--- src/core/sysfs.cc 2016-05-07 05:36:45.771620396 +0200 ++++ src/core/sysfs.cc 2016-05-07 05:37:33.265617827 +0200 +@@ -19,6 +19,10 @@ + __ID("@(#) $Id$"); + ++#if !defined(__GLIBC__) ++#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src) ++#endif ++ + using namespace sysfs; + + struct sysfs::entry_i diff --git a/srcpkgs/lshw/template b/srcpkgs/lshw/template index 8033a266464..b500b5e2647 100644 --- a/srcpkgs/lshw/template +++ b/srcpkgs/lshw/template @@ -1,7 +1,7 @@ # Template build file for 'lshw'. pkgname=lshw version=B.02.18 -revision=1 +revision=2 makedepends="gtk+-devel libglade-devel sqlite-devel" hostmakedepends="pkg-config" short_desc="Hardware lister application"