Skip to content

Commit

Permalink
libpciaccess: refactored and moved to pkgs/by-name from xorg namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
quantenzitrone committed Dec 31, 2024
1 parent 9dc0a55 commit b737264
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 23 deletions.
82 changes: 82 additions & 0 deletions pkgs/by-name/li/libpciaccess/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
lib,
stdenv,
fetchurl,
testers,
writeScript,
pkg-config,
meson,
ninja,
zlib,
netbsd,
hwdata,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "libpciaccess";
version = "0.18.1";

src = fetchurl {
url = "mirror://xorg/individual/lib/libpciaccess-${finalAttrs.version}.tar.xz";
hash = "sha256-SvQ0RLOK21VF0O0cLORtlgjMR7McI4f8UYFlZ2Wm+nY=";
};

# not sure if needed
hardeningDisable = [
"bindnow"
"relro"
];
strictDeps = true;

nativeBuildInputs = [
pkg-config
meson
ninja
];

buildInputs =
[ zlib ]
++ lib.optionals stdenv.hostPlatform.isNetBSD [
netbsd.libarch
netbsd.libpci
];

mesonFlags = [
(lib.mesonOption "pci-ids" "${hwdata}/share/hwdata")
(lib.mesonEnable "zlib" true)
];

passthru = {
updateScript = writeScript "update-${finalAttrs.pname}" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts
version="$(list-directory-versions --pname ${finalAttrs.pname} \
--url https://xorg.freedesktop.org/releases/individual/lib/ \
| sort | tail -n1)"
update-source-version ${finalAttrs.pname} "$version"
'';
tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
};

meta = {
description = "Generic PCI access library";
homepage = "https://gitlab.freedesktop.org/xorg/lib/libpciaccess";
license = with lib.licenses; [
mit
isc
x11
];
pkgConfigModules = [ "pciaccess" ];
# https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/blob/6cd5a4afbb70868c7746de8d50dea59e02e9acf2/configure.ac#L108-114
platforms =
with lib.platforms;
cygwin
++ freebsd
++ illumos
++ linux
++ lib.platforms.netbsd # otherwise netbsd from the function arguments is used
++ openbsd;
};
})
2 changes: 2 additions & 0 deletions pkgs/servers/x11/xorg/generate-expr-from-tarballs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@
font-alias,
font-util,
gccmakedep,
libpciaccess
luit,
}:

Expand All @@ -272,6 +273,7 @@
inherit pixman;
inherit
gccmakedep
libpciaccess
luit
;
fontalias = font-alias;
Expand Down
22 changes: 0 additions & 22 deletions pkgs/servers/x11/xorg/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -414,28 +414,6 @@ self: super:
outputs = [ "out" "dev" ]; # mainly to avoid propagation
});

libpciaccess = super.libpciaccess.overrideAttrs (attrs: {
nativeBuildInputs = attrs.nativeBuildInputs ++ [ meson ninja ];

buildInputs = attrs.buildInputs ++ [ zlib ]
++ lib.optionals stdenv.hostPlatform.isNetBSD [ netbsd.libarch netbsd.libpci ];

mesonFlags = [
(lib.mesonOption "pci-ids" "${hwdata}/share/hwdata")
(lib.mesonEnable "zlib" true)
];

meta = attrs.meta // {
# https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/blob/master/configure.ac#L108-114
platforms = lib.fold (os: ps: ps ++ lib.platforms.${os}) []
[ "cygwin" "freebsd" "linux" "netbsd" "openbsd" "illumos" ];
badPlatforms = [
# mandatory shared library
lib.systems.inspect.platformPatterns.isStatic
];
};
});

libpthreadstubs = super.libpthreadstubs.overrideAttrs (attrs: {
# only contains a pkgconfig file on linux and windows
meta = attrs.meta // { platforms = lib.platforms.unix ++ lib.platforms.windows; };
Expand Down
1 change: 0 additions & 1 deletion pkgs/servers/x11/xorg/tarballs.list
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ mirror://xorg/individual/lib/libdmx-1.1.5.tar.xz
mirror://xorg/individual/lib/libfontenc-1.1.8.tar.xz
mirror://xorg/individual/lib/libFS-1.0.10.tar.xz
mirror://xorg/individual/lib/libICE-1.1.1.tar.xz
mirror://xorg/individual/lib/libpciaccess-0.18.1.tar.xz
mirror://xorg/individual/lib/libSM-1.2.4.tar.xz
mirror://xorg/individual/lib/libWindowsWM-1.0.1.tar.bz2
mirror://xorg/individual/lib/libX11-1.8.10.tar.xz
Expand Down

0 comments on commit b737264

Please sign in to comment.