Commit adf49a8b authored by Emily Trau's avatar Emily Trau
Browse files

minimal-bootstrap.bzip2: build with musl

parent 2f400ede
Loading
Loading
Loading
Loading
+7 −22
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
, bash
, tinycc
, gnumake
, gnupatch
, gnutar
, gzip
}:
let
@@ -14,16 +14,6 @@ let
    url = "https://sourceware.org/pub/bzip2/bzip2-${version}.tar.gz";
    sha256 = "0s92986cv0p692icqlw1j42y9nld8zd83qwhzbqd61p1dqbh6nmb";
  };

  patches = [
    # mes libc has no time support, so we remove that.
    # It also does not have fch{own,mod}, which we don't care about in the bootstrap
    # anyway, so we can null-op those calls.
    (fetchurl {
      url = "https://github.com/fosslinux/live-bootstrap/raw/87e9d7db9d22b400d1c05247254ac39ee2577e80/sysa/bzip2-1.0.8/patches/mes-libc.patch";
      sha256 = "14dciwib28h413skzfkh7samzh8x87dmwhldyxxphff04pvl1j3c";
    })
  ];
in
bash.runCommand "${pname}-${version}" {
  inherit pname version;
@@ -31,13 +21,13 @@ bash.runCommand "${pname}-${version}" {
  nativeBuildInputs = [
    tinycc.compiler
    gnumake
    gnupatch
    gnutar
    gzip
  ];

  passthru.tests.get-version = result:
    bash.runCommand "${pname}-get-version-${version}" {} ''
      ${result}/bin/bzip2 --version --help
      ${result}/bin/bzip2 --help
      mkdir $out
    '';

@@ -50,21 +40,16 @@ bash.runCommand "${pname}-${version}" {
  };
} ''
  # Unpack
  cp ${src} bzip2.tar.gz
  gunzip bzip2.tar.gz
  untar --file bzip2.tar
  rm bzip2.tar
  tar xzf ${src}
  cd bzip2-${version}

  # Patch
  ${lib.concatMapStringsSep "\n" (f: "patch -Np0 -i ${f}") patches}

  # Build
  make \
    CC="tcc -B ${tinycc.libs}/lib -I ." \
    -j $NIX_BUILD_CORES \
    CC="tcc -B ${tinycc.libs}/lib" \
    AR="tcc -ar" \
    bzip2 bzip2recover

  # Install
  make install PREFIX=$out
  make install -j $NIX_BUILD_CORES PREFIX=$out
''
+3 −1
Original line number Diff line number Diff line
@@ -32,7 +32,9 @@ lib.makeScope

    bzip2 = callPackage ./bzip2 {
      bash = bash_2_05;
      tinycc = tinycc-mes;
      tinycc = tinycc-musl;
      gnumake = gnumake-musl;
      gnutar = gnutar-musl;
    };

    coreutils = callPackage ./coreutils { tinycc = tinycc-mes; };