diff --git a/fish/PKGBUILD b/fish/PKGBUILD index bfbc872e..b066a835 100644 --- a/fish/PKGBUILD +++ b/fish/PKGBUILD @@ -2,7 +2,7 @@ pkgname=fish pkgver=3.0.0 -pkgrel=1 +pkgrel=2 epoch= pkgdesc="a smart and user-friendly command line shell" arch=('i686' 'x86_64') @@ -14,10 +14,16 @@ makedepends=('gcc' 'ncurses-devel' 'gettext-devel' 'intltool' 'libiconv-devel' ' optdepends=('python: for manual page completion parser and web configuration tool') install=fish.install source=("https://github.com/fish-shell/fish-shell/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.gz"{,.asc} - 01-msysize.patch) + 01-msysize.patch + config.fish + msys2.fish + perlbin.fish) sha256sums=('ea9dd3614bb0346829ce7319437c6a93e3e1dfde3b7f6a469b543b0d2c68f2cf' 'SKIP' - '1e2743177c499e890d681be685fed6f849e42cb282e13b4e56324169a43bd987') + '1e2743177c499e890d681be685fed6f849e42cb282e13b4e56324169a43bd987' + '983c3273e0249957ed6c40785e005739da30f31d4f029383f257f9990d38811a' + '0d01a03280347bce3499a603e18f4de9b2a61709b0c50595bfb58ecb335c63f3' + 'b136a9fa94abf53e302f7a1cc28def03b58dd2326990c5f02ceb4988341a5ac6') validpgpkeys=('003837986104878835FA516D7A67D962D88A709A') prepare() { @@ -34,5 +40,9 @@ build() { package() { cd "${srcdir}/${pkgname}-${pkgver}" + backup=('etc/fish/config.fish' 'etc/fish/msys2.fish' 'etc/fish/perlbin.fish') make DESTDIR="${pkgdir}/" install + install -D -m644 "${srcdir}/config.fish" "${pkgdir}/etc/fish/config.fish" + install -D -m644 "${srcdir}/msys2.fish" "${pkgdir}/etc/fish/msys2.fish" + install -D -m644 "${srcdir}/perlbin.fish" "${pkgdir}/etc/fish/perlbin.fish" } diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 00000000..b7930e3e --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,18 @@ +# Put system-wide fish configuration entries here +# or in .fish files in conf.d/ +# Files in conf.d can be overridden by the user +# by files with the same name in $XDG_CONFIG_HOME/fish/conf.d + +# This file is run by all fish instances. +# To include configuration only for login shells, use +# if status --is-login +# ... +# end +# To include configuration only for interactive shells, use +# if status --is-interactive +# ... +# end + +if status --is-login + source /etc/fish/msys2.fish +end \ No newline at end of file diff --git a/fish/msys2.fish b/fish/msys2.fish new file mode 100644 index 00000000..4c2fa9fb --- /dev/null +++ b/fish/msys2.fish @@ -0,0 +1,107 @@ +# To the extent possible under law, the author(s) have dedicated all +# copyright and related and neighboring rights to this software to the +# public domain worldwide. This software is distributed without any warranty. +# You should have received a copy of the CC0 Public Domain Dedication along +# with this software. +# If not, see . + + +# System-wide profile file + +# Setup some default paths. Note that this order will allow user installed +# software to override 'system' software. +# Modifying these default path settings can be done in different ways. +# To learn more about startup files, refer to your shell's man page. + +set MSYS2_PATH /usr/local/bin /usr/bin /bin +set -x MANPATH /usr/local/man /usr/share/man /usr/man /share/man +set -x INFOPATH /usr/local/info /usr/share/info /usr/info /share/info + +if not set -q MSYS2_PATH_TYPE + set MSYS2_PATH_TYPE minimal +end + +switch $MSYS2_PATH_TYPE +case strict + # Do not inherit any path configuration, and allow for full customization + # of external path. This is supposed to be used in special cases such as + # debugging without need to change this file, but not daily usage. + set -ex ORIGINAL_PATH +case inherit + # Inherit previous path. Note that this will make all of the Windows path + # available in current shell, with possible interference in project builds. + if not set -q ORIGINAL_PATH + set -x ORIGINAL_PATH $PATH + end +case '*' + # Do not inherit any path configuration but configure a default Windows path + # suitable for normal usage with minimal external interference. + set -l PATH $MSYS2_PATH 2>/dev/null + set WIN_ROOT (cygpath -Wu) + set -x ORIGINAL_PATH $WIN_ROOT/System32 $WIN_ROOT $WIN_ROOT/System32/Wbem $WIN_ROOT/System32/WindowsPowerShell/v1.0/ +end + +set -e MINGW_MOUNT_POINT +/bin/sh '/etc/msystem' +switch $MSYSTEM +case MINGW32 + set MINGW_MOUNT_POINT $MINGW_PREFIX + set -x PATH $MINGW_MOUNT_POINT/bin $MSYS2_PATH $ORIGINAL_PATH 2>/dev/null + set -x PKG_CONFIG_PATH "$MINGW_MOUNT_POINT/lib/pkgconfig:$MINGW_MOUNT_POINT/share/pkgconfig" + set ACLOCAL_PATH "$MINGW_MOUNT_POINT/share/aclocal:/usr/share/aclocal" + set -x MANPATH $MINGW_MOUNT_POINT/local/man $MINGW_MOUNT_POINT/share/man $MANPATH +case MINGW64 + set MINGW_MOUNT_POINT $MINGW_PREFIX + set -x PATH $MINGW_MOUNT_POINT/bin $MSYS2_PATH $ORIGINAL_PATH 2>/dev/null + set -x PKG_CONFIG_PATH "$MINGW_MOUNT_POINT/lib/pkgconfig:$MINGW_MOUNT_POINT/share/pkgconfig" + set ACLOCAL_PATH "$MINGW_MOUNT_POINT/share/aclocal:/usr/share/aclocal" + set -x MANPATH $MINGW_MOUNT_POINT/local/man $MINGW_MOUNT_POINT/share/man $MANPATH +case '*' + set -x PATH $MSYS2_PATH /opt/bin $ORIGINAL_PATH 2>/dev/null + set -x PKG_CONFIG_PATH "/usr/lib/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig" +end + +# TMP and TEMP as defined in the Windows environment must be kept +# for windows apps, even if started from msys2. However, leaving +# them set to the default Windows temporary directory or unset +# can have unexpected consequences for msys2 apps, so we define +# our own to match GNU/Linux behaviour. +# +# Note: this uppercase/lowercase workaround does not seem to work. +# In fact, it has been removed from Cygwin some years ago. See: +# +# * https://cygwin.com/git/gitweb.cgi?p=cygwin-apps/base-files.git;a=commitdiff;h=3e54b07 +# * https://cygwin.com/git/gitweb.cgi?p=cygwin-apps/base-files.git;a=commitdiff;h=7f09aef +# +if not set -q ORIGINAL_TMP + set ORIGINAL_TMP $TMP +end +if not set -q ORIGINAL_TEMP + set ORIGINAL_TEMP $TEMP +end +set -e TMP +set -e TEMP +set -x tmp (cygpath -w "$ORIGINAL_TMP" 2> /dev/null) +set -x temp (cygpath -w "$ORIGINAL_TEMP" 2> /dev/null) +set -x TMP "/tmp" +set -x TEMP "/tmp" + +# Define default printer +set p '/proc/registry/HKEY_CURRENT_USER/Software/Microsoft/Windows NT/CurrentVersion/Windows/Device' +if test -e $p + #Can't use read -d, fish too old + set PRINTER (cat $p) + set -x PRINTER (string split ',' $PRINTER)[1] +end +set -e p + +/usr/bin/hostname | read HOSTNAME +set -x HOSTNAME $HOSTNAME +source /etc/fish/perlbin.fish + +if set -q ACLOCAL_PATH + set -x ACLOCAL_PATH $ACLOCAL_PATH +end + +export USER PRINTER PS1 SHELL +set -e PATH_SEPARATOR \ No newline at end of file diff --git a/fish/perlbin.fish b/fish/perlbin.fish new file mode 100644 index 00000000..6dd8a50e --- /dev/null +++ b/fish/perlbin.fish @@ -0,0 +1,19 @@ +# Set path to perl scriptdirs if they exist +# https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_scripts +# Added /usr/bin/*_perl dirs for scripts +# Remove /usr/lib/perl5/*_perl/bin in next release + +function __addpath + set -l p $argv[1] + if test -d $p + set PATH $PATH $p + end +end + +__addpath /usr/bin/site_perl +__addpath /usr/lib/perl5/site_perl/bin +__addpath /usr/bin/vendor_perl +__addpath /usr/lib/perl5/vendor_perl/bin +__addpath /usr/bin/core_perl + +functions -e __addpath \ No newline at end of file