From 37e6fd602685136a98fc0ff1db1672ca86e4cf74 Mon Sep 17 00:00:00 2001 From: yuu Date: Tue, 9 Nov 2021 11:28:06 -0300 Subject: [PATCH] stargate-libcds: init at 1.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: figsoda Co-authored-by: Jonathan Ringer Co-authored-by: Sandro Jäckel --- .../libraries/stargate-libcds/Makefile.patch | 19 ++++++++ .../libraries/stargate-libcds/default.nix | 47 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 68 insertions(+) create mode 100644 pkgs/development/libraries/stargate-libcds/Makefile.patch create mode 100644 pkgs/development/libraries/stargate-libcds/default.nix diff --git a/pkgs/development/libraries/stargate-libcds/Makefile.patch b/pkgs/development/libraries/stargate-libcds/Makefile.patch new file mode 100644 index 000000000000..b5b116b78bec --- /dev/null +++ b/pkgs/development/libraries/stargate-libcds/Makefile.patch @@ -0,0 +1,19 @@ +diff --git a/Makefile b/Makefile +index 872af46..7eba8a1 100644 +--- a/Makefile ++++ b/Makefile +@@ -156,13 +156,7 @@ test: + # Compile and run the test suite through Valgrind to check for + # memory errors, then generate an HTML code coverage report + # using gcovr +- $(CC) $(CC_ARGS) -O0 $(DEBUG_FLAGS) $(PLAT_FLAGS) $(GCOVARGS) \ ++ $(CC) $(CC_ARGS) -O0 $(DEBUG_FLAGS) $(PLAT_FLAGS) \ + $(shell find src tests -name *.c) \ + -Iinclude \ + -o $(NAME).tests +- # If Valgrind exits non-zero, try running 'gdb ./libcds.tests' +- # to debug the test suite +- valgrind ./$(NAME).tests --track-origins=yes --leak-check=full +- mkdir html || rm -rf html/* +- gcovr -r . --exclude=bench --html --html-details -o html/coverage.html +- $(BROWSER) html/coverage.html & diff --git a/pkgs/development/libraries/stargate-libcds/default.nix b/pkgs/development/libraries/stargate-libcds/default.nix new file mode 100644 index 000000000000..409d9e820fce --- /dev/null +++ b/pkgs/development/libraries/stargate-libcds/default.nix @@ -0,0 +1,47 @@ +{ lib +, stdenv +, fetchpatch +, fetchFromGitHub +}: + +stdenv.mkDerivation rec { + pname = "stargate-libcds"; + version = "1.0.0"; + + src = fetchFromGitHub { + owner = "stargateaudio"; + repo = "libcds"; + rev = version; + sha256 = "sha256-THThEzS8gGdwn3h0EBttaX5ljZH9Ma2Rcg143+GIdU8="; + }; + + # Fix 'error: unrecognized command line option' in platforms other than x86 + PLAT_FLAGS = lib.optionalString stdenv.isx86_64 "-mfpmath=sse -mssse3"; + + patches = [ + # Remove unecessary tests (valgrind, coverage) + ./Makefile.patch + + # Fix for building on darwin + (fetchpatch { + name = "malloc-to-stdlib.patch"; + url = "https://github.com/stargateaudio/libcds/commit/65dc08f059deda8ba5707ba6116b616d0ad0bd8d.patch"; + sha256 = "sha256-FIGlobUVrDYOtnHjsWyE420PoULPHEK/3T9Fv8hfTl4="; + }) + ]; + + doCheck = true; + + installPhase = '' + runHook preInstall + install -D libcds.so -t $out/lib/ + runHook postInstall + ''; + + meta = with lib; { + description = "C data structure library"; + homepage = "https://github.com/stargateaudio/libcds"; + maintainers = with maintainers; [ yuu ]; + license = licenses.lgpl3Only; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index da791f4ecad7..d552529c8099 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19567,6 +19567,8 @@ with pkgs; srtp = callPackage ../development/libraries/srtp { }; + stargate-libcds = callPackage ../development/libraries/stargate-libcds { }; + stb = callPackage ../development/libraries/stb { }; StormLib = callPackage ../development/libraries/StormLib { };