3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/compilers/ponyc/default.nix

84 lines
2.8 KiB
Nix
Raw Normal View History

2016-10-07 20:17:08 +01:00
{ stdenv, fetchFromGitHub, llvm, makeWrapper, pcre2, coreutils, which, libressl,
cc ? stdenv.cc, lto ? !stdenv.isDarwin }:
2016-10-07 20:17:08 +01:00
stdenv.mkDerivation ( rec {
pname = "ponyc";
version = "0.30.0";
src = fetchFromGitHub {
2016-07-27 16:51:19 +01:00
owner = "ponylang";
repo = pname;
2016-10-07 20:17:08 +01:00
rev = version;
sha256 = "1gs9x4rw4mfv499j3k1brm8gbz7pjl8dyr7v68pa2f563cbzwaq9";
};
2016-10-07 20:17:08 +01:00
buildInputs = [ llvm makeWrapper which ];
propagatedBuildInputs = [ cc ];
2016-07-27 16:51:19 +01:00
# Disable problematic networking tests
patches = [ ./disable-tests.patch ];
2016-07-27 16:51:19 +01:00
preBuild = ''
# Fix tests
substituteInPlace packages/process/_test.pony \
2016-10-07 20:17:08 +01:00
--replace '"/bin/' '"${coreutils}/bin/'
substituteInPlace packages/process/_test.pony \
--replace '=/bin' "${coreutils}/bin"
2019-08-13 15:29:41 +01: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 20:17:08 +01:00
# Remove impure system refs
substituteInPlace src/libponyc/pkg/package.c \
--replace "/usr/local/lib" "" \
2016-10-07 20:17:08 +01: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 16:51:19 +01:00
export LLVM_CONFIG=${llvm}/bin/llvm-config
2016-10-07 20:17:08 +01: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`
'';
2016-10-07 20:17:08 +01:00
makeFlags = [ "config=release" ] ++ stdenv.lib.optionals stdenv.isDarwin [ "bits=64" ]
++ stdenv.lib.optionals (stdenv.isDarwin && (!lto)) [ "lto=no" ];
2016-07-27 16:51:19 +01:00
enableParallelBuilding = true;
doCheck = true;
2016-10-07 20:17:08 +01:00
checkTarget = "test-ci";
preCheck = ''
2016-10-07 20:17:08 +01:00
export PONYPATH="$out/lib:${stdenv.lib.makeLibraryPath [ pcre2 libressl ]}"
'';
installPhase = ''
2016-10-07 20:17:08 +01:00
make config=release prefix=$out ''
+ stdenv.lib.optionalString stdenv.isDarwin '' bits=64 ''
+ stdenv.lib.optionalString (stdenv.isDarwin && (!lto)) '' lto=no ''
+ '' install
wrapProgram $out/bin/ponyc \
--prefix PATH ":" "${stdenv.cc}/bin" \
--set-default CC "$CC" \
--prefix PONYPATH : "${stdenv.lib.makeLibraryPath [ pcre2 libressl (placeholder "out") ]}"
'';
2016-10-07 20:17:08 +01:00
# Stripping breaks linking for ponyc
dontStrip = true;
2017-03-21 12:12:24 +00:00
meta = with stdenv.lib; {
description = "Pony is an Object-oriented, actor-model, capabilities-secure, high performance programming language";
2018-06-27 21:12:57 +01:00
homepage = https://www.ponylang.org;
2017-03-21 12:12:24 +00:00
license = licenses.bsd2;
2017-08-29 19:26:24 +01:00
maintainers = with maintainers; [ doublec kamilchm patternspandemic ];
platforms = [ "x86_64-linux" "x86_64-darwin" ];
};
2016-10-07 20:17:08 +01:00
})