mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-15 19:23:01 +03:00
mrbgems: Add mruby-zmq
This commit is contained in:
parent
efd31433ba
commit
2b57dd33e3
@ -1,4 +1,12 @@
|
||||
{ stdenvNoCC, lib, fetchFromGitHub, fetchpatch, libffi }:
|
||||
{ stdenvNoCC
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
|
||||
, libffi
|
||||
, pkg-config
|
||||
, zeromq
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib) licenses;
|
||||
@ -343,4 +351,42 @@ rec {
|
||||
|
||||
meta.licenses = licenses.mit;
|
||||
};
|
||||
|
||||
mruby-zmq = mkGem {
|
||||
src = fetchFromGitHub {
|
||||
repo = "mruby-zmq";
|
||||
owner = "zeromq";
|
||||
rev = "39b6dab7cb944595064ca3e9376637024d3bf483";
|
||||
sha256 = "03n9890wx18v7pwnk5w8s10l7yij6hyj8y5q4jf296k56dr4g01m";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
url = "https://github.com/zeromq/mruby-zmq/pull/16.patch";
|
||||
sha256 = "1m63yl84hg80whqpr3yznk06yalaasiszwm3pjvsr2di8gyi0bm5";
|
||||
})
|
||||
./mruby-zmq/0001-Work-around-missing-pthread.patch
|
||||
./mruby-zmq/0001-HACK-cross-build-is-not-special-with-Nixpkgs.patch
|
||||
];
|
||||
|
||||
gemBuildInputs = [
|
||||
(zeromq.override {
|
||||
enableDrafts = true;
|
||||
})
|
||||
];
|
||||
|
||||
gemNativeBuildInputs = [
|
||||
pkg-config
|
||||
];
|
||||
|
||||
requiredGems = [
|
||||
mruby-errno
|
||||
mruby-proc-irep-ext
|
||||
mruby-simplemsgpack
|
||||
mruby-pack
|
||||
mruby-env
|
||||
];
|
||||
|
||||
meta.licenses = licenses.mpl20;
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
From c959a7e964c2f203e6a46405feb3bd036d460f5f Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
|
||||
Date: Tue, 27 Oct 2020 00:26:16 -0400
|
||||
Subject: [PATCH] =?UTF-8?q?[HACK]=C2=A0cross-build=20is=20not=20special=20?=
|
||||
=?UTF-8?q?with=20Nixpkgs?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
mrbgem.rake | 12 ------------
|
||||
1 file changed, 12 deletions(-)
|
||||
|
||||
diff --git a/mrbgem.rake b/mrbgem.rake
|
||||
index ff42825..30fd90d 100644
|
||||
--- a/mrbgem.rake
|
||||
+++ b/mrbgem.rake
|
||||
@@ -31,18 +31,6 @@ MRuby::Gem::Specification.new('mruby-zmq') do |spec|
|
||||
end
|
||||
if spec.build.toolchains.include? 'visualcpp'
|
||||
spec.linker.libraries << 'libzmq'
|
||||
- elsif build.is_a?(MRuby::CrossBuild)
|
||||
- unless File.exists?("#{spec.build_dir}/lib/libzmq.a")
|
||||
- sh "cd #{spec.dir}/libzmq && ./autogen.sh && mkdir -p #{spec.build_dir}/build && cd #{spec.build_dir}/build && #{spec.dir}/libzmq/configure CC=\"#{spec.cc.command}\" CFLAGS=\"#{spec.cc.flags.join(' ')}\" LDFLAGS=\"#{spec.linker.flags.join(' ')}\" CXX=\"#{spec.cxx.command}\" CXXFLAGS=\"#{spec.cxx.flags.join(' ')}\" --host=#{build.host_target} --build=#{build.build_target} --disable-shared --enable-static --without-docs --prefix=#{spec.build_dir} && make -j4 && make install"
|
||||
- end
|
||||
- spec.linker.flags_before_libraries << "\"#{spec.build_dir}/lib/libzmq.a\" -pthread"
|
||||
- spec.linker.libraries << 'stdc++'
|
||||
- spec.cc.include_paths << "#{spec.build_dir}/include"
|
||||
- spec.cxx.include_paths << "#{spec.build_dir}/include"
|
||||
- build.cc.include_paths << "#{spec.build_dir}/include"
|
||||
- build.cxx.include_paths << "#{spec.build_dir}/include"
|
||||
- spec.cxx.defines << 'ZMQ_BUILD_DRAFT_API=1'
|
||||
- spec.cc.defines << 'ZMQ_BUILD_DRAFT_API=1'
|
||||
else
|
||||
`pkg-config --cflags libzmq 2>/dev/null`.split("\s").each do |cflag|
|
||||
spec.cxx.flags << cflag
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,24 @@
|
||||
From 772fade0232b98460ba9557eba703593226ce804 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
|
||||
Date: Fri, 23 Oct 2020 20:59:10 -0400
|
||||
Subject: [PATCH] Work around missing -pthread
|
||||
|
||||
It is unknown why `pkg-config` does not return `-pthread` for zeromq.
|
||||
|
||||
---
|
||||
mrbgem.rake | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/mrbgem.rake b/mrbgem.rake
|
||||
index ff42825..3b7ebdc 100644
|
||||
--- a/mrbgem.rake
|
||||
+++ b/mrbgem.rake
|
||||
@@ -75,4 +75,5 @@ MRuby::Gem::Specification.new('mruby-zmq') do |spec|
|
||||
spec.cc.defines << 'ZMQ_BUILD_DRAFT_API=1'
|
||||
end
|
||||
end
|
||||
+ spec.linker.flags_before_libraries << "-pthread"
|
||||
end
|
||||
--
|
||||
2.28.0
|
||||
|
Loading…
Reference in New Issue
Block a user