0
0
Fork 0
haikuports/sys-apps/pciutils/pciutils-3.6.2.recipe

165 lines
4.2 KiB
Bash

SUMMARY="Utilities for inspecting and manipulating PCI devices"
DESCRIPTION="The PCI Utilities are a collection of programs for inspecting \
and manipulating configuration of PCI devices, all based on a common \
portable library libpci which offers access to the PCI configuration space \
on a variety of operating systems.
The utilities include:
- lspci - displays detailed information about all PCI buses and devices in \
the system
- setpci - allows reading from and writing to PCI device configuration \
registers. For example, you can adjust the latency timers with it."
HOMEPAGE="https://mj.ucw.cz/sw/pciutils/"
COPYRIGHT="1997-2018 Martin Mares"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/pciutils-$portVersion.tar.gz"
CHECKSUM_SHA256="30005e341bb0ffa734174e592dc8f0dd928e1c9368b859715812149ed91d8f93"
PATCHES="pciutils-$portVersion.patchset"
ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"
libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
# libpci.so can only be built (for this package) if gcc >= 4.
if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
LIBPCI_SHARED=yes
else
LIBPCI_SHARED=no
fi
PROVIDES="
pciutils$secondaryArchSuffix = $portVersion
cmd:lspci$secondaryArchSuffix = $portVersion
cmd:setpci$secondaryArchSuffix = $portVersion
"
if [ "$LIBPCI_SHARED" = yes ]; then
PROVIDES="$PROVIDES
lib:libpci$secondaryArchSuffix = $libVersionCompat
"
fi
REQUIRES="
haiku$secondaryArchSuffix
pciutils_data == $portVersion
"
if [ -z "$secondaryArchSuffix" ]; then
SUMMARY_data="Utilities for inspecting and manipulating PCI devices \
(data)"
ARCHITECTURES_data="any"
PROVIDES_data="
pciutils_data = $portVersion
"
REQUIRES_data=""
fi
PROVIDES_devel="
pciutils${secondaryArchSuffix}_devel = $portVersion
devel:libpci$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
pciutils$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
if [ -n "$secondaryArchSuffix" ]; then
BUILD_REQUIRES="$BUILD_REQUIRES
pciutils_data == $portVersion
"
fi
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:sed
"
BUILD()
{
make \
ZLIB=no \
SHARED=$LIBPCI_SHARED \
PREFIX="$prefix" \
SHAREDIR="$dataDir" \
IDSDIR="$dataDir"/pciutils \
SBINDIR="$binDir" \
MANDIR="$manDir" \
INCDIR="$includeDir" \
LIBDIR="$libDir" \
}
INSTALL()
{
make \
ZLIB=no \
SHARED=$LIBPCI_SHARED \
PREFIX="$prefix" \
SHAREDIR="$dataDir" \
IDSDIR="$dataDir"/pciutils \
SBINDIR="$binDir" \
MANDIR="$manDir" \
INCDIR="$includeDir" \
LIBDIR="$libDir" \
install install-lib
# update-pciids is useless because pci.ids is read-only.
rm -f "$binDir"/update-pciids
rm -f "$manDir"/man*/update-pciids.*
prepareInstalledDevelLib libpci
fixPkgconfig
if [ -z "$secondaryArchSuffix" ]; then
maybe_manDir_man7="$manDir"/man7
packageEntries data \
"$dataDir"
sed -i -e "s,$dataDir/,/system/data/,g" \
"$manDir"/man8/lspci.8 \
"$manDir"/man8/setpci.8
local include_pci=/system/$relativeOldIncludeDir/pci
sed -i -e "s,/usr/include/linux/,$include_pci/,g" \
"$manDir"/man8/lspci.8
sed -i -e "s,/usr/include/pci/,$include_pci/,g" \
"$manDir"/man8/setpci.8
else
maybe_manDir_man7=
rm -rf "$dataDir" "$documentationDir"
fi
# $dataDir/pciutils/pci.ids is not in pciutils but in pciutils_data.
local data_dir="${dataDir/pciutils$secondaryArchSuffix/pciutils_data}"
# So we need to fix the idsdir custom parameter in libpci.pc to make
# pkg-config --variable=idsdir libpci
# yeld the correct path to the directory where pci.ids will be.
sed -i \
-e "/^idsdir=/ s,=$dataDir/,=$data_dir/," \
"$developLibDir"/pkgconfig/libpci.pc
# devel package
packageEntries devel \
"$developDir" \
${maybe_manDir_man7:+"$maybe_manDir_man7"}
}
TEST()
{
if [ "$LIBPCI_SHARED" = yes ]; then
# Do we already have a symlink for the library with its soname?
if [ ! -e lib/libpci.so.${libVersionCompat##* } ]; then
# Not yet. So let's create it.
ln -s libpci.so.$libVersion lib/libpci.so.${libVersionCompat##* }
fi
LIBRARY_PATH="$sourceDir/lib${LIBRARY_PATH:+:$LIBRARY_PATH}" \
"$sourceDir"/lspci
else
"$sourceDir"/lspci
fi
}