about summary refs log tree commit diff
path: root/nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/musl/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-10-20 22:09:03 +0000
committerAlyssa Ross <hi@alyssa.is>2023-10-20 22:09:03 +0000
commit50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e (patch)
treef2556b911180125ccbb7ed0e78a54e92da89adce /nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/musl/default.nix
parent4c16d4548a98563c9d9ad76f4e5b2202864ccd54 (diff)
parentcfc75eec4603c06503ae750f88cf397e00796ea8 (diff)
downloadnixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar
nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.gz
nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.bz2
nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.lz
nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.xz
nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.tar.zst
nixlib-50c21d167f7114fa1dbd95e5c4fb30eeb1a2d02e.zip
Merge commit 'cfc75eec4603c06503ae750f88cf397e00796ea8'
Conflicts:
	nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix
Diffstat (limited to 'nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/musl/default.nix')
-rw-r--r--nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/musl/default.nix28
1 files changed, 11 insertions, 17 deletions
diff --git a/nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/musl/default.nix b/nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/musl/default.nix
index c252d60328e9..437ef342f6ae 100644
--- a/nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/musl/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/musl/default.nix
@@ -8,12 +8,11 @@
 , gnumake
 , gnugrep
 , gnused
-, gawk
 , gnutar
 , gzip
 }:
 let
-  pname = "musl";
+  inherit (import ./common.nix { inherit lib; }) pname meta;
   version = "1.2.4";
 
   src = fetchurl {
@@ -22,7 +21,7 @@ let
   };
 in
 bash.runCommand "${pname}-${version}" {
-  inherit pname version;
+  inherit pname version meta;
 
   nativeBuildInputs = [
     gcc
@@ -30,14 +29,13 @@ bash.runCommand "${pname}-${version}" {
     gnumake
     gnused
     gnugrep
-    gawk
     gnutar
     gzip
   ];
 
   passthru.tests.hello-world = result:
     bash.runCommand "${pname}-simple-program-${version}" {
-        nativeBuildInputs = [ gcc binutils ];
+        nativeBuildInputs = [ gcc binutils result ];
       } ''
         cat <<EOF >> test.c
         #include <stdio.h>
@@ -46,18 +44,10 @@ bash.runCommand "${pname}-${version}" {
           return 0;
         }
         EOF
-        gcc -static -B${result}/lib -I${result}/include -o test test.c
+        musl-gcc -o test test.c
         ./test
         mkdir $out
       '';
-
-  meta = with lib; {
-    description = "An efficient, small, quality libc implementation";
-    homepage = "https://musl.libc.org";
-    license = licenses.mit;
-    maintainers = teams.minimal-bootstrap.members;
-    platforms = platforms.unix;
-  };
 } ''
   # Unpack
   tar xzf ${src}
@@ -77,11 +67,15 @@ bash.runCommand "${pname}-${version}" {
   bash ./configure \
     --prefix=$out \
     --build=${buildPlatform.config} \
-    --host=${hostPlatform.config}
+    --host=${hostPlatform.config} \
+    --syslibdir=$out/lib \
+    --enable-wrapper
 
   # Build
-  make
+  make -j $NIX_BUILD_CORES
 
   # Install
-  make install
+  make -j $NIX_BUILD_CORES install
+  sed -i 's|/bin/sh|${bash}/bin/bash|' $out/bin/*
+  ln -s ../lib/libc.so $out/bin/ldd
 ''