about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/memstream
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-09-27 16:00:58 +0000
committerAlyssa Ross <hi@alyssa.is>2021-09-27 16:00:58 +0000
commitc504e5d19d940926b3ddcf62c983d66f49f3cbb2 (patch)
treeec955e58bcac2cb93b9f8c10786b23f61d40cd7e /nixpkgs/pkgs/development/libraries/memstream
parent72789cefce7b17419815f600fbd18238d89afcc9 (diff)
parent1737f98af6667560e3e4f930312f9b5002649d04 (diff)
downloadnixlib-c504e5d19d940926b3ddcf62c983d66f49f3cbb2.tar
nixlib-c504e5d19d940926b3ddcf62c983d66f49f3cbb2.tar.gz
nixlib-c504e5d19d940926b3ddcf62c983d66f49f3cbb2.tar.bz2
nixlib-c504e5d19d940926b3ddcf62c983d66f49f3cbb2.tar.lz
nixlib-c504e5d19d940926b3ddcf62c983d66f49f3cbb2.tar.xz
nixlib-c504e5d19d940926b3ddcf62c983d66f49f3cbb2.tar.zst
nixlib-c504e5d19d940926b3ddcf62c983d66f49f3cbb2.zip
Merge commit '1737f98af6667560e3e4f930312f9b5002649d04'
Conflicts:
	nixpkgs/nixos/modules/services/networking/ssh/sshd.nix
	nixpkgs/pkgs/applications/networking/irc/weechat/scripts/default.nix
	nixpkgs/pkgs/development/node-packages/default.nix
	nixpkgs/pkgs/development/python-modules/priority/deadline.patch
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/memstream')
-rw-r--r--nixpkgs/pkgs/development/libraries/memstream/default.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/memstream/setup-hook.sh6
2 files changed, 49 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/memstream/default.nix b/nixpkgs/pkgs/development/libraries/memstream/default.nix
new file mode 100644
index 000000000000..90505a56a931
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/memstream/default.nix
@@ -0,0 +1,43 @@
+{ lib, stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "memstream";
+  version = "0.1";
+
+  src = fetchurl {
+    url = "https://piumarta.com/software/memstream/memstream-${version}.tar.gz";
+    sha256 = "0kvdb897g7nyviaz72arbqijk2g2wa61cmi3l5yh48rzr49r3a3a";
+  };
+
+  dontConfigure = true;
+
+  postBuild = ''
+    $AR rcs libmemstream.a memstream.o
+  '';
+
+  doCheck = true;
+  checkPhase = ''
+    runHook preCheck
+
+    ./test | grep "This is a test of memstream"
+
+    runHook postCheck
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    install -D libmemstream.a "$out"/lib/libmemstream.a
+    install -D memstream.h "$out"/include/memstream.h
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    homepage = "https://www.piumarta.com/software/memstream/";
+    description = "memstream.c is an implementation of the POSIX function open_memstream() for BSD and BSD-like operating systems";
+    license = licenses.mit;
+    maintainers = with maintainers; [ veprbl ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/memstream/setup-hook.sh b/nixpkgs/pkgs/development/libraries/memstream/setup-hook.sh
new file mode 100644
index 000000000000..09aabe748841
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/memstream/setup-hook.sh
@@ -0,0 +1,6 @@
+useMemstream () {
+  export NIX_CFLAGS_COMPILE="${NIX_CFLAGS_COMPILE-}${NIX_CFLAGS_COMPILE:+ }-include memstream.h";
+  export NIX_LDFLAGS="${NIX_LDFLAGS-}${NIX_LDFLAGS:+ }-lmemstream";
+}
+
+postHooks+=(useMemstream)