From 3c7f6572cea284ee792dcd31ea5be185734c21b1 Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Sun, 1 Apr 2018 00:00:01 +0000 Subject: bash: simplify expression, add `withDocs` option --- pkgs/shells/bash/4.4.nix | 53 ++++++++--------- pkgs/shells/bash/cygwin-bash-4.4.11-2.src.patch | 76 ++++++++++++------------- 2 files changed, 63 insertions(+), 66 deletions(-) (limited to 'pkgs/shells/bash') diff --git a/pkgs/shells/bash/4.4.nix b/pkgs/shells/bash/4.4.nix index 04a03698289..72ce29bf3f2 100644 --- a/pkgs/shells/bash/4.4.nix +++ b/pkgs/shells/bash/4.4.nix @@ -1,37 +1,33 @@ { stdenv, buildPackages -, fetchurl, readline70 ? null, texinfo ? null, binutils ? null, bison, autoconf +, fetchurl, binutils ? null, bison, autoconf , buildPlatform, hostPlatform -, interactive ? false + +# patch for cygwin requires readline support +, interactive ? stdenv.isCygwin, readline70 ? null +, withDocs ? false, texinfo ? null +, self }: +with stdenv.lib; + assert interactive -> readline70 != null; +assert withDocs -> texinfo != null; assert hostPlatform.isDarwin -> binutils != null; let - version = "4.4"; - realName = "bash-${version}"; - shortName = "bash44"; - sha256 = "1jyz6snd63xjn6skk7za6psgidsd53k05cr3lksqybi0q6936syq"; - - upstreamPatches = - let - patch = nr: sha256: - fetchurl { - url = "mirror://gnu/bash/${realName}-patches/${shortName}-${nr}"; - inherit sha256; - }; - in - import ./bash-4.4-patches.nix patch; - - inherit (stdenv.lib) optional optionals optionalString; + upstreamPatches = import ./bash-4.4-patches.nix (nr: sha256: fetchurl { + url = "mirror://gnu/bash/bash-4.4-patches/bash44-${nr}"; + inherit sha256; + }); in stdenv.mkDerivation rec { - name = "${realName}-p${toString (builtins.length upstreamPatches)}"; + name = "bash-${optionalString interactive "interactive-"}${version}-p${toString (builtins.length upstreamPatches)}"; + version = "4.4"; src = fetchurl { - url = "mirror://gnu/bash/${realName}.tar.gz"; - inherit sha256; + url = "mirror://gnu/bash/bash-${version}.tar.gz"; + sha256 = "1jyz6snd63xjn6skk7za6psgidsd53k05cr3lksqybi0q6936syq"; }; hardeningDisable = [ "format" ]; @@ -50,18 +46,19 @@ stdenv.mkDerivation rec { patchFlags = "-p0"; patches = upstreamPatches + ++ optional hostPlatform.isCygwin ./cygwin-bash-4.4.11-2.src.patch # https://lists.gnu.org/archive/html/bug-bash/2016-10/msg00006.html - ++ optional (hostPlatform.libc == "musl") (fetchurl { + ++ optional hostPlatform.isMusl (fetchurl { url = "https://lists.gnu.org/archive/html/bug-bash/2016-10/patchJxugOXrY2y.patch"; sha256 = "1m4v9imidb1cc1h91f2na0b8y9kc5c5fgmpvy9apcyv2kbdcghg1"; - }); - - postPatch = optionalString hostPlatform.isCygwin "patch -p2 < ${./cygwin-bash-4.4.11-2.src.patch}"; + }); configureFlags = [ (if interactive then "--with-installed-readline" else "--disable-readline") ] ++ optionals (hostPlatform != buildPlatform) [ - "bash_cv_job_control_missing=nomissing bash_cv_sys_named_pipes=nomissing bash_cv_getcwd_malloc=yes" + "bash_cv_job_control_missing=nomissing" + "bash_cv_sys_named_pipes=nomissing" + "bash_cv_getcwd_malloc=yes" ] ++ optionals hostPlatform.isCygwin [ "--without-libintl-prefix --without-libiconv-prefix" "--with-installed-readline" @@ -75,8 +72,8 @@ stdenv.mkDerivation rec { # Note: Bison is needed because the patches above modify parse.y. depsBuildBuild = [ buildPackages.stdenv.cc ]; - nativeBuildInputs = [bison] - ++ optional (texinfo != null) texinfo + nativeBuildInputs = [ bison ] + ++ optional withDocs texinfo ++ optional hostPlatform.isDarwin binutils ++ optional (hostPlatform.libc == "musl") autoconf; diff --git a/pkgs/shells/bash/cygwin-bash-4.4.11-2.src.patch b/pkgs/shells/bash/cygwin-bash-4.4.11-2.src.patch index c854e8828ae..48837310962 100644 --- a/pkgs/shells/bash/cygwin-bash-4.4.11-2.src.patch +++ b/pkgs/shells/bash/cygwin-bash-4.4.11-2.src.patch @@ -1,5 +1,5 @@ ---- origsrc/bash-4.4/bashline.c 2017-01-23 13:28:06.955247200 -0600 -+++ src/bash-4.4/bashline.c 2017-01-23 13:55:07.992877600 -0600 +--- bashline.c 2017-01-23 13:28:06.955247200 -0600 ++++ bashline.c 2017-01-23 13:55:07.992877600 -0600 @@ -76,6 +76,16 @@ # include "pcomplete.h" #endif @@ -104,8 +104,8 @@ r = file_isdir (fn); free (fn); ---- origsrc/bash-4.4/builtins/read.def 2017-01-23 13:28:07.017686500 -0600 -+++ src/bash-4.4/builtins/read.def 2017-01-23 13:55:07.992877600 -0600 +--- builtins/read.def 2017-01-23 13:28:07.017686500 -0600 ++++ builtins/read.def 2017-01-23 13:55:07.992877600 -0600 @@ -85,7 +85,6 @@ $END #ifdef __CYGWIN__ @@ -140,8 +140,8 @@ if ((skip_ctlesc == 0 && c == CTLESC) || (skip_ctlnul == 0 && c == CTLNUL)) { saw_escape++; ---- origsrc/bash-4.4/builtins/set.def 2016-06-02 19:10:10.000000000 -0500 -+++ src/bash-4.4/builtins/set.def 2017-01-23 13:55:07.992877600 -0600 +--- builtins/set.def 2016-06-02 19:10:10.000000000 -0500 ++++ builtins/set.def 2017-01-23 13:55:07.992877600 -0600 @@ -56,6 +56,13 @@ extern int dont_save_function_defs; #if defined (READLINE) extern int no_line_editing; @@ -258,8 +258,8 @@ free (vname); } } ---- origsrc/bash-4.4/builtins/shopt.def 2016-05-06 14:00:02.000000000 -0500 -+++ src/bash-4.4/builtins/shopt.def 2017-01-23 13:55:07.992877600 -0600 +--- builtins/shopt.def 2016-05-06 14:00:02.000000000 -0500 ++++ builtins/shopt.def 2017-01-23 13:55:07.992877600 -0600 @@ -92,6 +92,10 @@ extern int glob_asciirange; extern int lastpipe_opt; extern int inherit_errexit; @@ -281,8 +281,8 @@ #if defined (READLINE) { "complete_fullquote", &complete_fullquote, (shopt_set_func_t *)NULL}, { "direxpand", &dircomplete_expand, shopt_set_complete_direxpand }, ---- origsrc/bash-4.4/config-top.h 2016-05-19 13:34:02.000000000 -0500 -+++ src/bash-4.4/config-top.h 2017-01-23 13:55:07.992877600 -0600 +--- config-top.h 2016-05-19 13:34:02.000000000 -0500 ++++ config-top.h 2017-01-23 13:55:07.992877600 -0600 @@ -87,10 +87,10 @@ #define DEFAULT_BASHRC "~/.bashrc" @@ -305,8 +305,8 @@ /* Define if you want the case-capitalizing operators (~[~]) and the `capcase' variable attribute (declare -c). */ ---- origsrc/bash-4.4/doc/Makefile.in 2015-12-06 18:55:56.000000000 -0600 -+++ src/bash-4.4/doc/Makefile.in 2017-01-23 13:55:07.992877600 -0600 +--- doc/Makefile.in 2015-12-06 18:55:56.000000000 -0600 ++++ doc/Makefile.in 2017-01-23 13:55:07.992877600 -0600 @@ -189,7 +189,7 @@ bashref.html: $(BASHREF_FILES) $(HSUSER) $(MAKEINFO) --html --no-split -I$(TEXINPUTDIR) $(srcdir)/bashref.texi @@ -329,8 +329,8 @@ -if test -f bash.info; then d=.; else d=$(srcdir); fi; \ $(INSTALL_DATA) $$d/bash.info $(DESTDIR)$(infodir)/bash.info # run install-info if it is present to update the info directory ---- origsrc/bash-4.4/doc/bash.1 2016-08-26 08:45:17.000000000 -0500 -+++ src/bash-4.4/doc/bash.1 2017-01-23 13:55:08.008447700 -0600 +--- doc/bash.1 2016-08-26 08:45:17.000000000 -0500 ++++ doc/bash.1 2017-01-23 13:55:08.008447700 -0600 @@ -9607,6 +9607,10 @@ filenames. This variable is set by default, which is the default bash behavior in versions through 4.2. @@ -342,8 +342,8 @@ .B direxpand If set, .B bash ---- origsrc/bash-4.4/doc/bashref.texi 2016-09-07 16:13:36.000000000 -0500 -+++ src/bash-4.4/doc/bashref.texi 2017-01-23 13:55:08.008447700 -0600 +--- doc/bashref.texi 2016-09-07 16:13:36.000000000 -0500 ++++ doc/bashref.texi 2017-01-23 13:55:08.008447700 -0600 @@ -5123,6 +5123,10 @@ filenames. This variable is set by default, which is the default Bash behavior in versions through 4.2. @@ -355,8 +355,8 @@ @item direxpand If set, Bash replaces directory names with the results of word expansion when performing ---- origsrc/bash-4.4/doc/builtins.1 2012-02-21 13:32:05.000000000 -0600 -+++ src/bash-4.4/doc/builtins.1 2017-01-23 13:55:08.008447700 -0600 +--- doc/builtins.1 2012-02-21 13:32:05.000000000 -0600 ++++ doc/builtins.1 2017-01-23 13:55:08.008447700 -0600 @@ -19,6 +19,6 @@ shift, shopt, source, suspend, test, tim ulimit, umask, unalias, unset, wait \- bash built-in commands, see \fBbash\fR(1) .SH BASH BUILTIN COMMANDS @@ -365,8 +365,8 @@ +.so man1/bash.1 .SH SEE ALSO bash(1), sh(1) ---- origsrc/bash-4.4/general.c 2016-08-11 10:16:56.000000000 -0500 -+++ src/bash-4.4/general.c 2017-01-23 13:55:08.008447700 -0600 +--- general.c 2016-08-11 10:16:56.000000000 -0500 ++++ general.c 2017-01-23 13:55:08.008447700 -0600 @@ -48,6 +48,10 @@ #include @@ -388,8 +388,8 @@ result = savestring (pathbuf); } #else ---- origsrc/bash-4.4/input.c 2015-09-24 18:49:23.000000000 -0500 -+++ src/bash-4.4/input.c 2017-01-23 13:55:08.008447700 -0600 +--- input.c 2015-09-24 18:49:23.000000000 -0500 ++++ input.c 2017-01-23 13:55:08.008447700 -0600 @@ -44,6 +44,10 @@ #include "quit.h" #include "trap.h" @@ -421,8 +421,8 @@ #if !defined (DJGPP) return (bufstream_getc (buffers[bash_input.location.buffered_fd])); #else ---- origsrc/bash-4.4/lib/sh/pathphys.c 2013-05-28 14:33:58.000000000 -0500 -+++ src/bash-4.4/lib/sh/pathphys.c 2017-01-23 13:55:08.008447700 -0600 +--- lib/sh/pathphys.c 2013-05-28 14:33:58.000000000 -0500 ++++ lib/sh/pathphys.c 2017-01-23 13:55:08.008447700 -0600 @@ -35,6 +35,7 @@ #include #include @@ -453,8 +453,8 @@ double_slash_path = DOUBLE_SLASH (workpath); qbase += double_slash_path; ---- origsrc/bash-4.4/lib/sh/tmpfile.c 2016-08-11 10:05:58.000000000 -0500 -+++ src/bash-4.4/lib/sh/tmpfile.c 2017-01-23 13:55:08.008447700 -0600 +--- lib/sh/tmpfile.c 2016-08-11 10:05:58.000000000 -0500 ++++ lib/sh/tmpfile.c 2017-01-23 13:55:08.008447700 -0600 @@ -101,7 +101,7 @@ get_tmpdir (flags) if (tdir && (file_iswdir (tdir) == 0 || strlen (tdir) > PATH_MAX)) tdir = 0; @@ -464,8 +464,8 @@ tdir = get_sys_tmpdir (); #if defined (HAVE_PATHCONF) && defined (_PC_NAME_MAX) ---- origsrc/bash-4.4/mksyntax.c 2012-07-29 18:48:38.000000000 -0500 -+++ src/bash-4.4/mksyntax.c 2017-01-23 13:55:08.008447700 -0600 +--- mksyntax.c 2012-07-29 18:48:38.000000000 -0500 ++++ mksyntax.c 2017-01-23 13:55:08.008447700 -0600 @@ -29,13 +29,13 @@ #ifdef HAVE_UNISTD_H @@ -483,8 +483,8 @@ #ifndef errno extern int errno; #endif ---- origsrc/bash-4.4/parse.y 2016-09-11 10:31:46.000000000 -0500 -+++ src/bash-4.4/parse.y 2017-01-23 13:55:08.008447700 -0600 +--- parse.y 2016-09-11 10:31:46.000000000 -0500 ++++ parse.y 2017-01-23 13:55:08.008447700 -0600 @@ -1539,14 +1539,20 @@ yy_string_get () string = bash_input.location.string; @@ -509,8 +509,8 @@ } static int ---- origsrc/bash-4.4/subst.c 2017-01-23 13:28:06.955247200 -0600 -+++ src/bash-4.4/subst.c 2017-01-23 13:55:08.008447700 -0600 +--- subst.c 2017-01-23 13:28:06.955247200 -0600 ++++ subst.c 2017-01-23 13:55:08.008447700 -0600 @@ -43,6 +43,7 @@ #include "posixstat.h" #include "bashintl.h" @@ -562,8 +562,8 @@ old_pid = last_made_pid; #if defined (JOB_CONTROL) old_pipeline_pgrp = pipeline_pgrp; ---- origsrc/bash-4.4/support/bashversion.c 2008-09-09 08:31:53.000000000 -0500 -+++ src/bash-4.4/support/bashversion.c 2017-01-23 13:55:08.024037200 -0600 +--- support/bashversion.c 2008-09-09 08:31:53.000000000 -0500 ++++ support/bashversion.c 2017-01-23 13:55:08.024037200 -0600 @@ -26,6 +26,9 @@ #if defined (HAVE_UNISTD_H) @@ -584,8 +584,8 @@ extern char *dist_version; extern int patch_level; ---- origsrc/bash-4.4/support/mkversion.sh 2008-08-13 07:25:57.000000000 -0500 -+++ src/bash-4.4/support/mkversion.sh 2017-01-23 13:55:08.024037200 -0600 +--- support/mkversion.sh 2008-08-13 07:25:57.000000000 -0500 ++++ support/mkversion.sh 2017-01-23 13:55:08.024037200 -0600 @@ -29,7 +29,7 @@ source_dir="." while [ $# -gt 0 ]; do case "$1" in @@ -595,8 +595,8 @@ -s) shift; rel_status=$1; shift ;; -p) shift; patch_level=$1; shift ;; -d) shift; dist_version=$1; shift ;; ---- origsrc/bash-4.4/variables.c 2016-06-15 15:05:52.000000000 -0500 -+++ src/bash-4.4/variables.c 2017-01-23 13:55:08.024037200 -0600 +--- variables.c 2016-06-15 15:05:52.000000000 -0500 ++++ variables.c 2017-01-23 13:55:08.024037200 -0600 @@ -5239,6 +5239,7 @@ sv_winsize (name) /* Update the value of HOME in the export environment so tilde expansion will work on cygwin. */ -- cgit 1.4.1