1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

build system: fix detection of default system directories

src/cmd/INIT/iffe.sh:
- Fix "standard system directories" for the cmd test, which were
  hardcoded as bin, /etc, /usr/bin, /usr/etc, /usr/ucb. That's both
  unportable and antiquated. Replace this with the path output by
  'getconf PATH'.
- Add fixes from modernish for 'getconf PATH' output to compensate
  for bugs/shortcomigns in NixOS and AIX. Source:
  9e4bf5eb/lib/modernish/aux/defpath.sh
  Ref.: https://github.com/NixOS/nixpkgs/issues/65512

src/lib/libast/comp/conf.tab: PATH:
- Add the NixOS and AIX default path fixes here too; this fixes
  'command -p' and the builtin 'getconf PATH' on these systems.

bin/package, src/cmd/INIT/package.sh:
- Re-support being launched with just the command name 'package' in
  the command line (if the 'package' command is in $PATH). At least
  one other script in the build system does this. (re: 6cc2f6a0)
- Go back three levels (../../..) if we were invoked from
  arch/*/bin/package, otherwise we won't find src/cmd/ksh93/SHOPT.sh.
This commit is contained in:
Martijn Dekker 2021-02-03 16:58:35 +00:00
parent be33942415
commit f5eaf217ed
4 changed files with 143 additions and 40 deletions

View file

@ -375,9 +375,41 @@ PATH AST CS 1 MU sh{
*) CONF_path=`"$CONF_getconf" PATH` ;;
esac
case $CONF_path in
'') echo '"/bin:/usr/bin:/sbin:/usr/sbin"' ;;
*) echo "\\"$CONF_path\\"" ;;
'' | [!/]* | *:[!/]* | *: )
CONF_path=/bin:/usr/bin:/sbin:/usr/sbin ;;
esac
# Fix for NixOS. Not all POSIX standard utilities come with the default system,
# e.g. 'bc', 'file', 'vi'. The command that NixOS recommends to get missing
# utilities, e.g. 'nix-env -iA nixos.bc', installs them in a default profile
# directory that is not in $(getconf PATH). So add this path to the standard path.
# See: https://github.com/NixOS/nixpkgs/issues/65512
if test -e /etc/NIXOS &&
nix_profile_dir=/nix/var/nix/profiles/default/bin &&
test -d "$nix_profile_dir"
then case ":$CONF_path:" in
*:"$nix_profile_dir":* )
# nothing to do
;;
* ) # insert the default profile directory as the second entry
CONF_path=`
set -f
IFS=:
set $CONF_path
one=$1
shift
echo "$one:$nix_profile_dir${1+:}$*"
` ;;
esac
fi
# Fix for AIX. At least as of version 7.1, the system default 'find', 'diff -u' and 'patch' utilities
# are broken and/or non-compliant in ways that make them incompatible with POSIX 2018. However, GNU
# utilities are commonly installed in /opt/freeware/bin, and under standard names (no g- prefix).
if test -d /opt/freeware/bin
then case `uname` in
AIX ) CONF_path="/opt/freeware/bin:$CONF_path" ;;
esac
fi
echo "\\"$CONF_path\\""
}
PATH_MAX POSIX PC 1 CDLMUX MAXPATHLEN 1024
PBS POSIX SC 2 FUW