about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/ponyc
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/ponyc')
-rw-r--r--nixpkgs/pkgs/development/compilers/ponyc/default.nix79
-rw-r--r--nixpkgs/pkgs/development/compilers/ponyc/disable-tests.patch14
-rw-r--r--nixpkgs/pkgs/development/compilers/ponyc/pony-stable.nix25
3 files changed, 118 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/ponyc/default.nix b/nixpkgs/pkgs/development/compilers/ponyc/default.nix
new file mode 100644
index 000000000000..749fbcc2fafb
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/ponyc/default.nix
@@ -0,0 +1,79 @@
+{ stdenv, fetchFromGitHub, llvm, makeWrapper, pcre2, coreutils, which, libressl,
+  cc ? stdenv.cc, lto ? !stdenv.isDarwin }:
+
+stdenv.mkDerivation ( rec {
+  pname = "ponyc";
+  version = "0.28.0";
+
+  src = fetchFromGitHub {
+    owner = "ponylang";
+    repo = pname;
+    rev = version;
+    sha256 = "011qxhiq75j6d37ws4nb6a8bdfw2cvlcsb2fgdkn1hx2xb81h6wc";
+  };
+
+  buildInputs = [ llvm makeWrapper which ];
+  propagatedBuildInputs = [ cc ];
+
+  # Disable problematic networking tests
+  patches = [ ./disable-tests.patch ];
+
+  preBuild = ''
+    # Fix tests
+    substituteInPlace packages/process/_test.pony \
+        --replace '"/bin/' '"${coreutils}/bin/'
+    substituteInPlace packages/process/_test.pony \
+        --replace '=/bin' "${coreutils}/bin"
+
+    # Remove impure system refs
+    substituteInPlace src/libponyc/pkg/package.c \
+        --replace "/usr/local/lib" "" \
+        --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
+
+    export LLVM_CONFIG=${llvm}/bin/llvm-config
+  '' + 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`
+  '';
+
+  makeFlags = [ "config=release" ] ++ stdenv.lib.optionals stdenv.isDarwin [ "bits=64" ]
+              ++ stdenv.lib.optionals (stdenv.isDarwin && (!lto)) [ "lto=no" ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  checkTarget = "test-ci";
+
+  preCheck = ''
+    export PONYPATH="$out/lib:${stdenv.lib.makeLibraryPath [ pcre2 libressl ]}"
+  '';
+
+  installPhase = ''
+    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") ]}"
+  '';
+
+  # Stripping breaks linking for ponyc
+  dontStrip = true;
+
+  meta = with stdenv.lib; {
+    description = "Pony is an Object-oriented, actor-model, capabilities-secure, high performance programming language";
+    homepage = https://www.ponylang.org;
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ doublec kamilchm patternspandemic ];
+    platforms = [ "x86_64-linux" "x86_64-darwin" ];
+  };
+})
diff --git a/nixpkgs/pkgs/development/compilers/ponyc/disable-tests.patch b/nixpkgs/pkgs/development/compilers/ponyc/disable-tests.patch
new file mode 100644
index 000000000000..f8c996137af9
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/ponyc/disable-tests.patch
@@ -0,0 +1,14 @@
+diff --git a/packages/net/_test.pony b/packages/net/_test.pony
+index baf29e7..b63f368 100644
+--- a/packages/net/_test.pony
++++ b/packages/net/_test.pony
+@@ -5,9 +5,6 @@ actor Main is TestList
+   new make() => None
+ 
+   fun tag tests(test: PonyTest) =>
+-    ifdef not osx then
+-      test(_TestBroadcast)
+-    end
+     test(_TestTCPWritev)
+     test(_TestTCPExpect)
+     test(_TestTCPMute)
diff --git a/nixpkgs/pkgs/development/compilers/ponyc/pony-stable.nix b/nixpkgs/pkgs/development/compilers/ponyc/pony-stable.nix
new file mode 100644
index 000000000000..821a9b8125cd
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/ponyc/pony-stable.nix
@@ -0,0 +1,25 @@
+{stdenv, fetchFromGitHub, ponyc }:
+
+stdenv.mkDerivation rec {
+  name = "pony-stable-${version}";
+  version = "0.2.0";
+
+  src = fetchFromGitHub {
+    owner = "ponylang";
+    repo = "pony-stable";
+    rev = version;
+    sha256 = "0zzcq0vsl6kcrsxwqzd3s9mq7aq5sg8si5c83rxyi9n6a06gnbh7";
+  };
+
+  buildInputs = [ ponyc ];
+
+  installFlags = [ "prefix=${placeholder "out"}" "install" ];
+
+  meta = {
+    description = "A simple dependency manager for the Pony language.";
+    homepage = https://www.ponylang.org;
+    license = stdenv.lib.licenses.bsd2;
+    maintainers = with stdenv.lib.maintainers; [ dipinhora kamilchm patternspandemic ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}