Skip to content

Commit

Permalink
fix: package pkg-config properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Dich0tomy committed May 16, 2024
1 parent 300210a commit a612e8f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
3 changes: 2 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
in {
formatter = pkgs.alejandra;

packages.default = package;
packages.dev = package.dev;
packages.default = package.out;

devShells = import ./nix/shell.nix {
inherit pkgs buildDeps nativeDeps preCommitCheck;
Expand Down
2 changes: 1 addition & 1 deletion nix/package/dire.pc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ prefix=@out@
includedir=${prefix}/include
libdir=${prefix}/lib

Name: libdire
Name: dire
Description: Complete cross-platform data and user dirs discovery.
Version: @version@
Libs: -L${libdir}/ -ldire
Expand Down
21 changes: 10 additions & 11 deletions nix/package/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
buildDeps,
rootDir,
version,
}: let
dire-pkgconfig = pkgs.substituteAll {
src = ./dire.pc;
inherit version;
};
in
}:
pkgs.stdenv.mkDerivation {
pname = "dire";
inherit version;
Expand Down Expand Up @@ -46,13 +41,17 @@ in
'';

installPhase = ''
mkdir -p {$dev,$out}/lib $dev/lib/pkgconfig $dev/include
mkdir -p {$dev,$out}/lib $dev/lib/pkgconfig $dev/include
cp src/lib/libdire.a $out/lib
cp src/lib/libdire.a $dev/lib
cp src/lib/libdire.a $out/lib
cp src/lib/libdire.a $dev/lib
cp -r $src/src/lib/include/* $dev/include
cp -r $src/src/lib/include/* $dev/include
substituteAll ${dire-pkgconfig} $dev/lib/pkgconfig/dire.pc
substitute \
${./dire.pc} \
$dev/lib/pkgconfig/dire.pc \
--subst-var out \
--subst-var version
'';
}

0 comments on commit a612e8f

Please sign in to comment.