2016-10-07 21:17:08 +02:00
|
|
|
{ stdenv, fetchFromGitHub, llvm, makeWrapper, pcre2, coreutils, which, libressl,
|
|
|
|
cc ? stdenv.cc, lto ? !stdenv.isDarwin }:
|
2015-10-25 11:08:02 +01:00
|
|
|
|
2016-10-07 21:17:08 +02:00
|
|
|
stdenv.mkDerivation ( rec {
|
|
|
|
name = "ponyc-${version}";
|
2018-01-05 18:52:11 +01:00
|
|
|
version = "0.21.2";
|
2015-10-25 11:08:02 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2016-07-27 17:51:19 +02:00
|
|
|
owner = "ponylang";
|
2015-10-25 11:08:02 +01:00
|
|
|
repo = "ponyc";
|
2016-10-07 21:17:08 +02:00
|
|
|
rev = version;
|
2018-01-05 18:52:11 +01:00
|
|
|
sha256 = "0gdkm1mihn266km3q5ma7nhvjpzwdzmy39cxb7kkz8aal2nmvwri";
|
2015-10-25 11:08:02 +01:00
|
|
|
};
|
|
|
|
|
2016-10-07 21:17:08 +02:00
|
|
|
buildInputs = [ llvm makeWrapper which ];
|
|
|
|
propagatedBuildInputs = [ cc ];
|
2015-10-25 11:08:02 +01:00
|
|
|
|
2016-07-27 17:51:19 +02:00
|
|
|
# Disable problematic networking tests
|
|
|
|
patches = [ ./disable-tests.patch ];
|
2015-10-25 11:08:02 +01:00
|
|
|
|
2016-07-27 17:51:19 +02:00
|
|
|
preBuild = ''
|
|
|
|
# Fix tests
|
|
|
|
substituteInPlace packages/process/_test.pony \
|
2016-10-07 21:17:08 +02:00
|
|
|
--replace '"/bin/' '"${coreutils}/bin/'
|
|
|
|
substituteInPlace packages/process/_test.pony \
|
|
|
|
--replace '=/bin' "${coreutils}/bin"
|
|
|
|
|
|
|
|
|
|
|
|
# Fix llvm-ar check for darwin
|
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace "llvm-ar-3.8" "llvm-ar"
|
|
|
|
|
|
|
|
# Remove impure system refs
|
|
|
|
substituteInPlace src/libponyc/pkg/package.c \
|
|
|
|
--replace "/usr/local/lib" ""
|
|
|
|
substituteInPlace src/libponyc/pkg/package.c \
|
|
|
|
--replace "/opt/local/lib" ""
|
|
|
|
|
|
|
|
for file in `grep -irl '/usr/local/opt/libressl/lib' ./*`; do
|
|
|
|
substituteInPlace $file --replace '/usr/local/opt/libressl/lib' "${stdenv.lib.getLib libressl}/lib"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Fix ponypath issue
|
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace "PONYPATH=." "PONYPATH=.:\$(PONYPATH)"
|
2016-07-27 17:51:19 +02:00
|
|
|
|
|
|
|
export LLVM_CONFIG=${llvm}/bin/llvm-config
|
2016-10-07 21:17:08 +02:00
|
|
|
'' + stdenv.lib.optionalString ((!stdenv.isDarwin) && (!cc.isClang) && lto) ''
|
|
|
|
export LTO_PLUGIN=`find ${cc.cc}/ -name liblto_plugin.so`
|
|
|
|
'' + stdenv.lib.optionalString ((!stdenv.isDarwin) && (cc.isClang) && lto) ''
|
|
|
|
export LTO_PLUGIN=`find ${cc.cc}/ -name LLVMgold.so`
|
2015-10-25 11:08:02 +01:00
|
|
|
'';
|
|
|
|
|
2016-10-07 21:17:08 +02:00
|
|
|
makeFlags = [ "config=release" ] ++ stdenv.lib.optionals stdenv.isDarwin [ "bits=64" ]
|
|
|
|
++ stdenv.lib.optionals (stdenv.isDarwin && (!lto)) [ "lto=no" ];
|
2016-07-27 17:51:19 +02:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2016-10-07 21:17:08 +02:00
|
|
|
checkTarget = "test-ci";
|
2015-10-25 11:08:02 +01:00
|
|
|
|
|
|
|
preCheck = ''
|
2016-10-07 21:17:08 +02:00
|
|
|
export PONYPATH="$out/lib:${stdenv.lib.makeLibraryPath [ pcre2 libressl ]}"
|
2015-10-25 11:08:02 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2016-10-07 21:17:08 +02:00
|
|
|
make config=release prefix=$out ''
|
|
|
|
+ stdenv.lib.optionalString stdenv.isDarwin '' bits=64 ''
|
|
|
|
+ stdenv.lib.optionalString (stdenv.isDarwin && (!lto)) '' lto=no ''
|
|
|
|
+ '' install
|
2015-10-25 11:08:02 +01:00
|
|
|
mv $out/bin/ponyc $out/bin/ponyc.wrapped
|
|
|
|
makeWrapper $out/bin/ponyc.wrapped $out/bin/ponyc \
|
2016-10-07 21:17:08 +02:00
|
|
|
--prefix PONYPATH : "$out/lib" \
|
|
|
|
--prefix PONYPATH : "${stdenv.lib.getLib pcre2}/lib" \
|
|
|
|
--prefix PONYPATH : "${stdenv.lib.getLib libressl}/lib"
|
2015-10-25 11:08:02 +01:00
|
|
|
'';
|
|
|
|
|
2016-10-07 21:17:08 +02:00
|
|
|
# Stripping breaks linking for ponyc
|
|
|
|
dontStrip = true;
|
|
|
|
|
2017-03-21 13:12:24 +01:00
|
|
|
meta = with stdenv.lib; {
|
2015-10-25 11:08:02 +01:00
|
|
|
description = "Pony is an Object-oriented, actor-model, capabilities-secure, high performance programming language";
|
|
|
|
homepage = http://www.ponylang.org;
|
2017-03-21 13:12:24 +01:00
|
|
|
license = licenses.bsd2;
|
2017-08-29 20:26:24 +02:00
|
|
|
maintainers = with maintainers; [ doublec kamilchm patternspandemic ];
|
2017-03-21 13:12:24 +01:00
|
|
|
platforms = subtractLists platforms.i686 platforms.unix;
|
2015-10-25 11:08:02 +01:00
|
|
|
};
|
2016-10-07 21:17:08 +02:00
|
|
|
})
|