Merge pull request #112939 from symphorien/musl32cross

pkgsCross.musl32: fix a few basic package
This commit is contained in:
Guillaume Girol
2021-02-18 06:44:49 +00:00
committed by GitHub
12 changed files with 134 additions and 10 deletions
+22
View File
@@ -16,6 +16,11 @@ let
sha256 = "14igk6k00bnpfw660qhswagyhvr0gfqg4q55dxvaaq7ikfkrir71";
};
stack_chk_fail_local_c = fetchurl {
url = "https://git.alpinelinux.org/aports/plain/main/musl/__stack_chk_fail_local.c?h=3.10-stable";
sha256 = "1nhkzzy9pklgjcq2yg89d3l18jif331srd3z3vhy5qwxl1spv6i9";
};
# iconv tool, implemented by musl author.
# Original: http://git.etalabs.net/cgit/noxcuse/plain/src/iconv.c?id=02d288d89683e99fd18fe9f54d4e731a6c474a4f
# We use copy from Alpine which fixes error messages, see:
@@ -87,6 +92,16 @@ stdenv.mkDerivation rec {
NIX_DONT_SET_RPATH = true;
preBuild = ''
${if (stdenv.targetPlatform.libc == "musl" && stdenv.targetPlatform.isx86_32) then
"# the -x c flag is required since the file extension confuses gcc
# that detect the file as a linker script.
$CC -x c -c ${stack_chk_fail_local_c} -o __stack_chk_fail_local.o
$AR r libssp_nonshared.a __stack_chk_fail_local.o"
else ""
}
'';
postInstall = ''
# Not sure why, but link in all but scsi directory as that's what uclibc/glibc do.
# Apparently glibc provides scsi itself?
@@ -96,6 +111,13 @@ stdenv.mkDerivation rec {
$STRIP -S $out/lib/libc.a
mkdir -p $out/bin
${if (stdenv.targetPlatform.libc == "musl" && stdenv.targetPlatform.isx86_32) then
"install -D libssp_nonshared.a $out/lib/libssp_nonshared.a
$STRIP -S $out/lib/libssp_nonshared.a"
else ""
}
# Create 'ldd' symlink, builtin
ln -rs $out/lib/libc.so $out/bin/ldd