@ -1,17 +1,24 @@
{ stdenv , fetchurl , ncurses , libX11 , xproto , buildEnv }:
{ stdenv , fetchurl
, ncurses
, libX11 , xproto , buildEnv
} :
let
useX11 = stdenv . isi686 || stdenv . isx86_64 ;
x11deps = [ libX11 xproto ] ;
inherit ( stdenv . lib ) optionals ;
baseOcamlBranch = " 4 . 0 7 " ;
baseOcamlVersion = " ${ baseOcamlBranch } . 1 " ;
metaocamlPatch = " 1 0 7 " ;
in
stdenv . mkDerivation rec {
name = " b e r - m e t a o c a m l - ${ version } " ;
version = " 1 0 7 " ;
version = metaocamlPatch ;
src = fetchurl {
url = " h t t p s : / / c a m l . i n r i a . f r / p u b / d i s t r i b / o c a m l - 4 . 0 7 / o c a m l - 4 . 0 7 . 1 . t a r . g z " ;
url = " h t t p s : / / c a m l . i n r i a . f r / p u b / d i s t r i b / o c a m l - ${ baseOcamlBranch } / o c a m l - ${ baseOcamlVersion } . t a r . g z " ;
sha256 = " 1 x 4 s l n 1 3 1 m c s p i s r 2 2 q c 3 0 4 5 9 0 r v g 7 2 0 r b l 7 g 2 i 4 x i y m g v h k p m 1 a " ;
} ;
@ -20,21 +27,19 @@ stdenv.mkDerivation rec {
sha256 = " 0 x y 6 n 0 y j 1 f 5 3 p k 6 1 2 z f m n 4 9 p n 0 4 b d 7 5 q a 4 0 x g m r 0 w 0 l z x 6 d q s f m m " ;
} ;
# Needed to avoid a SIGBUS on the final executable on mips
NIX_CFLAGS_COMPILE = if stdenv . isMips then " - f P I C " else " " ;
x11env = buildEnv { name = " x 1 1 e n v " ; paths = [ libX11 xproto ] ; } ;
x11lib = x11env + " / l i b " ;
x11inc = x11env + " / i n c l u d e " ;
x11env = buildEnv { name = " x 1 1 e n v " ; paths = x11deps ; } ;
x11lib = " ${ x11env } / l i b " ;
x11inc = " ${ x11env } / i n c l u d e " ;
prefixKey = " - p r e f i x " ;
configureFlags = optionals useX11 [ " - x 1 1 l i b " x11lib
" - x 1 1 i n c l u d e " x11inc ] ;
configureFlags = optionals useX11
[ " - x 1 1 l i b " x11lib
" - x 1 1 i n c l u d e " x11inc
" - f l a m b d a "
] ;
dontStrip = true ;
buildInputs = [ ncurses ] ++ optionals useX11 [ libX11 xproto ] ;
installFlags = " - i " ;
installTargets = " i n s t a l l " ; # + optionalString useNativeCompilers " installopt";
buildInputs = [ ncurses ] ++ optionals useX11 x11deps ;
postConfigure = ''
tar - xvzf $ metaocaml
@ -42,6 +47,7 @@ stdenv.mkDerivation rec {
make patch
cd . .
'' ;
buildPhase = ''
make world
make - i install
@ -53,13 +59,13 @@ stdenv.mkDerivation rec {
ln - sv $ out/lib/ocaml/caml $ out/include/caml
cd $ { name }
make all
'' ;
installPhase = ''
make install
make install . opt
cd . .
'' ;
installPhase = " " ;
postBuild = ''
'' ;
checkPhase = ''
cd $ { name }
make test
@ -68,16 +74,23 @@ stdenv.mkDerivation rec {
cd . .
'' ;
passthru = {
nativeCompilers = true ;
} ;
meta = with stdenv . lib ; {
homepage = " h t t p : / / o k m i j . o r g / f t p / M L / i n d e x . h t m l # b e r - m e t a o c a m l " ;
license = with licenses ; [
qpl /* c o m p i l e r */
lgpl2 /* l i b r a r y */
] ;
description = " C o n s e r v a t i v e e x t e n s i o n o f O C a m l " ;
description = " M u l t i - S t a g e P r o g r a m m i n g e x t e n s i o n f o r O C a m l " ;
homepage = http://okmij.org/ftp/ML/MetaOCaml.html ;
license = with licenses ; [ /* c o m p i l e r */ qpl /* l i b r a r y */ lgpl2 ] ;
maintainers = with maintainers ; [ thoughtpolice ] ;
branch = baseOcamlBranch ;
platforms = with platforms ; linux ++ darwin ;
broken = stdenv . isAarch64 || stdenv . isMips ;
longDescription = ''
A conservative extension of OCaml with the primitive type of code values ,
and three basic multi-stage expression forms : Brackets , Escape , and Run
A simpl e extension of OCaml with the primitive type of code values , and
three basic multi-stage expression forms : Brackets , Escape , and Run .
'' ;
} ;
}