Last active
February 9, 2023 11:06
-
-
Save andreabedini/3e867b2d05dc98a1853513972afd8509 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
inputs.nix.url = "github:NixOS/nix/2.13.2"; | |
outputs = { self, nixpkgs, nix }: { | |
packages.x86_64-linux.default = | |
nix.packages.x86_64-linux.nix.overrideAttrs (oldAttrs: { | |
separateDebugInfo = false; | |
phases = [ "unpackPhase" "patchPhase" "autoreconfPhase" "configurePhase" "installPhase" ]; | |
outputs = [ "out" ]; | |
copyIncludeFiles = '' | |
#!/usr/bin/env bash | |
while getopts ":I:" arg @CXXFLAGS@; do | |
case $arg in | |
I) # Specify p value. | |
echo $OPTARG | |
cp --no-preserve=mode -vr $OPTARG/* $out/include | |
;; | |
esac | |
done | |
''; | |
passAsFile = oldAttrs.passAsFile or [ ] ++ [ "copyIncludeFiles" ]; | |
installPhase = '' | |
set -ex | |
shopt -s globstar | |
mkdir $out/include | |
./config.status --file=Makefile.config | |
ln -s $copyIncludeFilesPath copyIncludeFiles.sh.in | |
./config.status --file=copyIncludeFiles.sh | |
bash copyIncludeFiles.sh | |
cp --no-preserve=mode --parents -vr Makefile config.h **/*.mk src/**/*.{cc,cpp,hh,hpp,l,y,nix} $out | |
cp Makefile.config $out/Makefile.config.orig | |
''; | |
}); | |
}; | |
} | |
# | |
# Use like this | |
# | |
# $ cp -r --no-preserve=mode --dereference $(nix build --no-link --print-out-paths) tmp | |
# $ cd tmp | |
# $ make LDFLAGS="-larchive -lcrypto -lbrotlienc -lbrotlidec -lgc -lpthread -ldl -lcpuid" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment