about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorkirillrdy <kirillrdy@gmail.com>2024-05-10 19:36:41 +1000
committerGitHub <noreply@github.com>2024-05-10 19:36:41 +1000
commitf29a72fb830980c615c9df3247c7bf35dbeaf7b0 (patch)
tree2f39a6c65f3a9437d87e34068a7abe98ba775807 /pkgs
parent53717915c945159f430c08ec4266ba5c70d4dd7f (diff)
parent31bfe498e711be77f17df7ab48646c80a7c70d4a (diff)
Merge pull request #310473 from Sigmanificient/ustr-adopt
ustr: adopt, use fetchgit instead of fetchurl, migrate to by-name
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/by-name/us/ustr/package.nix52
-rw-r--r--pkgs/by-name/us/ustr/va_args.patch (renamed from pkgs/development/libraries/ustr/va_args.patch)0
-rw-r--r--pkgs/development/libraries/ustr/default.nix43
-rw-r--r--pkgs/top-level/all-packages.nix2
4 files changed, 52 insertions, 45 deletions
diff --git a/pkgs/by-name/us/ustr/package.nix b/pkgs/by-name/us/ustr/package.nix
new file mode 100644
index 0000000000000..0da93206752ba
--- /dev/null
+++ b/pkgs/by-name/us/ustr/package.nix
@@ -0,0 +1,52 @@
+{
+  lib,
+  stdenv,
+  fetchgit,
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "ustr";
+  version = "1.0.4";
+
+  src = fetchgit {
+    url = "http://www.and.org/ustr/ustr.git";
+    rev = "v${finalAttrs.version}";
+    hash = "sha256-pQrQy+S9fVFl8Mop4QmwEAXGiBSheQE4HgAZ4srFz64=";
+  };
+
+  # Fixes bogus warnings that failed libsemanage
+  patches = [ ./va_args.patch ];
+
+  # Work around gcc5 switch to gnu11
+  env.NIX_CFLAGS_COMPILE = "-std=gnu89";
+
+  # Fix detection of stdint.h
+  postPatch = ''
+    substituteInPlace Makefile \
+      --replace-fail "have_stdint_h=0" "have_stdint_h=1"
+
+    cat ustr-import.in | grep USTR_CONF
+    substituteInPlace ustr-import.in \
+      --replace-fail "USTR_CONF_HAVE_STDINT_H 0" "USTR_CONF_HAVE_STDINT_H 1"
+  '';
+
+  makeFlags = [
+    "prefix=${placeholder "out"}"
+    "LDCONFIG=echo"
+    "HIDE="
+  ];
+
+  # Remove debug libraries
+  postInstall = ''
+    find $out/lib -name \*debug\* -delete
+  '';
+
+  meta = with lib; {
+    homepage = "http://www.and.org/ustr/";
+    description = "Micro String API for C language";
+    mainProgram = "ustr-import";
+    license = licenses.bsd2;
+    maintainers = with lib.maintainers; [ sigmanificient ];
+    platforms = platforms.linux;
+  };
+})
diff --git a/pkgs/development/libraries/ustr/va_args.patch b/pkgs/by-name/us/ustr/va_args.patch
index f75b537485d89..f75b537485d89 100644
--- a/pkgs/development/libraries/ustr/va_args.patch
+++ b/pkgs/by-name/us/ustr/va_args.patch
diff --git a/pkgs/development/libraries/ustr/default.nix b/pkgs/development/libraries/ustr/default.nix
deleted file mode 100644
index 598e5e7c76a11..0000000000000
--- a/pkgs/development/libraries/ustr/default.nix
+++ /dev/null
@@ -1,43 +0,0 @@
-{ lib, stdenv, fetchurl }:
-
-stdenv.mkDerivation rec {
-  pname = "ustr";
-  version = "1.0.4";
-
-  src = fetchurl {
-    url = "http://www.and.org/ustr/${version}/${pname}-${version}.tar.bz2";
-    sha256 = "1i623ygdj7rkizj7985q9d6vj5amwg686aqb5j3ixpkqkyp6xbrx";
-  };
-
-  # Fixes bogus warnings that failed libsemanage
-  patches = [ ./va_args.patch ];
-
-  # Work around gcc5 switch to gnu11
-  env.NIX_CFLAGS_COMPILE = "-std=gnu89";
-
-  # Fix detection of stdint.h
-  postPatch = ''
-    sed -i 's,\(have_stdint_h\)=0,\1=1,g' Makefile
-    sed -i 's,\(USTR_CONF_HAVE_STDINT_H\) 0,\1 1,g' ustr-import.in
-  '';
-
-  preBuild = ''
-    makeFlagsArray+=("prefix=$out")
-    makeFlagsArray+=("LDCONFIG=echo")
-    makeFlagsArray+=("HIDE=")
-  '';
-
-  # Remove debug libraries
-  postInstall = ''
-    find $out/lib -name \*debug\* -delete
-  '';
-
-  meta = with lib; {
-    homepage = "http://www.and.org/ustr/";
-    description = "Micro String API for C language";
-    mainProgram = "ustr-import";
-    license = licenses.bsd2;
-    maintainers = [ ];
-    platforms = platforms.linux;
-  };
-}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 6b805e67f46db..b8e08e9c7c448 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -24786,8 +24786,6 @@ with pkgs;
 
   unixODBCDrivers = recurseIntoAttrs (callPackages ../development/libraries/unixODBCDrivers { });
 
-  ustr = callPackage ../development/libraries/ustr { };
-
   usrsctp = callPackage ../development/libraries/usrsctp { };
 
   usbredir = callPackage ../development/libraries/usbredir { };