diff --git a/msys2-base/PKGBUILD b/msys2-base/PKGBUILD new file mode 100644 index 00000000..c09b3700 --- /dev/null +++ b/msys2-base/PKGBUILD @@ -0,0 +1,46 @@ +# Maintainer: Alexey Pavlov + +pkgname=msys2-base +pkgver=1.0 +pkgrel=1 +pkgdesc="MSYS2 base files" +arch=('any') +url="" +license=('BSD') +groups=('base') +depends=() +provides=($pkgname) +conflicts=($pkgname) +replaces=() +backup=() +options=() +source=('cmd' + 'compress-msys2' + 'compress_exclude' + 'mingw_shell.bat' + 'msys2_shell.bat' + 'regen-info.sh' + 'start' + 'which') +noextract=() +md5sums=('bf6a73107768c9b7f667430cfcb1d840' + '8a0f89affc79867b337cf783cff1bbf0' + '3e727adfc6ae21fd5f333dc7d086a51b' + '9e62a3d8ac6af4c8cb4982688d24abf0' + 'fb20c7b9a8dc3a0a89a2834bd991186f' + '1c5faeb9b7f083bcdab768c41c933039' + 'f9b5897a4f3f3cf7a59ec90a6dd41ed2' + '3de69e0d868cbd5ea2c775335edd33f9') + +package() { + mkdir -p $pkgdir/usr/{bin,etc,sbin} + + cp -f $srcdir/mingw_shell.bat $pkgdir/usr/ + cp -f $srcdir/msys2_shell.bat $pkgdir/usr/ + cp -f $srcdir/cmd $pkgdir/usr/bin/ + cp -f $srcdir/start $pkgdir/usr/bin + cp -f $srcdir/which $pkgdir/usr/bin/ + cp -f $srcdir/regen-info.sh $pkgdir/usr/sbin/ + cp -f $srcdir/compress-msys2 $pkgdir/usr/sbin/ + cp -f $srcdir/compress_exclude $pkgdir/usr/etc/ +} diff --git a/msys2-base/cmd b/msys2-base/cmd new file mode 100644 index 00000000..2e6989cb --- /dev/null +++ b/msys2-base/cmd @@ -0,0 +1,8 @@ +#!/bin/sh +# Copyright (C) 2002, Earnie Boyd +# mailto:earnie@users.sf.net +# This file is part of Minimal SYStem. +# http://www.mingw.org/msys.shtml +# File: cmd + +"$COMSPEC" "$@" \ No newline at end of file diff --git a/msys2-base/compress-msys2 b/msys2-base/compress-msys2 new file mode 100644 index 00000000..7d3699e2 --- /dev/null +++ b/msys2-base/compress-msys2 @@ -0,0 +1,32 @@ +#!/bin/bash + +_arch=$(uname -m) +_date=$(date +'%Y%m%d') +_filename=${_arch}-msys2-${_date}.tar.xz +_log=/tmp/compress.log + +echo "Creating MSYS2 archive /tmp/$_filename" +if [ -f /tmp/$_filename ]; then + rm -f /tmp/$_filename +fi + +_dirs= +for curr_dir in /bin /etc /include /lib /libexec /sbin /share /ssl /${_arch}-pc-msys /tmp /var /mingw_shell.bat /msys.ico /msys2_shell.bat ; do + if [[ -d $curr_dir || -f $curr_dir ]]; then + _dirs="$_dirs $curr_dir" + fi +done + +if [ -n "$_dirs" ]; then + _compress_cmd="/bin/tar --transform='s/:/_/g' --dereference --hard-dereference -cvJf /tmp/${_filename} $_dirs -X /etc/compress_exclude" + cd / + eval ${_compress_cmd} | tee $_log 2>&1 + _result=$? + if [ "$_result" -eq "0" ]; then + echo " done" + else + die "MSYS2 compressing fail. See $_log" + fi +fi + +exit 0 diff --git a/msys2-base/compress_exclude b/msys2-base/compress_exclude new file mode 100644 index 00000000..55523b9c --- /dev/null +++ b/msys2-base/compress_exclude @@ -0,0 +1,9 @@ +/etc/postinstall/postinstall.marker +/etc/group +/etc/passwd +/etc/mtab +/etc/fstab +/home/* +/dev/* +/tmp/* +/var/tmp/* diff --git a/msys2-base/mingw_shell.bat b/msys2-base/mingw_shell.bat new file mode 100644 index 00000000..e3768676 --- /dev/null +++ b/msys2-base/mingw_shell.bat @@ -0,0 +1,46 @@ +@echo off + +rem ember value of GOTO: is used to know recursion has happened. +if "%1" == "GOTO:" goto %2 + +if NOT "x%WD%" == "x" set WD= + +rem ember command.com only uses the first eight characters of the label. +goto _WindowsNT + +start /min %COMSPEC% /e:4096 /c %0 GOTO: _Resume %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 +goto EOF + +rem ember that we execute here if we recursed. +:_Resume +for %%F in (1 2 3) do shift +if NOT EXIST %WD%msys-2.0.dll set WD=.\bin\ + +rem ember that we get here even in command.com. +:_WindowsNT + +if NOT EXIST %WD%msys-2.0.dll set WD=%~dp0\bin\ + +set MSYSTEM=MINGW +set MSYSCON=mintty.exe +if "x%1" == "x-consolez" set MSYSCON=console.exe +if "x%1" == "x-mintty" set MSYSCON=mintty.exe + +if "x%MSYSCON%" == "xmintty.exe" goto startmintty +if "x%MSYSCON%" == "xconsole.exe" goto startconsolez + +:startmintty +if NOT EXIST %WD%mintty.exe goto startsh +start %WD%mintty -i /msys.ico - +exit + +:startconsolez +cd %WD%..\lib\ConsoleZ +start console -t "MinGW" +exit + +:startsh +start %WD%sh --login -i +exit + +:EOF diff --git a/msys2-base/msys2_shell.bat b/msys2-base/msys2_shell.bat new file mode 100644 index 00000000..e22beb2b --- /dev/null +++ b/msys2-base/msys2_shell.bat @@ -0,0 +1,46 @@ +@echo off + +rem ember value of GOTO: is used to know recursion has happened. +if "%1" == "GOTO:" goto %2 + +if NOT "x%WD%" == "x" set WD= + +rem ember command.com only uses the first eight characters of the label. +goto _WindowsNT + +start /min %COMSPEC% /e:4096 /c %0 GOTO: _Resume %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 +goto EOF + +rem ember that we execute here if we recursed. +:_Resume +for %%F in (1 2 3) do shift +if NOT EXIST %WD%msys-2.0.dll set WD=.\bin\ + +rem ember that we get here even in command.com. +:_WindowsNT + +if NOT EXIST %WD%msys-2.0.dll set WD=%~dp0\bin\ + +set MSYSTEM=MSYS +set MSYSCON=mintty.exe +if "x%1" == "x-consolez" set MSYSCON=console.exe +if "x%1" == "x-mintty" set MSYSCON=mintty.exe + +if "x%MSYSCON%" == "xmintty.exe" goto startmintty +if "x%MSYSCON%" == "xconsole.exe" goto startconsolez + +:startmintty +if NOT EXIST %WD%mintty.exe goto startsh +start %WD%mintty -i /msys.ico - +exit + +:startconsolez +cd %WD%..\lib\ConsoleZ +start console -t "MSys2" +exit + +:startsh +start %WD%sh --login -i +exit + +:EOF diff --git a/msys2-base/regen-info.sh b/msys2-base/regen-info.sh new file mode 100644 index 00000000..ce97fc66 --- /dev/null +++ b/msys2-base/regen-info.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +INFODIR=/usr/share/info +rm -f $INFODIR/dir + +for F in $INFODIR/*.info; do + echo -n "--> Installing $F ..." + /usr/bin/install-info --info-file=$F --dir-file=$INFODIR/dir + echo " done" +done + +exit 0 \ No newline at end of file diff --git a/msys2-base/start b/msys2-base/start new file mode 100644 index 00000000..082ac294 --- /dev/null +++ b/msys2-base/start @@ -0,0 +1,8 @@ +#!/bin/sh +# Copyright (C) 2002, Earnie Boyd +# mailto:earnie@users.sf.net +# This file is part of Minimal SYStem. +# http://www.mingw.org/msys.shtml +# File: start + +cmd //c start "$@" diff --git a/msys2-base/which b/msys2-base/which new file mode 100644 index 00000000..bfd08232 --- /dev/null +++ b/msys2-base/which @@ -0,0 +1,66 @@ +#!/bin/sh +# Original copyright (C) 2002, Earnie Boyd +# mailto:earnie@users.sf.net +# This implementation copyright (C) 2006, 2008, Keith Marshall +# mailto:keithmarshall@users.sf.net +# +# This file is part of MSYS +# http://www.mingw.org/msys.shtml +# +# File: which +# $Id: which,v 1.4 2009/03/14 14:13:32 keithmarshall Exp $ + +CMD=`IFS='\\/:'; set CMD $0; eval echo \$\{$#\}` +if test $# -lt 1 +then + echo >&2 "$CMD: syntax error: missing argument" + echo >&2 "Usage: $CMD [ -a | --all ] cmd ..." + exit 1 +fi + +# To accomodate Woe32's typically asinine $PATH, which frequently +# includes directory names with embedded spaces, we need to set up +# $IFS to consider only a newline as a field separator. +IFS=$'\n' + +break=break +for PROG +do + if test x"$PROG" = x-a || test x"$PROG" = x--all + then + break="" + else + WHICH="" + # need `type -ap -- "$PROG" || type -p -- "$PROG"' + # because `type -ap foo' reports nothing, if both `foo' and `foo.exe' + # are present, and are distinct. + for LIST in `type -ap -- "$PROG" || type -p -- "$PROG"` + do + if test -f "$LIST" + then + # preserve `.exe' extension + WHICH="$LIST"`test -f "$LIST.exe" && echo '.exe'` + if test "$LIST" != "$WHICH" + then + # detect distinct `foo' and `foo.exe' + # (this needs IFS=, to get the INODE numbers) + IFS=" " INODE1=`ls -id "$LIST"` INODE2=`ls -id "$WHICH"` + if test `set ref $INODE1; echo $2` != `set ref $INODE2; echo $2` + then + # `foo' matches first, followed by `foo.exe' + test -z "$break" && echo "$LIST" || WHICH="$LIST" + fi + # reset IFS=, to get any further PROG names + IFS=$'\n' + fi + echo "$WHICH" + $break + fi + done + test x"$WHICH" = x && echo >&2 "$CMD: $PROG: "${ERROR="unknown command"} + fi +done +test ${ERROR+set} && exit 1 +exit 0 + +# $RCSfile: which,v $: end of file