rcmdnk's blog
Last update

Linuxコマンドブック ビギナーズ 第4版 (コマンドブックシリーズ)

前にも Linuxでのローカル初期設定 とかで必要なパッケージを入れたメモを載せたりしましたが、 必要なライブラリーが入ってるか調べたり、 実際コンパイルして足りなかったら足したりしながら入れたりしてました。

改めてセットアップする事があったので必要な物をスクリプトで 勝手にチェックして勝手に入れるようにしてみました。

インストールスクリプト

やりたいことは、主に最新のGit、GNU screen、Vim を入れることです。

それぞれ、$HOME/usr/local/以下に stow を使ってインストールします。

GNU screeenはUTF8のパッチを宛て、256 colorsにしたもの、 VimはLua入りの状態で入れます。

上の3つのパッケージ以外はシステムに無いものだけ入れます。

一応スクリプトの先頭でインストールしたりするパッケージをある程度指定 出来る様にしています。

また、各パッケージは簡単に調べられる物はその時点での 最新版を調べてインストールするようにしています。

こんな感じ。

追記: 2015/04/21

Gist版の方はアップデートしましたが、 Stow の代わりに XStow (xstow -f <package>) を使用してshare/info/dirの競合を簡単に回避するようにしました。

XStowでStowの代わりにパッケージ管理

追記ここまで

package_install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
#!/usr/bin/env bash

# Settings {{{
TMPDIR=~/tmp
INSTALLDIR=$HOME/usr/local
STOWDIR=$HOME/usr/local/stow

IS_CLEANUP=1

GIT=1

SCREEN=1
SCREEN_UTF8_PATCH=1
TEXINFO=1

VIM=1
EXPAT_VERSION=2.1.0
BZIP2_VERSION=1.0.6
TERMCAP_VERSION=1.3.1
PYTHON_VERSION=2.7.9

#}}}

# Global variables {{{
GITCMD=$(which git)
STOWCMD=stow
LDL_PATHES=($(echo $LD_LIBRARY_PATH|tr : ' '))
TARGZ=""
PACKAGE=""
_CONFIGURE=""
_MAKE="make"
_MAKE_INSTALL="make install"
CONFIGURE="$_CONFIGURE"
MAKE="$_MAKE"
MAKE_INSTALL="$_MAKE_INSTALL"
# }}}

# functions {{{

stow_wrap () {
  # To avoid dir/info conflict, just delete the previous info...
  if [ -f $1/share/info/dir ];then
    rm -f ../share/info/dir
  fi
  $STOWCMD $1
  if [ $? -ne 0 ];then
    echo FAITAL ERROR: failed to install $1
    exit 1
  fi
}

search_library () {
  for d in ${LDL_PATHES[@]};do
    if [ -f "$d/${1}.so" ];then
      return 0
    elif [ -f "$d/${1}.a" ];then
      return 0
    fi
  done
  return 1
}

get_latest_targz () {
  TARGZ=$(curl "$1/?C=M;O=A" 2>/dev/null|grep ".tar.gz<"|grep "$PACKAGE"|grep -v "\-doc\-"|tail -n1|
    awk '{split($0, tmp, "</a>")}
         {n=split(tmp[1], tmp2, ">")}{print tmp2[n]}')
}

wget_wrap () {
  wget --no-check-certificate $1 >&/dev/null
  if [ $? -ne 0 ];then
    echo FAITAL ERROR: failed to get $1
    exit 1
  fi
}

get_targz () {
  wget_wrap $1
  tar xzf ${1##*/}
}

stow_install () {
  if [ "$CONFIGURE" = "NONE" ];then
    :
  elif [ "$CONFIGURE" = "" ];then
    CFLAGS="-L$INSTALLDIR/lib -I$INSTALLDIR/include" \
      CPPFLAGS="-L$INSTALLDIR/lib -I$INSTALLDIR/include" \
      LDFLAGS="-L$INSTALLDIR/lib" \
      ./configure --prefix="$STOWDIR/$1" >/dev/null
  else
    eval $CONFIGURE >/dev/null
  fi
  eval $MAKE >/dev/null
  eval $MAKE_INSTALL >/dev/null
  cd $STOWDIR
  if [[ "$1" =~ stow-* ]];then
    STOWCMD=$STOWDIR/$1/bin/stow
  fi
  stow_wrap $1
  if [ $IS_CLEANUP -eq 1 ];then
    rm -rf $TMPDIR/${1%%-*}*
  fi
  CONFIGURE="$_CONFIGURE"
  MAKE="$_MAKE"
  MAKE_INSTALL="$_MAKE_INSTALL"
}

install_targz () {
  package=$(echo ${1##*/}|cut -d'-' -f1)
  cd $TMPDIR
  get_targz $1
  v=`ls -d ${package}-*|grep -v tar.gz|grep -v tgz`
  cd $v
  stow_install $v
}

install_latest_targz () {
  get_latest_targz $1
  install_targz $1/$TARGZ
}

install_latest_gnu () {
  set_package $1
  install_latest_targz http://ftp.gnu.org/gnu/$1/
}

banner () {
echo
echo "#####################################################"
echo "#  Installing $1..."
echo "#####################################################"
echo
}

set_package () {
  PACKAGE=$1
  banner $PACKAGE
}


#}}}

# First, prepare $TMPDIR {{{
mkdir -p $TMPDIR
# }}}

# Install stow {{{
if ! type -a $STOWCMD >& /dev/null;then
  install_latest_gnu stow
fi
# }}}

# Install Git {{{
if [ $GIT -eq 1 ] && [ ! -f $STOWDIR/../bin/git ];then
  if ! type -a m4 >& /dev/null;then
    install_latest_gnu m4
  fi
  if ! type -a autoconf >& /dev/null;then
    install_latest_gnu autoconf
  fi
  if ! search_library libcurl;then
    set_package curl
    install_latest_targz http://curl.haxx.se/download/
  fi
  if ! search_library libexpat;then
    set_package expat
    install_targz \
      http://downloads.sourceforge.net/expat/expat-${EXPAT_VERSION}.tar.gz
  fi
  set_package git
  cd $TMPDIR
  wget_wrap https://github.com/git/git/archive/master.zip
  unzip master.zip >/dev/null
  cd git-master
  make configure >/dev/null
  v=git-`grep 'PACKAGE_VERSION=' configure|cut -d"'" -f2|sed s/.GIT//`
  MAKE="make all"
  stow_install $v
  if [ $IS_CLEANUP -eq 1 ];then
    rm -rf $TMPDIR/master.zip
  fi
  GITCMD="$INSTALLDIR/bin/git"
fi
#}}}

# Install GNU screen {{{
if [ $SCREEN -eq 1 ] && [ ! -f $STOWDIR/../bin/screen ];then
  if ! type -a automake >& /dev/null;then
    install_latest_gnu automake
  fi
  if ! type -a makeinfo >& /dev/null && [ $TEXINFO -eq 1 ];then
    # To make information (not mandatory)
    install_latest_gnu texinfo
  fi
  if ! search_library libncurses;then
    install_latest_gnu ncurses
  fi
  set_package screen
  cd $TMPDIR
  $GITCMD clone git://git.sv.gnu.org/screen.git
  cd screen
  if [ $SCREEN_UTF8_PATCH -eq 1 ];then
    wget_wrap https://gist.github.com/raw/626040/be6a04f0e64c56185ba5850415ac59dad4cd62a0/screen-utf8-nfd.patch
    #wget_wrap http://zuse.jp/misc/screen-utf8-osc.diff
    wget_wrap https://gist.githubusercontent.com/rcmdnk/143cb56d31335dbccf70/raw/4b3e175946f2366b4076088c1c8f2bbe65b32e16/screen-utf8-osc.diff
    patch -p1 < screen-utf8-nfd.patch >/dev/null
    patch -p1 < screen-utf8-osc.diff >/dev/null
  fi
  cd src/
  v=screeen-$(grep Version ChangeLog |head -n1|cut -d' ' -f2)
  ./autogen.sh >/dev/null
  CONFIGURE="CFLAGS=\"-L$INSTALLDIR/lib\" LDFLAGS=\"-L$INSTALLDIR/lib\"
    ./configure --prefix=\"$STOWDIR/$v\"  --enable-colors256"
  stow_install $v
fi
#}}}

# Install Vim {{{
if [ $VIM -eq 1 ] && [ ! -f $STOWDIR/../bin/vim ];then
  if ! search_library libreadline;then
    install_latest_gnu readline
  fi
  if ! python -c "import bz2" >&/dev/null;then
    if ! search_library libbz2;then
      # bzip2 library for Python, to install Mercurial
      set_package bzip2
      v=bzip2-${BZIP2_VERSION}
      CONFIGURE="NONE"
      MAKE="make -f Makefile-libbz2_so"
      MAKE_INSTALL="make install PREFIX=$STOWDIR/$v"
      install_targz \
        http://www.bzip.org/${BZIP2_VERSION}/${v}.tar.gz
    fi
    # Need for Mercurial, too
    set_package Python
    install_targz http://www.python.org/ftp/python/$PYTHON_VERSION/Python-${PYTHON_VERSION}.tgz
  fi
  if ! type -a hg >& /dev/null;then
    set_package Mercurial
    cd $TMPDIR
    get_targz http://selenic.com/repo/hg/archive/tip.tar.gz
    cd Mercurial-*
    v=Mercurial-$(tail -1 .hgtags|cut -d' ' -f2)
    CONFIGURE="NONE"
    MAKE="make build"
    MAKE_INSTALL="python setup.py install --prefix=$STOWDIR/$v --force"
    stow_install $v
    if [ $IS_CLEANUP -eq 1 ];then
      rm -rf $TMPDIR/tip.tar.gz
    fi
  fi
  if ! search_library liblua;then
    if ! search_library libtermcap;then
      install_latest_gnu termcap
    fi
    set_package lua
    lua_file=$(curl http://www.lua.org/ftp/ 2>/dev/null|grep -v all|grep "tar.gz"|head -1|
      awk '{split($0, tmp, "</A>")}{n=split(tmp[1], tmp2, ">")}
           {print tmp2[n]}')
    CONFIGURE="NONE"
    MAKE="make linux  MYLIBS=\" -ltermcap\" MYLDFLAGS=\"
      -L$INSTALLDIR/lib\" MYCFLAGS=\" -I$INSTALLDIR/include\""
    MAKE_INSTALL="make install INSTALL_TOP=$STOWDIR/${lua_file%.tar.gz}"
    install_targz \
      http://www.lua.org/ftp/$lua_file
  fi
  set_package vim
  cd $TMPDIR
  hg clone https://vim.googlecode.com/hg/ vim
  cd vim
  v=vim-$(tail -n1 .hgtags|cut -d' ' -f2)
  CONFIGURE="./configure LDFLAGS=\"-L$INSTALLDIR/lib/\"
    --prefix=\"$STOWDIR/$v\" --with-lua-prefix=\"$INSTALLDIR\"
    --with-local-dir=\"$INSTALLDIR\" --enable-luainterp=yes
    --enable-perlinterp=yes --enable-pythoninterp=yes
    --enable-python3interp=yes --enable-rubyinterp=yes --enable-cscope
    --enable-multibyte --enable-gui=no"
  stow_install $v
fi
#}}}

一応Gistに最新版を置いておくことにします(アップデートが必要ならGistの方をアップデートするかも)。

パッケージごとにベタ書きしたもの

さくっとあるパッケージだけ、とかインストールしたくなるかもしれないので それぞれをベタ書きしたものもメモしておきます。

package_install_raw.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
#!/usr/bin/env bash
#####################################################
#  Install stow
#####################################################

p=stow
targz=$(curl "http://ftp.gnu.org/gnu/$p/?C=M;O=A" 2>/dev/null|
  grep ".tar.gz<"|grep "$p"|grep -v "\-doc\-"|tail -n1|
  awk '{split($0, tmp, "</a>")}{n=split(tmp[1], tmp2, ">")}{print tmp2[n]}')
cd ~/tmp
wget --no-check-certificate http://ftp.gnu.org/gnu/$p/$tartz
tar xzf $targz
v=`ls -d $p-*|grep -v 'tar.gz'`
cd $v
CFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  CPPFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  LDFLAGS="-L$HOME/usr/local/lib" \
  ./configure --prefix=/$HOME/usr/local/stow/$v
make
make install
cd $HOME/usr/local/stow
$v/bin/stow stow $v
rm -rf ~/tmp/${v%%-*}*

#####################################################
#  Install m4
#####################################################

p=m4
targz=$(curl "http://ftp.gnu.org/gnu/$p/?C=M;O=A" 2>/dev/null|
  grep ".tar.gz<"|grep "$p"|grep -v "\-doc\-"|tail -n1|
  awk '{split($0, tmp, "</a>")}{n=split(tmp[1], tmp2, ">")}{print tmp2[n]}')
cd ~/tmp
wget --no-check-certificate http://ftp.gnu.org/gnu/$p/$tartz
tar xzf $targz
v=`ls -d $p-*|grep -v 'tar.gz'`
cd $v
CFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  CPPFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  LDFLAGS="-L$HOME/usr/local/lib" \
  ./configure --prefix=/$HOME/usr/local/stow/$v
make
make install
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*

#####################################################
#  Install autoconf
#####################################################

p=autoconf
targz=$(curl "http://ftp.gnu.org/gnu/$p/?C=M;O=A" 2>/dev/null|
  grep ".tar.gz<"|grep "$p"|grep -v "\-doc\-"|tail -n1|
  awk '{split($0, tmp, "</a>")}{n=split(tmp[1], tmp2, ">")}{print tmp2[n]}')
cd ~/tmp
wget --no-check-certificate http://ftp.gnu.org/gnu/$p/$tartz
tar xzf $targz
v=`ls -d $p-*|grep -v 'tar.gz'`
cd $v
CFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  CPPFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  LDFLAGS="-L$HOME/usr/local/lib" \
  ./configure --prefix=/$HOME/usr/local/stow/$v
make
make install
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*

#####################################################
#  Install curl
#####################################################

p=autoconf
targz=$(curl "http://curl.haxx.se/download/?C=M;O=A" 2>/dev/null|
  grep ".tar.gz<"|grep "$p"|grep -v "\-doc\-"|tail -n1|
  awk '{split($0, tmp, "</a>")}{n=split(tmp[1], tmp2, ">")}{print tmp2[n]}')
cd ~/tmp
wget --no-check-certificate http://curl.haxx.se/download/$tartz
tar xzf $targz
v=`ls -d $p-*|grep -v 'tar.gz'`
cd $v
CFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  CPPFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  LDFLAGS="-L$HOME/usr/local/lib" \
  ./configure --prefix=/$HOME/usr/local/stow/$v
make
make install
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*

#####################################################
#  Install expat
#####################################################

p=expat
targz=$(curl "http://ftp.gnu.org/gnu/$p/?C=M;O=A" 2>/dev/null|
  grep ".tar.gz<"|grep "$p"|grep -v "\-doc\-"|tail -n1|
  awk '{split($0, tmp, "</a>")}{n=split(tmp[1], tmp2, ">")}{print tmp2[n]}')
cd ~/tmp
wget --no-check-certificate http://ftp.gnu.org/gnu/$p/$tartz
tar xzf $targz
v=`ls -d $p-*|grep -v 'tar.gz'`
cd $v
CFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  CPPFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  LDFLAGS="-L$HOME/usr/local/lib" \
  ./configure --prefix=/$HOME/usr/local/stow/$v
make
make install
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*

#####################################################
#  Install git
#####################################################

p=git
cd ~/tmp
wget --no-check-certificate https://github.com/git/git/archive/master.zip
unzip master.zip
cd git-master
make configure
v=git-$(grep 'PACKAGE_VERSION=' configure|cut -d"'" -f2|sed s/.GIT//)
CFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  CPPFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  LDFLAGS="-L$HOME/usr/local/lib" \
  ./configure --prefix=/$HOME/usr/local/stow/$v
make all
make install
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*
rm -rf ~/tmp/master.zip

#####################################################
#  Install automake
#####################################################

p=automake
targz=$(curl "http://ftp.gnu.org/gnu/$p/?C=M;O=A" 2>/dev/null|
  grep ".tar.gz<"|grep "$p"|grep -v "\-doc\-"|tail -n1|
  awk '{split($0, tmp, "</a>")}{n=split(tmp[1], tmp2, ">")}{print tmp2[n]}')
cd ~/tmp
wget --no-check-certificate http://ftp.gnu.org/gnu/$p/$tartz
tar xzf $targz
v=`ls -d $p-*|grep -v 'tar.gz'`
cd $v
CFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  CPPFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  LDFLAGS="-L$HOME/usr/local/lib" \
  ./configure --prefix=/$HOME/usr/local/stow/$v
make
make install
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*

#####################################################
#  Install texinfo
#####################################################

p=texinfo
targz=$(curl "http://ftp.gnu.org/gnu/$p/?C=M;O=A" 2>/dev/null|
  grep ".tar.gz<"|grep "$p"|grep -v "\-doc\-"|tail -n1|
  awk '{split($0, tmp, "</a>")}{n=split(tmp[1], tmp2, ">")}{print tmp2[n]}')
cd ~/tmp
wget --no-check-certificate http://ftp.gnu.org/gnu/$p/$tartz
tar xzf $targz
v=`ls -d $p-*|grep -v 'tar.gz'`
cd $v
CFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  CPPFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  LDFLAGS="-L$HOME/usr/local/lib" \
  ./configure --prefix=/$HOME/usr/local/stow/$v
make
make install
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*

#####################################################
#  Install ncurses
#####################################################

p=ncurses
targz=$(curl "http://ftp.gnu.org/gnu/$p/?C=M;O=A" 2>/dev/null|
  grep ".tar.gz<"|grep "$p"|grep -v "\-doc\-"|tail -n1|
  awk '{split($0, tmp, "</a>")}{n=split(tmp[1], tmp2, ">")}{print tmp2[n]}')
cd ~/tmp
wget --no-check-certificate http://ftp.gnu.org/gnu/$p/$tartz
tar xzf $targz
v=`ls -d $p-*|grep -v 'tar.gz'`
cd $v
CFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  CPPFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  LDFLAGS="-L$HOME/usr/local/lib" \
  ./configure --prefix=/$HOME/usr/local/stow/$v
make
make install
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*

#####################################################
#  Install screen
#####################################################

p=screen
cd ~/tmp
git clone git://git.sv.gnu.org/screen.git
cd screen
wget --no-check-certificate https://gist.github.com/raw/626040/be6a04f0e64c56185ba5850415ac59dad4cd62a0/screen-utf8-nfd.patch
wget --no-check-certificate https://gist.githubusercontent.com/rcmdnk/143cb56d31335dbccf70/raw/4b3e175946f2366b4076088c1c8f2bbe65b32e16/screen-utf8-osc.diff
patch -p1 < screen-utf8-nfd.patch >/dev/null
patch -p1 < screen-utf8-osc.diff >/dev/null
cd src/
v=screeen-$(grep Version ChangeLog |head -n1|cut -d' ' -f2)
./autogen.sh >/dev/null
CFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  CPPFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  LDFLAGS="-L$HOME/usr/local/lib" \
  ./configure --prefix=/$HOME/usr/local/stow/$v --enable-colors256
make
make install
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*

#####################################################
#  Install readline
#####################################################

p=readline
targz=$(curl "http://ftp.gnu.org/gnu/$p/?C=M;O=A" 2>/dev/null|
  grep ".tar.gz<"|grep "$p"|grep -v "\-doc\-"|tail -n1|
  awk '{split($0, tmp, "</a>")}{n=split(tmp[1], tmp2, ">")}{print tmp2[n]}')
cd ~/tmp
wget --no-check-certificate http://ftp.gnu.org/gnu/$p/$tartz
tar xzf $targz
v=`ls -d $p-*|grep -v 'tar.gz'`
cd $v
CFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  CPPFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  LDFLAGS="-L$HOME/usr/local/lib" \
  ./configure --prefix=/$HOME/usr/local/stow/$v
make
make install
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*

#####################################################
#  Install bzip2
#####################################################

p=bzip2
v=$p-1.0.6
targz=$v.tar.gz
cd ~/tmp
wget --no-check-certificate http://www.bzip.org/1.0.6/$targz
tar xzf $targz
cd $v
make -f Makefile-libbz2_so
make install PREFIX=$HOME/usr/local/stow/$v
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*

#####################################################
#  Install Python
#####################################################

p=Python
cd ~/tmp
targz=Python-2.7.8.tgz
wget --no-check-certificate http://www.python.org/ftp/python/2.7.9/$targz
tar xzf $targz
v=`ls -d $p-*|grep -v 'tgz'`
cd $v
CFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  CPPFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  LDFLAGS="-L$HOME/usr/local/lib" \
  ./configure --prefix=/$HOME/usr/local/stow/$v
make
make install
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*

#####################################################
#  Install Mercurial
#####################################################

p=Mercurial
targz="tip.tar.gz"
cd ~/tmp
wget --no-check-certificate http://selenic.com/repo/hg/archive/$targz
tar xzf tip.tar.gz
cd Mercurial-*
v=Mercurial-$(tail -1 .hgtags|cut -d' ' -f2)
make build
python setup.py install --prefix=$HOME/usr/local/$v --force
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*

#####################################################
#  Install termcap
#####################################################

p=termcap
targz=$(curl "http://ftp.gnu.org/gnu/$p/?C=M;O=A" 2>/dev/null|
  grep ".tar.gz<"|grep "$p"|grep -v "\-doc\-"|tail -n1|
  awk '{split($0, tmp, "</a>")}{n=split(tmp[1], tmp2, ">")}{print tmp2[n]}')
cd ~/tmp
wget --no-check-certificate http://ftp.gnu.org/gnu/$p/$tartz
tar xzf $targz
v=`ls -d $p-*|grep -v 'tar.gz'`
cd $v
CFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  CPPFLAGS="-L$HOME/usr/local/lib -I$HOME/usr/local/include" \
  LDFLAGS="-L$HOME/usr/local/lib" \
  ./configure --prefix=/$HOME/usr/local/stow/$v
make
make install
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*

#####################################################
#  Install lua
#####################################################

p=lua
targz=$(curl http://www.lua.org/ftp/ 2>/dev/null|
  grep -v all|grep "tar.gz"|head -1|
  awk '{split($0, tmp, "</A>")}{n=split(tmp[1], tmp2, ">")}
       {print tmp2[n]}')
cd ~/tmp
wget --no-check-certificate http://www.lua.org/ftp/$targz
tar xzf $targz
v=`ls -d $p-*|grep -v 'tar.gz'`
cd $v
make linux MYLIBS=" -ltermcap" MYLDFLAGS=" -L$HOME/usr/local/lib" \
  MYCFLAGS=" -I$HOME/usr/local/include"
make install INSTALL_TOP=$HOME/usr/local/stow/$v
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*

#####################################################
#  Install vim
#####################################################

p=vim
cd ~/tmp
hg clone https://vim.googlecode.com/hg/ vim
cd vim
v=vim-$(tail -n1 .hgtags|cut -d' ' -f2)
./configure LDFLAGS="-L$HOME/usr/local/lib/"
    --prefix="$HOME/usr/local/stow/$v" --with-lua-prefix="$HOME/usr/local"
    --with-local-dir="$HOME/usr/local" --enable-luainterp=yes
    --enable-perlinterp=yes --enable-pythoninterp=yes
    --enable-python3interp=yes --enable-rubyinterp=yes --enable-cscope
    --enable-multibyte --enable-gui=no
make
make install
cd $HOME/usr/local/stow
stow $v
rm -rf ~/tmp/${v%%-*}*

Gist版:

Sponsored Links
Sponsored Links

« FirefoxのリンクになってないURLを開くプラグインの変更 JavaScriptをコマンドラインから使う方法 »

}