2019-11-18 02:27:42 +01:00
|
|
|
{ stdenv, fetchFromGitHub, llvm, makeWrapper, pcre2, coreutils, which, libressl, libxml2,
|
2016-10-07 21:17:08 +02:00
|
|
|
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 {
|
2019-03-25 00:08:24 +01:00
|
|
|
pname = "ponyc";
|
2019-11-18 02:27:42 +01:00
|
|
|
version = "0.33.0";
|
2015-10-25 11:08:02 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2016-07-27 17:51:19 +02:00
|
|
|
owner = "ponylang";
|
2019-03-25 00:08:24 +01:00
|
|
|
repo = pname;
|
2016-10-07 21:17:08 +02:00
|
|
|
rev = version;
|
2019-11-18 02:27:42 +01:00
|
|
|
sha256 = "0a0sw902nrayg0s1zrkhfpvrmdqw19nif67hsv0ijrckcq37bjcz";
|
2015-10-25 11:08:02 +01:00
|
|
|
};
|
|
|
|
|
2019-11-18 02:27:42 +01:00
|
|
|
buildInputs = [ llvm makeWrapper which libxml2 ];
|
2016-10-07 21:17:08 +02:00
|
|
|
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"
|
|
|
|
|
2019-08-13 16:29:41 +02:00
|
|
|
# Disabling the stdlib tests
|
|
|
|
substituteInPlace Makefile-ponyc \
|
|
|
|
--replace 'test-ci: all check-version test-core test-stdlib-debug test-stdlib' 'test-ci: all check-version test-core'
|
|
|
|
|
2016-10-07 21:17:08 +02:00
|
|
|
# Remove impure system refs
|
|
|
|
substituteInPlace src/libponyc/pkg/package.c \
|
2019-03-02 09:08:34 +01:00
|
|
|
--replace "/usr/local/lib" "" \
|
2016-10-07 21:17:08 +02:00
|
|
|
--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
|
|
|
|
|
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
|
2018-01-11 03:16:01 +01:00
|
|
|
|
|
|
|
wrapProgram $out/bin/ponyc \
|
|
|
|
--prefix PATH ":" "${stdenv.cc}/bin" \
|
|
|
|
--set-default CC "$CC" \
|
2019-03-02 09:08:34 +01:00
|
|
|
--prefix PONYPATH : "${stdenv.lib.makeLibraryPath [ pcre2 libressl (placeholder "out") ]}"
|
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";
|
2018-06-27 22:12:57 +02:00
|
|
|
homepage = https://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 ];
|
2018-01-23 20:41:57 +01:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
2015-10-25 11:08:02 +01:00
|
|
|
};
|
2016-10-07 21:17:08 +02:00
|
|
|
})
|