Migrate to wedges
This commit is contained in:
parent
cf19b5725f
commit
cda034b29e
8 changed files with 242 additions and 151 deletions
144
package.nix
Normal file
144
package.nix
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
callPackage,
|
||||
symlinkJoin,
|
||||
pkg-config,
|
||||
ninja,
|
||||
git,
|
||||
re2c,
|
||||
cmark,
|
||||
which,
|
||||
time,
|
||||
readline,
|
||||
ncurses,
|
||||
zlib,
|
||||
libffi,
|
||||
}:
|
||||
|
||||
let
|
||||
version = "0.37.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "oils-for-unix";
|
||||
repo = "oils";
|
||||
rev = "release/${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 = [
|
||||
readline
|
||||
ncurses
|
||||
zlib
|
||||
libffi
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs .
|
||||
|
||||
substituteInPlace build/dynamic-deps.sh \
|
||||
--replace-quiet '/usr/bin/env' "$(command -v env)"
|
||||
|
||||
substituteInPlace pyext/posixmodule.c \
|
||||
--replace-quiet '_PyVerify_fd(fd)' '1'
|
||||
|
||||
substituteInPlace doctools/cmark.py \
|
||||
--replace-quiet "raise AssertionError('bin/cmark not found')" \
|
||||
"cmark_path = '${cmark}/bin/cmark'"
|
||||
'';
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
|
||||
./configure \
|
||||
--datarootdir=$out \
|
||||
--with-readline \
|
||||
--readline=${wedges.readline-all}
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
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
|
||||
build/py.sh py-extensions
|
||||
build/doc.sh all-ref
|
||||
./NINJA-config.sh
|
||||
ninja _bin/cxx-opt/oils-for-unix
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin
|
||||
install -m755 _bin/cxx-opt/oils-for-unix $out/bin/oils-for-unix
|
||||
ln -s oils-for-unix $out/bin/osh
|
||||
ln -s oils-for-unix $out/bin/ysh
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=incompatible-function-pointer-types";
|
||||
|
||||
meta = {
|
||||
description = "Oils is our upgrade path from bash to a better language and runtime";
|
||||
homepage = "https://www.oilshell.org/";
|
||||
license = lib.licenses.asl20;
|
||||
platforms = lib.platforms.unix;
|
||||
mainProgram = "osh";
|
||||
};
|
||||
|
||||
passthru = {
|
||||
inherit wedges;
|
||||
|
||||
withSrc = newSrc: finalAttrs.finalPackage.overrideAttrs { src = newSrc; };
|
||||
}
|
||||
// (
|
||||
let
|
||||
mkShell =
|
||||
shellName:
|
||||
symlinkJoin {
|
||||
name = "oils-for-unix-${shellName}-${version}";
|
||||
paths = [ finalAttrs.finalPackage ];
|
||||
passthru.shellPath = "/bin/${shellName}";
|
||||
meta = finalAttrs.meta // {
|
||||
mainProgram = shellName;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
osh = mkShell "osh";
|
||||
ysh = mkShell "ysh";
|
||||
}
|
||||
);
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue