cygwin.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 18 Feb 2017 14:02:20 +0200
changeset 2090 1a788101d63c
parent 2079 5c346302c5ba
child 2091 059f9e54d538
permissions -rw-r--r--
http://mirrors.kernel.org/sources.redhat.com/cygwin/

.. -*- coding: utf-8; -*-

=========
 Cygwin.
=========
.. contents::
   :local:

Installation.
=============

Run setup.exe. Use output dir like::

  d:\opt\cygwin

Add to your PATH env var exactly before C:\WINDOWS\system32;C:\WINDOWS values::

  set PATH=d:\opt\cygwin\bin;d:\opt\cygwin\usr\local\bin;%PATH%

  REM Set CYGWIN variable to 'nontsec'. That makes sure that permissions
  REM on your windows machine are not updated as a side effect of cygwin
  REM operations.
  set CYGWIN=binary nontsec nodosfilewarning codepage:cp1251 noglob

  set LANG=ru_RU.cp1251

Set HOME env var (where places config file and projects)::

  set HOME=d:\home

Set TMP and TEMP env vars with good path (without spaces, etc.; these vars
already set as used defined, so you need change their values)::

  set TMP=c:\tmp
  set TEMP=c:\tmp

Also you need edit /etc/passwd to point to correct home path.

apt-cyg package manager
=======================

``apt-cyg`` is based on ``bash``, ``wget``, ``tar``, ``gawk`` and ``bzip2``
packages and provide convenient commands for managing and queries packages::

  $ apt-cyg update
  $ apt-cyg install emacs-w32
  $ apt-cyg remove emacs-w32

Information about package and dependencies::

  $ apt-cyg show emacs-w32
  $ apt-cyg depends wget
  $ apt-cyg rdepends emacs

List installed packages::

  $ apt-cyg list

Search for package with file across installed packages::

  $ apt-cyg search stdio.h

List package files for installed packages::

  $ apt-cyg listfiles util-linux

Search for package with file through cygwin.com::

  $ apt-cyg searchall stdio.h

List all packages in ``setup.ini``::

  $ apt-cyg listall

Find package by regex::

  $ apt-cyg listall ^emacs

To switch between mirrors::

  $ apt-cyg mirror ftp://ftp.cygwinports.org/pub/cygwinports
  $ apt-cyg update
  $ apt-cyg install php

  $ apt-cyg mirror ftp://www.fruitbat.org/pub/cygwin/circa/2016/08/30/104223

  $ apt-cyg mirror http://mirrors.kernel.org/sources.redhat.com/cygwin/

To change a location of directory where packages and ``setup.ini`` downloaded::

  $ apt-cyg cache
  C:\net

  $ apt-cyg cache ~/net
  Cache set to C:\home\net.

https://github.com/transcode-open/apt-cyg/
  Home page.

Installation on Windows XP
==========================

Cygwin from v2.5.5 and Setup version 2.874 (on 25 Aug 2016) is latest version
with Windows XP support. Later versions build with dependencies on newer
syscalls and failt to run in Windows XP.

Latest mirrors avaialble at fruitbat.org:

* 32-bit: ftp://www.fruitbat.org/pub/cygwin/circa/2016/08/30/104223
* 64-bit: ftp://www.fruitbat.org/pub/cygwin/circa/64bit/2016/08/30/104235

To run setup against this mirror::

  cmd> setup.exe 

``setup.exe`` available at:

* 32-bit ftp://www.fruitbat.org/pub/cygwin/setup/snapshots/setup-x86-2.874.exe
* 64-bit ftp://www.fruitbat.org/pub/cygwin/setup/snapshots/setup-x86_64-2.874.exe

Run as (``-X`` disable signature verification, ``-s <url>`` option select a
particular mirror, ``-O`` option disallow any other mirrors)::

  cmd> setup-x86.exe -X -s ftp://www.fruitbat.org/pub/cygwin/circa/2016/08/30/104223 -O

http://www.fruitbat.org/Cygwin/timemachine.html
  Description of Cygwin time machine project.
http://stackoverflow.com/questions/39479826/cygwin-2-5-2-mirror-getting-the-last-xp-release
  Question about Cygwin old mirror.
http://superuser.com/questions/1132000/is-it-still-possible-to-get-cygwin-for-xp
  Question about Cygwin old mirror.
http://cygwin-xp.portfolis.net/
  Another old mirror.

Cygwin ports.
=============

This project provides Cygwin binary and source packages for a large variety of programs and
libraries, including the GNOME  and KDE desktop environments

  http://cygwin-ports.sourceforge.net/
                newest home of the Cygwin Ports project
  http://sourceware.org/cygwinports/
                home page
  http://cygwinports.blogspot.com
                official blog??

Which Cygwin version you run?
=============================
::

  $ uname -r
  1.7.7(0.230/5/3)
  $ cygcheck -c cygwin
  Cygwin Package Information
  Package              Version        Status
  cygwin               1.7.7-1        OK

Recreate /etc/passwd and /etc/groups.
=====================================
::

  $ mkpasswd -d | grep $yourlogin > /etc/passwd  # if you in Windows domain
  $ mkpasswd -l > /etc/passwd                    # if you in Windows domain

  $ mkgroup -l > /etc/group

Adding mount points.
====================

``/etc/fstab``::

  C:/foo /bar/baz ntfs text,posix=0 0 0
  /var /usr/var none bind

Running X Window.
=================
::

  $ XWin -multiwindow&

or::

  $ XWin -clipboard -silent-dup-error -xkblayout "us,ru" -xkboptions "grp:caps_toggle"&

To start X application you must set 'DISPLAY'::

  $ DISPLAY=:0 xterm&

Working with packages.
======================

Installed package list with versions.
-------------------------------------
::

  $ cygcheck -c -d

List of package files.
----------------------
::

  $ cygcheck -l pkg-name

Search package by containing file (only under installed packages).
------------------------------------------------------------------
::

  $ cygcheck -f full-path-to-file

Search packages by containing path (only under installed packages).
-------------------------------------------------------------------
::

  $ for f in /etc/setup/*.lst.gz; do gzip -c -d $f | grep $WORD  2>&1 >/dev/null && { echo $f; break; } || :; done

Search for package.
-------------------

If you have file name or regex use (need internet connection)::

  $ cygcheck -p REGEX

cygcheck use such link:

  http://cygwin.com/cgi-bin2/package-grep.cgi?grep=REGEX

Cygwin installation info.
=========================
::

  $ uname -a
  $ cygcheck -s -r

Cygwin acronyms.
================

  http://www.cygwin.com/acronyms
                One encounters all sorts of acronyms on the Cygwin mailing lists.

Check dll dependency.
=====================
::

  $ ldd my.dll
  $ ldd my.exe
  $ cygcheck ./my.dll
  $ cygcheck ./my.exe

Cygwin alternatives.
====================

  http://www.suacommunity.com/SUA.aspx
                Subsystem for Unix-based Applications and Services for Unix