minimal-bootstrap.xz: build with musl

This commit is contained in:
Emily Trau 2023-09-18 21:59:03 -07:00
parent 4166e1fded
commit 3fd09b7547
3 changed files with 16 additions and 48 deletions

View File

@ -149,8 +149,8 @@ lib.makeScope
xz = callPackage ./xz {
bash = bash_2_05;
tinycc = tinycc-mes;
inherit (heirloom) sed;
tinycc = tinycc-musl;
musl = musl11;
};
inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText;

View File

@ -4,19 +4,21 @@
, fetchurl
, bash
, tinycc
, musl
, gnumake
, gnused
, gnugrep
, gawk
, sed
, gnutar
, gzip
}:
let
pname = "xz";
# >=5.2 uses poll.h, unsupported by meslibc
version = "5.0.8";
version = "5.4.3";
src = fetchurl {
url = "https://tukaani.org/xz/xz-${version}.tar.bz2";
sha256 = "1nkb68dyrf16xwyqichcy1vhgbfg20dxz459rcsdx85h1gczk1i2";
url = "https://tukaani.org/xz/xz-${version}.tar.gz";
hash = "sha256-HDguC8Lk4K9YOYqQPdYv/35RAXHS3keh6+BtFSjpt+k=";
};
in
bash.runCommand "${pname}-${version}" {
@ -25,9 +27,11 @@ bash.runCommand "${pname}-${version}" {
nativeBuildInputs = [
tinycc.compiler
gnumake
gnused
gnugrep
gawk
sed
gnutar
gzip
];
passthru.tests.get-version = result:
@ -45,33 +49,22 @@ bash.runCommand "${pname}-${version}" {
};
} ''
# Unpack
unbz2 --file ${src} --output xz.tar
untar --file xz.tar
rm xz.tar
tar xzf ${src}
cd xz-${version}
# Configure
export CC="tcc -B ${tinycc.libs}/lib -include${./stubs.h}"
export CPP="tcc -E"
export LD=tcc
export CC="tcc -B ${musl}/lib"
export AR="tcc -ar"
export SED=sed
export ac_cv_prog_cc_c99=
export ac_cv_header_fcntl_h=yes
export ac_cv_header_limits_h=yes
export ac_cv_header_sys_time_h=yes
export ac_cv_func_utime=no
export LD=tcc
bash ./configure \
--prefix=$out \
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--disable-shared \
--disable-nls \
--disable-threads \
--disable-assembler
# Build
make all
make
# Install
make install

View File

@ -1,25 +0,0 @@
#define sig_atomic_t int
#define SSIZE_MAX LONG_MAX
#define O_NOCTTY 0400
#define O_NONBLOCK 04000
#define S_ISVTX 01000
#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
int fchmod (int fd, int mode)
{
return 0;
}
int fchown (int fd, int owner, int group)
{
return 0;
}
#include <signal.h>
int sigfillset (sigset_t * set)
{
return 0;
}