Skip to content

Commit

Permalink
Merge pull request #279491 from wegank/termcap-init
Browse files Browse the repository at this point in the history
termcap: init at 1.3.1
  • Loading branch information
Ericson2314 authored Jan 10, 2024
2 parents 1ee8cbd + 77b22b0 commit 78a70be
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions pkgs/by-name/te/termcap/package.nix
Original file line number Diff line number Diff line change
@@ -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;
};
}

0 comments on commit 78a70be

Please sign in to comment.