Merge pull request #237870 from emilytrau/minimal-xz

minimal-bootstrap.xz: init at 5.0.8
This commit is contained in:
John Ericson 2023-06-24 13:31:18 -04:00 committed by GitHub
commit 5467f89ede
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 110 additions and 0 deletions

View file

@ -70,6 +70,12 @@ lib.makeScope
tinycc-bootstrappable = lib.recurseIntoAttrs (callPackage ./tinycc/bootstrappable.nix { });
tinycc-mes = lib.recurseIntoAttrs (callPackage ./tinycc/mes.nix { });
xz = callPackage ./xz {
bash = bash_2_05;
tinycc = tinycc-mes;
inherit (heirloom) sed;
};
inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText;
test = kaem.runCommand "minimal-bootstrap-test" {} ''
@ -83,6 +89,7 @@ lib.makeScope
echo ${heirloom.tests.get-version}
echo ${mes.compiler.tests.get-version}
echo ${tinycc-mes.compiler.tests.chain}
echo ${xz.tests.get-version}
mkdir ''${out}
'';
})

View file

@ -0,0 +1,78 @@
{ lib
, buildPlatform
, hostPlatform
, fetchurl
, bash
, tinycc
, gnumake
, gnugrep
, gawk
, sed
}:
let
pname = "xz";
# >=5.2 uses poll.h, unsupported by meslibc
version = "5.0.8";
src = fetchurl {
url = "https://tukaani.org/xz/xz-${version}.tar.bz2";
sha256 = "1nkb68dyrf16xwyqichcy1vhgbfg20dxz459rcsdx85h1gczk1i2";
};
in
bash.runCommand "${pname}-${version}" {
inherit pname version;
nativeBuildInputs = [
tinycc.compiler
gnumake
gnugrep
gawk
sed
];
passthru.tests.get-version = result:
bash.runCommand "${pname}-get-version-${version}" {} ''
${result}/bin/xz --version
mkdir $out
'';
meta = with lib; {
description = "A general-purpose data compression software, successor of LZMA";
homepage = "https://tukaani.org/xz";
license = with licenses; [ gpl2Plus lgpl21Plus ];
maintainers = teams.minimal-bootstrap.members;
platforms = platforms.unix;
};
} ''
# Unpack
unbz2 --file ${src} --output xz.tar
untar --file xz.tar
rm xz.tar
cd xz-${version}
# Configure
export CC="tcc -B ${tinycc.libs}/lib -include${./stubs.h}"
export CPP="tcc -E"
export LD=tcc
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
bash ./configure \
--prefix=$out \
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--disable-shared \
--disable-nls \
--disable-threads \
--disable-assembler
# Build
make all
# Install
make install
''

View file

@ -0,0 +1,25 @@
#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;
}