Leverage deps.sh
This commit is contained in:
parent
cda034b29e
commit
061cb5fc1f
5 changed files with 184 additions and 216 deletions
7
manifest
Normal file
7
manifest
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
time-helper 2023-02-28 /wedge/oils-for-unix.org/pkg HOST
|
||||
cmark 0.29.0 /wedge/oils-for-unix.org/pkg HOST
|
||||
re2c 3.0 /wedge/oils-for-unix.org/pkg HOST
|
||||
python2 2.7.18 /wedge/oils-for-unix.org/pkg HOST
|
||||
pyflakes 2.4.0 /homeless-shelter/wedge/oils-for-unix.org/pkg HOST
|
||||
python3 3.10.4 /wedge/oils-for-unix.org/pkg HOST
|
||||
mypy 0.780 /homeless-shelter/wedge/oils-for-unix.org/pkg HOST
|
||||
62
package.nix
62
package.nix
|
|
@ -7,8 +7,6 @@
|
|||
pkg-config,
|
||||
ninja,
|
||||
git,
|
||||
re2c,
|
||||
cmark,
|
||||
which,
|
||||
time,
|
||||
readline,
|
||||
|
|
@ -17,33 +15,23 @@
|
|||
libffi,
|
||||
}:
|
||||
|
||||
let
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "oils-for-unix";
|
||||
version = "0.37.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "oils-for-unix";
|
||||
repo = "oils";
|
||||
rev = "release/${version}";
|
||||
rev = "release/${finalAttrs.version}";
|
||||
hash = "sha256-d2i2P8ZiGb+FYzZIzs0pY2gIRQGGuenLbxrGhafVxVc=";
|
||||
};
|
||||
|
||||
wedges = callPackage ./wedges.nix { };
|
||||
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "oils-for-unix";
|
||||
inherit version src;
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
ninja
|
||||
git
|
||||
re2c
|
||||
cmark
|
||||
which
|
||||
time
|
||||
wedges.python2Wedge
|
||||
wedges.python3Wedge
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
|
|
@ -64,28 +52,18 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
|
||||
substituteInPlace doctools/cmark.py \
|
||||
--replace-quiet "raise AssertionError('bin/cmark not found')" \
|
||||
"cmark_path = '${cmark}/bin/cmark'"
|
||||
"cmark_path = '${finalAttrs.passthru.wedge.cmark}/bin/cmark'"
|
||||
'';
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
|
||||
./configure \
|
||||
--datarootdir=$out \
|
||||
--with-readline \
|
||||
--readline=${wedges.readline-all}
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
configureFlags = [
|
||||
"--datarootdir=${placeholder "out"}"
|
||||
"--with-readline"
|
||||
"--readline=${finalAttrs.passthru.wedge.readline-all}"
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
export PATH="${wedges.python2Wedge}/bin:${wedges.python3Wedge}/bin:$PATH"
|
||||
export PATH="${wedges.mypyWedge}/bin:$PATH"
|
||||
export PYTHONPATH="${wedges.mypyWedge}/lib/python3.10/site-packages:.:vendor/"
|
||||
export LD_LIBRARY_PATH="${wedges.python2Wedge}/lib:${wedges.python3Wedge}/lib:''${LD_LIBRARY_PATH:-}"
|
||||
|
||||
build/py.sh configure-for-dev
|
||||
build/stamp.sh write-git-commit
|
||||
build/py.sh py-source
|
||||
|
|
@ -108,7 +86,23 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
runHook postInstall
|
||||
'';
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=incompatible-function-pointer-types";
|
||||
env = {
|
||||
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=incompatible-function-pointer-types";
|
||||
PYTHONPATH = "${finalAttrs.passthru.wedge.mypy}:${finalAttrs.passthru.wedge.py3-libs}/lib/python3.10/site-packages:.:vendor/";
|
||||
LD_LIBRARY_PATH = "${finalAttrs.passthru.wedge.python2}/lib:${finalAttrs.passthru.wedge.python3}/lib";
|
||||
};
|
||||
|
||||
preBuild = ''
|
||||
export PATH="${
|
||||
lib.makeBinPath [
|
||||
finalAttrs.passthru.wedge.python2
|
||||
finalAttrs.passthru.wedge.python3
|
||||
finalAttrs.passthru.wedge.re2c
|
||||
finalAttrs.passthru.wedge.cmark
|
||||
finalAttrs.passthru.wedge.py3-libs
|
||||
]
|
||||
}:$PATH"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Oils is our upgrade path from bash to a better language and runtime";
|
||||
|
|
@ -119,7 +113,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
};
|
||||
|
||||
passthru = {
|
||||
inherit wedges;
|
||||
wedge = callPackage ./wedge.nix { oilsSrc = finalAttrs.src; };
|
||||
|
||||
withSrc = newSrc: finalAttrs.finalPackage.overrideAttrs { src = newSrc; };
|
||||
}
|
||||
|
|
@ -128,7 +122,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
mkShell =
|
||||
shellName:
|
||||
symlinkJoin {
|
||||
name = "oils-for-unix-${shellName}-${version}";
|
||||
name = "oils-for-unix-${shellName}-${finalAttrs.version}";
|
||||
paths = [ finalAttrs.finalPackage ];
|
||||
passthru.shellPath = "/bin/${shellName}";
|
||||
meta = finalAttrs.meta // {
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
pip==26.0.1
|
||||
setuptools==82.0.0
|
||||
wheel==0.46.3
|
||||
packaging==24.2
|
||||
typing_extensions==4.15.0
|
||||
mypy_extensions==0.4.3
|
||||
typed_ast==1.5.5
|
||||
mypy==0.780
|
||||
149
wedge.nix
Normal file
149
wedge.nix
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
{
|
||||
stdenv,
|
||||
stdenvNoCC,
|
||||
symlinkJoin,
|
||||
pkg-config,
|
||||
cacert,
|
||||
gitMinimal,
|
||||
wget,
|
||||
cmake,
|
||||
ninja,
|
||||
python3,
|
||||
autoconf,
|
||||
automake,
|
||||
libtool,
|
||||
openssl,
|
||||
zlib,
|
||||
libffi,
|
||||
readline,
|
||||
ncurses,
|
||||
bzip2,
|
||||
xz,
|
||||
gdbm,
|
||||
sqlite,
|
||||
oilsSrc,
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
depsSource = stdenvNoCC.mkDerivation {
|
||||
name = "oils-deps-source";
|
||||
src = oilsSrc;
|
||||
|
||||
nativeBuildInputs = [
|
||||
cacert
|
||||
gitMinimal
|
||||
wget
|
||||
];
|
||||
|
||||
dontConfigure = true;
|
||||
dontFixup = true;
|
||||
|
||||
env.SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
|
||||
buildPhase = ''
|
||||
# Fix 404: old blob URL moved to op.oils.pub
|
||||
sed -i 's|www.oilshell.org/blob|op.oils.pub/blob|g' build/deps.sh
|
||||
|
||||
bash build/deps.sh fetch
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
# Remove .git folders
|
||||
find _build/deps-source -name .git -print0 | xargs -0 rm -rf
|
||||
|
||||
mv _build/deps-source $out
|
||||
'';
|
||||
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "sha256-TXIFiCCLtyuhEKncJ1nI11hUeMGgoqabUPzhSyN4Trw=";
|
||||
};
|
||||
|
||||
deps = stdenv.mkDerivation {
|
||||
name = "oils-deps";
|
||||
src = oilsSrc;
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
cmake
|
||||
ninja
|
||||
python3
|
||||
autoconf
|
||||
automake
|
||||
libtool
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
readline
|
||||
ncurses
|
||||
zlib
|
||||
bzip2
|
||||
openssl
|
||||
libffi
|
||||
xz
|
||||
gdbm
|
||||
sqlite
|
||||
];
|
||||
|
||||
# Disable ensurepip for python3
|
||||
env.with_ensurepip = "no";
|
||||
|
||||
configurePhase = ''
|
||||
patchShebangs build/ deps/
|
||||
mkdir -p _build/deps-source
|
||||
cp -r ${depsSource}/* _build/deps-source/
|
||||
chmod -R u+w _build/deps-source
|
||||
mkdir -p ../oils.DEPS/wedge
|
||||
|
||||
# Skip spec-bin-wedges (only needed for testing)
|
||||
substituteInPlace build/deps.sh \
|
||||
--replace-fail 'spec-bin-wedges "$how"' '# spec-bin-wedges "$how"'
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
bash build/deps.sh install-wedges
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cp -r ../oils.DEPS/wedge/* $out/
|
||||
'';
|
||||
};
|
||||
|
||||
readline-all = symlinkJoin {
|
||||
name = "readline-all";
|
||||
paths = [
|
||||
readline
|
||||
readline.dev
|
||||
];
|
||||
};
|
||||
|
||||
# Script to check manifest matches print-wedge-list
|
||||
checkManifest = stdenvNoCC.mkDerivation {
|
||||
name = "check-oils-manifest";
|
||||
src = oilsSrc;
|
||||
nativeBuildInputs = [ python3 ];
|
||||
dontConfigure = true;
|
||||
dontFixup = true;
|
||||
buildPhase = ''
|
||||
patchShebangs build/
|
||||
# Skip spec-bin-wedges to match deps derivation
|
||||
substituteInPlace build/deps.sh \
|
||||
--replace-fail 'spec-bin-wedges "$how"' '# spec-bin-wedges "$how"'
|
||||
diff ${./manifest} <(bash build/deps.sh print-wedge-list)
|
||||
'';
|
||||
installPhase = ''
|
||||
echo "Manifest check passed" > $out
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
inherit depsSource deps readline-all checkManifest;
|
||||
|
||||
python2 = "${deps}/python2/2.7.18";
|
||||
python3 = "${deps}/python3/3.10.4";
|
||||
re2c = "${deps}/re2c/3.0";
|
||||
cmark = "${deps}/cmark/0.29.0";
|
||||
mypy = "${deps}/mypy/0.780";
|
||||
py3-libs = "${deps}/py3-libs/0.780";
|
||||
}
|
||||
174
wedges.nix
174
wedges.nix
|
|
@ -1,174 +0,0 @@
|
|||
# Wedge derivations for oils-for-unix
|
||||
#
|
||||
# These mirror oils' upstream wedge system (build/deps.sh):
|
||||
# - Python 2.7 and 3.10 built from official tarballs
|
||||
# - mypy and dependencies downloaded via pip (FOD)
|
||||
# - mypy installed in a venv from cached packages
|
||||
|
||||
{
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
fetchurl,
|
||||
symlinkJoin,
|
||||
pkg-config,
|
||||
cacert,
|
||||
openssl,
|
||||
zlib,
|
||||
libffi,
|
||||
readline,
|
||||
ncurses,
|
||||
bzip2,
|
||||
xz,
|
||||
gdbm,
|
||||
sqlite,
|
||||
}:
|
||||
|
||||
let
|
||||
mkPythonWedge =
|
||||
{
|
||||
version,
|
||||
hash,
|
||||
extraConfigureFlags ? [ ],
|
||||
}:
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "oils-python-wedge";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.python.org/ftp/python/${finalAttrs.version}/Python-${finalAttrs.version}.tar.xz";
|
||||
inherit hash;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
buildInputs = [
|
||||
readline
|
||||
ncurses
|
||||
zlib
|
||||
bzip2
|
||||
openssl
|
||||
libffi
|
||||
xz
|
||||
gdbm
|
||||
sqlite
|
||||
];
|
||||
|
||||
env = {
|
||||
CPPFLAGS = "-I${zlib.dev}/include -I${libffi.dev}/include";
|
||||
LDFLAGS = "-L${zlib}/lib -L${libffi}/lib -Wl,-rpath,${placeholder "out"}/lib";
|
||||
PKG_CONFIG_PATH = "${libffi.dev}/lib/pkgconfig:${zlib.dev}/lib/pkgconfig:${openssl.dev}/lib/pkgconfig";
|
||||
LIBFFI_INCLUDEDIR = "${libffi.dev}/include";
|
||||
LIBFFI_LIBDIR = "${libffi}/lib";
|
||||
};
|
||||
|
||||
configureFlags = [
|
||||
"--enable-shared"
|
||||
"--with-system-ffi"
|
||||
] ++ extraConfigureFlags;
|
||||
|
||||
doCheck = false;
|
||||
enableParallelBuilding = true;
|
||||
});
|
||||
|
||||
python2Wedge = mkPythonWedge {
|
||||
version = "2.7.18";
|
||||
hash = "sha256-tiwOeTdVHQzAK4/Vyw9UT5QFuvyaVNOAjtRZSBLt70M=";
|
||||
extraConfigureFlags = [
|
||||
"--enable-unicode=ucs4"
|
||||
"--with-ensurepip=no"
|
||||
];
|
||||
};
|
||||
|
||||
python3Wedge = mkPythonWedge {
|
||||
version = "3.10.4";
|
||||
hash = "sha256-gL+SX1cdpDazUhCIbPefbrX6XWxXExa3NWg0NFH3ehk=";
|
||||
extraConfigureFlags = [
|
||||
"--with-ensurepip=install"
|
||||
];
|
||||
};
|
||||
|
||||
py3LibsCache = stdenv.mkDerivation {
|
||||
name = "oils-py3-libs-cache";
|
||||
|
||||
nativeBuildInputs = [
|
||||
python3Wedge
|
||||
cacert
|
||||
];
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
buildPhase = ''
|
||||
export HOME=$TMPDIR
|
||||
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
|
||||
|
||||
mkdir -p $out
|
||||
|
||||
${python3Wedge}/bin/pip3 install --upgrade pip setuptools wheel
|
||||
|
||||
# Download exact versions (see requirements.txt)
|
||||
${python3Wedge}/bin/pip3 download -d $out --only-binary=:all: --no-deps \
|
||||
-r ${./requirements.txt}
|
||||
'';
|
||||
|
||||
dontInstall = true;
|
||||
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "sha256-dTO5D4vr42A7Pui0i8ggt8rD6xQplG17rGB76M4ntRY=";
|
||||
};
|
||||
|
||||
mypyWedge = stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "oils-mypy-wedge";
|
||||
version = "0.780";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "python";
|
||||
repo = "mypy";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-czwCx6ZjCu3CrVmbI6NbstzWM0GvuPTWJiiUhXSznu4=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ python3Wedge ];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
export HOME=$TMPDIR
|
||||
|
||||
${python3Wedge}/bin/python3 -m venv $out
|
||||
|
||||
# Install all packages from cached wheels (--no-deps to bypass version conflicts)
|
||||
$out/bin/pip install \
|
||||
--no-index \
|
||||
--find-links=${py3LibsCache} \
|
||||
--no-deps \
|
||||
setuptools wheel packaging \
|
||||
typing_extensions mypy_extensions typed_ast \
|
||||
mypy
|
||||
|
||||
# Copy mypy source (mycpp extends mypy classes)
|
||||
cp -r . $out/mypy-src
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
dontInstall = true;
|
||||
dontFixup = true;
|
||||
});
|
||||
|
||||
readline-all = symlinkJoin {
|
||||
name = "readline-all";
|
||||
paths = [
|
||||
readline
|
||||
readline.dev
|
||||
];
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
inherit
|
||||
python2Wedge
|
||||
python3Wedge
|
||||
mypyWedge
|
||||
readline-all
|
||||
;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue