Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* New script /etc/msystem providing information associated with the current MSYSTEM. This is sourced by /etc/profile but can be used by non-login scripts for getting information such as the current compiler architecture or mount point. * New script /usr/bin/shell for switching between shells without restarting MSYS2. This can be used in interactive sessions but also from shell scripts for switching the MSYSTEM without restarting bash or spawning a subshell. * Allow /etc/profile to be sourced multiple times without continuously appending stuff to PATH or losing track of the original Windows TEMP. Also implemented for /etc/profile.d/perlbin.sh, so perl path is not repeatedly appended.
- Loading branch information
1 parent
98f8df2
commit b827a67
Showing
6 changed files
with
108 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# MSYSTEM Environment Information | ||
# Copyright (C) 2016 Renato Silva | ||
# Licensed under public domain | ||
|
||
# Once sourced, this script provides common information associated with the | ||
# current MSYSTEM. For example, the compiler architecture and host type. | ||
|
||
# The MSYSTEM_ prefix is used for avoiding too generic names. For example, | ||
# makepkg is sensitive to the value of CARCH, so MSYSTEM_CARCH is defined | ||
# instead. The MINGW_ prefix does not influence makepkg-mingw variables and | ||
# is not used for the MSYS shell. | ||
|
||
unset MSYSTEM_PREFIX | ||
unset MSYSTEM_CARCH | ||
unset MSYSTEM_CHOST | ||
|
||
unset MINGW_CHOST | ||
unset MINGW_PREFIX | ||
unset MINGW_PACKAGE_PREFIX | ||
|
||
case "${MSYSTEM}" in | ||
MINGW32) | ||
MSYSTEM_PREFIX='/mingw32' | ||
MSYSTEM_CARCH='i686' | ||
MSYSTEM_CHOST='i686-w64-mingw32' | ||
MINGW_CHOST="${MSYSTEM_CHOST}" | ||
MINGW_PREFIX="${MSYSTEM_PREFIX}" | ||
MINGW_PACKAGE_PREFIX="mingw-w64-${MSYSTEM_CARCH}" | ||
export MSYSTEM_PREFIX MSYSTEM_CARCH MSYSTEM_CHOST MINGW_CHOST MINGW_PREFIX MINGW_PACKAGE_PREFIX | ||
;; | ||
MINGW64) | ||
MSYSTEM_PREFIX='/mingw64' | ||
MSYSTEM_CARCH='x86_64' | ||
MSYSTEM_CHOST='x86_64-w64-mingw32' | ||
MINGW_CHOST="${MSYSTEM_CHOST}" | ||
MINGW_PREFIX="${MSYSTEM_PREFIX}" | ||
MINGW_PACKAGE_PREFIX="mingw-w64-${MSYSTEM_CARCH}" | ||
export MSYSTEM_PREFIX MSYSTEM_CARCH MSYSTEM_CHOST MINGW_CHOST MINGW_PREFIX MINGW_PACKAGE_PREFIX | ||
;; | ||
MSYS) | ||
MSYSTEM_PREFIX='/usr' | ||
MSYSTEM_CARCH="${HOSTTYPE}" | ||
MSYSTEM_CHOST="${MACHTYPE}" | ||
export MSYSTEM_PREFIX MSYSTEM_CARCH MSYSTEM_CHOST | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
if [[ "${BASH_SOURCE}" = "${0}" || ! "${1}" =~ ^(mingw(32|64)|msys)$ ]]; then tee <<done | ||
MSYS2 Shell Switcher 2016.5.1 | ||
Copyright (C) 2016 Renato Silva | ||
Licensed under public domain | ||
This script switches between shells without restarting MSYS2. This is done | ||
by setting the MSYSTEM variable and sourcing /etc/profile, as well as | ||
~/.bashrc, for interactive shells. | ||
Usage: source $(basename "${0}") mingw32|mingw64|msys | ||
done | ||
if [[ "${BASH_SOURCE}" = "${0}" ]] | ||
then exit 1 | ||
else return 1 | ||
fi | ||
fi | ||
|
||
_current_directory="$(pwd)" | ||
export MSYSTEM="${1^^}" | ||
source /etc/profile | ||
[[ "${-}" = *i* ]] && source ~/.bashrc | ||
cd "${_current_directory}" | ||
unset _current_directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is incorrect.
PERL_PATH
is long established as a variable used by scripts to refer to the Perl interpreter. Exporting this causes harm and is improper.