diff options
author | Gonzalo Exequiel Pedone | 2024-03-20 17:23:22 -0300 |
---|---|---|
committer | Gonzalo Exequiel Pedone | 2024-03-20 17:23:22 -0300 |
commit | ae60f0ec1ba10d4867f304d81f07cc6f5981f4c4 (patch) | |
tree | a6d7e0aa0a308724bee7e9b59885fd9009cbd67e | |
parent | 51fc45b90cc2687e99f28b90851a18d52f107bff (diff) | |
download | aur-ae60f0ec1ba10d4867f304d81f07cc6f5981f4c4.tar.gz |
Define basename() for API < 23.
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | 0003-Define-basename.patch | 10 | ||||
-rw-r--r-- | PKGBUILD | 14 | ||||
-rw-r--r-- | basename-impl.h | 52 |
4 files changed, 78 insertions, 4 deletions
@@ -1,7 +1,7 @@ pkgbase = android-x86-pciutils pkgdesc = PCI bus configuration space access library and tools (Android, x86) pkgver = 3.11.1 - pkgrel = 2 + pkgrel = 4 url = https://mj.ucw.cz/sw/pciutils/ arch = any license = GPL2 @@ -14,12 +14,16 @@ pkgbase = android-x86-pciutils options = !emptydirs source = https://mj.ucw.cz/download/linux/pci/pciutils-3.11.1.tar.gz source = https://mj.ucw.cz/download/linux/pci/pciutils-3.11.1.tar.gz.sign + source = basename-impl.h source = 0001-Do-not-use-lresolv.patch source = 0002-Disable-ecam.patch + source = 0003-Define-basename.patch validpgpkeys = C466A56CADA981F4297D20C31F3D0761D9B65F0B sha256sums = 1904864ce5b0272d0a2e42e72ceac9e8810d1898480567f36b70642f8205fbfd sha256sums = SKIP + sha256sums = 8d31c8da27c19ff4c358fdb3f47eb34eb5b3f1660009999377c8f93e923a6d4f sha256sums = 14a963d11acb299db114187768bdf53ee1cb39f1044a0a2aa5c5a90ae58e42a3 sha256sums = bff4d9e509ceba0cdde7a20e83afa5303f27cd93705c54867c6c073fc153aa87 + sha256sums = 8a55146fb7574ab1b4bda06efea69e0c84043e28ca65882cb106efe79e506754 pkgname = android-x86-pciutils diff --git a/0003-Define-basename.patch b/0003-Define-basename.patch new file mode 100644 index 000000000000..6967183ebaab --- /dev/null +++ b/0003-Define-basename.patch @@ -0,0 +1,10 @@ +--- a/lib/sysfs.c ++++ b/lib/sysfs.c +@@ -21,6 +21,7 @@ + #include <fcntl.h> + #include <sys/types.h> + ++#include "../../basename-impl.h" + #include "internal.h" + + static void @@ -5,7 +5,7 @@ _android_arch=x86 pkgname=android-${_android_arch}-pciutils pkgver=3.11.1 -pkgrel=2 +pkgrel=4 arch=('any') pkgdesc="PCI bus configuration space access library and tools (Android, ${_android_arch})" license=('GPL2') @@ -15,12 +15,16 @@ depends=("android-${_android_arch}-hwdata" makedepends=('android-environment') options=(!strip !buildflags staticlibs !emptydirs) source=("https://mj.ucw.cz/download/linux/pci/pciutils-${pkgver}.tar.gz"{,.sign} + 'basename-impl.h' '0001-Do-not-use-lresolv.patch' - '0002-Disable-ecam.patch') + '0002-Disable-ecam.patch' + '0003-Define-basename.patch') sha256sums=('1904864ce5b0272d0a2e42e72ceac9e8810d1898480567f36b70642f8205fbfd' 'SKIP' + '8d31c8da27c19ff4c358fdb3f47eb34eb5b3f1660009999377c8f93e923a6d4f' '14a963d11acb299db114187768bdf53ee1cb39f1044a0a2aa5c5a90ae58e42a3' - 'bff4d9e509ceba0cdde7a20e83afa5303f27cd93705c54867c6c073fc153aa87') + 'bff4d9e509ceba0cdde7a20e83afa5303f27cd93705c54867c6c073fc153aa87' + '8a55146fb7574ab1b4bda06efea69e0c84043e28ca65882cb106efe79e506754') validpgpkeys=('C466A56CADA981F4297D20C31F3D0761D9B65F0B') # Martin Mares <mj@ucw.cz> prepare() { @@ -32,6 +36,10 @@ prepare() { if [ "${ANDROID_MINIMUM_PLATFORM}" -lt 28 ]; then patch -Np1 -i ../0002-Disable-ecam.patch fi + + if [ "${ANDROID_MINIMUM_PLATFORM}" -lt 23 ]; then + patch -Np1 -i ../0003-Define-basename.patch + fi } build() { diff --git a/basename-impl.h b/basename-impl.h new file mode 100644 index 000000000000..6218ddd1dff1 --- /dev/null +++ b/basename-impl.h @@ -0,0 +1,52 @@ +/* + * libkmod - interface to kernel module operations + * + * Copyright (C) 2024 Gonzalo Exequiel Pedone. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once +#ifndef _BASENAME_IMPL_H_ +#define _BASENAME_IMPL_H_ + +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + +inline char *basename(char *path) +{ + int i; + int len; + int last; + + if (path == NULL) + return NULL; + + len = strlen(path); + last = len - 1; + + for (i = last; i >= 0; i--) + if (*(path + i) == '/') + return path + i + 1; + + return path + len; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif +#endif |