2021-01-19 07:50:56 +01:00
|
|
|
{ lib, stdenv, fetchgit, libusb1, pkg-config, pmutils, udev} :
|
2014-10-27 18:39:45 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
version = "2.1.1";
|
|
|
|
daemonlib = fetchgit {
|
|
|
|
url = "https://github.com/Tinkerforge/daemonlib.git";
|
|
|
|
rev = "refs/tags/brickd-${version}";
|
|
|
|
sha256 = "097kaz7d0rzg0ijvcna3y620k3m5fgxpqsac5gbhah8pd7vlj1a4";
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2019-08-13 23:52:01 +02:00
|
|
|
stdenv.mkDerivation {
|
2019-08-13 23:52:01 +02:00
|
|
|
pname = "brickd";
|
|
|
|
inherit version;
|
2014-11-06 01:44:33 +01:00
|
|
|
|
2014-10-27 18:39:45 +01:00
|
|
|
src = fetchgit {
|
|
|
|
url = "git://github.com/Tinkerforge/brickd.git";
|
|
|
|
rev = "refs/tags/v${version}";
|
2016-06-02 13:26:44 +02:00
|
|
|
sha256 = "0m2q01sbgf8z4559jpr6k3jivb8x98vxv1fhgx8nfcjbwz1q83gb";
|
2014-10-27 18:39:45 +01:00
|
|
|
};
|
|
|
|
|
2021-01-19 07:50:56 +01:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2020-04-24 23:39:32 +02:00
|
|
|
buildInputs = [ libusb1 pmutils udev ];
|
2014-11-06 01:44:33 +01:00
|
|
|
|
2014-10-27 18:39:45 +01:00
|
|
|
# shell thing didn't work so i replaced it using nix
|
|
|
|
prePatch = ''
|
|
|
|
substituteInPlace src/brickd/Makefile --replace 'PKG_CONFIG := $(shell which pkg-config 2> /dev/null)' "PKG_CONFIG := $pkgconfig/bin/pkg_config";
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
export
|
|
|
|
# build the brickd binary
|
|
|
|
mkdir src/daemonlib
|
|
|
|
cp -r ${daemonlib}/* src/daemonlib
|
|
|
|
cd src/brickd
|
|
|
|
make
|
|
|
|
|
|
|
|
# build and execute the unit tests
|
|
|
|
cd ../tests
|
|
|
|
make
|
|
|
|
for i in array_test base58_test node_test putenv_test queue_test sha1_test; do
|
|
|
|
echo "running unit test $i:"
|
|
|
|
./$i
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
cd ../brickd
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp brickd $out/bin/brickd
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://www.tinkerforge.com/";
|
2014-11-11 14:20:43 +01:00
|
|
|
description = "A daemon (or service on Windows) that acts as a bridge between the Bricks/Bricklets and the API bindings for the different programming languages";
|
2021-01-15 08:07:56 +01:00
|
|
|
maintainers = [ lib.maintainers.qknight ];
|
|
|
|
license = lib.licenses.gpl2;
|
|
|
|
platforms = lib.platforms.all;
|
2014-10-27 18:39:45 +01:00
|
|
|
};
|
|
|
|
}
|