目次

CYGWIN

Windows上にLinux環境を入れる方法は

  1. VMware playerでLinuxを動かす。
  2. Wubiでubuntu環境をwindoows上にインストール
  3. CygwinでなんちゃってLinux環境を構築する。
  4. MinGWでなんちゃってLinux環境を構築する。

という方法がある。

Cygwinの特徴

インストール

ネット収集した情報をもとにインストール。以下、そのまとめ。

Math gnuplot
bc
Devel gcc4-gfortran fortranコンパイラ
gdb デバッガ
make lapackやslatecをインストールするため
Editors emacs-x11
emacs-el
vim
Net ncftp
openssh
Web wget プロキシの設定は/etc/wgetrcか~/.wgetrc
X11 X-start-menu-icons startxwin.batなどをインストール
font-adobe-dpi75
font-adobe-dpi100
font-misc-misc
font-sony-misc
font-jis-misc
gv
xorg-server
xterm

windows側で環境設定

HOME C:\cygwin/c/home/hoge

hogeのところに自分のアカウントを.

そのままでは.bashrcを見に行かないので、.bash_profileに以下のように書き込む1)

source ~/.bashrc

.bashrcの中身

if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
 
export SHELL=/bin/bash
export HOME=/home/hoge
export TMPDIR=/tmp
export TZ=JST-09
export MAKE_MODE=unix
 
PATH=/usr/local/sbin:/usr/sbin:/sbin:.:~/bin
PATH=/usr/local/bin:/usr/X11R6/bin:/usr/bin:/bin:$PATH
PAGER=less
JLESSCHARSET=japanese-sjis
export PATH PAGER JLESSCHARSET
 
PS1="$HOSTNAME:\w$ "
 
if [ -n ${DISPLAY} ]; then
export DISPLAY=localhost:0.0
fi
 
if [ ! -n "${TERM}" ]; then
TERM=cygwin
fi
 
alias rm="rm -i"
alias cp="cp -i"
alias mv="mv -i"

lapackのインストール

xterm上で以下を実行。

$ wget http://www.netlib.org/lapack/lapack-3.1.1.tgz
$ tar xzvf lapack-3.1.1.tgz
$ cd lapack-3.1.1/
$ cp INSTALL/make.inc.gfortran ./make.inc

make.incを変更。

PLAT = _CYGWIN
(略)
FORTRAN  = gfortran-4.exe
OPTS     = -O2
DRVOPTS  = $(OPTS)
NOOPT    = -O0
LOADER   = gfortran-4.exe
LOADOPTS =
$ make blaslib
$ make lapacklib
$ make tmglib

blas_CYGWIN.a, lapack_CYGWIN.a, tmglib_CYGWIN.aなどのライブラリができる。 Liblaryパスを通すなり、一緒にコンパイルするなりして使う。

pgplot

書きかけ

#!/usr/bin/sh
g77 #1 /usr/local/pgplot/libpgplot.a -X11 -Xm

.emacs.el

;;; -*- mode: emacs-lisp; syntax: elisp -*-
;;;
;;; .emacs.el
;;;
 
(setenv "LANG" "C")
(setenv "TZ" "JST-9")
(setenv "RCSINIT" "-z+09:00")
 
;;; cygwin "df" always checks the floppy drives, which is annoying
;;; in the dired mode.
 
(setq directory-free-space-program nil)
 
;;; misc settings
 
(setq tooltip-use-echo-area t)
(blink-cursor-mode nil)
(tool-bar-mode 0)
(menu-bar-mode 0)
(setq next-line-add-newlines t)
(setq ls-lisp-dirs-first t)
(setq resize-mini-windows nil)
(setq cursor-in-non-selected-windows nil)
(auto-image-file-mode)
(setq-default line-spacing 0)
(scroll-bar-mode nil)
(setq default-frame-alist
      (cons '(cursor-type . box) default-frame-alist))
(setq visible-bell t)
 
;;; font-lock-mode
 
(setq default-frame-alist
      (append '((font . "fontset-12")) default-frame-alist))
(global-font-lock-mode t)
 
;;;;;; japanese environment (input method, encoding, and fonts)
;;;
;;;(set-language-environment "Japanese")
;;;(set-default-coding-systems 'sjis)
;;;(set-keyboard-coding-system 'sjis)
;;;(set-terminal-coding-system 'sjis)
;;;(setq network-coding-system-alist
;;;      '(("nntp" . (junet-unix . junet-unix))
;;;	(110 . (no-conversion . no-conversion))
;;;	(25 . (no-conversion . no-conversion))))
;;;
;;;;;; no need for mule-ucs!
;;;
;;;(utf-translate-cjk-mode 1)
;;;
;;;;;; ime
;;;
;;;(if (not (null window-system))
;;;    (progn
;;;      (setq default-input-method "japanese-egg-canna")
;;;      (setq canna-hostname "localhost")
;;;      (setq its-hira-comma ",")
;;;      (setq its-hira-period "。")
;;;      (load-library "egg")))
;;;
;;;;;; shell
 
(setq exec-path
      (mapcar
       'expand-file-name
       (list
	"~/bin"
	"/usr/local/bin"
	"/usr/bin"
	"/bin"
	"/usr/X11R6/bin"
	)))
(setenv "MAKE_MODE" "unix")
(setenv "MANPATH" "/usr/local/netpbm/man:/usr/local/man:/usr/X11R6/man:/usr/share/man:/usr/man")
(setq explicit-shell-file-name "bash")
 
;;; clipboard
 
(global-set-key "\C-cw" 'cb-copy)
(global-set-key "\C-cy" 'cb-paste)
(defun cb-copy ()
  (interactive)
  (let ((coding-system-for-write 'shift_jis-dos))
    (shell-command-on-region (region-beginning) (region-end) "cat > /dev/clipboard" nil nil nil))
  (message ""))
(defun cb-paste ()
  (interactive)
  (let ((coding-system-for-read 'shift_jis-dos))
    (goto-char
     (+ (point) (cadr (insert-file-contents "/dev/clipboard"))))))
 
;;; emacsclient
 
(server-start)
 
;;; make splash-screen visible, which is not shown if server-start is
;;; used. please refer
;;; http://tsukuba.m17n.org/mule-ja-archive/2002-3/msg00006.html.
 
(add-hook
 'emacs-startup-hook
 '(lambda nil
    (if (and (string-equal "*scratch*" (buffer-name))
	     (zerop (buffer-size)))
	(display-splash-screen))))
 
;;; custom (use M-x customize-option)
 
(load-library "custom")
(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(archive-zip-use-pkzip nil)
 '(auto-compression-mode t nil (jka-compr))
 '(diff-switches "-u"))
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 )
 
(put 'narrow-to-region 'disabled nil)
 
(mouse-wheel-mode t)
(setq mouse-wheel-follow-mouse t)
 
(set-terminal-coding-system 'sjis-dos)
(set-keyboard-coding-system 'sjis-dos)
(set-language-environment "Japanese")
(set-buffer-file-coding-system 'sjis-dos)
(set-selection-coding-system 'sjis-dos)
(set-next-selection-coding-system 'sjis-dos)
1) こんな感じで。 HOMEの設定はwindows側の環境変数でされているのでなくてもよい.
$ echo "source ~/.bashrc" > ~/.bash_profile