1{ stdenv, lib, fetchFromGitHub, pkg-config, glib, libglibutil }:
2
3stdenv.mkDerivation rec {
4 pname = "libgbinder";
5 version = "1.1.40";
6
7 src = fetchFromGitHub {
8 owner = "mer-hybris";
9 repo = pname;
10 rev = version;
11 sha256 = "sha256-bv3UeL5xx28N/fSG1BeUSbbSvDaNgehpnx2OzIIaSXw=";
12 };
13
14 outputs = [ "out" "dev" ];
15
16 nativeBuildInputs = [
17 pkg-config
18 ];
19
20 buildInputs = [
21 glib
22 libglibutil
23 ];
24
25 postPatch = ''
26 # Fix pkg-config and ranlib names for cross-compilation
27 substituteInPlace Makefile \
28 --replace "pkg-config" "$PKG_CONFIG" \
29 --replace "ranlib" "$RANLIB"
30 '';
31
32 makeFlags = [
33 "LIBDIR=$(out)/lib"
34 "INSTALL_INCLUDE_DIR=$(dev)/include/gbinder"
35 "INSTALL_PKGCONFIG_DIR=$(dev)/lib/pkgconfig"
36 ];
37
38 installTargets = [ "install" "install-dev" ];
39
40 postInstall = ''
41 sed -i -e "s@includedir=/usr@includedir=$dev@g" $dev/lib/pkgconfig/$pname.pc
42 sed -i -e "s@Cflags: @Cflags: $($PKG_CONFIG --cflags libglibutil) @g" $dev/lib/pkgconfig/$pname.pc
43 '';
44
45 meta = {
46 description = "GLib-style interface to binder";
47 homepage = "https://github.com/mer-hybris/libgbinder";
48 license = lib.licenses.bsd3;
49 platforms = lib.platforms.linux;
50 maintainers = with lib.maintainers; [ mcaju ];
51 };
52}