summary refs log tree commit diff
path: root/pkgs/development/libraries/libfsm
diff options
context:
space:
mode:
authorAustin Seipp <as@fastly.com>2019-06-16 12:45:36 -0500
committerAustin Seipp <aseipp@pobox.com>2019-06-16 16:39:42 -0500
commite6a0514aaf563e4dd079cf82892237b95f54f0e6 (patch)
tree8e4d659174cec2b3b619fc5384bbd5971673454d /pkgs/development/libraries/libfsm
parent9e84b40423697682a3bd579c0621ec640ceef9cd (diff)
downloadnixpkgs-e6a0514aaf563e4dd079cf82892237b95f54f0e6.tar
nixpkgs-e6a0514aaf563e4dd079cf82892237b95f54f0e6.tar.gz
nixpkgs-e6a0514aaf563e4dd079cf82892237b95f54f0e6.tar.bz2
nixpkgs-e6a0514aaf563e4dd079cf82892237b95f54f0e6.tar.lz
nixpkgs-e6a0514aaf563e4dd079cf82892237b95f54f0e6.tar.xz
nixpkgs-e6a0514aaf563e4dd079cf82892237b95f54f0e6.tar.zst
nixpkgs-e6a0514aaf563e4dd079cf82892237b95f54f0e6.zip
libfsm: init at 0.1pre1869_f70c3c5
Signed-off-by: Austin Seipp <as@fastly.com>
Diffstat (limited to 'pkgs/development/libraries/libfsm')
-rw-r--r--pkgs/development/libraries/libfsm/default.nix53
1 files changed, 53 insertions, 0 deletions
diff --git a/pkgs/development/libraries/libfsm/default.nix b/pkgs/development/libraries/libfsm/default.nix
new file mode 100644
index 00000000000..5491fab3edf
--- /dev/null
+++ b/pkgs/development/libraries/libfsm/default.nix
@@ -0,0 +1,53 @@
+{ stdenv, fetchFromGitHub
+, bmake
+}:
+
+stdenv.mkDerivation rec {
+  name    = "libfsm-${version}";
+  version = "0.1pre1869_${builtins.substring 0 7 src.rev}";
+
+  src = fetchFromGitHub {
+    owner  = "katef";
+    repo   = "libfsm";
+    rev    = "f70c3c5778a79eeecb52f9fd35c7cbc241db0ed6";
+    sha256 = "1hgv272jdv6dwnsdjajyky537z84q0cwzspw9br46qj51h8gkwvx";
+    fetchSubmodules = true;
+  };
+
+  nativeBuildInputs = [ bmake ];
+  enableParallelBuilding = true;
+
+  # note: build checks value of '$CC' to add some extra cflags, but we don't
+  # necessarily know which 'stdenv' someone chose, so we leave it alone (e.g.
+  # if we use stdenv vs clangStdenv, we don't know which, and CC=cc in all
+  # cases.) it's unclear exactly what should be done if we want those flags,
+  # but the defaults work fine.
+  buildPhase = "PREFIX=$out bmake -r install";
+
+  # fix up multi-output install. we also have to fix the pkgconfig libdir
+  # file; it uses prefix=$out; libdir=${prefix}/lib, which is wrong in
+  # our case; libdir should really be set to the $lib output.
+  installPhase = ''
+    mkdir -p $lib $dev/lib
+
+    mv $out/lib             $lib/lib
+    mv $out/include         $dev/include
+    mv $out/share/pkgconfig $dev/lib/pkgconfig
+    rmdir $out/share
+
+    for x in libfsm.pc libre.pc; do
+      substituteInPlace "$dev/lib/pkgconfig/$x" \
+        --replace 'libdir=''${prefix}/lib' "libdir=$lib/lib"
+    done
+  '';
+
+  outputs = [ "out" "lib" "dev" ];
+
+  meta = with stdenv.lib; {
+    description = "DFA regular expression library & friends";
+    homepage    = "https://github.com/katef/libfsm";
+    license     = licenses.bsd2;
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ thoughtpolice ];
+  };
+}