summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2024-01-12 00:13:34 +0000
committerGitHub <noreply@github.com>2024-01-12 00:13:34 +0000
commit855ac1fac1a5ec0238bd719dbb82ae18e75476e8 (patch)
treeb25d6a704ed3db2c04b8bc0b7a6a9b67946c6bfb
parentMerge release-23.05 into staging-next-23.05 (diff)
parentMerge pull request #280150 from obsidiansystems/readline-windows-23.05 (diff)
downloadnixpkgs-855ac1fac1a5ec0238bd719dbb82ae18e75476e8.tar.gz
Merge release-23.05 into staging-next-23.05
-rw-r--r--pkgs/by-name/te/termcap/package.nix67
-rw-r--r--pkgs/development/libraries/readline/8.2.nix49
2 files changed, 108 insertions, 8 deletions
diff --git a/pkgs/by-name/te/termcap/package.nix b/pkgs/by-name/te/termcap/package.nix
new file mode 100644
index 000000000000..6382ade90ea7
--- /dev/null
+++ b/pkgs/by-name/te/termcap/package.nix
@@ -0,0 +1,67 @@
+{ lib
+, stdenv
+, fetchurl
+, fetchpatch
+, autoreconfHook
+, enableStatic ? stdenv.hostPlatform.isStatic
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
+
+stdenv.mkDerivation rec {
+ pname = "termcap";
+ version = "1.3.1";
+
+ src = fetchurl {
+ url = "mirror://gnu/termcap/termcap-${version}.tar.gz";
+ hash = "sha256-kaDiLlOHykRntbyxjt8cUbkwJi/UZtX9o5bdnSZxkQA=";
+ };
+
+ patches = [
+ (fetchpatch {
+ name = "0001-tparam-replace-write-with-fprintf.patch";
+ url = "https://github.com/msys2/MINGW-packages/raw/c6691ad1bd9d4c6823a18068ca0683c3e32ea005/mingw-w64-termcap/0001-tparam-replace-write-with-fprintf.patch";
+ hash = "sha256-R9XaLfa8fzQBt+M+uA1AFTvKYCeOWLUD/7GViazXwto=";
+ })
+ ];
+
+ outputs = [ "out" "dev" ];
+
+ enableParallelBuilding = true;
+
+ strictDeps = true;
+
+ nativeBuildInputs = [ autoreconfHook ];
+
+ makeFlags = [
+ "AR=${stdenv.cc.targetPrefix}ar"
+ ];
+
+ env.NIX_CFLAGS_COMPILE = toString ([
+ "-DSTDC_HEADERS"
+ ] ++ lib.optionals stdenv.cc.isClang [
+ "-Wno-implicit-function-declaration"
+ ]);
+
+ # Library only statically links by default
+ postInstall = lib.optionalString (!enableStatic) ''
+ rm $out/lib/libtermcap.a
+ '' + lib.optionalString enableShared (let
+ libName = "lib${pname}${stdenv.hostPlatform.extensions.sharedLibrary}";
+ impLibName = "lib${pname}.dll.a";
+ winImpLib = lib.optionalString stdenv.hostPlatform.isWindows
+ "-Wl,--out-implib,${impLibName}";
+ in ''
+ ${stdenv.cc.targetPrefix}cc -shared -o ${libName} termcap.o tparam.o version.o ${winImpLib}
+ install -Dm644 ${libName} $out/lib
+ '' + lib.optionalString stdenv.hostPlatform.isWindows ''
+ install -Dm644 ${impLibName} $out/lib
+ '');
+
+ meta = {
+ description = "Terminal feature database";
+ homepage = "https://www.gnu.org/software/termutils/";
+ license = lib.licenses.gpl2Plus;
+ maintainers = with lib.maintainers; [ wegank ];
+ platforms = lib.platforms.all;
+ };
+}
diff --git a/pkgs/development/libraries/readline/8.2.nix b/pkgs/development/libraries/readline/8.2.nix
index 1c53da3cdfa4..274938145ccd 100644
--- a/pkgs/development/libraries/readline/8.2.nix
+++ b/pkgs/development/libraries/readline/8.2.nix
@@ -1,4 +1,10 @@
-{ fetchurl, stdenv, lib, ncurses
+{ lib, stdenv
+, fetchpatch, fetchurl
+, ncurses, termcap
+, curses-library ?
+ if stdenv.hostPlatform.isWindows
+ then termcap
+ else ncurses
}:
stdenv.mkDerivation rec {
@@ -13,7 +19,7 @@ stdenv.mkDerivation rec {
outputs = [ "out" "dev" "man" "doc" "info" ];
strictDeps = true;
- propagatedBuildInputs = [ ncurses ];
+ propagatedBuildInputs = [ curses-library ];
patchFlags = [ "-p0" ];
@@ -27,11 +33,38 @@ stdenv.mkDerivation rec {
in
import ./readline-8.2-patches.nix patch);
- patches =
- [ ./link-against-ncurses.patch
- ./no-arch_only-8.2.patch
- ]
- ++ upstreamPatches;
+ patches = lib.optionals (curses-library.pname == "ncurses") [
+ ./link-against-ncurses.patch
+ ] ++ [
+ ./no-arch_only-8.2.patch
+ ]
+ ++ upstreamPatches
+ ++ lib.optionals stdenv.hostPlatform.isWindows [
+ (fetchpatch {
+ name = "0001-sigwinch.patch";
+ url = "https://github.com/msys2/MINGW-packages/raw/90e7536e3b9c3af55c336d929cfcc32468b2f135/mingw-w64-readline/0001-sigwinch.patch";
+ stripLen = 1;
+ hash = "sha256-sFK6EJrSNl0KLWqFv5zBXaQRuiQoYIZVoZfa8BZqfKA=";
+ })
+ (fetchpatch {
+ name = "0002-event-hook.patch";
+ url = "https://github.com/msys2/MINGW-packages/raw/3476319d2751a676b911f3de9e1ec675081c03b8/mingw-w64-readline/0002-event-hook.patch";
+ stripLen = 1;
+ hash = "sha256-F8ytYuIjBtH83ZCJdf622qjwSw+wZEVyu53E/mPsoAo=";
+ })
+ (fetchpatch {
+ name = "0003-fd_set.patch";
+ url = "https://github.com/msys2/MINGW-packages/raw/90e7536e3b9c3af55c336d929cfcc32468b2f135/mingw-w64-readline/0003-fd_set.patch";
+ stripLen = 1;
+ hash = "sha256-MlsX5JYp1PHD25uuVnDKJWEquegUN3dkj9fhjQX51/M=";
+ })
+ (fetchpatch {
+ name = "0004-locale.patch";
+ url = "https://github.com/msys2/MINGW-packages/raw/f768c4b74708bb397a77e3374cc1e9e6ef647f20/mingw-w64-readline/0004-locale.patch";
+ stripLen = 1;
+ hash = "sha256-dk4343KP4EWXdRRCs8GRQlBgJFgu1rd79RfjwFD/nJc=";
+ })
+ ];
meta = with lib; {
description = "Library for interactive line editing";
@@ -57,7 +90,7 @@ stdenv.mkDerivation rec {
maintainers = with maintainers; [ dtzWill ];
- platforms = platforms.unix;
+ platforms = platforms.unix ++ platforms.windows;
branch = "8.2";
};
}