Created
May 13, 2018 13:04
-
-
Save adrianparvino/c049dd5ca8085edb25ceef5f613ebc02 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
{ pkgs ? (import <nixpkgs> {}) | |
, useClang ? false | |
, binutils ? pkgs.binutils | |
, lib ? pkgs.lib | |
, stdenv' ? pkgs.stdenv | |
, gcc ? pkgs.gcc | |
, clangStdenv ? pkgs.clangStdenv | |
, gnumake ? pkgs.gnumake | |
, llvmPackages ? pkgs.llvmPackages | |
}: | |
let | |
stdenv = stdenv'; | |
compilerString = if useClang | |
then "clang" | |
else "gcc"; | |
internalCompiler = if useClang | |
then "${llvmPackages.clang-unwrapped}/bin/${compilerString}" | |
else "${gcc}/bin/${compilerString}"; | |
in | |
stdenv.mkDerivation rec { | |
name = "hlibc"; | |
version = "0.0.1"; | |
src = ./../..; | |
phases = [ "unpackPhase" "patchPhase" "checkPhase" "configurePhase" "installPhase" ]; | |
patchPhase = if useClang then | |
'' | |
substituteInPlace ./tools/create_wrappers.sh --replace '"clang' '"hardeningDisable=all exec ${internalCompiler}' | |
'' | |
else ""; | |
checkPhase = '' | |
echo ./tools/build.sh ${compilerString}test ${gcc}/bin/gcc | |
''; | |
postInstall = '' | |
ln -s $out/bin/gcc-wrap $out/bin/cc | |
substituteInPlace $out/bin/${compilerString}-wrap --replace 'exec ${compilerString}' 'hardeningDisable=all exec ${stdenv.cc}/bin/${compilerString}' | |
''; | |
doCheck = true; | |
dontDisableStatic = true; | |
hardeningDisable = ["all"]; | |
nativeBuildInputs = [ ]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment