gcc
This commit is contained in:
parent
71ed2bc003
commit
a0a8188d82
5 changed files with 399 additions and 9 deletions
102
derivations/cross_toolchain/glibc.nix
Normal file
102
derivations/cross_toolchain/glibc.nix
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
{ pkgs, cc1 }:
|
||||
let
|
||||
stdenvNoCC = pkgs.stdenvNoCC;
|
||||
|
||||
nativePackages = with pkgs; [
|
||||
bison
|
||||
texinfo
|
||||
perl
|
||||
python3
|
||||
];
|
||||
|
||||
name = "glibc";
|
||||
version = "2.42";
|
||||
|
||||
|
||||
|
||||
# Attributes for stdenv.mkDerivation can be found at:
|
||||
# https://nixos.org/manual/nixpkgs/stable/#sec-tools-of-stdenv
|
||||
glibcPkg = stdenvNoCC.mkDerivation {
|
||||
inherit name version;
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://ftp.fau.de/gnu/${name}/${name}-${version}.tar.xz";
|
||||
hash = "";
|
||||
};
|
||||
|
||||
patchSrc = pkgs.fetchurl {
|
||||
url = "https://www.linuxfromscratch.org/patches/lfs/development/${name}-${version}-fhs-1.patch";
|
||||
hash = "";
|
||||
};
|
||||
|
||||
|
||||
nativeBuildInputs = [ nativePackages ];
|
||||
buildInputs = [ cc1 pkgs.gcc ];
|
||||
|
||||
prePhases = "prepEnvironmentPhase";
|
||||
prepEnvironmentPhase = ''
|
||||
export LFS=$PWD
|
||||
export LFSTOOLS=$LFS/tools
|
||||
export LFS_TGT=$(uname -m)-lfs-linux-gnu
|
||||
export PATH=$LFSTOOLS/bin:$PATH
|
||||
export PATH=$LFS/usr/bin:$PATH
|
||||
export CC1=${cc1}
|
||||
export CONFIG_SITE=$LFS/usr/share/config.site
|
||||
|
||||
cp -r $CC1/* $LFS/
|
||||
chmod -R u+w $LFS
|
||||
|
||||
'';
|
||||
|
||||
configurePhase = ''
|
||||
echo "rootsbindir=/usr/sbin" > configparms
|
||||
cp -pv $patchSrc ./glibc.patch
|
||||
patch -Np1 -i ./glibc.patch
|
||||
|
||||
mkdir -v build
|
||||
cd build
|
||||
|
||||
../configure \
|
||||
--prefix=/usr \
|
||||
--host=$LFS_TGT \
|
||||
--build=$(../scripts/config.guess) \
|
||||
--enable-kernel=4.19 \
|
||||
--with-headers=$LFS/usr/include \
|
||||
--disable-nscd \
|
||||
libc_cv_slibdir=/usr/lib
|
||||
'';
|
||||
|
||||
installFlags = [ "DESTDIR=$(LFS)" ];
|
||||
|
||||
postInstall = ''
|
||||
sed '/RTLDLIST=/s@/usr@@g' -i $LFS/usr/bin/ldd
|
||||
|
||||
pushd $LFS/lib
|
||||
case $(uname -m) in
|
||||
i?86) ln -sfv ./ld-linux.so.2 ./ld-lsb.so.3
|
||||
;;
|
||||
x86_64) ln -sfv ./ld-linux-x86-64.so.2 ../lib64
|
||||
ln -sfv ./ld-linux-x86-64.so.2 ../lib64/ld-lsb-x86-64.so.3
|
||||
;;
|
||||
esac
|
||||
popd
|
||||
|
||||
rm -r $LFS/$sourceRoot
|
||||
cp -rvp $LFS/* $out/
|
||||
'';
|
||||
|
||||
shellHook = ''
|
||||
echo -e "\033[31mNix Develop -> $name: Loading...\033[0m"
|
||||
|
||||
if [[ "$(basename $(pwd))" != "$name" ]]; then
|
||||
mkdir -p "$name"
|
||||
cd "$name"
|
||||
fi
|
||||
|
||||
eval "$prepEnvironmentPhase"
|
||||
echo -e "\033[36mNix Develop -> $name: Loaded.\033[0m"
|
||||
echo -e "\033[36mNix Develop -> Current directory: $(pwd)\033[0m"
|
||||
'';
|
||||
};
|
||||
in
|
||||
glibcPkg
|
||||
Loading…
Add table
Add a link
Reference in a new issue